// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go_gapic. DO NOT EDIT. package artifactregistry_test import ( "context" artifactregistry "cloud.google.com/go/artifactregistry/apiv1beta2" "google.golang.org/api/iterator" artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" iampb "google.golang.org/genproto/googleapis/iam/v1" ) func ExampleNewClient() { ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c } func ExampleClient_ListRepositories() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.ListRepositoriesRequest{ // TODO: Fill request struct fields. } it := c.ListRepositories(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } } func ExampleClient_GetRepository() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.GetRepositoryRequest{ // TODO: Fill request struct fields. } resp, err := c.GetRepository(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateRepository() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.CreateRepositoryRequest{ // TODO: Fill request struct fields. } op, err := c.CreateRepository(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateRepository() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.UpdateRepositoryRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateRepository(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_DeleteRepository() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.DeleteRepositoryRequest{ // TODO: Fill request struct fields. } op, err := c.DeleteRepository(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleClient_ListPackages() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.ListPackagesRequest{ // TODO: Fill request struct fields. } it := c.ListPackages(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } } func ExampleClient_GetPackage() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.GetPackageRequest{ // TODO: Fill request struct fields. } resp, err := c.GetPackage(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_DeletePackage() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.DeletePackageRequest{ // TODO: Fill request struct fields. } op, err := c.DeletePackage(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleClient_ListVersions() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.ListVersionsRequest{ // TODO: Fill request struct fields. } it := c.ListVersions(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } } func ExampleClient_GetVersion() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.GetVersionRequest{ // TODO: Fill request struct fields. } resp, err := c.GetVersion(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_DeleteVersion() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.DeleteVersionRequest{ // TODO: Fill request struct fields. } op, err := c.DeleteVersion(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleClient_ListFiles() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.ListFilesRequest{ // TODO: Fill request struct fields. } it := c.ListFiles(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } } func ExampleClient_GetFile() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.GetFileRequest{ // TODO: Fill request struct fields. } resp, err := c.GetFile(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_ListTags() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.ListTagsRequest{ // TODO: Fill request struct fields. } it := c.ListTags(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } } func ExampleClient_GetTag() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.GetTagRequest{ // TODO: Fill request struct fields. } resp, err := c.GetTag(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateTag() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.CreateTagRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateTag(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateTag() { // import artifactregistrypb "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.UpdateTagRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateTag(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_DeleteTag() { ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &artifactregistrypb.DeleteTagRequest{ // TODO: Fill request struct fields. } err = c.DeleteTag(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_SetIamPolicy() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.SetIamPolicyRequest{ // TODO: Fill request struct fields. } resp, err := c.SetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetIamPolicy() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.GetIamPolicyRequest{ // TODO: Fill request struct fields. } resp, err := c.GetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_TestIamPermissions() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := artifactregistry.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. } resp, err := c.TestIamPermissions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }