From b2a61719b3caf43b095fc290b23de245a2135512 Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Tue, 29 Jun 2021 17:10:59 -0700 Subject: [PATCH 01/18] fix(firestore): correct an issue with returning empty paritions from GetPartionedQueries (#4346) --- firestore/collgroupref.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firestore/collgroupref.go b/firestore/collgroupref.go index c13ff1f160b8..90986ad71f6c 100644 --- a/firestore/collgroupref.go +++ b/firestore/collgroupref.go @@ -60,8 +60,8 @@ func (cgr CollectionGroupRef) GetPartitionedQueries(ctx context.Context, partiti return nil, err } queries := make([]Query, len(qp)) - for _, part := range qp { - queries = append(queries, part.toQuery()) + for i, part := range qp { + queries[i] = part.toQuery() } return queries, nil } From 6e1be41279d660c15443dc9bd7ddd88798641fd3 Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Wed, 30 Jun 2021 06:02:22 -0700 Subject: [PATCH 02/18] chore: release spanner 1.22.0 (#4339) * chore: release spanner 1.22.0 * Update CHANGES.md Co-authored-by: Hengfeng Li --- spanner/CHANGES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spanner/CHANGES.md b/spanner/CHANGES.md index c94a9da05fa0..7e8c701e3796 100644 --- a/spanner/CHANGES.md +++ b/spanner/CHANGES.md @@ -1,5 +1,13 @@ # Changes +## [1.22.0](https://www.github.com/googleapis/google-cloud-go/compare/spanner/v1.21.0...spanner/v1.22.0) (2021-06-30) + + +### Features + +* **spanner:** support request and transaction tags ([#4336](https://www.github.com/googleapis/google-cloud-go/issues/4336)) ([f08c73a](https://www.github.com/googleapis/google-cloud-go/commit/f08c73a75e2d2a8b9a0b184179346cb97c82e9e5)) +* **spanner:** enable request options for batch read ([#4337](https://www.github.com/googleapis/google-cloud-go/issues/4337)) ([b9081c3](https://www.github.com/googleapis/google-cloud-go/commit/b9081c36ed6495a67f8e458ad884bdb8da5b7fbc)) + ## [1.21.0](https://www.github.com/googleapis/google-cloud-go/compare/spanner/v1.20.0...spanner/v1.21.0) (2021-06-23) From 8fb464956f0ca51d30e8e14dc625ff9fa150c437 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 30 Jun 2021 06:32:22 -0700 Subject: [PATCH 03/18] chore(all): auto-regenerate gapics (#4342) This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/627 Changes: Synchronize new proto/yaml changes. PiperOrigin-RevId: 381955863 Source-Link: https://github.com/googleapis/googleapis/commit/24443e8a67e256360067cdfc4105545fde620bf0 build(apigeeconnect): name should be @google-cloud/apigee-connect PiperOrigin-RevId: 381518921 Source-Link: https://github.com/googleapis/googleapis/commit/8b4a440aa7de03da4d1f3c38d593d2f0baf82857 feat(servicecontrol): Added the gRPC service config for the Service Controller v1 API docs: Updated some comments. PiperOrigin-RevId: 381355331 Source-Link: https://github.com/googleapis/googleapis/commit/da5f84269f0dcdd50554c974cfa968d5137c2300 feat(gkehub): added v1alpha messages and client for gkehub Clients can now target the v1alpha GKE Hub API to interact with Feature resources. PiperOrigin-RevId: 381332895 Source-Link: https://github.com/googleapis/googleapis/commit/3bd91d545c8eb384c398e755f35645187f9d08eb --- apigeeconnect/apiv1/doc.go | 2 +- bigquery/go.mod | 2 +- bigquery/go.sum | 7 +- bigtable/go.mod | 2 +- bigtable/go.sum | 7 +- cloudbuild/apiv1/v2/cloud_build_client.go | 14 +- cloudbuild/apiv1/v2/doc.go | 2 +- datastore/go.mod | 2 +- datastore/go.sum | 7 +- firestore/go.mod | 2 +- firestore/go.sum | 7 +- gkehub/apiv1beta1/doc.go | 2 +- go.mod | 2 +- go.sum | 4 +- internal/examples/fake/go.mod | 2 +- internal/examples/fake/go.sum | 8 +- internal/examples/mock/go.mod | 2 +- internal/examples/mock/go.sum | 9 +- internal/gapicgen/go.mod | 2 +- internal/gapicgen/go.sum | 7 +- internal/generated/snippets/go.mod | 2 +- internal/generated/snippets/go.sum | 11 +- internal/godocfx/go.sum | 204 ++---------------- logging/go.mod | 2 +- logging/go.sum | 7 +- pubsub/go.mod | 2 +- pubsub/go.sum | 7 +- pubsublite/go.mod | 2 +- pubsublite/go.sum | 7 +- servicecontrol/apiv1/doc.go | 6 +- .../apiv1/quota_controller_client.go | 4 +- .../apiv1/service_controller_client.go | 11 +- spanner/go.mod | 2 +- spanner/go.sum | 7 +- storage/go.mod | 2 +- storage/go.sum | 10 +- 36 files changed, 111 insertions(+), 267 deletions(-) diff --git a/apigeeconnect/apiv1/doc.go b/apigeeconnect/apiv1/doc.go index cafc83804d52..5b437a3a1941 100644 --- a/apigeeconnect/apiv1/doc.go +++ b/apigeeconnect/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210629" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/go.mod b/bigquery/go.mod index 60c8ce04778c..48b9e8098bb7 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -10,7 +10,7 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 4e3360fdd58d..96aa2e4a6bcb 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -369,8 +369,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -453,8 +454,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigtable/go.mod b/bigtable/go.mod index c69f977e3267..bdb3ed4432d3 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 rsc.io/binaryregexp v0.2.0 diff --git a/bigtable/go.sum b/bigtable/go.sum index f2cab4de1aae..44672e225535 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -368,8 +368,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -452,8 +453,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/cloudbuild/apiv1/v2/cloud_build_client.go b/cloudbuild/apiv1/v2/cloud_build_client.go index bde219b32df7..1ca6670a0126 100644 --- a/cloudbuild/apiv1/v2/cloud_build_client.go +++ b/cloudbuild/apiv1/v2/cloud_build_client.go @@ -644,7 +644,7 @@ func (c *gRPCClient) CreateBuildTrigger(ctx context.Context, req *cloudbuildpb.C defer cancel() ctx = cctx } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_id", url.QueryEscape(req.GetProjectId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "parent", url.QueryEscape(req.GetParent()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).CreateBuildTrigger[0:len((*c.CallOptions).CreateBuildTrigger):len((*c.CallOptions).CreateBuildTrigger)], opts...) var resp *cloudbuildpb.BuildTrigger @@ -665,7 +665,7 @@ func (c *gRPCClient) GetBuildTrigger(ctx context.Context, req *cloudbuildpb.GetB defer cancel() ctx = cctx } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()), "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).GetBuildTrigger[0:len((*c.CallOptions).GetBuildTrigger):len((*c.CallOptions).GetBuildTrigger)], opts...) var resp *cloudbuildpb.BuildTrigger @@ -681,7 +681,7 @@ func (c *gRPCClient) GetBuildTrigger(ctx context.Context, req *cloudbuildpb.GetB } func (c *gRPCClient) ListBuildTriggers(ctx context.Context, req *cloudbuildpb.ListBuildTriggersRequest, opts ...gax.CallOption) *BuildTriggerIterator { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project_id", url.QueryEscape(req.GetProjectId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "parent", url.QueryEscape(req.GetParent()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).ListBuildTriggers[0:len((*c.CallOptions).ListBuildTriggers):len((*c.CallOptions).ListBuildTriggers)], opts...) it := &BuildTriggerIterator{} @@ -726,7 +726,7 @@ func (c *gRPCClient) DeleteBuildTrigger(ctx context.Context, req *cloudbuildpb.D defer cancel() ctx = cctx } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()), "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).DeleteBuildTrigger[0:len((*c.CallOptions).DeleteBuildTrigger):len((*c.CallOptions).DeleteBuildTrigger)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { @@ -743,7 +743,7 @@ func (c *gRPCClient) UpdateBuildTrigger(ctx context.Context, req *cloudbuildpb.U defer cancel() ctx = cctx } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()), "trigger.resource_name", url.QueryEscape(req.GetTrigger().GetResourceName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).UpdateBuildTrigger[0:len((*c.CallOptions).UpdateBuildTrigger):len((*c.CallOptions).UpdateBuildTrigger)], opts...) var resp *cloudbuildpb.BuildTrigger @@ -764,7 +764,7 @@ func (c *gRPCClient) RunBuildTrigger(ctx context.Context, req *cloudbuildpb.RunB defer cancel() ctx = cctx } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger_id", url.QueryEscape(req.GetTriggerId()), "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).RunBuildTrigger[0:len((*c.CallOptions).RunBuildTrigger):len((*c.CallOptions).RunBuildTrigger)], opts...) var resp *longrunningpb.Operation @@ -782,7 +782,7 @@ func (c *gRPCClient) RunBuildTrigger(ctx context.Context, req *cloudbuildpb.RunB } func (c *gRPCClient) ReceiveTriggerWebhook(ctx context.Context, req *cloudbuildpb.ReceiveTriggerWebhookRequest, opts ...gax.CallOption) (*cloudbuildpb.ReceiveTriggerWebhookResponse, error) { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger", url.QueryEscape(req.GetTrigger()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project_id", url.QueryEscape(req.GetProjectId()), "trigger", url.QueryEscape(req.GetTrigger()), "name", url.QueryEscape(req.GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) opts = append((*c.CallOptions).ReceiveTriggerWebhook[0:len((*c.CallOptions).ReceiveTriggerWebhook):len((*c.CallOptions).ReceiveTriggerWebhook)], opts...) var resp *cloudbuildpb.ReceiveTriggerWebhookResponse diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 6d520a99bc44..95c1596f973e 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210629" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index 8db8e8d5640d..2f5b25325441 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/datastore/go.sum b/datastore/go.sum index 1567ab6a27e3..8b897debcbfc 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -365,8 +365,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -449,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/firestore/go.mod b/firestore/go.mod index f5f80c3f6ade..2663995e148c 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/firestore/go.sum b/firestore/go.sum index 1567ab6a27e3..8b897debcbfc 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -365,8 +365,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -449,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/gkehub/apiv1beta1/doc.go b/gkehub/apiv1beta1/doc.go index 35abd5d983e8..6ffdf1e8317c 100644 --- a/gkehub/apiv1beta1/doc.go +++ b/gkehub/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210629" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/go.mod b/go.mod index 787e3a5f41c6..f9ff5016b5cb 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.6 golang.org/x/tools v0.1.4 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 9a8de8842b99..a13fe6fe1e47 100644 --- a/go.sum +++ b/go.sum @@ -459,8 +459,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 h1:R1r5J0u6Cx+RNl/6mezTw6oA14cmKC96FeUwL6A9bd4= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index 186c772f8c97..00a09169a041 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -5,6 +5,6 @@ go 1.15 require ( cloud.google.com/go v0.84.0 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index 28eb0db10c57..5cb73adaa907 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -363,6 +363,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -445,8 +446,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -481,8 +482,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index 44100a374ebd..50df88ef0475 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -7,5 +7,5 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index 28127469ce2c..e8c633cd3dde 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -84,7 +84,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -95,8 +95,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -113,8 +113,9 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/gapicgen/go.mod b/internal/gapicgen/go.mod index 3a104af6f008..9130fbdb720b 100644 --- a/internal/gapicgen/go.mod +++ b/internal/gapicgen/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/protobuf v1.27.1 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/internal/gapicgen/go.sum b/internal/gapicgen/go.sum index b038dccb032f..0a16bd5b57e5 100644 --- a/internal/gapicgen/go.sum +++ b/internal/gapicgen/go.sum @@ -419,8 +419,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -502,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index cd9d99660cc8..ffe17313edc1 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -32,5 +32,5 @@ require ( cloud.google.com/go/pubsublite v0.84.0 cloud.google.com/go/spanner v0.84.0 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index ae6fb5433cc4..c3d12cb8f302 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -81,8 +81,9 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -116,6 +117,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -132,8 +134,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -153,8 +155,9 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index ea66b6af2ca9..a519bf7fe51f 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -1,38 +1,11 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.64.0/go.mod h1:xfORb36jGvE+6EexW71nMEtL025s3x6xvuYUKM4JLv4= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0 h1:hVhK90DwCdOAYGME/FJd9vNIZye9HBR6Yy3fu4js3N8= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= @@ -52,14 +25,11 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -71,19 +41,12 @@ github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -93,13 +56,10 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -107,40 +67,20 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -159,7 +99,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.9 h1:XsVHmzm4P6g84IBbAj+WYMF/IEZ3J9+3I1wlqCNa/SQ= github.com/yuin/goldmark v1.3.9/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -168,20 +107,15 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= @@ -190,18 +124,13 @@ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMx golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= @@ -209,8 +138,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -224,45 +151,27 @@ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -271,8 +180,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -280,18 +187,13 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -299,58 +201,34 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -358,26 +236,16 @@ golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200817023811-d00afeaade8f/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200827163409-021d7c6f1ec3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -385,9 +253,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= @@ -399,43 +264,30 @@ google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/ google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0 h1:RDAPWfNFY06dffEXfn7hZF5Fr1ZbnChzfQZAPyBd1+I= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= +google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -443,26 +295,11 @@ google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200815001618-f69a88009b70/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200827165113-ac2560b5e952/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d h1:KzwjikDymrEmYYbdyfievTwjEeGlu+OM6oiKBkF3Jfg= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -473,16 +310,9 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= @@ -497,8 +327,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -508,12 +339,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/logging/go.mod b/logging/go.mod index 947dc0fe49ee..f86d8fcfe355 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -11,7 +11,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/logging/go.sum b/logging/go.sum index 7af34dad03a3..5a67c1ea1d18 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -371,8 +371,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -455,8 +456,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsub/go.mod b/pubsub/go.mod index 8462fdcd2233..ca89d5a3f3df 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index af1167b29f20..e1ca5a5cf44f 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -369,8 +369,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -453,8 +454,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/go.mod b/pubsublite/go.mod index f655870221b1..e632bb49b686 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index cb361ab194ae..f57f8077c1e5 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -374,8 +374,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -460,8 +461,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/servicecontrol/apiv1/doc.go b/servicecontrol/apiv1/doc.go index 01b21c2d93f1..4f98398eb1ad 100644 --- a/servicecontrol/apiv1/doc.go +++ b/servicecontrol/apiv1/doc.go @@ -17,8 +17,8 @@ // Package servicecontrol is an auto-generated package for the // Service Control API. // -// Provides control plane functionality to managed services, such as logging, -// monitoring, and status checks. +// Provides admission control and telemetry reporting for services integrated +// with Service Infrastructure. // // Use of Context // @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210629" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicecontrol/apiv1/quota_controller_client.go b/servicecontrol/apiv1/quota_controller_client.go index 531210a45b9f..da8125e0393d 100644 --- a/servicecontrol/apiv1/quota_controller_client.go +++ b/servicecontrol/apiv1/quota_controller_client.go @@ -67,7 +67,7 @@ type internalQuotaControllerClient interface { // QuotaControllerClient is a client for interacting with Service Control API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Google Quota Control API (at https://cloud.google.com/service-control/overview) +// Google Quota Control API (at /service-control/overview) // // Allows clients to allocate and release quota against a managed // service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). @@ -139,7 +139,7 @@ type quotaControllerGRPCClient struct { // NewQuotaControllerClient creates a new quota controller client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Google Quota Control API (at https://cloud.google.com/service-control/overview) +// Google Quota Control API (at /service-control/overview) // // Allows clients to allocate and release quota against a managed // service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). diff --git a/servicecontrol/apiv1/service_controller_client.go b/servicecontrol/apiv1/service_controller_client.go index e7541ad14283..019856243421 100644 --- a/servicecontrol/apiv1/service_controller_client.go +++ b/servicecontrol/apiv1/service_controller_client.go @@ -70,7 +70,7 @@ type internalServiceControllerClient interface { // ServiceControllerClient is a client for interacting with Service Control API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Google Service Control API (at https://cloud.google.com/service-control/overview) +// Google Service Control API (at /service-control/overview) // // Lets clients check and report operations against a managed // service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). @@ -115,7 +115,8 @@ func (c *ServiceControllerClient) Connection() *grpc.ClientConn { // propagation, therefore callers MUST NOT depend on the Check method having // the latest policy information. // -// NOTE: the CheckRequest has the size limit of 64KB. +// NOTE: the CheckRequest has +// the size limit (wire-format byte size) of 1MB. // // This method requires the servicemanagement.services.check permission // on the specified service. For more information, see @@ -133,8 +134,8 @@ func (c *ServiceControllerClient) Check(ctx context.Context, req *servicecontrol // the aggregation time window to avoid data loss risk more than 0.01% // for business and compliance reasons. // -// NOTE: the ReportRequest has the size limit (wire-format byte size) of -// 1MB. +// NOTE: the ReportRequest has +// the size limit (wire-format byte size) of 1MB. // // This method requires the servicemanagement.services.report permission // on the specified service. For more information, see @@ -166,7 +167,7 @@ type serviceControllerGRPCClient struct { // NewServiceControllerClient creates a new service controller client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Google Service Control API (at https://cloud.google.com/service-control/overview) +// Google Service Control API (at /service-control/overview) // // Lets clients check and report operations against a managed // service (at https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). diff --git a/spanner/go.mod b/spanner/go.mod index f03220525b02..18144dd61382 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -10,7 +10,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/spanner/go.sum b/spanner/go.sum index 1567ab6a27e3..8b897debcbfc 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -365,8 +365,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -449,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/storage/go.mod b/storage/go.mod index 528ae7da6fcb..0e0c8018e85c 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a + google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 google.golang.org/grpc v1.38.0 ) diff --git a/storage/go.sum b/storage/go.sum index 50ab8d21775e..cf41d224d751 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -369,8 +369,9 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -453,8 +454,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a h1:b5Bhxmy6Tppar7Yl4J6c6xF33YSBhkm2FtV9/ZQuBkQ= -google.golang.org/genproto v0.0.0-20210624174822-c5cf32407d0a/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= +google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -489,8 +490,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From cfee36161d41e3a0f769e51ab96c25d0967af273 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Wed, 30 Jun 2021 12:46:34 -0500 Subject: [PATCH 04/18] chore: bulk release clients (#4350) Changes: feat(dataflow): start generating apiv1beta3 feat(datastream): start generating apiv1alpha1 feat(eventarc): start generating apiv1 feat(workflows/executions): start generating apiv1 Release-As: 0.85.0 --- dataflow/apiv1beta3/doc.go | 121 + dataflow/apiv1beta3/flex_templates_client.go | 198 ++ .../flex_templates_client_example_test.go | 55 + dataflow/apiv1beta3/gapic_metadata.json | 153 ++ dataflow/apiv1beta3/jobs_v1_beta3_client.go | 486 ++++ .../jobs_v1_beta3_client_example_test.go | 182 ++ .../apiv1beta3/messages_v1_beta3_client.go | 279 +++ .../messages_v1_beta3_client_example_test.go | 62 + .../apiv1beta3/metrics_v1_beta3_client.go | 407 ++++ .../metrics_v1_beta3_client_example_test.go | 106 + .../apiv1beta3/snapshots_v1_beta3_client.go | 260 +++ .../snapshots_v1_beta3_client_example_test.go | 93 + dataflow/apiv1beta3/templates_client.go | 260 +++ .../templates_client_example_test.go | 93 + datastream/apiv1alpha1/datastream_client.go | 2077 +++++++++++++++++ .../datastream_client_example_test.go | 513 ++++ datastream/apiv1alpha1/doc.go | 116 + datastream/apiv1alpha1/gapic_metadata.json | 123 + eventarc/apiv1/doc.go | 116 + eventarc/apiv1/eventarc_client.go | 631 +++++ .../apiv1/eventarc_client_example_test.go | 153 ++ eventarc/apiv1/gapic_metadata.json | 43 + internal/gapicgen/generator/config.go | 58 +- workflows/executions/apiv1/doc.go | 118 + .../executions/apiv1/executions_client.go | 351 +++ .../apiv1/executions_client_example_test.go | 119 + .../executions/apiv1/gapic_metadata.json | 38 + 27 files changed, 7195 insertions(+), 16 deletions(-) create mode 100644 dataflow/apiv1beta3/doc.go create mode 100644 dataflow/apiv1beta3/flex_templates_client.go create mode 100644 dataflow/apiv1beta3/flex_templates_client_example_test.go create mode 100644 dataflow/apiv1beta3/gapic_metadata.json create mode 100644 dataflow/apiv1beta3/jobs_v1_beta3_client.go create mode 100644 dataflow/apiv1beta3/jobs_v1_beta3_client_example_test.go create mode 100644 dataflow/apiv1beta3/messages_v1_beta3_client.go create mode 100644 dataflow/apiv1beta3/messages_v1_beta3_client_example_test.go create mode 100644 dataflow/apiv1beta3/metrics_v1_beta3_client.go create mode 100644 dataflow/apiv1beta3/metrics_v1_beta3_client_example_test.go create mode 100644 dataflow/apiv1beta3/snapshots_v1_beta3_client.go create mode 100644 dataflow/apiv1beta3/snapshots_v1_beta3_client_example_test.go create mode 100644 dataflow/apiv1beta3/templates_client.go create mode 100644 dataflow/apiv1beta3/templates_client_example_test.go create mode 100644 datastream/apiv1alpha1/datastream_client.go create mode 100644 datastream/apiv1alpha1/datastream_client_example_test.go create mode 100644 datastream/apiv1alpha1/doc.go create mode 100644 datastream/apiv1alpha1/gapic_metadata.json create mode 100644 eventarc/apiv1/doc.go create mode 100644 eventarc/apiv1/eventarc_client.go create mode 100644 eventarc/apiv1/eventarc_client_example_test.go create mode 100644 eventarc/apiv1/gapic_metadata.json create mode 100644 workflows/executions/apiv1/doc.go create mode 100644 workflows/executions/apiv1/executions_client.go create mode 100644 workflows/executions/apiv1/executions_client_example_test.go create mode 100644 workflows/executions/apiv1/gapic_metadata.json diff --git a/dataflow/apiv1beta3/doc.go b/dataflow/apiv1beta3/doc.go new file mode 100644 index 000000000000..850564f3c3ad --- /dev/null +++ b/dataflow/apiv1beta3/doc.go @@ -0,0 +1,121 @@ +// Copyright 2021 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 dataflow is an auto-generated package for the +// Dataflow API. +// +// Manages Google Cloud Dataflow projects on Google Cloud Platform. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package dataflow // import "cloud.google.com/go/dataflow/apiv1beta3" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "UNKNOWN" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly", + "https://www.googleapis.com/auth/userinfo.email", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/dataflow/apiv1beta3/flex_templates_client.go b/dataflow/apiv1beta3/flex_templates_client.go new file mode 100644 index 000000000000..9e7917b2aaee --- /dev/null +++ b/dataflow/apiv1beta3/flex_templates_client.go @@ -0,0 +1,198 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newFlexTemplatesClientHook clientHook + +// FlexTemplatesCallOptions contains the retry settings for each method of FlexTemplatesClient. +type FlexTemplatesCallOptions struct { + LaunchFlexTemplate []gax.CallOption +} + +func defaultFlexTemplatesGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultFlexTemplatesCallOptions() *FlexTemplatesCallOptions { + return &FlexTemplatesCallOptions{ + LaunchFlexTemplate: []gax.CallOption{}, + } +} + +// internalFlexTemplatesClient is an interface that defines the methods availaible from Dataflow API. +type internalFlexTemplatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + LaunchFlexTemplate(context.Context, *dataflowpb.LaunchFlexTemplateRequest, ...gax.CallOption) (*dataflowpb.LaunchFlexTemplateResponse, error) +} + +// FlexTemplatesClient is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Provides a service for Flex templates. This feature is not ready yet. +type FlexTemplatesClient struct { + // The internal transport-dependent client. + internalClient internalFlexTemplatesClient + + // The call options for this service. + CallOptions *FlexTemplatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *FlexTemplatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *FlexTemplatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FlexTemplatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// LaunchFlexTemplate launch a job with a FlexTemplate. +func (c *FlexTemplatesClient) LaunchFlexTemplate(ctx context.Context, req *dataflowpb.LaunchFlexTemplateRequest, opts ...gax.CallOption) (*dataflowpb.LaunchFlexTemplateResponse, error) { + return c.internalClient.LaunchFlexTemplate(ctx, req, opts...) +} + +// flexTemplatesGRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type flexTemplatesGRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing FlexTemplatesClient + CallOptions **FlexTemplatesCallOptions + + // The gRPC API client. + flexTemplatesClient dataflowpb.FlexTemplatesServiceClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewFlexTemplatesClient creates a new flex templates service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Provides a service for Flex templates. This feature is not ready yet. +func NewFlexTemplatesClient(ctx context.Context, opts ...option.ClientOption) (*FlexTemplatesClient, error) { + clientOpts := defaultFlexTemplatesGRPCClientOptions() + if newFlexTemplatesClientHook != nil { + hookOpts, err := newFlexTemplatesClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := FlexTemplatesClient{CallOptions: defaultFlexTemplatesCallOptions()} + + c := &flexTemplatesGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + flexTemplatesClient: dataflowpb.NewFlexTemplatesServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *flexTemplatesGRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *flexTemplatesGRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *flexTemplatesGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *flexTemplatesGRPCClient) LaunchFlexTemplate(ctx context.Context, req *dataflowpb.LaunchFlexTemplateRequest, opts ...gax.CallOption) (*dataflowpb.LaunchFlexTemplateResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).LaunchFlexTemplate[0:len((*c.CallOptions).LaunchFlexTemplate):len((*c.CallOptions).LaunchFlexTemplate)], opts...) + var resp *dataflowpb.LaunchFlexTemplateResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.flexTemplatesClient.LaunchFlexTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/dataflow/apiv1beta3/flex_templates_client_example_test.go b/dataflow/apiv1beta3/flex_templates_client_example_test.go new file mode 100644 index 000000000000..04876acb107f --- /dev/null +++ b/dataflow/apiv1beta3/flex_templates_client_example_test.go @@ -0,0 +1,55 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewFlexTemplatesClient() { + ctx := context.Background() + c, err := dataflow.NewFlexTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleFlexTemplatesClient_LaunchFlexTemplate() { + ctx := context.Background() + c, err := dataflow.NewFlexTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.LaunchFlexTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LaunchFlexTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dataflow/apiv1beta3/gapic_metadata.json b/dataflow/apiv1beta3/gapic_metadata.json new file mode 100644 index 000000000000..b918aaea24e0 --- /dev/null +++ b/dataflow/apiv1beta3/gapic_metadata.json @@ -0,0 +1,153 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.dataflow.v1beta3", + "libraryPackage": "cloud.google.com/go/dataflow/apiv1beta3", + "services": { + "FlexTemplatesService": { + "clients": { + "grpc": { + "libraryClient": "FlexTemplatesClient", + "rpcs": { + "LaunchFlexTemplate": { + "methods": [ + "LaunchFlexTemplate" + ] + } + } + } + } + }, + "JobsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "JobsV1Beta3Client", + "rpcs": { + "AggregatedListJobs": { + "methods": [ + "AggregatedListJobs" + ] + }, + "CheckActiveJobs": { + "methods": [ + "CheckActiveJobs" + ] + }, + "CreateJob": { + "methods": [ + "CreateJob" + ] + }, + "GetJob": { + "methods": [ + "GetJob" + ] + }, + "ListJobs": { + "methods": [ + "ListJobs" + ] + }, + "SnapshotJob": { + "methods": [ + "SnapshotJob" + ] + }, + "UpdateJob": { + "methods": [ + "UpdateJob" + ] + } + } + } + } + }, + "MessagesV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MessagesV1Beta3Client", + "rpcs": { + "ListJobMessages": { + "methods": [ + "ListJobMessages" + ] + } + } + } + } + }, + "MetricsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MetricsV1Beta3Client", + "rpcs": { + "GetJobExecutionDetails": { + "methods": [ + "GetJobExecutionDetails" + ] + }, + "GetJobMetrics": { + "methods": [ + "GetJobMetrics" + ] + }, + "GetStageExecutionDetails": { + "methods": [ + "GetStageExecutionDetails" + ] + } + } + } + } + }, + "SnapshotsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "SnapshotsV1Beta3Client", + "rpcs": { + "DeleteSnapshot": { + "methods": [ + "DeleteSnapshot" + ] + }, + "GetSnapshot": { + "methods": [ + "GetSnapshot" + ] + }, + "ListSnapshots": { + "methods": [ + "ListSnapshots" + ] + } + } + } + } + }, + "TemplatesService": { + "clients": { + "grpc": { + "libraryClient": "TemplatesClient", + "rpcs": { + "CreateJobFromTemplate": { + "methods": [ + "CreateJobFromTemplate" + ] + }, + "GetTemplate": { + "methods": [ + "GetTemplate" + ] + }, + "LaunchTemplate": { + "methods": [ + "LaunchTemplate" + ] + } + } + } + } + } + } +} diff --git a/dataflow/apiv1beta3/jobs_v1_beta3_client.go b/dataflow/apiv1beta3/jobs_v1_beta3_client.go new file mode 100644 index 000000000000..e477258d8583 --- /dev/null +++ b/dataflow/apiv1beta3/jobs_v1_beta3_client.go @@ -0,0 +1,486 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newJobsV1Beta3ClientHook clientHook + +// JobsV1Beta3CallOptions contains the retry settings for each method of JobsV1Beta3Client. +type JobsV1Beta3CallOptions struct { + CreateJob []gax.CallOption + GetJob []gax.CallOption + UpdateJob []gax.CallOption + ListJobs []gax.CallOption + AggregatedListJobs []gax.CallOption + CheckActiveJobs []gax.CallOption + SnapshotJob []gax.CallOption +} + +func defaultJobsV1Beta3GRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultJobsV1Beta3CallOptions() *JobsV1Beta3CallOptions { + return &JobsV1Beta3CallOptions{ + CreateJob: []gax.CallOption{}, + GetJob: []gax.CallOption{}, + UpdateJob: []gax.CallOption{}, + ListJobs: []gax.CallOption{}, + AggregatedListJobs: []gax.CallOption{}, + CheckActiveJobs: []gax.CallOption{}, + SnapshotJob: []gax.CallOption{}, + } +} + +// internalJobsV1Beta3Client is an interface that defines the methods availaible from Dataflow API. +type internalJobsV1Beta3Client interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateJob(context.Context, *dataflowpb.CreateJobRequest, ...gax.CallOption) (*dataflowpb.Job, error) + GetJob(context.Context, *dataflowpb.GetJobRequest, ...gax.CallOption) (*dataflowpb.Job, error) + UpdateJob(context.Context, *dataflowpb.UpdateJobRequest, ...gax.CallOption) (*dataflowpb.Job, error) + ListJobs(context.Context, *dataflowpb.ListJobsRequest, ...gax.CallOption) *JobIterator + AggregatedListJobs(context.Context, *dataflowpb.ListJobsRequest, ...gax.CallOption) *JobIterator + CheckActiveJobs(context.Context, *dataflowpb.CheckActiveJobsRequest, ...gax.CallOption) (*dataflowpb.CheckActiveJobsResponse, error) + SnapshotJob(context.Context, *dataflowpb.SnapshotJobRequest, ...gax.CallOption) (*dataflowpb.Snapshot, error) +} + +// JobsV1Beta3Client is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Provides a method to create and modify Google Cloud Dataflow jobs. +// A Job is a multi-stage computation graph run by the Cloud Dataflow service. +type JobsV1Beta3Client struct { + // The internal transport-dependent client. + internalClient internalJobsV1Beta3Client + + // The call options for this service. + CallOptions *JobsV1Beta3CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *JobsV1Beta3Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *JobsV1Beta3Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *JobsV1Beta3Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateJob creates a Cloud Dataflow job. +// +// To create a job, we recommend using projects.locations.jobs.create with a +// [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). Using +// projects.jobs.create is not recommended, as your job will always start +// in us-central1. +func (c *JobsV1Beta3Client) CreateJob(ctx context.Context, req *dataflowpb.CreateJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + return c.internalClient.CreateJob(ctx, req, opts...) +} + +// GetJob gets the state of the specified Cloud Dataflow job. +// +// To get the state of a job, we recommend using projects.locations.jobs.get +// with a [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). Using +// projects.jobs.get is not recommended, as you can only get the state of +// jobs that are running in us-central1. +func (c *JobsV1Beta3Client) GetJob(ctx context.Context, req *dataflowpb.GetJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + return c.internalClient.GetJob(ctx, req, opts...) +} + +// UpdateJob updates the state of an existing Cloud Dataflow job. +// +// To update the state of an existing job, we recommend using +// projects.locations.jobs.update with a [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). Using +// projects.jobs.update is not recommended, as you can only update the state +// of jobs that are running in us-central1. +func (c *JobsV1Beta3Client) UpdateJob(ctx context.Context, req *dataflowpb.UpdateJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + return c.internalClient.UpdateJob(ctx, req, opts...) +} + +// ListJobs list the jobs of a project. +// +// To list the jobs of a project in a region, we recommend using +// projects.locations.jobs.list with a [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). To +// list the all jobs across all regions, use projects.jobs.aggregated. Using +// projects.jobs.list is not recommended, as you can only get the list of +// jobs that are running in us-central1. +func (c *JobsV1Beta3Client) ListJobs(ctx context.Context, req *dataflowpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + return c.internalClient.ListJobs(ctx, req, opts...) +} + +// AggregatedListJobs list the jobs of a project across all regions. +func (c *JobsV1Beta3Client) AggregatedListJobs(ctx context.Context, req *dataflowpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + return c.internalClient.AggregatedListJobs(ctx, req, opts...) +} + +// CheckActiveJobs check for existence of active jobs in the given project across all regions. +func (c *JobsV1Beta3Client) CheckActiveJobs(ctx context.Context, req *dataflowpb.CheckActiveJobsRequest, opts ...gax.CallOption) (*dataflowpb.CheckActiveJobsResponse, error) { + return c.internalClient.CheckActiveJobs(ctx, req, opts...) +} + +// SnapshotJob snapshot the state of a streaming job. +func (c *JobsV1Beta3Client) SnapshotJob(ctx context.Context, req *dataflowpb.SnapshotJobRequest, opts ...gax.CallOption) (*dataflowpb.Snapshot, error) { + return c.internalClient.SnapshotJob(ctx, req, opts...) +} + +// jobsV1Beta3GRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type jobsV1Beta3GRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing JobsV1Beta3Client + CallOptions **JobsV1Beta3CallOptions + + // The gRPC API client. + jobsV1Beta3Client dataflowpb.JobsV1Beta3Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewJobsV1Beta3Client creates a new jobs v1 beta3 client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Provides a method to create and modify Google Cloud Dataflow jobs. +// A Job is a multi-stage computation graph run by the Cloud Dataflow service. +func NewJobsV1Beta3Client(ctx context.Context, opts ...option.ClientOption) (*JobsV1Beta3Client, error) { + clientOpts := defaultJobsV1Beta3GRPCClientOptions() + if newJobsV1Beta3ClientHook != nil { + hookOpts, err := newJobsV1Beta3ClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := JobsV1Beta3Client{CallOptions: defaultJobsV1Beta3CallOptions()} + + c := &jobsV1Beta3GRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + jobsV1Beta3Client: dataflowpb.NewJobsV1Beta3Client(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *jobsV1Beta3GRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *jobsV1Beta3GRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *jobsV1Beta3GRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *jobsV1Beta3GRPCClient) CreateJob(ctx context.Context, req *dataflowpb.CreateJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).CreateJob[0:len((*c.CallOptions).CreateJob):len((*c.CallOptions).CreateJob)], opts...) + var resp *dataflowpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.CreateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *jobsV1Beta3GRPCClient) GetJob(ctx context.Context, req *dataflowpb.GetJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetJob[0:len((*c.CallOptions).GetJob):len((*c.CallOptions).GetJob)], opts...) + var resp *dataflowpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.GetJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *jobsV1Beta3GRPCClient) UpdateJob(ctx context.Context, req *dataflowpb.UpdateJobRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).UpdateJob[0:len((*c.CallOptions).UpdateJob):len((*c.CallOptions).UpdateJob)], opts...) + var resp *dataflowpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.UpdateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *jobsV1Beta3GRPCClient) ListJobs(ctx context.Context, req *dataflowpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).ListJobs[0:len((*c.CallOptions).ListJobs):len((*c.CallOptions).ListJobs)], opts...) + it := &JobIterator{} + req = proto.Clone(req).(*dataflowpb.ListJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataflowpb.Job, string, error) { + var resp *dataflowpb.ListJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.ListJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetJobs(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *jobsV1Beta3GRPCClient) AggregatedListJobs(ctx context.Context, req *dataflowpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).AggregatedListJobs[0:len((*c.CallOptions).AggregatedListJobs):len((*c.CallOptions).AggregatedListJobs)], opts...) + it := &JobIterator{} + req = proto.Clone(req).(*dataflowpb.ListJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataflowpb.Job, string, error) { + var resp *dataflowpb.ListJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.AggregatedListJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetJobs(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *jobsV1Beta3GRPCClient) CheckActiveJobs(ctx context.Context, req *dataflowpb.CheckActiveJobsRequest, opts ...gax.CallOption) (*dataflowpb.CheckActiveJobsResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).CheckActiveJobs[0:len((*c.CallOptions).CheckActiveJobs):len((*c.CallOptions).CheckActiveJobs)], opts...) + var resp *dataflowpb.CheckActiveJobsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.CheckActiveJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *jobsV1Beta3GRPCClient) SnapshotJob(ctx context.Context, req *dataflowpb.SnapshotJobRequest, opts ...gax.CallOption) (*dataflowpb.Snapshot, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SnapshotJob[0:len((*c.CallOptions).SnapshotJob):len((*c.CallOptions).SnapshotJob)], opts...) + var resp *dataflowpb.Snapshot + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobsV1Beta3Client.SnapshotJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// JobIterator manages a stream of *dataflowpb.Job. +type JobIterator struct { + items []*dataflowpb.Job + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataflowpb.Job, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobIterator) Next() (*dataflowpb.Job, error) { + var item *dataflowpb.Job + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobIterator) bufLen() int { + return len(it.items) +} + +func (it *JobIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dataflow/apiv1beta3/jobs_v1_beta3_client_example_test.go b/dataflow/apiv1beta3/jobs_v1_beta3_client_example_test.go new file mode 100644 index 000000000000..101dc40be891 --- /dev/null +++ b/dataflow/apiv1beta3/jobs_v1_beta3_client_example_test.go @@ -0,0 +1,182 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewJobsV1Beta3Client() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleJobsV1Beta3Client_CreateJob() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CreateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobsV1Beta3Client_GetJob() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobsV1Beta3Client_UpdateJob() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.UpdateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobsV1Beta3Client_ListJobs() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleJobsV1Beta3Client_AggregatedListJobs() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.AggregatedListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleJobsV1Beta3Client_CheckActiveJobs() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CheckActiveJobsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CheckActiveJobs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobsV1Beta3Client_SnapshotJob() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.SnapshotJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SnapshotJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dataflow/apiv1beta3/messages_v1_beta3_client.go b/dataflow/apiv1beta3/messages_v1_beta3_client.go new file mode 100644 index 000000000000..cc2ccb08df0e --- /dev/null +++ b/dataflow/apiv1beta3/messages_v1_beta3_client.go @@ -0,0 +1,279 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newMessagesV1Beta3ClientHook clientHook + +// MessagesV1Beta3CallOptions contains the retry settings for each method of MessagesV1Beta3Client. +type MessagesV1Beta3CallOptions struct { + ListJobMessages []gax.CallOption +} + +func defaultMessagesV1Beta3GRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultMessagesV1Beta3CallOptions() *MessagesV1Beta3CallOptions { + return &MessagesV1Beta3CallOptions{ + ListJobMessages: []gax.CallOption{}, + } +} + +// internalMessagesV1Beta3Client is an interface that defines the methods availaible from Dataflow API. +type internalMessagesV1Beta3Client interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + ListJobMessages(context.Context, *dataflowpb.ListJobMessagesRequest, ...gax.CallOption) *JobMessageIterator +} + +// MessagesV1Beta3Client is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Dataflow Messages API is used for monitoring the progress of +// Dataflow jobs. +type MessagesV1Beta3Client struct { + // The internal transport-dependent client. + internalClient internalMessagesV1Beta3Client + + // The call options for this service. + CallOptions *MessagesV1Beta3CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *MessagesV1Beta3Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *MessagesV1Beta3Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *MessagesV1Beta3Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// ListJobMessages request the job status. +// +// To request the status of a job, we recommend using +// projects.locations.jobs.messages.list with a [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). Using +// projects.jobs.messages.list is not recommended, as you can only request +// the status of jobs that are running in us-central1. +func (c *MessagesV1Beta3Client) ListJobMessages(ctx context.Context, req *dataflowpb.ListJobMessagesRequest, opts ...gax.CallOption) *JobMessageIterator { + return c.internalClient.ListJobMessages(ctx, req, opts...) +} + +// messagesV1Beta3GRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type messagesV1Beta3GRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing MessagesV1Beta3Client + CallOptions **MessagesV1Beta3CallOptions + + // The gRPC API client. + messagesV1Beta3Client dataflowpb.MessagesV1Beta3Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewMessagesV1Beta3Client creates a new messages v1 beta3 client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// The Dataflow Messages API is used for monitoring the progress of +// Dataflow jobs. +func NewMessagesV1Beta3Client(ctx context.Context, opts ...option.ClientOption) (*MessagesV1Beta3Client, error) { + clientOpts := defaultMessagesV1Beta3GRPCClientOptions() + if newMessagesV1Beta3ClientHook != nil { + hookOpts, err := newMessagesV1Beta3ClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := MessagesV1Beta3Client{CallOptions: defaultMessagesV1Beta3CallOptions()} + + c := &messagesV1Beta3GRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + messagesV1Beta3Client: dataflowpb.NewMessagesV1Beta3Client(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *messagesV1Beta3GRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *messagesV1Beta3GRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *messagesV1Beta3GRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *messagesV1Beta3GRPCClient) ListJobMessages(ctx context.Context, req *dataflowpb.ListJobMessagesRequest, opts ...gax.CallOption) *JobMessageIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).ListJobMessages[0:len((*c.CallOptions).ListJobMessages):len((*c.CallOptions).ListJobMessages)], opts...) + it := &JobMessageIterator{} + req = proto.Clone(req).(*dataflowpb.ListJobMessagesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataflowpb.JobMessage, string, error) { + var resp *dataflowpb.ListJobMessagesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.messagesV1Beta3Client.ListJobMessages(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetJobMessages(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// JobMessageIterator manages a stream of *dataflowpb.JobMessage. +type JobMessageIterator struct { + items []*dataflowpb.JobMessage + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataflowpb.JobMessage, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobMessageIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobMessageIterator) Next() (*dataflowpb.JobMessage, error) { + var item *dataflowpb.JobMessage + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobMessageIterator) bufLen() int { + return len(it.items) +} + +func (it *JobMessageIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dataflow/apiv1beta3/messages_v1_beta3_client_example_test.go b/dataflow/apiv1beta3/messages_v1_beta3_client_example_test.go new file mode 100644 index 000000000000..d07cbb34975a --- /dev/null +++ b/dataflow/apiv1beta3/messages_v1_beta3_client_example_test.go @@ -0,0 +1,62 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewMessagesV1Beta3Client() { + ctx := context.Background() + c, err := dataflow.NewMessagesV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleMessagesV1Beta3Client_ListJobMessages() { + ctx := context.Background() + c, err := dataflow.NewMessagesV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobMessagesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobMessages(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/dataflow/apiv1beta3/metrics_v1_beta3_client.go b/dataflow/apiv1beta3/metrics_v1_beta3_client.go new file mode 100644 index 000000000000..76bf3af545bc --- /dev/null +++ b/dataflow/apiv1beta3/metrics_v1_beta3_client.go @@ -0,0 +1,407 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newMetricsV1Beta3ClientHook clientHook + +// MetricsV1Beta3CallOptions contains the retry settings for each method of MetricsV1Beta3Client. +type MetricsV1Beta3CallOptions struct { + GetJobMetrics []gax.CallOption + GetJobExecutionDetails []gax.CallOption + GetStageExecutionDetails []gax.CallOption +} + +func defaultMetricsV1Beta3GRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultMetricsV1Beta3CallOptions() *MetricsV1Beta3CallOptions { + return &MetricsV1Beta3CallOptions{ + GetJobMetrics: []gax.CallOption{}, + GetJobExecutionDetails: []gax.CallOption{}, + GetStageExecutionDetails: []gax.CallOption{}, + } +} + +// internalMetricsV1Beta3Client is an interface that defines the methods availaible from Dataflow API. +type internalMetricsV1Beta3Client interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + GetJobMetrics(context.Context, *dataflowpb.GetJobMetricsRequest, ...gax.CallOption) (*dataflowpb.JobMetrics, error) + GetJobExecutionDetails(context.Context, *dataflowpb.GetJobExecutionDetailsRequest, ...gax.CallOption) *StageSummaryIterator + GetStageExecutionDetails(context.Context, *dataflowpb.GetStageExecutionDetailsRequest, ...gax.CallOption) *WorkerDetailsIterator +} + +// MetricsV1Beta3Client is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Dataflow Metrics API lets you monitor the progress of Dataflow +// jobs. +type MetricsV1Beta3Client struct { + // The internal transport-dependent client. + internalClient internalMetricsV1Beta3Client + + // The call options for this service. + CallOptions *MetricsV1Beta3CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *MetricsV1Beta3Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *MetricsV1Beta3Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *MetricsV1Beta3Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// GetJobMetrics request the job status. +// +// To request the status of a job, we recommend using +// projects.locations.jobs.getMetrics with a [regional endpoint] +// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints (at https://cloud.google.com/dataflow/docs/concepts/regional-endpoints)). Using +// projects.jobs.getMetrics is not recommended, as you can only request the +// status of jobs that are running in us-central1. +func (c *MetricsV1Beta3Client) GetJobMetrics(ctx context.Context, req *dataflowpb.GetJobMetricsRequest, opts ...gax.CallOption) (*dataflowpb.JobMetrics, error) { + return c.internalClient.GetJobMetrics(ctx, req, opts...) +} + +// GetJobExecutionDetails request detailed information about the execution status of the job. +// +// EXPERIMENTAL. This API is subject to change or removal without notice. +func (c *MetricsV1Beta3Client) GetJobExecutionDetails(ctx context.Context, req *dataflowpb.GetJobExecutionDetailsRequest, opts ...gax.CallOption) *StageSummaryIterator { + return c.internalClient.GetJobExecutionDetails(ctx, req, opts...) +} + +// GetStageExecutionDetails request detailed information about the execution status of a stage of the +// job. +// +// EXPERIMENTAL. This API is subject to change or removal without notice. +func (c *MetricsV1Beta3Client) GetStageExecutionDetails(ctx context.Context, req *dataflowpb.GetStageExecutionDetailsRequest, opts ...gax.CallOption) *WorkerDetailsIterator { + return c.internalClient.GetStageExecutionDetails(ctx, req, opts...) +} + +// metricsV1Beta3GRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type metricsV1Beta3GRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing MetricsV1Beta3Client + CallOptions **MetricsV1Beta3CallOptions + + // The gRPC API client. + metricsV1Beta3Client dataflowpb.MetricsV1Beta3Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewMetricsV1Beta3Client creates a new metrics v1 beta3 client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// The Dataflow Metrics API lets you monitor the progress of Dataflow +// jobs. +func NewMetricsV1Beta3Client(ctx context.Context, opts ...option.ClientOption) (*MetricsV1Beta3Client, error) { + clientOpts := defaultMetricsV1Beta3GRPCClientOptions() + if newMetricsV1Beta3ClientHook != nil { + hookOpts, err := newMetricsV1Beta3ClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := MetricsV1Beta3Client{CallOptions: defaultMetricsV1Beta3CallOptions()} + + c := &metricsV1Beta3GRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + metricsV1Beta3Client: dataflowpb.NewMetricsV1Beta3Client(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *metricsV1Beta3GRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *metricsV1Beta3GRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *metricsV1Beta3GRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *metricsV1Beta3GRPCClient) GetJobMetrics(ctx context.Context, req *dataflowpb.GetJobMetricsRequest, opts ...gax.CallOption) (*dataflowpb.JobMetrics, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetJobMetrics[0:len((*c.CallOptions).GetJobMetrics):len((*c.CallOptions).GetJobMetrics)], opts...) + var resp *dataflowpb.JobMetrics + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsV1Beta3Client.GetJobMetrics(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metricsV1Beta3GRPCClient) GetJobExecutionDetails(ctx context.Context, req *dataflowpb.GetJobExecutionDetailsRequest, opts ...gax.CallOption) *StageSummaryIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetJobExecutionDetails[0:len((*c.CallOptions).GetJobExecutionDetails):len((*c.CallOptions).GetJobExecutionDetails)], opts...) + it := &StageSummaryIterator{} + req = proto.Clone(req).(*dataflowpb.GetJobExecutionDetailsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataflowpb.StageSummary, string, error) { + var resp *dataflowpb.JobExecutionDetails + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsV1Beta3Client.GetJobExecutionDetails(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetStages(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *metricsV1Beta3GRPCClient) GetStageExecutionDetails(ctx context.Context, req *dataflowpb.GetStageExecutionDetailsRequest, opts ...gax.CallOption) *WorkerDetailsIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetStageExecutionDetails[0:len((*c.CallOptions).GetStageExecutionDetails):len((*c.CallOptions).GetStageExecutionDetails)], opts...) + it := &WorkerDetailsIterator{} + req = proto.Clone(req).(*dataflowpb.GetStageExecutionDetailsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataflowpb.WorkerDetails, string, error) { + var resp *dataflowpb.StageExecutionDetails + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsV1Beta3Client.GetStageExecutionDetails(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetWorkers(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// StageSummaryIterator manages a stream of *dataflowpb.StageSummary. +type StageSummaryIterator struct { + items []*dataflowpb.StageSummary + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataflowpb.StageSummary, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StageSummaryIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StageSummaryIterator) Next() (*dataflowpb.StageSummary, error) { + var item *dataflowpb.StageSummary + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StageSummaryIterator) bufLen() int { + return len(it.items) +} + +func (it *StageSummaryIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// WorkerDetailsIterator manages a stream of *dataflowpb.WorkerDetails. +type WorkerDetailsIterator struct { + items []*dataflowpb.WorkerDetails + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataflowpb.WorkerDetails, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *WorkerDetailsIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *WorkerDetailsIterator) Next() (*dataflowpb.WorkerDetails, error) { + var item *dataflowpb.WorkerDetails + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *WorkerDetailsIterator) bufLen() int { + return len(it.items) +} + +func (it *WorkerDetailsIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dataflow/apiv1beta3/metrics_v1_beta3_client_example_test.go b/dataflow/apiv1beta3/metrics_v1_beta3_client_example_test.go new file mode 100644 index 000000000000..7677189c7867 --- /dev/null +++ b/dataflow/apiv1beta3/metrics_v1_beta3_client_example_test.go @@ -0,0 +1,106 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewMetricsV1Beta3Client() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleMetricsV1Beta3Client_GetJobMetrics() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobMetricsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJobMetrics(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricsV1Beta3Client_GetJobExecutionDetails() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobExecutionDetailsRequest{ + // TODO: Fill request struct fields. + } + it := c.GetJobExecutionDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetricsV1Beta3Client_GetStageExecutionDetails() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetStageExecutionDetailsRequest{ + // TODO: Fill request struct fields. + } + it := c.GetStageExecutionDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/dataflow/apiv1beta3/snapshots_v1_beta3_client.go b/dataflow/apiv1beta3/snapshots_v1_beta3_client.go new file mode 100644 index 000000000000..212281bc7d4c --- /dev/null +++ b/dataflow/apiv1beta3/snapshots_v1_beta3_client.go @@ -0,0 +1,260 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newSnapshotsV1Beta3ClientHook clientHook + +// SnapshotsV1Beta3CallOptions contains the retry settings for each method of SnapshotsV1Beta3Client. +type SnapshotsV1Beta3CallOptions struct { + GetSnapshot []gax.CallOption + DeleteSnapshot []gax.CallOption + ListSnapshots []gax.CallOption +} + +func defaultSnapshotsV1Beta3GRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultSnapshotsV1Beta3CallOptions() *SnapshotsV1Beta3CallOptions { + return &SnapshotsV1Beta3CallOptions{ + GetSnapshot: []gax.CallOption{}, + DeleteSnapshot: []gax.CallOption{}, + ListSnapshots: []gax.CallOption{}, + } +} + +// internalSnapshotsV1Beta3Client is an interface that defines the methods availaible from Dataflow API. +type internalSnapshotsV1Beta3Client interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + GetSnapshot(context.Context, *dataflowpb.GetSnapshotRequest, ...gax.CallOption) (*dataflowpb.Snapshot, error) + DeleteSnapshot(context.Context, *dataflowpb.DeleteSnapshotRequest, ...gax.CallOption) (*dataflowpb.DeleteSnapshotResponse, error) + ListSnapshots(context.Context, *dataflowpb.ListSnapshotsRequest, ...gax.CallOption) (*dataflowpb.ListSnapshotsResponse, error) +} + +// SnapshotsV1Beta3Client is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Provides methods to manage snapshots of Google Cloud Dataflow jobs. +type SnapshotsV1Beta3Client struct { + // The internal transport-dependent client. + internalClient internalSnapshotsV1Beta3Client + + // The call options for this service. + CallOptions *SnapshotsV1Beta3CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SnapshotsV1Beta3Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SnapshotsV1Beta3Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SnapshotsV1Beta3Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// GetSnapshot gets information about a snapshot. +func (c *SnapshotsV1Beta3Client) GetSnapshot(ctx context.Context, req *dataflowpb.GetSnapshotRequest, opts ...gax.CallOption) (*dataflowpb.Snapshot, error) { + return c.internalClient.GetSnapshot(ctx, req, opts...) +} + +// DeleteSnapshot deletes a snapshot. +func (c *SnapshotsV1Beta3Client) DeleteSnapshot(ctx context.Context, req *dataflowpb.DeleteSnapshotRequest, opts ...gax.CallOption) (*dataflowpb.DeleteSnapshotResponse, error) { + return c.internalClient.DeleteSnapshot(ctx, req, opts...) +} + +// ListSnapshots lists snapshots. +func (c *SnapshotsV1Beta3Client) ListSnapshots(ctx context.Context, req *dataflowpb.ListSnapshotsRequest, opts ...gax.CallOption) (*dataflowpb.ListSnapshotsResponse, error) { + return c.internalClient.ListSnapshots(ctx, req, opts...) +} + +// snapshotsV1Beta3GRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type snapshotsV1Beta3GRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing SnapshotsV1Beta3Client + CallOptions **SnapshotsV1Beta3CallOptions + + // The gRPC API client. + snapshotsV1Beta3Client dataflowpb.SnapshotsV1Beta3Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSnapshotsV1Beta3Client creates a new snapshots v1 beta3 client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Provides methods to manage snapshots of Google Cloud Dataflow jobs. +func NewSnapshotsV1Beta3Client(ctx context.Context, opts ...option.ClientOption) (*SnapshotsV1Beta3Client, error) { + clientOpts := defaultSnapshotsV1Beta3GRPCClientOptions() + if newSnapshotsV1Beta3ClientHook != nil { + hookOpts, err := newSnapshotsV1Beta3ClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := SnapshotsV1Beta3Client{CallOptions: defaultSnapshotsV1Beta3CallOptions()} + + c := &snapshotsV1Beta3GRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + snapshotsV1Beta3Client: dataflowpb.NewSnapshotsV1Beta3Client(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *snapshotsV1Beta3GRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *snapshotsV1Beta3GRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *snapshotsV1Beta3GRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *snapshotsV1Beta3GRPCClient) GetSnapshot(ctx context.Context, req *dataflowpb.GetSnapshotRequest, opts ...gax.CallOption) (*dataflowpb.Snapshot, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetSnapshot[0:len((*c.CallOptions).GetSnapshot):len((*c.CallOptions).GetSnapshot)], opts...) + var resp *dataflowpb.Snapshot + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.snapshotsV1Beta3Client.GetSnapshot(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *snapshotsV1Beta3GRPCClient) DeleteSnapshot(ctx context.Context, req *dataflowpb.DeleteSnapshotRequest, opts ...gax.CallOption) (*dataflowpb.DeleteSnapshotResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).DeleteSnapshot[0:len((*c.CallOptions).DeleteSnapshot):len((*c.CallOptions).DeleteSnapshot)], opts...) + var resp *dataflowpb.DeleteSnapshotResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.snapshotsV1Beta3Client.DeleteSnapshot(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *snapshotsV1Beta3GRPCClient) ListSnapshots(ctx context.Context, req *dataflowpb.ListSnapshotsRequest, opts ...gax.CallOption) (*dataflowpb.ListSnapshotsResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).ListSnapshots[0:len((*c.CallOptions).ListSnapshots):len((*c.CallOptions).ListSnapshots)], opts...) + var resp *dataflowpb.ListSnapshotsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.snapshotsV1Beta3Client.ListSnapshots(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/dataflow/apiv1beta3/snapshots_v1_beta3_client_example_test.go b/dataflow/apiv1beta3/snapshots_v1_beta3_client_example_test.go new file mode 100644 index 000000000000..3c41e38f62b8 --- /dev/null +++ b/dataflow/apiv1beta3/snapshots_v1_beta3_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewSnapshotsV1Beta3Client() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSnapshotsV1Beta3Client_GetSnapshot() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsV1Beta3Client_DeleteSnapshot() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.DeleteSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsV1Beta3Client_ListSnapshots() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListSnapshotsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListSnapshots(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dataflow/apiv1beta3/templates_client.go b/dataflow/apiv1beta3/templates_client.go new file mode 100644 index 000000000000..856ad73d5e4e --- /dev/null +++ b/dataflow/apiv1beta3/templates_client.go @@ -0,0 +1,260 @@ +// Copyright 2021 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 dataflow + +import ( + "context" + "math" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newTemplatesClientHook clientHook + +// TemplatesCallOptions contains the retry settings for each method of TemplatesClient. +type TemplatesCallOptions struct { + CreateJobFromTemplate []gax.CallOption + LaunchTemplate []gax.CallOption + GetTemplate []gax.CallOption +} + +func defaultTemplatesGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataflow.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataflow.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataflow.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultTemplatesCallOptions() *TemplatesCallOptions { + return &TemplatesCallOptions{ + CreateJobFromTemplate: []gax.CallOption{}, + LaunchTemplate: []gax.CallOption{}, + GetTemplate: []gax.CallOption{}, + } +} + +// internalTemplatesClient is an interface that defines the methods availaible from Dataflow API. +type internalTemplatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateJobFromTemplate(context.Context, *dataflowpb.CreateJobFromTemplateRequest, ...gax.CallOption) (*dataflowpb.Job, error) + LaunchTemplate(context.Context, *dataflowpb.LaunchTemplateRequest, ...gax.CallOption) (*dataflowpb.LaunchTemplateResponse, error) + GetTemplate(context.Context, *dataflowpb.GetTemplateRequest, ...gax.CallOption) (*dataflowpb.GetTemplateResponse, error) +} + +// TemplatesClient is a client for interacting with Dataflow API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Provides a method to create Cloud Dataflow jobs from templates. +type TemplatesClient struct { + // The internal transport-dependent client. + internalClient internalTemplatesClient + + // The call options for this service. + CallOptions *TemplatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TemplatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TemplatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TemplatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateJobFromTemplate creates a Cloud Dataflow job from a template. +func (c *TemplatesClient) CreateJobFromTemplate(ctx context.Context, req *dataflowpb.CreateJobFromTemplateRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + return c.internalClient.CreateJobFromTemplate(ctx, req, opts...) +} + +// LaunchTemplate launch a template. +func (c *TemplatesClient) LaunchTemplate(ctx context.Context, req *dataflowpb.LaunchTemplateRequest, opts ...gax.CallOption) (*dataflowpb.LaunchTemplateResponse, error) { + return c.internalClient.LaunchTemplate(ctx, req, opts...) +} + +// GetTemplate get the template associated with a template. +func (c *TemplatesClient) GetTemplate(ctx context.Context, req *dataflowpb.GetTemplateRequest, opts ...gax.CallOption) (*dataflowpb.GetTemplateResponse, error) { + return c.internalClient.GetTemplate(ctx, req, opts...) +} + +// templatesGRPCClient is a client for interacting with Dataflow API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type templatesGRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing TemplatesClient + CallOptions **TemplatesCallOptions + + // The gRPC API client. + templatesClient dataflowpb.TemplatesServiceClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTemplatesClient creates a new templates service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Provides a method to create Cloud Dataflow jobs from templates. +func NewTemplatesClient(ctx context.Context, opts ...option.ClientOption) (*TemplatesClient, error) { + clientOpts := defaultTemplatesGRPCClientOptions() + if newTemplatesClientHook != nil { + hookOpts, err := newTemplatesClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := TemplatesClient{CallOptions: defaultTemplatesCallOptions()} + + c := &templatesGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + templatesClient: dataflowpb.NewTemplatesServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *templatesGRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *templatesGRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *templatesGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *templatesGRPCClient) CreateJobFromTemplate(ctx context.Context, req *dataflowpb.CreateJobFromTemplateRequest, opts ...gax.CallOption) (*dataflowpb.Job, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).CreateJobFromTemplate[0:len((*c.CallOptions).CreateJobFromTemplate):len((*c.CallOptions).CreateJobFromTemplate)], opts...) + var resp *dataflowpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.templatesClient.CreateJobFromTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *templatesGRPCClient) LaunchTemplate(ctx context.Context, req *dataflowpb.LaunchTemplateRequest, opts ...gax.CallOption) (*dataflowpb.LaunchTemplateResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).LaunchTemplate[0:len((*c.CallOptions).LaunchTemplate):len((*c.CallOptions).LaunchTemplate)], opts...) + var resp *dataflowpb.LaunchTemplateResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.templatesClient.LaunchTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *templatesGRPCClient) GetTemplate(ctx context.Context, req *dataflowpb.GetTemplateRequest, opts ...gax.CallOption) (*dataflowpb.GetTemplateResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetTemplate[0:len((*c.CallOptions).GetTemplate):len((*c.CallOptions).GetTemplate)], opts...) + var resp *dataflowpb.GetTemplateResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.templatesClient.GetTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/dataflow/apiv1beta3/templates_client_example_test.go b/dataflow/apiv1beta3/templates_client_example_test.go new file mode 100644 index 000000000000..16bc0ab021be --- /dev/null +++ b/dataflow/apiv1beta3/templates_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 dataflow_test + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func ExampleNewTemplatesClient() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTemplatesClient_CreateJobFromTemplate() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CreateJobFromTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJobFromTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTemplatesClient_LaunchTemplate() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.LaunchTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LaunchTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTemplatesClient_GetTemplate() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/datastream/apiv1alpha1/datastream_client.go b/datastream/apiv1alpha1/datastream_client.go new file mode 100644 index 000000000000..37d76bb99e94 --- /dev/null +++ b/datastream/apiv1alpha1/datastream_client.go @@ -0,0 +1,2077 @@ +// Copyright 2021 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 datastream + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newClientHook clientHook + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ListConnectionProfiles []gax.CallOption + GetConnectionProfile []gax.CallOption + CreateConnectionProfile []gax.CallOption + UpdateConnectionProfile []gax.CallOption + DeleteConnectionProfile []gax.CallOption + DiscoverConnectionProfile []gax.CallOption + ListStreams []gax.CallOption + GetStream []gax.CallOption + CreateStream []gax.CallOption + UpdateStream []gax.CallOption + DeleteStream []gax.CallOption + FetchErrors []gax.CallOption + FetchStaticIps []gax.CallOption + CreatePrivateConnection []gax.CallOption + GetPrivateConnection []gax.CallOption + ListPrivateConnections []gax.CallOption + DeletePrivateConnection []gax.CallOption + CreateRoute []gax.CallOption + GetRoute []gax.CallOption + ListRoutes []gax.CallOption + DeleteRoute []gax.CallOption +} + +func defaultGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("datastream.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("datastream.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://datastream.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCallOptions() *CallOptions { + return &CallOptions{ + ListConnectionProfiles: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetConnectionProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateConnectionProfile: []gax.CallOption{}, + UpdateConnectionProfile: []gax.CallOption{}, + DeleteConnectionProfile: []gax.CallOption{}, + DiscoverConnectionProfile: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListStreams: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetStream: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateStream: []gax.CallOption{}, + UpdateStream: []gax.CallOption{}, + DeleteStream: []gax.CallOption{}, + FetchErrors: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + FetchStaticIps: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreatePrivateConnection: []gax.CallOption{}, + GetPrivateConnection: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListPrivateConnections: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeletePrivateConnection: []gax.CallOption{}, + CreateRoute: []gax.CallOption{}, + GetRoute: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListRoutes: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 10000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteRoute: []gax.CallOption{}, + } +} + +// internalClient is an interface that defines the methods availaible from DataStream API. +type internalClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + ListConnectionProfiles(context.Context, *datastreampb.ListConnectionProfilesRequest, ...gax.CallOption) *ConnectionProfileIterator + GetConnectionProfile(context.Context, *datastreampb.GetConnectionProfileRequest, ...gax.CallOption) (*datastreampb.ConnectionProfile, error) + CreateConnectionProfile(context.Context, *datastreampb.CreateConnectionProfileRequest, ...gax.CallOption) (*CreateConnectionProfileOperation, error) + CreateConnectionProfileOperation(name string) *CreateConnectionProfileOperation + UpdateConnectionProfile(context.Context, *datastreampb.UpdateConnectionProfileRequest, ...gax.CallOption) (*UpdateConnectionProfileOperation, error) + UpdateConnectionProfileOperation(name string) *UpdateConnectionProfileOperation + DeleteConnectionProfile(context.Context, *datastreampb.DeleteConnectionProfileRequest, ...gax.CallOption) (*DeleteConnectionProfileOperation, error) + DeleteConnectionProfileOperation(name string) *DeleteConnectionProfileOperation + DiscoverConnectionProfile(context.Context, *datastreampb.DiscoverConnectionProfileRequest, ...gax.CallOption) (*datastreampb.DiscoverConnectionProfileResponse, error) + ListStreams(context.Context, *datastreampb.ListStreamsRequest, ...gax.CallOption) *StreamIterator + GetStream(context.Context, *datastreampb.GetStreamRequest, ...gax.CallOption) (*datastreampb.Stream, error) + CreateStream(context.Context, *datastreampb.CreateStreamRequest, ...gax.CallOption) (*CreateStreamOperation, error) + CreateStreamOperation(name string) *CreateStreamOperation + UpdateStream(context.Context, *datastreampb.UpdateStreamRequest, ...gax.CallOption) (*UpdateStreamOperation, error) + UpdateStreamOperation(name string) *UpdateStreamOperation + DeleteStream(context.Context, *datastreampb.DeleteStreamRequest, ...gax.CallOption) (*DeleteStreamOperation, error) + DeleteStreamOperation(name string) *DeleteStreamOperation + FetchErrors(context.Context, *datastreampb.FetchErrorsRequest, ...gax.CallOption) (*FetchErrorsOperation, error) + FetchErrorsOperation(name string) *FetchErrorsOperation + FetchStaticIps(context.Context, *datastreampb.FetchStaticIpsRequest, ...gax.CallOption) *StringIterator + CreatePrivateConnection(context.Context, *datastreampb.CreatePrivateConnectionRequest, ...gax.CallOption) (*CreatePrivateConnectionOperation, error) + CreatePrivateConnectionOperation(name string) *CreatePrivateConnectionOperation + GetPrivateConnection(context.Context, *datastreampb.GetPrivateConnectionRequest, ...gax.CallOption) (*datastreampb.PrivateConnection, error) + ListPrivateConnections(context.Context, *datastreampb.ListPrivateConnectionsRequest, ...gax.CallOption) *PrivateConnectionIterator + DeletePrivateConnection(context.Context, *datastreampb.DeletePrivateConnectionRequest, ...gax.CallOption) (*DeletePrivateConnectionOperation, error) + DeletePrivateConnectionOperation(name string) *DeletePrivateConnectionOperation + CreateRoute(context.Context, *datastreampb.CreateRouteRequest, ...gax.CallOption) (*CreateRouteOperation, error) + CreateRouteOperation(name string) *CreateRouteOperation + GetRoute(context.Context, *datastreampb.GetRouteRequest, ...gax.CallOption) (*datastreampb.Route, error) + ListRoutes(context.Context, *datastreampb.ListRoutesRequest, ...gax.CallOption) *RouteIterator + DeleteRoute(context.Context, *datastreampb.DeleteRouteRequest, ...gax.CallOption) (*DeleteRouteOperation, error) + DeleteRouteOperation(name string) *DeleteRouteOperation +} + +// Client is a client for interacting with DataStream API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Datastream service +type Client struct { + // The internal transport-dependent client. + internalClient internalClient + + // The call options for this service. + CallOptions *CallOptions + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// ListConnectionProfiles use this method to list connection profiles created in a project and +// location. +func (c *Client) ListConnectionProfiles(ctx context.Context, req *datastreampb.ListConnectionProfilesRequest, opts ...gax.CallOption) *ConnectionProfileIterator { + return c.internalClient.ListConnectionProfiles(ctx, req, opts...) +} + +// GetConnectionProfile use this method to get details about a connection profile. +func (c *Client) GetConnectionProfile(ctx context.Context, req *datastreampb.GetConnectionProfileRequest, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + return c.internalClient.GetConnectionProfile(ctx, req, opts...) +} + +// CreateConnectionProfile use this method to create a connection profile in a project and location. +func (c *Client) CreateConnectionProfile(ctx context.Context, req *datastreampb.CreateConnectionProfileRequest, opts ...gax.CallOption) (*CreateConnectionProfileOperation, error) { + return c.internalClient.CreateConnectionProfile(ctx, req, opts...) +} + +// CreateConnectionProfileOperation returns a new CreateConnectionProfileOperation from a given name. +// The name must be that of a previously created CreateConnectionProfileOperation, possibly from a different process. +func (c *Client) CreateConnectionProfileOperation(name string) *CreateConnectionProfileOperation { + return c.internalClient.CreateConnectionProfileOperation(name) +} + +// UpdateConnectionProfile use this method to update the parameters of a connection profile. +func (c *Client) UpdateConnectionProfile(ctx context.Context, req *datastreampb.UpdateConnectionProfileRequest, opts ...gax.CallOption) (*UpdateConnectionProfileOperation, error) { + return c.internalClient.UpdateConnectionProfile(ctx, req, opts...) +} + +// UpdateConnectionProfileOperation returns a new UpdateConnectionProfileOperation from a given name. +// The name must be that of a previously created UpdateConnectionProfileOperation, possibly from a different process. +func (c *Client) UpdateConnectionProfileOperation(name string) *UpdateConnectionProfileOperation { + return c.internalClient.UpdateConnectionProfileOperation(name) +} + +// DeleteConnectionProfile use this method to delete a connection profile… +func (c *Client) DeleteConnectionProfile(ctx context.Context, req *datastreampb.DeleteConnectionProfileRequest, opts ...gax.CallOption) (*DeleteConnectionProfileOperation, error) { + return c.internalClient.DeleteConnectionProfile(ctx, req, opts...) +} + +// DeleteConnectionProfileOperation returns a new DeleteConnectionProfileOperation from a given name. +// The name must be that of a previously created DeleteConnectionProfileOperation, possibly from a different process. +func (c *Client) DeleteConnectionProfileOperation(name string) *DeleteConnectionProfileOperation { + return c.internalClient.DeleteConnectionProfileOperation(name) +} + +// DiscoverConnectionProfile use this method to discover a connection profile. +// The discover API call exposes the data objects and metadata belonging to +// the profile. Typically, a request returns children data objects under a +// parent data object that’s optionally supplied in the request. +func (c *Client) DiscoverConnectionProfile(ctx context.Context, req *datastreampb.DiscoverConnectionProfileRequest, opts ...gax.CallOption) (*datastreampb.DiscoverConnectionProfileResponse, error) { + return c.internalClient.DiscoverConnectionProfile(ctx, req, opts...) +} + +// ListStreams use this method to list streams in a project and location. +func (c *Client) ListStreams(ctx context.Context, req *datastreampb.ListStreamsRequest, opts ...gax.CallOption) *StreamIterator { + return c.internalClient.ListStreams(ctx, req, opts...) +} + +// GetStream use this method to get details about a stream. +func (c *Client) GetStream(ctx context.Context, req *datastreampb.GetStreamRequest, opts ...gax.CallOption) (*datastreampb.Stream, error) { + return c.internalClient.GetStream(ctx, req, opts...) +} + +// CreateStream use this method to create a stream. +func (c *Client) CreateStream(ctx context.Context, req *datastreampb.CreateStreamRequest, opts ...gax.CallOption) (*CreateStreamOperation, error) { + return c.internalClient.CreateStream(ctx, req, opts...) +} + +// CreateStreamOperation returns a new CreateStreamOperation from a given name. +// The name must be that of a previously created CreateStreamOperation, possibly from a different process. +func (c *Client) CreateStreamOperation(name string) *CreateStreamOperation { + return c.internalClient.CreateStreamOperation(name) +} + +// UpdateStream use this method to update the configuration of a stream. +func (c *Client) UpdateStream(ctx context.Context, req *datastreampb.UpdateStreamRequest, opts ...gax.CallOption) (*UpdateStreamOperation, error) { + return c.internalClient.UpdateStream(ctx, req, opts...) +} + +// UpdateStreamOperation returns a new UpdateStreamOperation from a given name. +// The name must be that of a previously created UpdateStreamOperation, possibly from a different process. +func (c *Client) UpdateStreamOperation(name string) *UpdateStreamOperation { + return c.internalClient.UpdateStreamOperation(name) +} + +// DeleteStream use this method to delete a stream. +func (c *Client) DeleteStream(ctx context.Context, req *datastreampb.DeleteStreamRequest, opts ...gax.CallOption) (*DeleteStreamOperation, error) { + return c.internalClient.DeleteStream(ctx, req, opts...) +} + +// DeleteStreamOperation returns a new DeleteStreamOperation from a given name. +// The name must be that of a previously created DeleteStreamOperation, possibly from a different process. +func (c *Client) DeleteStreamOperation(name string) *DeleteStreamOperation { + return c.internalClient.DeleteStreamOperation(name) +} + +// FetchErrors use this method to fetch any errors associated with a stream. +func (c *Client) FetchErrors(ctx context.Context, req *datastreampb.FetchErrorsRequest, opts ...gax.CallOption) (*FetchErrorsOperation, error) { + return c.internalClient.FetchErrors(ctx, req, opts...) +} + +// FetchErrorsOperation returns a new FetchErrorsOperation from a given name. +// The name must be that of a previously created FetchErrorsOperation, possibly from a different process. +func (c *Client) FetchErrorsOperation(name string) *FetchErrorsOperation { + return c.internalClient.FetchErrorsOperation(name) +} + +// FetchStaticIps the FetchStaticIps API call exposes the static ips used by Datastream. +// Typically, a request returns children data objects under +// a parent data object that’s optionally supplied in the request. +func (c *Client) FetchStaticIps(ctx context.Context, req *datastreampb.FetchStaticIpsRequest, opts ...gax.CallOption) *StringIterator { + return c.internalClient.FetchStaticIps(ctx, req, opts...) +} + +// CreatePrivateConnection use this method to create a private connectivity configuration. +func (c *Client) CreatePrivateConnection(ctx context.Context, req *datastreampb.CreatePrivateConnectionRequest, opts ...gax.CallOption) (*CreatePrivateConnectionOperation, error) { + return c.internalClient.CreatePrivateConnection(ctx, req, opts...) +} + +// CreatePrivateConnectionOperation returns a new CreatePrivateConnectionOperation from a given name. +// The name must be that of a previously created CreatePrivateConnectionOperation, possibly from a different process. +func (c *Client) CreatePrivateConnectionOperation(name string) *CreatePrivateConnectionOperation { + return c.internalClient.CreatePrivateConnectionOperation(name) +} + +// GetPrivateConnection use this method to get details about a private connectivity configuration. +func (c *Client) GetPrivateConnection(ctx context.Context, req *datastreampb.GetPrivateConnectionRequest, opts ...gax.CallOption) (*datastreampb.PrivateConnection, error) { + return c.internalClient.GetPrivateConnection(ctx, req, opts...) +} + +// ListPrivateConnections use this method to list private connectivity configurations in a project +// and location. +func (c *Client) ListPrivateConnections(ctx context.Context, req *datastreampb.ListPrivateConnectionsRequest, opts ...gax.CallOption) *PrivateConnectionIterator { + return c.internalClient.ListPrivateConnections(ctx, req, opts...) +} + +// DeletePrivateConnection use this method to delete a private connectivity configuration. +func (c *Client) DeletePrivateConnection(ctx context.Context, req *datastreampb.DeletePrivateConnectionRequest, opts ...gax.CallOption) (*DeletePrivateConnectionOperation, error) { + return c.internalClient.DeletePrivateConnection(ctx, req, opts...) +} + +// DeletePrivateConnectionOperation returns a new DeletePrivateConnectionOperation from a given name. +// The name must be that of a previously created DeletePrivateConnectionOperation, possibly from a different process. +func (c *Client) DeletePrivateConnectionOperation(name string) *DeletePrivateConnectionOperation { + return c.internalClient.DeletePrivateConnectionOperation(name) +} + +// CreateRoute use this method to create a route for a private connectivity in a project +// and location. +func (c *Client) CreateRoute(ctx context.Context, req *datastreampb.CreateRouteRequest, opts ...gax.CallOption) (*CreateRouteOperation, error) { + return c.internalClient.CreateRoute(ctx, req, opts...) +} + +// CreateRouteOperation returns a new CreateRouteOperation from a given name. +// The name must be that of a previously created CreateRouteOperation, possibly from a different process. +func (c *Client) CreateRouteOperation(name string) *CreateRouteOperation { + return c.internalClient.CreateRouteOperation(name) +} + +// GetRoute use this method to get details about a route. +func (c *Client) GetRoute(ctx context.Context, req *datastreampb.GetRouteRequest, opts ...gax.CallOption) (*datastreampb.Route, error) { + return c.internalClient.GetRoute(ctx, req, opts...) +} + +// ListRoutes use this method to list routes created for a private connectivity in a +// project and location. +func (c *Client) ListRoutes(ctx context.Context, req *datastreampb.ListRoutesRequest, opts ...gax.CallOption) *RouteIterator { + return c.internalClient.ListRoutes(ctx, req, opts...) +} + +// DeleteRoute use this method to delete a route. +func (c *Client) DeleteRoute(ctx context.Context, req *datastreampb.DeleteRouteRequest, opts ...gax.CallOption) (*DeleteRouteOperation, error) { + return c.internalClient.DeleteRoute(ctx, req, opts...) +} + +// DeleteRouteOperation returns a new DeleteRouteOperation from a given name. +// The name must be that of a previously created DeleteRouteOperation, possibly from a different process. +func (c *Client) DeleteRouteOperation(name string) *DeleteRouteOperation { + return c.internalClient.DeleteRouteOperation(name) +} + +// gRPCClient is a client for interacting with DataStream API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type gRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing Client + CallOptions **CallOptions + + // The gRPC API client. + client datastreampb.DatastreamClient + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient **lroauto.OperationsClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new datastream client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Datastream service +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + clientOpts := defaultGRPCClientOptions() + if newClientHook != nil { + hookOpts, err := newClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := Client{CallOptions: defaultCallOptions()} + + c := &gRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + client: datastreampb.NewDatastreamClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + c.LROClient = &client.LROClient + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *gRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *gRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *gRPCClient) ListConnectionProfiles(ctx context.Context, req *datastreampb.ListConnectionProfilesRequest, opts ...gax.CallOption) *ConnectionProfileIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListConnectionProfiles[0:len((*c.CallOptions).ListConnectionProfiles):len((*c.CallOptions).ListConnectionProfiles)], opts...) + it := &ConnectionProfileIterator{} + req = proto.Clone(req).(*datastreampb.ListConnectionProfilesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datastreampb.ConnectionProfile, string, error) { + var resp *datastreampb.ListConnectionProfilesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListConnectionProfiles(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetConnectionProfiles(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) GetConnectionProfile(ctx context.Context, req *datastreampb.GetConnectionProfileRequest, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetConnectionProfile[0:len((*c.CallOptions).GetConnectionProfile):len((*c.CallOptions).GetConnectionProfile)], opts...) + var resp *datastreampb.ConnectionProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetConnectionProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) CreateConnectionProfile(ctx context.Context, req *datastreampb.CreateConnectionProfileRequest, opts ...gax.CallOption) (*CreateConnectionProfileOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateConnectionProfile[0:len((*c.CallOptions).CreateConnectionProfile):len((*c.CallOptions).CreateConnectionProfile)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateConnectionProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) UpdateConnectionProfile(ctx context.Context, req *datastreampb.UpdateConnectionProfileRequest, opts ...gax.CallOption) (*UpdateConnectionProfileOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "connection_profile.name", url.QueryEscape(req.GetConnectionProfile().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateConnectionProfile[0:len((*c.CallOptions).UpdateConnectionProfile):len((*c.CallOptions).UpdateConnectionProfile)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateConnectionProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) DeleteConnectionProfile(ctx context.Context, req *datastreampb.DeleteConnectionProfileRequest, opts ...gax.CallOption) (*DeleteConnectionProfileOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteConnectionProfile[0:len((*c.CallOptions).DeleteConnectionProfile):len((*c.CallOptions).DeleteConnectionProfile)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeleteConnectionProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) DiscoverConnectionProfile(ctx context.Context, req *datastreampb.DiscoverConnectionProfileRequest, opts ...gax.CallOption) (*datastreampb.DiscoverConnectionProfileResponse, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DiscoverConnectionProfile[0:len((*c.CallOptions).DiscoverConnectionProfile):len((*c.CallOptions).DiscoverConnectionProfile)], opts...) + var resp *datastreampb.DiscoverConnectionProfileResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DiscoverConnectionProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) ListStreams(ctx context.Context, req *datastreampb.ListStreamsRequest, opts ...gax.CallOption) *StreamIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListStreams[0:len((*c.CallOptions).ListStreams):len((*c.CallOptions).ListStreams)], opts...) + it := &StreamIterator{} + req = proto.Clone(req).(*datastreampb.ListStreamsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datastreampb.Stream, string, error) { + var resp *datastreampb.ListStreamsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListStreams(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetStreams(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) GetStream(ctx context.Context, req *datastreampb.GetStreamRequest, opts ...gax.CallOption) (*datastreampb.Stream, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetStream[0:len((*c.CallOptions).GetStream):len((*c.CallOptions).GetStream)], opts...) + var resp *datastreampb.Stream + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) CreateStream(ctx context.Context, req *datastreampb.CreateStreamRequest, opts ...gax.CallOption) (*CreateStreamOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateStream[0:len((*c.CallOptions).CreateStream):len((*c.CallOptions).CreateStream)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) UpdateStream(ctx context.Context, req *datastreampb.UpdateStreamRequest, opts ...gax.CallOption) (*UpdateStreamOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "stream.name", url.QueryEscape(req.GetStream().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateStream[0:len((*c.CallOptions).UpdateStream):len((*c.CallOptions).UpdateStream)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) DeleteStream(ctx context.Context, req *datastreampb.DeleteStreamRequest, opts ...gax.CallOption) (*DeleteStreamOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteStream[0:len((*c.CallOptions).DeleteStream):len((*c.CallOptions).DeleteStream)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeleteStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) FetchErrors(ctx context.Context, req *datastreampb.FetchErrorsRequest, opts ...gax.CallOption) (*FetchErrorsOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "stream", url.QueryEscape(req.GetStream()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).FetchErrors[0:len((*c.CallOptions).FetchErrors):len((*c.CallOptions).FetchErrors)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.FetchErrors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &FetchErrorsOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) FetchStaticIps(ctx context.Context, req *datastreampb.FetchStaticIpsRequest, opts ...gax.CallOption) *StringIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).FetchStaticIps[0:len((*c.CallOptions).FetchStaticIps):len((*c.CallOptions).FetchStaticIps)], opts...) + it := &StringIterator{} + req = proto.Clone(req).(*datastreampb.FetchStaticIpsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) { + var resp *datastreampb.FetchStaticIpsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.FetchStaticIps(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetStaticIps(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) CreatePrivateConnection(ctx context.Context, req *datastreampb.CreatePrivateConnectionRequest, opts ...gax.CallOption) (*CreatePrivateConnectionOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreatePrivateConnection[0:len((*c.CallOptions).CreatePrivateConnection):len((*c.CallOptions).CreatePrivateConnection)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreatePrivateConnection(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreatePrivateConnectionOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) GetPrivateConnection(ctx context.Context, req *datastreampb.GetPrivateConnectionRequest, opts ...gax.CallOption) (*datastreampb.PrivateConnection, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetPrivateConnection[0:len((*c.CallOptions).GetPrivateConnection):len((*c.CallOptions).GetPrivateConnection)], opts...) + var resp *datastreampb.PrivateConnection + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetPrivateConnection(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) ListPrivateConnections(ctx context.Context, req *datastreampb.ListPrivateConnectionsRequest, opts ...gax.CallOption) *PrivateConnectionIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListPrivateConnections[0:len((*c.CallOptions).ListPrivateConnections):len((*c.CallOptions).ListPrivateConnections)], opts...) + it := &PrivateConnectionIterator{} + req = proto.Clone(req).(*datastreampb.ListPrivateConnectionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datastreampb.PrivateConnection, string, error) { + var resp *datastreampb.ListPrivateConnectionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListPrivateConnections(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetPrivateConnections(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) DeletePrivateConnection(ctx context.Context, req *datastreampb.DeletePrivateConnectionRequest, opts ...gax.CallOption) (*DeletePrivateConnectionOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeletePrivateConnection[0:len((*c.CallOptions).DeletePrivateConnection):len((*c.CallOptions).DeletePrivateConnection)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeletePrivateConnection(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeletePrivateConnectionOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) CreateRoute(ctx context.Context, req *datastreampb.CreateRouteRequest, opts ...gax.CallOption) (*CreateRouteOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateRoute[0:len((*c.CallOptions).CreateRoute):len((*c.CallOptions).CreateRoute)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateRoute(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateRouteOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) GetRoute(ctx context.Context, req *datastreampb.GetRouteRequest, opts ...gax.CallOption) (*datastreampb.Route, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetRoute[0:len((*c.CallOptions).GetRoute):len((*c.CallOptions).GetRoute)], opts...) + var resp *datastreampb.Route + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetRoute(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) ListRoutes(ctx context.Context, req *datastreampb.ListRoutesRequest, opts ...gax.CallOption) *RouteIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListRoutes[0:len((*c.CallOptions).ListRoutes):len((*c.CallOptions).ListRoutes)], opts...) + it := &RouteIterator{} + req = proto.Clone(req).(*datastreampb.ListRoutesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datastreampb.Route, string, error) { + var resp *datastreampb.ListRoutesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListRoutes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetRoutes(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) DeleteRoute(ctx context.Context, req *datastreampb.DeleteRouteRequest, opts ...gax.CallOption) (*DeleteRouteOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteRoute[0:len((*c.CallOptions).DeleteRoute):len((*c.CallOptions).DeleteRoute)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeleteRoute(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteRouteOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +// CreateConnectionProfileOperation manages a long-running operation from CreateConnectionProfile. +type CreateConnectionProfileOperation struct { + lro *longrunning.Operation +} + +// CreateConnectionProfileOperation returns a new CreateConnectionProfileOperation from a given name. +// The name must be that of a previously created CreateConnectionProfileOperation, possibly from a different process. +func (c *gRPCClient) CreateConnectionProfileOperation(name string) *CreateConnectionProfileOperation { + return &CreateConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateConnectionProfileOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + var resp datastreampb.ConnectionProfile + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateConnectionProfileOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + var resp datastreampb.ConnectionProfile + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateConnectionProfileOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateConnectionProfileOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateConnectionProfileOperation) Name() string { + return op.lro.Name() +} + +// CreatePrivateConnectionOperation manages a long-running operation from CreatePrivateConnection. +type CreatePrivateConnectionOperation struct { + lro *longrunning.Operation +} + +// CreatePrivateConnectionOperation returns a new CreatePrivateConnectionOperation from a given name. +// The name must be that of a previously created CreatePrivateConnectionOperation, possibly from a different process. +func (c *gRPCClient) CreatePrivateConnectionOperation(name string) *CreatePrivateConnectionOperation { + return &CreatePrivateConnectionOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreatePrivateConnectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.PrivateConnection, error) { + var resp datastreampb.PrivateConnection + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreatePrivateConnectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.PrivateConnection, error) { + var resp datastreampb.PrivateConnection + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreatePrivateConnectionOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreatePrivateConnectionOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreatePrivateConnectionOperation) Name() string { + return op.lro.Name() +} + +// CreateRouteOperation manages a long-running operation from CreateRoute. +type CreateRouteOperation struct { + lro *longrunning.Operation +} + +// CreateRouteOperation returns a new CreateRouteOperation from a given name. +// The name must be that of a previously created CreateRouteOperation, possibly from a different process. +func (c *gRPCClient) CreateRouteOperation(name string) *CreateRouteOperation { + return &CreateRouteOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateRouteOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Route, error) { + var resp datastreampb.Route + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateRouteOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Route, error) { + var resp datastreampb.Route + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateRouteOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateRouteOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateRouteOperation) Name() string { + return op.lro.Name() +} + +// CreateStreamOperation manages a long-running operation from CreateStream. +type CreateStreamOperation struct { + lro *longrunning.Operation +} + +// CreateStreamOperation returns a new CreateStreamOperation from a given name. +// The name must be that of a previously created CreateStreamOperation, possibly from a different process. +func (c *gRPCClient) CreateStreamOperation(name string) *CreateStreamOperation { + return &CreateStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateStreamOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Stream, error) { + var resp datastreampb.Stream + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateStreamOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Stream, error) { + var resp datastreampb.Stream + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateStreamOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateStreamOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateStreamOperation) Name() string { + return op.lro.Name() +} + +// DeleteConnectionProfileOperation manages a long-running operation from DeleteConnectionProfile. +type DeleteConnectionProfileOperation struct { + lro *longrunning.Operation +} + +// DeleteConnectionProfileOperation returns a new DeleteConnectionProfileOperation from a given name. +// The name must be that of a previously created DeleteConnectionProfileOperation, possibly from a different process. +func (c *gRPCClient) DeleteConnectionProfileOperation(name string) *DeleteConnectionProfileOperation { + return &DeleteConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteConnectionProfileOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteConnectionProfileOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteConnectionProfileOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteConnectionProfileOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteConnectionProfileOperation) Name() string { + return op.lro.Name() +} + +// DeletePrivateConnectionOperation manages a long-running operation from DeletePrivateConnection. +type DeletePrivateConnectionOperation struct { + lro *longrunning.Operation +} + +// DeletePrivateConnectionOperation returns a new DeletePrivateConnectionOperation from a given name. +// The name must be that of a previously created DeletePrivateConnectionOperation, possibly from a different process. +func (c *gRPCClient) DeletePrivateConnectionOperation(name string) *DeletePrivateConnectionOperation { + return &DeletePrivateConnectionOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeletePrivateConnectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeletePrivateConnectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeletePrivateConnectionOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeletePrivateConnectionOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeletePrivateConnectionOperation) Name() string { + return op.lro.Name() +} + +// DeleteRouteOperation manages a long-running operation from DeleteRoute. +type DeleteRouteOperation struct { + lro *longrunning.Operation +} + +// DeleteRouteOperation returns a new DeleteRouteOperation from a given name. +// The name must be that of a previously created DeleteRouteOperation, possibly from a different process. +func (c *gRPCClient) DeleteRouteOperation(name string) *DeleteRouteOperation { + return &DeleteRouteOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteRouteOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteRouteOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteRouteOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteRouteOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteRouteOperation) Name() string { + return op.lro.Name() +} + +// DeleteStreamOperation manages a long-running operation from DeleteStream. +type DeleteStreamOperation struct { + lro *longrunning.Operation +} + +// DeleteStreamOperation returns a new DeleteStreamOperation from a given name. +// The name must be that of a previously created DeleteStreamOperation, possibly from a different process. +func (c *gRPCClient) DeleteStreamOperation(name string) *DeleteStreamOperation { + return &DeleteStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteStreamOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteStreamOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteStreamOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteStreamOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteStreamOperation) Name() string { + return op.lro.Name() +} + +// FetchErrorsOperation manages a long-running operation from FetchErrors. +type FetchErrorsOperation struct { + lro *longrunning.Operation +} + +// FetchErrorsOperation returns a new FetchErrorsOperation from a given name. +// The name must be that of a previously created FetchErrorsOperation, possibly from a different process. +func (c *gRPCClient) FetchErrorsOperation(name string) *FetchErrorsOperation { + return &FetchErrorsOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *FetchErrorsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.FetchErrorsResponse, error) { + var resp datastreampb.FetchErrorsResponse + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *FetchErrorsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.FetchErrorsResponse, error) { + var resp datastreampb.FetchErrorsResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *FetchErrorsOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *FetchErrorsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *FetchErrorsOperation) Name() string { + return op.lro.Name() +} + +// UpdateConnectionProfileOperation manages a long-running operation from UpdateConnectionProfile. +type UpdateConnectionProfileOperation struct { + lro *longrunning.Operation +} + +// UpdateConnectionProfileOperation returns a new UpdateConnectionProfileOperation from a given name. +// The name must be that of a previously created UpdateConnectionProfileOperation, possibly from a different process. +func (c *gRPCClient) UpdateConnectionProfileOperation(name string) *UpdateConnectionProfileOperation { + return &UpdateConnectionProfileOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateConnectionProfileOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + var resp datastreampb.ConnectionProfile + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateConnectionProfileOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.ConnectionProfile, error) { + var resp datastreampb.ConnectionProfile + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateConnectionProfileOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateConnectionProfileOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateConnectionProfileOperation) Name() string { + return op.lro.Name() +} + +// UpdateStreamOperation manages a long-running operation from UpdateStream. +type UpdateStreamOperation struct { + lro *longrunning.Operation +} + +// UpdateStreamOperation returns a new UpdateStreamOperation from a given name. +// The name must be that of a previously created UpdateStreamOperation, possibly from a different process. +func (c *gRPCClient) UpdateStreamOperation(name string) *UpdateStreamOperation { + return &UpdateStreamOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateStreamOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Stream, error) { + var resp datastreampb.Stream + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateStreamOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datastreampb.Stream, error) { + var resp datastreampb.Stream + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateStreamOperation) Metadata() (*datastreampb.OperationMetadata, error) { + var meta datastreampb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateStreamOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateStreamOperation) Name() string { + return op.lro.Name() +} + +// ConnectionProfileIterator manages a stream of *datastreampb.ConnectionProfile. +type ConnectionProfileIterator struct { + items []*datastreampb.ConnectionProfile + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datastreampb.ConnectionProfile, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ConnectionProfileIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ConnectionProfileIterator) Next() (*datastreampb.ConnectionProfile, error) { + var item *datastreampb.ConnectionProfile + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ConnectionProfileIterator) bufLen() int { + return len(it.items) +} + +func (it *ConnectionProfileIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// PrivateConnectionIterator manages a stream of *datastreampb.PrivateConnection. +type PrivateConnectionIterator struct { + items []*datastreampb.PrivateConnection + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datastreampb.PrivateConnection, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *PrivateConnectionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *PrivateConnectionIterator) Next() (*datastreampb.PrivateConnection, error) { + var item *datastreampb.PrivateConnection + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *PrivateConnectionIterator) bufLen() int { + return len(it.items) +} + +func (it *PrivateConnectionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// RouteIterator manages a stream of *datastreampb.Route. +type RouteIterator struct { + items []*datastreampb.Route + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datastreampb.Route, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *RouteIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *RouteIterator) Next() (*datastreampb.Route, error) { + var item *datastreampb.Route + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *RouteIterator) bufLen() int { + return len(it.items) +} + +func (it *RouteIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// StreamIterator manages a stream of *datastreampb.Stream. +type StreamIterator struct { + items []*datastreampb.Stream + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datastreampb.Stream, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StreamIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StreamIterator) Next() (*datastreampb.Stream, error) { + var item *datastreampb.Stream + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StreamIterator) bufLen() int { + return len(it.items) +} + +func (it *StreamIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// StringIterator manages a stream of string. +type StringIterator struct { + items []string + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StringIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StringIterator) Next() (string, error) { + var item string + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StringIterator) bufLen() int { + return len(it.items) +} + +func (it *StringIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/datastream/apiv1alpha1/datastream_client_example_test.go b/datastream/apiv1alpha1/datastream_client_example_test.go new file mode 100644 index 000000000000..c2fdcb2e2ad1 --- /dev/null +++ b/datastream/apiv1alpha1/datastream_client_example_test.go @@ -0,0 +1,513 @@ +// Copyright 2021 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 datastream_test + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleClient_ListConnectionProfiles() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListConnectionProfilesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConnectionProfiles(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetConnectionProfile() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateConnectionProfile() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateConnectionProfile(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_UpdateConnectionProfile() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.UpdateConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateConnectionProfile(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_DeleteConnectionProfile() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DiscoverConnectionProfile() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DiscoverConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DiscoverConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListStreams() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListStreamsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListStreams(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetStream() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetStreamRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateStream() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateStream(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_UpdateStream() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.UpdateStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateStream(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_DeleteStream() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_FetchErrors() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.FetchErrorsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.FetchErrors(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_FetchStaticIps() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.FetchStaticIpsRequest{ + // TODO: Fill request struct fields. + } + it := c.FetchStaticIps(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreatePrivateConnection() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreatePrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreatePrivateConnection(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_GetPrivateConnection() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetPrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetPrivateConnection(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListPrivateConnections() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListPrivateConnectionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListPrivateConnections(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeletePrivateConnection() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeletePrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeletePrivateConnection(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateRoute() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateRouteRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateRoute(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_GetRoute() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetRouteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRoute(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListRoutes() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListRoutesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListRoutes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeleteRoute() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteRouteRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteRoute(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} diff --git a/datastream/apiv1alpha1/doc.go b/datastream/apiv1alpha1/doc.go new file mode 100644 index 000000000000..d435cf0162bf --- /dev/null +++ b/datastream/apiv1alpha1/doc.go @@ -0,0 +1,116 @@ +// Copyright 2021 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 datastream is an auto-generated package for the +// DataStream API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package datastream // import "cloud.google.com/go/datastream/apiv1alpha1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "UNKNOWN" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/datastream/apiv1alpha1/gapic_metadata.json b/datastream/apiv1alpha1/gapic_metadata.json new file mode 100644 index 000000000000..86d55bde2210 --- /dev/null +++ b/datastream/apiv1alpha1/gapic_metadata.json @@ -0,0 +1,123 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.datastream.v1alpha1", + "libraryPackage": "cloud.google.com/go/datastream/apiv1alpha1", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ + "CreateConnectionProfile" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "CreatePrivateConnection" + ] + }, + "CreateRoute": { + "methods": [ + "CreateRoute" + ] + }, + "CreateStream": { + "methods": [ + "CreateStream" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "DeleteConnectionProfile" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "DeletePrivateConnection" + ] + }, + "DeleteRoute": { + "methods": [ + "DeleteRoute" + ] + }, + "DeleteStream": { + "methods": [ + "DeleteStream" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "DiscoverConnectionProfile" + ] + }, + "FetchErrors": { + "methods": [ + "FetchErrors" + ] + }, + "FetchStaticIps": { + "methods": [ + "FetchStaticIps" + ] + }, + "GetConnectionProfile": { + "methods": [ + "GetConnectionProfile" + ] + }, + "GetPrivateConnection": { + "methods": [ + "GetPrivateConnection" + ] + }, + "GetRoute": { + "methods": [ + "GetRoute" + ] + }, + "GetStream": { + "methods": [ + "GetStream" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "ListConnectionProfiles" + ] + }, + "ListPrivateConnections": { + "methods": [ + "ListPrivateConnections" + ] + }, + "ListRoutes": { + "methods": [ + "ListRoutes" + ] + }, + "ListStreams": { + "methods": [ + "ListStreams" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "UpdateConnectionProfile" + ] + }, + "UpdateStream": { + "methods": [ + "UpdateStream" + ] + } + } + } + } + } + } +} diff --git a/eventarc/apiv1/doc.go b/eventarc/apiv1/doc.go new file mode 100644 index 000000000000..917c37ef02e8 --- /dev/null +++ b/eventarc/apiv1/doc.go @@ -0,0 +1,116 @@ +// Copyright 2021 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 eventarc is an auto-generated package for the +// Eventarc API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package eventarc // import "cloud.google.com/go/eventarc/apiv1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "UNKNOWN" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/eventarc/apiv1/eventarc_client.go b/eventarc/apiv1/eventarc_client.go new file mode 100644 index 000000000000..e5b3824500d9 --- /dev/null +++ b/eventarc/apiv1/eventarc_client.go @@ -0,0 +1,631 @@ +// Copyright 2021 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 eventarc + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newClientHook clientHook + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + GetTrigger []gax.CallOption + ListTriggers []gax.CallOption + CreateTrigger []gax.CallOption + UpdateTrigger []gax.CallOption + DeleteTrigger []gax.CallOption +} + +func defaultGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("eventarc.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("eventarc.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://eventarc.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCallOptions() *CallOptions { + return &CallOptions{ + GetTrigger: []gax.CallOption{}, + ListTriggers: []gax.CallOption{}, + CreateTrigger: []gax.CallOption{}, + UpdateTrigger: []gax.CallOption{}, + DeleteTrigger: []gax.CallOption{}, + } +} + +// internalClient is an interface that defines the methods availaible from Eventarc API. +type internalClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + GetTrigger(context.Context, *eventarcpb.GetTriggerRequest, ...gax.CallOption) (*eventarcpb.Trigger, error) + ListTriggers(context.Context, *eventarcpb.ListTriggersRequest, ...gax.CallOption) *TriggerIterator + CreateTrigger(context.Context, *eventarcpb.CreateTriggerRequest, ...gax.CallOption) (*CreateTriggerOperation, error) + CreateTriggerOperation(name string) *CreateTriggerOperation + UpdateTrigger(context.Context, *eventarcpb.UpdateTriggerRequest, ...gax.CallOption) (*UpdateTriggerOperation, error) + UpdateTriggerOperation(name string) *UpdateTriggerOperation + DeleteTrigger(context.Context, *eventarcpb.DeleteTriggerRequest, ...gax.CallOption) (*DeleteTriggerOperation, error) + DeleteTriggerOperation(name string) *DeleteTriggerOperation +} + +// Client is a client for interacting with Eventarc API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Eventarc allows users to subscribe to various events that are provided by +// Google Cloud services and forward them to supported destinations. +type Client struct { + // The internal transport-dependent client. + internalClient internalClient + + // The call options for this service. + CallOptions *CallOptions + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// GetTrigger get a single trigger. +func (c *Client) GetTrigger(ctx context.Context, req *eventarcpb.GetTriggerRequest, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + return c.internalClient.GetTrigger(ctx, req, opts...) +} + +// ListTriggers list triggers. +func (c *Client) ListTriggers(ctx context.Context, req *eventarcpb.ListTriggersRequest, opts ...gax.CallOption) *TriggerIterator { + return c.internalClient.ListTriggers(ctx, req, opts...) +} + +// CreateTrigger create a new trigger in a particular project and location. +func (c *Client) CreateTrigger(ctx context.Context, req *eventarcpb.CreateTriggerRequest, opts ...gax.CallOption) (*CreateTriggerOperation, error) { + return c.internalClient.CreateTrigger(ctx, req, opts...) +} + +// CreateTriggerOperation returns a new CreateTriggerOperation from a given name. +// The name must be that of a previously created CreateTriggerOperation, possibly from a different process. +func (c *Client) CreateTriggerOperation(name string) *CreateTriggerOperation { + return c.internalClient.CreateTriggerOperation(name) +} + +// UpdateTrigger update a single trigger. +func (c *Client) UpdateTrigger(ctx context.Context, req *eventarcpb.UpdateTriggerRequest, opts ...gax.CallOption) (*UpdateTriggerOperation, error) { + return c.internalClient.UpdateTrigger(ctx, req, opts...) +} + +// UpdateTriggerOperation returns a new UpdateTriggerOperation from a given name. +// The name must be that of a previously created UpdateTriggerOperation, possibly from a different process. +func (c *Client) UpdateTriggerOperation(name string) *UpdateTriggerOperation { + return c.internalClient.UpdateTriggerOperation(name) +} + +// DeleteTrigger delete a single trigger. +func (c *Client) DeleteTrigger(ctx context.Context, req *eventarcpb.DeleteTriggerRequest, opts ...gax.CallOption) (*DeleteTriggerOperation, error) { + return c.internalClient.DeleteTrigger(ctx, req, opts...) +} + +// DeleteTriggerOperation returns a new DeleteTriggerOperation from a given name. +// The name must be that of a previously created DeleteTriggerOperation, possibly from a different process. +func (c *Client) DeleteTriggerOperation(name string) *DeleteTriggerOperation { + return c.internalClient.DeleteTriggerOperation(name) +} + +// gRPCClient is a client for interacting with Eventarc API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type gRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing Client + CallOptions **CallOptions + + // The gRPC API client. + client eventarcpb.EventarcClient + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient **lroauto.OperationsClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new eventarc client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Eventarc allows users to subscribe to various events that are provided by +// Google Cloud services and forward them to supported destinations. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + clientOpts := defaultGRPCClientOptions() + if newClientHook != nil { + hookOpts, err := newClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := Client{CallOptions: defaultCallOptions()} + + c := &gRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + client: eventarcpb.NewEventarcClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + c.LROClient = &client.LROClient + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *gRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *gRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *gRPCClient) GetTrigger(ctx context.Context, req *eventarcpb.GetTriggerRequest, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetTrigger[0:len((*c.CallOptions).GetTrigger):len((*c.CallOptions).GetTrigger)], opts...) + var resp *eventarcpb.Trigger + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) ListTriggers(ctx context.Context, req *eventarcpb.ListTriggersRequest, opts ...gax.CallOption) *TriggerIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListTriggers[0:len((*c.CallOptions).ListTriggers):len((*c.CallOptions).ListTriggers)], opts...) + it := &TriggerIterator{} + req = proto.Clone(req).(*eventarcpb.ListTriggersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*eventarcpb.Trigger, string, error) { + var resp *eventarcpb.ListTriggersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTriggers(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetTriggers(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) CreateTrigger(ctx context.Context, req *eventarcpb.CreateTriggerRequest, opts ...gax.CallOption) (*CreateTriggerOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateTrigger[0:len((*c.CallOptions).CreateTrigger):len((*c.CallOptions).CreateTrigger)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) UpdateTrigger(ctx context.Context, req *eventarcpb.UpdateTriggerRequest, opts ...gax.CallOption) (*UpdateTriggerOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "trigger.name", url.QueryEscape(req.GetTrigger().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateTrigger[0:len((*c.CallOptions).UpdateTrigger):len((*c.CallOptions).UpdateTrigger)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *gRPCClient) DeleteTrigger(ctx context.Context, req *eventarcpb.DeleteTriggerRequest, opts ...gax.CallOption) (*DeleteTriggerOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteTrigger[0:len((*c.CallOptions).DeleteTrigger):len((*c.CallOptions).DeleteTrigger)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeleteTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +// CreateTriggerOperation manages a long-running operation from CreateTrigger. +type CreateTriggerOperation struct { + lro *longrunning.Operation +} + +// CreateTriggerOperation returns a new CreateTriggerOperation from a given name. +// The name must be that of a previously created CreateTriggerOperation, possibly from a different process. +func (c *gRPCClient) CreateTriggerOperation(name string) *CreateTriggerOperation { + return &CreateTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateTriggerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateTriggerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateTriggerOperation) Metadata() (*eventarcpb.OperationMetadata, error) { + var meta eventarcpb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateTriggerOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateTriggerOperation) Name() string { + return op.lro.Name() +} + +// DeleteTriggerOperation manages a long-running operation from DeleteTrigger. +type DeleteTriggerOperation struct { + lro *longrunning.Operation +} + +// DeleteTriggerOperation returns a new DeleteTriggerOperation from a given name. +// The name must be that of a previously created DeleteTriggerOperation, possibly from a different process. +func (c *gRPCClient) DeleteTriggerOperation(name string) *DeleteTriggerOperation { + return &DeleteTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteTriggerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteTriggerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteTriggerOperation) Metadata() (*eventarcpb.OperationMetadata, error) { + var meta eventarcpb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteTriggerOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteTriggerOperation) Name() string { + return op.lro.Name() +} + +// UpdateTriggerOperation manages a long-running operation from UpdateTrigger. +type UpdateTriggerOperation struct { + lro *longrunning.Operation +} + +// UpdateTriggerOperation returns a new UpdateTriggerOperation from a given name. +// The name must be that of a previously created UpdateTriggerOperation, possibly from a different process. +func (c *gRPCClient) UpdateTriggerOperation(name string) *UpdateTriggerOperation { + return &UpdateTriggerOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateTriggerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateTriggerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*eventarcpb.Trigger, error) { + var resp eventarcpb.Trigger + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateTriggerOperation) Metadata() (*eventarcpb.OperationMetadata, error) { + var meta eventarcpb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateTriggerOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateTriggerOperation) Name() string { + return op.lro.Name() +} + +// TriggerIterator manages a stream of *eventarcpb.Trigger. +type TriggerIterator struct { + items []*eventarcpb.Trigger + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*eventarcpb.Trigger, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TriggerIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TriggerIterator) Next() (*eventarcpb.Trigger, error) { + var item *eventarcpb.Trigger + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TriggerIterator) bufLen() int { + return len(it.items) +} + +func (it *TriggerIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/eventarc/apiv1/eventarc_client_example_test.go b/eventarc/apiv1/eventarc_client_example_test.go new file mode 100644 index 000000000000..3829788aee3d --- /dev/null +++ b/eventarc/apiv1/eventarc_client_example_test.go @@ -0,0 +1,153 @@ +// Copyright 2021 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 eventarc_test + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + "google.golang.org/api/iterator" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleClient_GetTrigger() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.GetTriggerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTriggers() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.ListTriggersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTriggers(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreateTrigger() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.CreateTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateTrigger(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_UpdateTrigger() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.UpdateTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateTrigger(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_DeleteTrigger() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.DeleteTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/eventarc/apiv1/gapic_metadata.json b/eventarc/apiv1/gapic_metadata.json new file mode 100644 index 000000000000..cc93d105421b --- /dev/null +++ b/eventarc/apiv1/gapic_metadata.json @@ -0,0 +1,43 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.eventarc.v1", + "libraryPackage": "cloud.google.com/go/eventarc/apiv1", + "services": { + "Eventarc": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateTrigger": { + "methods": [ + "CreateTrigger" + ] + }, + "DeleteTrigger": { + "methods": [ + "DeleteTrigger" + ] + }, + "GetTrigger": { + "methods": [ + "GetTrigger" + ] + }, + "ListTriggers": { + "methods": [ + "ListTriggers" + ] + }, + "UpdateTrigger": { + "methods": [ + "UpdateTrigger" + ] + } + } + } + } + } + } +} diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index b7f4ea4fb3e5..935d478b2547 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -594,8 +594,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/dialogflow/cx/apiv3", gRPCServiceConfigPath: "google/cloud/dialogflow/cx/v3/dialogflow_grpc_service_config.json", apiServiceConfigPath: "google/cloud/dialogflow/cx/v3/dialogflow_v3.yaml", - // GA after 2021/04/23 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/dialogflow/v2", @@ -857,6 +856,15 @@ var microgenGapicConfigs = []*microgenConfig{ apiServiceConfigPath: "google/cloud/workflows/v1beta/workflows_v1beta.yaml", releaseLevel: "beta", }, + { + inputDirectoryPath: "google/cloud/workflows/executions/v1", + pkg: "executions", + importPath: "cloud.google.com/go/workflows/executions/apiv1", + gRPCServiceConfigPath: "google/cloud/workflows/executions/v1/executions_grpc_service_config.json", + apiServiceConfigPath: "google/cloud/workflows/executions/v1/workflowexecutions_v1.yaml", + // GA after 2021/07/30 + releaseLevel: "beta", + }, { inputDirectoryPath: "google/cloud/workflows/executions/v1beta", pkg: "executions", @@ -879,8 +887,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/security/privateca/apiv1", gRPCServiceConfigPath: "google/cloud/security/privateca/v1/privateca_grpc_service_config.json", apiServiceConfigPath: "google/cloud/security/privateca/v1/privateca_v1.yaml", - // GA after 2021/05/29 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/assuredworkloads/v1beta1", @@ -982,8 +989,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/documentai/apiv1", gRPCServiceConfigPath: "google/cloud/documentai/v1/documentai_v1_grpc_service_config.json", apiServiceConfigPath: "google/cloud/documentai/v1/documentai_v1.yaml", - // GA after 2021/04/23 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/documentai/v1beta3", @@ -1063,8 +1069,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/metastore/apiv1", gRPCServiceConfigPath: "google/cloud/metastore/v1/metastore_grpc_service_config.json", apiServiceConfigPath: "google/cloud/metastore/v1/metastore_v1.yaml", - // GA after 2021/06/10 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/metastore/v1alpha", @@ -1088,8 +1093,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/resourcesettings/apiv1", gRPCServiceConfigPath: "google/cloud/resourcesettings/v1/resourcesettings_grpc_service_config.json", apiServiceConfigPath: "google/cloud/resourcesettings/v1/resourcesettings_v1.yaml", - // GA after 2021/04/23 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/clouddms/v1", @@ -1097,8 +1101,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/clouddms/apiv1", gRPCServiceConfigPath: "google/cloud/clouddms/v1/library_grpc_service_config.json", apiServiceConfigPath: "google/cloud/clouddms/v1/datamigration_v1.yaml", - // GA after 2021/06/10 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/essentialcontacts/v1", @@ -1106,8 +1109,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/essentialcontacts/apiv1", gRPCServiceConfigPath: "google/cloud/essentialcontacts/v1/essentialcontacts_v1_grpc_service_config.json", apiServiceConfigPath: "google/cloud/essentialcontacts/v1/essentialcontacts_v1.yaml", - // GA after 2021/06/18 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/api/serviceusage/v1", @@ -1115,8 +1117,7 @@ var microgenGapicConfigs = []*microgenConfig{ importPath: "cloud.google.com/go/serviceusage/apiv1", gRPCServiceConfigPath: "google/api/serviceusage/v1/serviceusage_grpc_service_config.json", apiServiceConfigPath: "google/api/serviceusage/v1/serviceusage_v1.yaml", - // GA after 2021/06/18 - releaseLevel: "beta", + releaseLevel: "ga", }, { inputDirectoryPath: "google/cloud/shell/v1", @@ -1187,6 +1188,31 @@ var microgenGapicConfigs = []*microgenConfig{ apiServiceConfigPath: "google/cloud/gkeconnect/gateway/v1beta1/connectgateway_v1beta1.yaml", releaseLevel: "beta", }, + { + inputDirectoryPath: "google/cloud/datastream/v1alpha1", + pkg: "datastream", + importPath: "cloud.google.com/go/datastream/apiv1alpha1", + gRPCServiceConfigPath: "google/cloud/datastream/v1alpha1/datastream_grpc_service_config.json", + apiServiceConfigPath: "google/cloud/datastream/v1alpha1/datastream_v1alpha1.yaml", + releaseLevel: "alpha", + }, + { + inputDirectoryPath: "google/dataflow/v1beta3", + pkg: "dataflow", + importPath: "cloud.google.com/go/dataflow/apiv1beta3", + gRPCServiceConfigPath: "google/dataflow/v1beta3/dataflow_grpc_service_config.json", + apiServiceConfigPath: "google/dataflow/v1beta3/dataflow_v1beta3.yaml", + releaseLevel: "beta", + }, + { + inputDirectoryPath: "google/cloud/eventarc/v1", + pkg: "eventarc", + importPath: "cloud.google.com/go/eventarc/apiv1", + gRPCServiceConfigPath: "google/cloud/eventarc/v1/eventarc_grpc_service_config.json", + apiServiceConfigPath: "google/cloud/eventarc/v1/eventarc_v1.yaml", + // GA after 2021/07/30 + releaseLevel: "beta", + }, // Non-Cloud APIs { diff --git a/workflows/executions/apiv1/doc.go b/workflows/executions/apiv1/doc.go new file mode 100644 index 000000000000..ace2c66faf23 --- /dev/null +++ b/workflows/executions/apiv1/doc.go @@ -0,0 +1,118 @@ +// Copyright 2021 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 executions is an auto-generated package for the +// Workflow Executions API. +// +// Execute workflows created with Workflows API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package executions // import "cloud.google.com/go/workflows/executions/apiv1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "UNKNOWN" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/workflows/executions/apiv1/executions_client.go b/workflows/executions/apiv1/executions_client.go new file mode 100644 index 000000000000..d83ac03b02cb --- /dev/null +++ b/workflows/executions/apiv1/executions_client.go @@ -0,0 +1,351 @@ +// Copyright 2021 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 executions + +import ( + "context" + "fmt" + "math" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newClientHook clientHook + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ListExecutions []gax.CallOption + CreateExecution []gax.CallOption + GetExecution []gax.CallOption + CancelExecution []gax.CallOption +} + +func defaultGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("workflowexecutions.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("workflowexecutions.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://workflowexecutions.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCallOptions() *CallOptions { + return &CallOptions{ + ListExecutions: []gax.CallOption{}, + CreateExecution: []gax.CallOption{}, + GetExecution: []gax.CallOption{}, + CancelExecution: []gax.CallOption{}, + } +} + +// internalClient is an interface that defines the methods availaible from Workflow Executions API. +type internalClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + ListExecutions(context.Context, *executionspb.ListExecutionsRequest, ...gax.CallOption) *ExecutionIterator + CreateExecution(context.Context, *executionspb.CreateExecutionRequest, ...gax.CallOption) (*executionspb.Execution, error) + GetExecution(context.Context, *executionspb.GetExecutionRequest, ...gax.CallOption) (*executionspb.Execution, error) + CancelExecution(context.Context, *executionspb.CancelExecutionRequest, ...gax.CallOption) (*executionspb.Execution, error) +} + +// Client is a client for interacting with Workflow Executions API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Executions is used to start and manage running instances of +// Workflows called executions. +type Client struct { + // The internal transport-dependent client. + internalClient internalClient + + // The call options for this service. + CallOptions *CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// ListExecutions returns a list of executions which belong to the workflow with +// the given name. The method returns executions of all workflow +// revisions. Returned executions are ordered by their start time (newest +// first). +func (c *Client) ListExecutions(ctx context.Context, req *executionspb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator { + return c.internalClient.ListExecutions(ctx, req, opts...) +} + +// CreateExecution creates a new execution using the latest revision of the given workflow. +func (c *Client) CreateExecution(ctx context.Context, req *executionspb.CreateExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + return c.internalClient.CreateExecution(ctx, req, opts...) +} + +// GetExecution returns an execution of the given name. +func (c *Client) GetExecution(ctx context.Context, req *executionspb.GetExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + return c.internalClient.GetExecution(ctx, req, opts...) +} + +// CancelExecution cancels an execution of the given name. +func (c *Client) CancelExecution(ctx context.Context, req *executionspb.CancelExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + return c.internalClient.CancelExecution(ctx, req, opts...) +} + +// gRPCClient is a client for interacting with Workflow Executions API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type gRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing Client + CallOptions **CallOptions + + // The gRPC API client. + client executionspb.ExecutionsClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new executions client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Executions is used to start and manage running instances of +// Workflows called executions. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + clientOpts := defaultGRPCClientOptions() + if newClientHook != nil { + hookOpts, err := newClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := Client{CallOptions: defaultCallOptions()} + + c := &gRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + client: executionspb.NewExecutionsClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *gRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *gRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *gRPCClient) ListExecutions(ctx context.Context, req *executionspb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListExecutions[0:len((*c.CallOptions).ListExecutions):len((*c.CallOptions).ListExecutions)], opts...) + it := &ExecutionIterator{} + req = proto.Clone(req).(*executionspb.ListExecutionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*executionspb.Execution, string, error) { + var resp *executionspb.ListExecutionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListExecutions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetExecutions(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +func (c *gRPCClient) CreateExecution(ctx context.Context, req *executionspb.CreateExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateExecution[0:len((*c.CallOptions).CreateExecution):len((*c.CallOptions).CreateExecution)], opts...) + var resp *executionspb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) GetExecution(ctx context.Context, req *executionspb.GetExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetExecution[0:len((*c.CallOptions).GetExecution):len((*c.CallOptions).GetExecution)], opts...) + var resp *executionspb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *gRPCClient) CancelExecution(ctx context.Context, req *executionspb.CancelExecutionRequest, opts ...gax.CallOption) (*executionspb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CancelExecution[0:len((*c.CallOptions).CancelExecution):len((*c.CallOptions).CancelExecution)], opts...) + var resp *executionspb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CancelExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ExecutionIterator manages a stream of *executionspb.Execution. +type ExecutionIterator struct { + items []*executionspb.Execution + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*executionspb.Execution, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ExecutionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ExecutionIterator) Next() (*executionspb.Execution, error) { + var item *executionspb.Execution + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ExecutionIterator) bufLen() int { + return len(it.items) +} + +func (it *ExecutionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/workflows/executions/apiv1/executions_client_example_test.go b/workflows/executions/apiv1/executions_client_example_test.go new file mode 100644 index 000000000000..9e1166407f3e --- /dev/null +++ b/workflows/executions/apiv1/executions_client_example_test.go @@ -0,0 +1,119 @@ +// Copyright 2021 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 executions_test + +import ( + "context" + + executions "cloud.google.com/go/workflows/executions/apiv1" + "google.golang.org/api/iterator" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleClient_ListExecutions() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.ListExecutionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListExecutions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreateExecution() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.CreateExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetExecution() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.GetExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CancelExecution() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.CancelExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CancelExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/workflows/executions/apiv1/gapic_metadata.json b/workflows/executions/apiv1/gapic_metadata.json new file mode 100644 index 000000000000..bd49590ca4b4 --- /dev/null +++ b/workflows/executions/apiv1/gapic_metadata.json @@ -0,0 +1,38 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.workflows.executions.v1", + "libraryPackage": "cloud.google.com/go/workflows/executions/apiv1", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelExecution": { + "methods": [ + "CancelExecution" + ] + }, + "CreateExecution": { + "methods": [ + "CreateExecution" + ] + }, + "GetExecution": { + "methods": [ + "GetExecution" + ] + }, + "ListExecutions": { + "methods": [ + "ListExecutions" + ] + } + } + } + } + } + } +} From aeea1ce1e5dff3acdfe208932327b52c49851b41 Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Wed, 30 Jun 2021 11:19:13 -0700 Subject: [PATCH 05/18] fix(internal): fix googleapis-disco regen (#4354) --- internal/gapicgen/generator/gapics.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/gapicgen/generator/gapics.go b/internal/gapicgen/generator/gapics.go index 48a16e67acc4..e57315a91dfe 100644 --- a/internal/gapicgen/generator/gapics.go +++ b/internal/gapicgen/generator/gapics.go @@ -491,7 +491,11 @@ func (g *GapicGenerator) manifest(confs []*microgenConfig) error { entries[manual.DistributionName] = manual } for _, conf := range confs { - yamlPath := filepath.Join(g.googleapisDir, conf.apiServiceConfigPath) + dir := g.googleapisDir + if conf.googleapisDiscovery { + dir = g.googleapisDiscoDir + } + yamlPath := filepath.Join(dir, conf.apiServiceConfigPath) yamlFile, err := os.Open(yamlPath) if err != nil { return err @@ -535,7 +539,11 @@ func (g *GapicGenerator) copyMicrogenFiles() error { func (g *GapicGenerator) parseAPIShortnames(confs []*microgenConfig, manualEntries []manifestEntry) (map[string]string, error) { shortnames := map[string]string{} for _, conf := range confs { - yamlPath := filepath.Join(g.googleapisDir, conf.apiServiceConfigPath) + dir := g.googleapisDir + if conf.googleapisDiscovery { + dir = g.googleapisDiscoDir + } + yamlPath := filepath.Join(dir, conf.apiServiceConfigPath) yamlFile, err := os.Open(yamlPath) if err != nil { return nil, err From c03b54473e23d44bdadf3bd21cf69bd5f56ab23f Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Wed, 30 Jun 2021 11:21:17 -0700 Subject: [PATCH 06/18] chore: release 0.85.0 (#4278) --- CHANGES.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ff6d1ec3e65b..e2db8879fb4f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,30 @@ # Changes +## [0.85.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.84.0...v0.85.0) (2021-06-30) + + +### Features + +* **dataflow:** start generating apiv1beta3 ([cfee361](https://www.github.com/googleapis/google-cloud-go/commit/cfee36161d41e3a0f769e51ab96c25d0967af273)) +* **datastream:** start generating apiv1alpha1 ([cfee361](https://www.github.com/googleapis/google-cloud-go/commit/cfee36161d41e3a0f769e51ab96c25d0967af273)) +* **dialogflow:** added Automated agent reply type and allow cancellation flag for partial response feature. ([5a9c6ce](https://www.github.com/googleapis/google-cloud-go/commit/5a9c6ce781fb6a338e29d3dee72367998d834af0)) +* **documentai:** update document.proto, add the processor management methods. ([5a9c6ce](https://www.github.com/googleapis/google-cloud-go/commit/5a9c6ce781fb6a338e29d3dee72367998d834af0)) +* **eventarc:** start generating apiv1 ([cfee361](https://www.github.com/googleapis/google-cloud-go/commit/cfee36161d41e3a0f769e51ab96c25d0967af273)) +* **gkehub:** added v1alpha messages and client for gkehub ([8fb4649](https://www.github.com/googleapis/google-cloud-go/commit/8fb464956f0ca51d30e8e14dc625ff9fa150c437)) +* **internal/godocfx:** add support for other modules ([#4290](https://www.github.com/googleapis/google-cloud-go/issues/4290)) ([d52bae6](https://www.github.com/googleapis/google-cloud-go/commit/d52bae6cd77474174192c46236d309bf967dfa00)) +* **internal/godocfx:** different metadata for different modules ([#4297](https://www.github.com/googleapis/google-cloud-go/issues/4297)) ([598f5b9](https://www.github.com/googleapis/google-cloud-go/commit/598f5b93778b2e2e75265ae54484dd54477433f5)) +* **internal:** add force option for regen ([#4310](https://www.github.com/googleapis/google-cloud-go/issues/4310)) ([de654eb](https://www.github.com/googleapis/google-cloud-go/commit/de654ebfcf23a53b4d1fee0aa48c73999a55c1a6)) +* **servicecontrol:** Added the gRPC service config for the Service Controller v1 API docs: Updated some comments. ([8fb4649](https://www.github.com/googleapis/google-cloud-go/commit/8fb464956f0ca51d30e8e14dc625ff9fa150c437)) +* **workflows/executions:** start generating apiv1 ([cfee361](https://www.github.com/googleapis/google-cloud-go/commit/cfee36161d41e3a0f769e51ab96c25d0967af273)) + + +### Bug Fixes + +* **internal:** add autogenerated header to snippets ([#4261](https://www.github.com/googleapis/google-cloud-go/issues/4261)) ([2220787](https://www.github.com/googleapis/google-cloud-go/commit/222078722c37c3fdadec7bbbe0bcf81edd105f1a)), refs [#4260](https://www.github.com/googleapis/google-cloud-go/issues/4260) +* **internal:** fix googleapis-disco regen ([#4354](https://www.github.com/googleapis/google-cloud-go/issues/4354)) ([aeea1ce](https://www.github.com/googleapis/google-cloud-go/commit/aeea1ce1e5dff3acdfe208932327b52c49851b41)) +* **kms:** replace IAMPolicy mixin in service config. ([5a9c6ce](https://www.github.com/googleapis/google-cloud-go/commit/5a9c6ce781fb6a338e29d3dee72367998d834af0)) +* **security/privateca:** Fixed casing of the Ruby namespace ([5a9c6ce](https://www.github.com/googleapis/google-cloud-go/commit/5a9c6ce781fb6a338e29d3dee72367998d834af0)) + ## [0.84.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.83.0...v0.84.0) (2021-06-09) From 1cf34b35e69127a57ab90be583c974a2467b3a97 Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Wed, 30 Jun 2021 12:55:02 -0700 Subject: [PATCH 07/18] fix(bigtable): fix #4338 by removing obsolete with block (#4353) --- bigtable/bigtable.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bigtable/bigtable.go b/bigtable/bigtable.go index 26384139fbae..a0ba9dfbf0a9 100644 --- a/bigtable/bigtable.go +++ b/bigtable/bigtable.go @@ -79,9 +79,7 @@ func NewClientWithConfig(ctx context.Context, project, instance string, config C option.WithGRPCConnectionPool(4), // Set the max size to correspond to server-side limits. option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(1<<28), grpc.MaxCallRecvMsgSize(1<<28))), - // TODO(grpc/grpc-go#1388) using connection pool without WithBlock - // can cause RPCs to fail randomly. We can delete this after the issue is fixed. - option.WithGRPCDialOption(grpc.WithBlock())) + ) // Attempts direct access to spanner service over gRPC to improve throughput, // whether the attempt is allowed is totally controlled by service owner. o = append(o, internaloption.EnableDirectPath(true)) From 8fe510f1e8d41f3a2924c11e37896172bc66aadd Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Wed, 30 Jun 2021 13:58:22 -0700 Subject: [PATCH 08/18] chore(internal): update microgen to v0.21.3 (#4358) --- internal/gapicgen/cmd/genbot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/gapicgen/cmd/genbot/Dockerfile b/internal/gapicgen/cmd/genbot/Dockerfile index 7290674a78d9..a63fd58728fd 100644 --- a/internal/gapicgen/cmd/genbot/Dockerfile +++ b/internal/gapicgen/cmd/genbot/Dockerfile @@ -28,7 +28,7 @@ RUN GO111MODULE=on go get \ golang.org/x/lint/golint@latest \ golang.org/x/tools/cmd/goimports@latest \ honnef.co/go/tools/cmd/staticcheck@latest \ - github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic@v0.21.2 + github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic@v0.21.3 ENV PATH="${PATH}:/root/go/bin" # Source: http://debuggable.com/posts/disable-strict-host-checking-for-git-clone:49896ff3-0ac0-4263-9703-1eae4834cda3 From 13acf7fb3b081c1ae14c0ecd66ee31db5476835e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 30 Jun 2021 14:44:51 -0700 Subject: [PATCH 09/18] chore(all): auto-regenerate gapics (#4355) * chore(all): auto-regenerate gapics This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/628 Changes: feat(pubsub): Adding subscription properties to streaming pull response in third party pubsub.proto. PiperOrigin-RevId: 382318016 Source-Link: https://github.com/googleapis/googleapis/commit/e9b2b616a20a11c97c7ac912536e82d33d006104 fix!(datastream): Remove DiscoverConnectionProfile method signature which didn't populate the request sufficiently fix!: Overhaul resource annotations, some of which were incorrect and some of which were just non-ideal PiperOrigin-RevId: 382316023 Source-Link: https://github.com/googleapis/googleapis/commit/125799dc997a0faea8b207b4e013f2c8371323d8 --- .../apiv1/access_approval_client.go | 1 + accessapproval/apiv1/doc.go | 2 +- aiplatform/apiv1/dataset_client.go | 1 + aiplatform/apiv1/doc.go | 2 +- aiplatform/apiv1/endpoint_client.go | 1 + aiplatform/apiv1/job_client.go | 1 + aiplatform/apiv1/migration_client.go | 1 + aiplatform/apiv1/model_client.go | 1 + aiplatform/apiv1/pipeline_client.go | 1 + aiplatform/apiv1/prediction_client.go | 1 + aiplatform/apiv1/specialist_pool_client.go | 1 + .../apiv1alpha/analytics_admin_client.go | 1 + analytics/admin/apiv1alpha/doc.go | 2 +- .../apiv1alpha/alpha_analytics_data_client.go | 1 + analytics/data/apiv1alpha/doc.go | 2 +- apigateway/apiv1/api_gateway_client.go | 1 + apigateway/apiv1/doc.go | 2 +- apigeeconnect/apiv1/connection_client.go | 1 + apigeeconnect/apiv1/doc.go | 2 +- apigeeconnect/apiv1/tether_client.go | 1 + appengine/apiv1/applications_client.go | 1 + .../apiv1/authorized_certificates_client.go | 1 + appengine/apiv1/authorized_domains_client.go | 1 + appengine/apiv1/doc.go | 2 +- appengine/apiv1/domain_mappings_client.go | 1 + appengine/apiv1/firewall_client.go | 1 + appengine/apiv1/instances_client.go | 1 + appengine/apiv1/services_client.go | 1 + appengine/apiv1/versions_client.go | 1 + area120/tables/apiv1alpha1/doc.go | 2 +- area120/tables/apiv1alpha1/tables_client.go | 1 + .../apiv1beta2/artifact_registry_client.go | 1 + artifactregistry/apiv1beta2/doc.go | 2 +- asset/apiv1/asset_client.go | 1 + asset/apiv1/doc.go | 2 +- asset/apiv1p2beta1/asset_client.go | 1 + asset/apiv1p2beta1/doc.go | 2 +- asset/apiv1p5beta1/asset_client.go | 1 + asset/apiv1p5beta1/doc.go | 2 +- .../apiv1beta1/assured_workloads_client.go | 1 + assuredworkloads/apiv1beta1/doc.go | 2 +- automl/apiv1/auto_ml_client.go | 1 + automl/apiv1/doc.go | 2 +- automl/apiv1/prediction_client.go | 1 + automl/apiv1beta1/auto_ml_client.go | 1 + automl/apiv1beta1/doc.go | 2 +- automl/apiv1beta1/prediction_client.go | 1 + .../connection/apiv1/connection_client.go | 1 + bigquery/connection/apiv1/doc.go | 2 +- .../apiv1beta1/connection_client.go | 1 + bigquery/connection/apiv1beta1/doc.go | 2 +- .../apiv1/data_transfer_client.go | 1 + bigquery/datatransfer/apiv1/doc.go | 2 +- bigquery/go.mod | 4 +- bigquery/go.sum | 14 ++--- bigquery/reservation/apiv1/doc.go | 2 +- .../reservation/apiv1/reservation_client.go | 1 + bigquery/reservation/apiv1beta1/doc.go | 2 +- .../apiv1beta1/reservation_client.go | 1 + .../storage/apiv1/big_query_read_client.go | 1 + bigquery/storage/apiv1/doc.go | 2 +- .../apiv1beta1/big_query_storage_client.go | 1 + bigquery/storage/apiv1beta1/doc.go | 2 +- .../apiv1beta2/big_query_read_client.go | 1 + .../apiv1beta2/big_query_write_client.go | 1 + bigquery/storage/apiv1beta2/doc.go | 2 +- bigtable/go.mod | 4 +- bigtable/go.sum | 11 ++-- billing/apiv1/cloud_billing_client.go | 1 + billing/apiv1/cloud_catalog_client.go | 1 + billing/apiv1/doc.go | 2 +- billing/budgets/apiv1/budget_client.go | 1 + billing/budgets/apiv1/doc.go | 2 +- billing/budgets/apiv1beta1/budget_client.go | 1 + billing/budgets/apiv1beta1/doc.go | 2 +- ...uthz_management_service_v1_beta1_client.go | 1 + binaryauthorization/apiv1beta1/doc.go | 2 +- channel/apiv1/cloud_channel_client.go | 1 + channel/apiv1/doc.go | 2 +- cloudbuild/apiv1/v2/cloud_build_client.go | 1 + cloudbuild/apiv1/v2/doc.go | 2 +- clouddms/apiv1/data_migration_client.go | 1 + clouddms/apiv1/doc.go | 4 +- cloudtasks/apiv2/cloud_tasks_client.go | 1 + cloudtasks/apiv2/doc.go | 2 +- cloudtasks/apiv2beta2/cloud_tasks_client.go | 1 + cloudtasks/apiv2beta2/doc.go | 2 +- cloudtasks/apiv2beta3/cloud_tasks_client.go | 1 + cloudtasks/apiv2beta3/doc.go | 2 +- container/apiv1/cluster_manager_client.go | 1 + container/apiv1/doc.go | 2 +- .../container_analysis_v1_beta1_client.go | 1 + containeranalysis/apiv1beta1/doc.go | 2 +- .../apiv1beta1/grafeas_v1_beta1_client.go | 1 + datacatalog/apiv1/data_catalog_client.go | 1 + datacatalog/apiv1/doc.go | 2 +- .../apiv1/policy_tag_manager_client.go | 1 + ...policy_tag_manager_serialization_client.go | 1 + datacatalog/apiv1beta1/data_catalog_client.go | 1 + datacatalog/apiv1beta1/doc.go | 2 +- .../apiv1beta1/policy_tag_manager_client.go | 1 + ...policy_tag_manager_serialization_client.go | 1 + .../apiv1beta1/data_labeling_client.go | 1 + datalabeling/apiv1beta1/doc.go | 2 +- dataproc/apiv1/autoscaling_policy_client.go | 1 + dataproc/apiv1/cluster_controller_client.go | 1 + dataproc/apiv1/doc.go | 2 +- dataproc/apiv1/job_controller_client.go | 1 + dataproc/apiv1/workflow_template_client.go | 1 + .../apiv1beta2/autoscaling_policy_client.go | 1 + .../apiv1beta2/cluster_controller_client.go | 1 + dataproc/apiv1beta2/doc.go | 2 +- dataproc/apiv1beta2/job_controller_client.go | 1 + .../apiv1beta2/workflow_template_client.go | 1 + dataqna/apiv1alpha/auto_suggestion_client.go | 1 + dataqna/apiv1alpha/doc.go | 2 +- dataqna/apiv1alpha/question_client.go | 1 + .../admin/apiv1/datastore_admin_client.go | 1 + datastore/admin/apiv1/doc.go | 2 +- datastore/go.mod | 4 +- datastore/go.sum | 14 ++--- datastream/apiv1alpha1/datastream_client.go | 6 +- datastream/apiv1alpha1/doc.go | 4 +- debugger/apiv2/controller2_client.go | 1 + debugger/apiv2/debugger2_client.go | 1 + debugger/apiv2/doc.go | 2 +- dialogflow/apiv2/agents_client.go | 1 + dialogflow/apiv2/answer_records_client.go | 1 + dialogflow/apiv2/contexts_client.go | 1 + .../apiv2/conversation_profiles_client.go | 1 + dialogflow/apiv2/conversations_client.go | 1 + dialogflow/apiv2/doc.go | 2 +- dialogflow/apiv2/documents_client.go | 1 + dialogflow/apiv2/entity_types_client.go | 1 + dialogflow/apiv2/environments_client.go | 1 + dialogflow/apiv2/fulfillments_client.go | 1 + dialogflow/apiv2/intents_client.go | 1 + dialogflow/apiv2/knowledge_bases_client.go | 1 + dialogflow/apiv2/participants_client.go | 1 + .../apiv2/session_entity_types_client.go | 1 + dialogflow/apiv2/sessions_client.go | 1 + dialogflow/apiv2/versions_client.go | 1 + dialogflow/cx/apiv3/agents_client.go | 1 + dialogflow/cx/apiv3/doc.go | 4 +- dialogflow/cx/apiv3/entity_types_client.go | 1 + dialogflow/cx/apiv3/environments_client.go | 1 + dialogflow/cx/apiv3/experiments_client.go | 1 + dialogflow/cx/apiv3/flows_client.go | 1 + dialogflow/cx/apiv3/intents_client.go | 1 + dialogflow/cx/apiv3/pages_client.go | 1 + .../cx/apiv3/security_settings_client.go | 1 + .../cx/apiv3/session_entity_types_client.go | 1 + dialogflow/cx/apiv3/sessions_client.go | 1 + dialogflow/cx/apiv3/test_cases_client.go | 1 + .../apiv3/transition_route_groups_client.go | 1 + dialogflow/cx/apiv3/versions_client.go | 1 + dialogflow/cx/apiv3/webhooks_client.go | 1 + dialogflow/cx/apiv3beta1/agents_client.go | 1 + dialogflow/cx/apiv3beta1/doc.go | 2 +- .../cx/apiv3beta1/entity_types_client.go | 1 + .../cx/apiv3beta1/environments_client.go | 1 + .../cx/apiv3beta1/experiments_client.go | 1 + dialogflow/cx/apiv3beta1/flows_client.go | 1 + dialogflow/cx/apiv3beta1/intents_client.go | 1 + dialogflow/cx/apiv3beta1/pages_client.go | 1 + .../cx/apiv3beta1/security_settings_client.go | 1 + .../apiv3beta1/session_entity_types_client.go | 1 + dialogflow/cx/apiv3beta1/sessions_client.go | 1 + dialogflow/cx/apiv3beta1/test_cases_client.go | 1 + .../transition_route_groups_client.go | 1 + dialogflow/cx/apiv3beta1/versions_client.go | 1 + dialogflow/cx/apiv3beta1/webhooks_client.go | 1 + dlp/apiv2/dlp_client.go | 1 + dlp/apiv2/doc.go | 2 +- documentai/apiv1/doc.go | 4 +- documentai/apiv1/document_processor_client.go | 1 + documentai/apiv1beta3/doc.go | 2 +- .../apiv1beta3/document_processor_client.go | 1 + domains/apiv1beta1/doc.go | 2 +- domains/apiv1beta1/domains_client.go | 1 + errorreporting/apiv1beta1/doc.go | 2 +- .../apiv1beta1/error_group_client.go | 1 + .../apiv1beta1/error_stats_client.go | 1 + .../apiv1beta1/report_errors_client.go | 1 + essentialcontacts/apiv1/doc.go | 4 +- .../apiv1/essential_contacts_client.go | 1 + firestore/apiv1/admin/doc.go | 2 +- .../apiv1/admin/firestore_admin_client.go | 1 + firestore/apiv1/doc.go | 2 +- firestore/apiv1/firestore_client.go | 1 + firestore/go.mod | 4 +- firestore/go.sum | 14 ++--- functions/apiv1/cloud_functions_client.go | 1 + functions/apiv1/doc.go | 2 +- gaming/apiv1/doc.go | 2 +- gaming/apiv1/game_server_clusters_client.go | 1 + gaming/apiv1/game_server_configs_client.go | 1 + .../apiv1/game_server_deployments_client.go | 1 + gaming/apiv1/realms_client.go | 1 + gaming/apiv1beta/doc.go | 2 +- .../apiv1beta/game_server_clusters_client.go | 1 + .../apiv1beta/game_server_configs_client.go | 1 + .../game_server_deployments_client.go | 1 + gaming/apiv1beta/realms_client.go | 1 + gkeconnect/gateway/apiv1beta1/doc.go | 2 +- .../gateway/apiv1beta1/gateway_client.go | 1 + gkehub/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gke_hub_membership_client.go | 1 + go.mod | 4 +- go.sum | 11 ++-- gsuiteaddons/apiv1/doc.go | 2 +- gsuiteaddons/apiv1/g_suite_add_ons_client.go | 1 + iam/credentials/apiv1/doc.go | 2 +- .../apiv1/iam_credentials_client.go | 1 + internal/.repo-metadata-full.json | 59 ++++++++++++++++--- internal/examples/fake/go.mod | 2 +- internal/examples/fake/go.sum | 4 +- internal/examples/mock/go.mod | 2 +- internal/examples/mock/go.sum | 4 +- internal/gapicgen/go.mod | 2 +- internal/gapicgen/go.sum | 4 +- .../LaunchFlexTemplate/main.go | 47 +++++++++++++++ .../AggregatedListJobs/main.go | 54 +++++++++++++++++ .../JobsV1Beta3Client/CheckActiveJobs/main.go | 47 +++++++++++++++ .../JobsV1Beta3Client/CreateJob/main.go | 47 +++++++++++++++ .../JobsV1Beta3Client/GetJob/main.go | 47 +++++++++++++++ .../JobsV1Beta3Client/ListJobs/main.go | 54 +++++++++++++++++ .../JobsV1Beta3Client/SnapshotJob/main.go | 47 +++++++++++++++ .../JobsV1Beta3Client/UpdateJob/main.go | 47 +++++++++++++++ .../ListJobMessages/main.go | 54 +++++++++++++++++ .../GetJobExecutionDetails/main.go | 54 +++++++++++++++++ .../GetJobMetrics/main.go | 47 +++++++++++++++ .../GetStageExecutionDetails/main.go | 54 +++++++++++++++++ .../DeleteSnapshot/main.go | 47 +++++++++++++++ .../GetSnapshot/main.go | 47 +++++++++++++++ .../ListSnapshots/main.go | 47 +++++++++++++++ .../CreateJobFromTemplate/main.go | 47 +++++++++++++++ .../TemplatesClient/GetTemplate/main.go | 47 +++++++++++++++ .../TemplatesClient/LaunchTemplate/main.go | 47 +++++++++++++++ .../Client/CreateConnectionProfile/main.go | 52 ++++++++++++++++ .../Client/CreatePrivateConnection/main.go | 52 ++++++++++++++++ .../apiv1alpha1/Client/CreateRoute/main.go | 52 ++++++++++++++++ .../apiv1alpha1/Client/CreateStream/main.go | 52 ++++++++++++++++ .../Client/DeleteConnectionProfile/main.go | 50 ++++++++++++++++ .../Client/DeletePrivateConnection/main.go | 50 ++++++++++++++++ .../apiv1alpha1/Client/DeleteRoute/main.go | 50 ++++++++++++++++ .../apiv1alpha1/Client/DeleteStream/main.go | 50 ++++++++++++++++ .../Client/DiscoverConnectionProfile/main.go | 47 +++++++++++++++ .../apiv1alpha1/Client/FetchErrors/main.go | 52 ++++++++++++++++ .../apiv1alpha1/Client/FetchStaticIps/main.go | 54 +++++++++++++++++ .../Client/GetConnectionProfile/main.go | 47 +++++++++++++++ .../Client/GetPrivateConnection/main.go | 47 +++++++++++++++ .../apiv1alpha1/Client/GetRoute/main.go | 47 +++++++++++++++ .../apiv1alpha1/Client/GetStream/main.go | 47 +++++++++++++++ .../Client/ListConnectionProfiles/main.go | 54 +++++++++++++++++ .../Client/ListPrivateConnections/main.go | 54 +++++++++++++++++ .../apiv1alpha1/Client/ListRoutes/main.go | 54 +++++++++++++++++ .../apiv1alpha1/Client/ListStreams/main.go | 54 +++++++++++++++++ .../Client/UpdateConnectionProfile/main.go | 52 ++++++++++++++++ .../apiv1alpha1/Client/UpdateStream/main.go | 52 ++++++++++++++++ .../apiv1/Client/CreateTrigger/main.go | 52 ++++++++++++++++ .../apiv1/Client/DeleteTrigger/main.go | 52 ++++++++++++++++ .../eventarc/apiv1/Client/GetTrigger/main.go | 47 +++++++++++++++ .../apiv1/Client/ListTriggers/main.go | 54 +++++++++++++++++ .../apiv1/Client/UpdateTrigger/main.go | 52 ++++++++++++++++ internal/generated/snippets/go.mod | 2 +- internal/generated/snippets/go.sum | 3 +- .../apiv1/Client/CancelExecution/main.go | 47 +++++++++++++++ .../apiv1/Client/CreateExecution/main.go | 47 +++++++++++++++ .../apiv1/Client/GetExecution/main.go | 47 +++++++++++++++ .../apiv1/Client/ListExecutions/main.go | 54 +++++++++++++++++ internal/godocfx/go.sum | 4 +- iot/apiv1/device_manager_client.go | 1 + iot/apiv1/doc.go | 2 +- kms/apiv1/doc.go | 2 +- kms/apiv1/key_management_client.go | 1 + language/apiv1/doc.go | 2 +- language/apiv1/language_client.go | 1 + language/apiv1beta2/doc.go | 2 +- language/apiv1beta2/language_client.go | 1 + lifesciences/apiv2beta/doc.go | 2 +- .../workflows_service_v2_beta_client.go | 1 + logging/apiv2/config_client.go | 1 + logging/apiv2/doc.go | 2 +- logging/apiv2/logging_client.go | 1 + logging/apiv2/metrics_client.go | 1 + logging/go.mod | 4 +- logging/go.sum | 11 ++-- longrunning/autogen/doc.go | 2 +- longrunning/autogen/operations_client.go | 1 + managedidentities/apiv1/doc.go | 2 +- .../apiv1/managed_identities_client.go | 1 + mediatranslation/apiv1beta1/doc.go | 2 +- .../apiv1beta1/speech_translation_client.go | 1 + memcache/apiv1/cloud_memcache_client.go | 1 + memcache/apiv1/doc.go | 2 +- memcache/apiv1beta2/cloud_memcache_client.go | 1 + memcache/apiv1beta2/doc.go | 2 +- metastore/apiv1/dataproc_metastore_client.go | 1 + metastore/apiv1/doc.go | 4 +- .../apiv1alpha/dataproc_metastore_client.go | 1 + metastore/apiv1alpha/doc.go | 2 +- .../apiv1beta/dataproc_metastore_client.go | 1 + metastore/apiv1beta/doc.go | 2 +- monitoring/apiv3/v2/alert_policy_client.go | 1 + monitoring/apiv3/v2/doc.go | 2 +- monitoring/apiv3/v2/group_client.go | 1 + monitoring/apiv3/v2/metric_client.go | 1 + .../apiv3/v2/notification_channel_client.go | 1 + monitoring/apiv3/v2/query_client.go | 1 + .../apiv3/v2/service_monitoring_client.go | 1 + monitoring/apiv3/v2/uptime_check_client.go | 1 + .../dashboard/apiv1/dashboards_client.go | 1 + monitoring/dashboard/apiv1/doc.go | 2 +- networkconnectivity/apiv1alpha1/doc.go | 2 +- networkconnectivity/apiv1alpha1/hub_client.go | 1 + notebooks/apiv1beta1/doc.go | 2 +- notebooks/apiv1beta1/notebook_client.go | 1 + orgpolicy/apiv2/doc.go | 2 +- orgpolicy/apiv2/org_policy_client.go | 1 + .../apiv1/agent_endpoint_client.go | 1 + osconfig/agentendpoint/apiv1/doc.go | 2 +- .../apiv1beta/agent_endpoint_client.go | 1 + osconfig/agentendpoint/apiv1beta/doc.go | 2 +- osconfig/apiv1/doc.go | 2 +- osconfig/apiv1/os_config_client.go | 1 + osconfig/apiv1alpha/doc.go | 2 +- osconfig/apiv1alpha/os_config_zonal_client.go | 1 + osconfig/apiv1beta/doc.go | 2 +- osconfig/apiv1beta/os_config_client.go | 1 + oslogin/apiv1/doc.go | 2 +- oslogin/apiv1/os_login_client.go | 1 + oslogin/apiv1beta/doc.go | 2 +- oslogin/apiv1beta/os_login_client.go | 1 + phishingprotection/apiv1beta1/doc.go | 2 +- ...hing_protection_service_v1_beta1_client.go | 1 + policytroubleshooter/apiv1/doc.go | 2 +- .../apiv1/iam_checker_client.go | 1 + privatecatalog/apiv1beta1/doc.go | 2 +- .../apiv1beta1/private_catalog_client.go | 1 + pubsub/apiv1/doc.go | 2 +- pubsub/apiv1/publisher_client.go | 1 + pubsub/apiv1/schema_client.go | 1 + pubsub/apiv1/subscriber_client.go | 1 + pubsub/go.mod | 4 +- pubsub/go.sum | 11 ++-- pubsublite/apiv1/admin_client.go | 1 + pubsublite/apiv1/cursor_client.go | 1 + pubsublite/apiv1/doc.go | 2 +- .../apiv1/partition_assignment_client.go | 1 + pubsublite/apiv1/publisher_client.go | 1 + pubsublite/apiv1/subscriber_client.go | 1 + pubsublite/apiv1/topic_stats_client.go | 1 + pubsublite/go.mod | 4 +- pubsublite/go.sum | 14 ++--- recaptchaenterprise/apiv1/doc.go | 2 +- .../apiv1/recaptcha_enterprise_client.go | 1 + recaptchaenterprise/apiv1beta1/doc.go | 2 +- ...tcha_enterprise_service_v1_beta1_client.go | 1 + recommender/apiv1/doc.go | 2 +- recommender/apiv1/recommender_client.go | 1 + recommender/apiv1beta1/doc.go | 2 +- recommender/apiv1beta1/recommender_client.go | 1 + redis/apiv1/cloud_redis_client.go | 1 + redis/apiv1/doc.go | 2 +- redis/apiv1beta1/cloud_redis_client.go | 1 + redis/apiv1beta1/doc.go | 2 +- resourcemanager/apiv2/doc.go | 2 +- resourcemanager/apiv2/folders_client.go | 1 + resourcesettings/apiv1/doc.go | 4 +- .../apiv1/resource_settings_client.go | 1 + retail/apiv2/catalog_client.go | 1 + retail/apiv2/doc.go | 2 +- retail/apiv2/prediction_client.go | 1 + retail/apiv2/product_client.go | 1 + retail/apiv2/user_event_client.go | 1 + scheduler/apiv1/cloud_scheduler_client.go | 1 + scheduler/apiv1/doc.go | 2 +- .../apiv1beta1/cloud_scheduler_client.go | 1 + scheduler/apiv1beta1/doc.go | 2 +- secretmanager/apiv1/doc.go | 2 +- secretmanager/apiv1/secret_manager_client.go | 1 + secretmanager/apiv1beta1/doc.go | 2 +- .../apiv1beta1/secret_manager_client.go | 1 + .../apiv1/certificate_authority_client.go | 1 + security/privateca/apiv1/doc.go | 4 +- .../certificate_authority_client.go | 1 + security/privateca/apiv1beta1/doc.go | 2 +- securitycenter/apiv1/doc.go | 2 +- .../apiv1/security_center_client.go | 1 + securitycenter/apiv1beta1/doc.go | 2 +- .../apiv1beta1/security_center_client.go | 1 + securitycenter/apiv1p1beta1/doc.go | 2 +- .../apiv1p1beta1/security_center_client.go | 1 + securitycenter/settings/apiv1beta1/doc.go | 2 +- .../security_center_settings_client.go | 1 + servicecontrol/apiv1/doc.go | 2 +- .../apiv1/quota_controller_client.go | 1 + .../apiv1/service_controller_client.go | 1 + servicedirectory/apiv1/doc.go | 2 +- servicedirectory/apiv1/lookup_client.go | 1 + servicedirectory/apiv1/registration_client.go | 1 + servicedirectory/apiv1beta1/doc.go | 2 +- servicedirectory/apiv1beta1/lookup_client.go | 1 + .../apiv1beta1/registration_client.go | 1 + servicemanagement/apiv1/doc.go | 2 +- .../apiv1/service_manager_client.go | 1 + serviceusage/apiv1/doc.go | 4 +- serviceusage/apiv1/service_usage_client.go | 1 + shell/apiv1/cloud_shell_client.go | 1 + shell/apiv1/doc.go | 2 +- .../database/apiv1/database_admin_client.go | 1 + spanner/admin/database/apiv1/doc.go | 2 +- spanner/admin/instance/apiv1/doc.go | 2 +- .../instance/apiv1/instance_admin_client.go | 1 + spanner/apiv1/doc.go | 2 +- spanner/apiv1/spanner_client.go | 1 + spanner/go.mod | 4 +- spanner/go.sum | 14 ++--- speech/apiv1/doc.go | 2 +- speech/apiv1/speech_client.go | 1 + speech/apiv1p1beta1/adaptation_client.go | 1 + speech/apiv1p1beta1/doc.go | 2 +- speech/apiv1p1beta1/speech_client.go | 1 + storage/go.mod | 4 +- storage/go.sum | 11 ++-- storage/internal/apiv1/doc.go | 4 +- talent/apiv4/company_client.go | 1 + talent/apiv4/completion_client.go | 1 + talent/apiv4/doc.go | 2 +- talent/apiv4/event_client.go | 1 + talent/apiv4/job_client.go | 1 + talent/apiv4/tenant_client.go | 1 + talent/apiv4beta1/application_client.go | 1 + talent/apiv4beta1/company_client.go | 1 + talent/apiv4beta1/completion_client.go | 1 + talent/apiv4beta1/doc.go | 2 +- talent/apiv4beta1/event_client.go | 1 + talent/apiv4beta1/job_client.go | 1 + talent/apiv4beta1/profile_client.go | 1 + talent/apiv4beta1/tenant_client.go | 1 + texttospeech/apiv1/doc.go | 2 +- texttospeech/apiv1/text_to_speech_client.go | 1 + tpu/apiv1/doc.go | 2 +- tpu/apiv1/tpu_client.go | 1 + trace/apiv1/doc.go | 2 +- trace/apiv1/trace_client.go | 1 + trace/apiv2/doc.go | 2 +- trace/apiv2/trace_client.go | 1 + translate/apiv3/doc.go | 2 +- translate/apiv3/translation_client.go | 1 + video/transcoder/apiv1beta1/doc.go | 2 +- .../apiv1beta1/transcoder_client.go | 1 + videointelligence/apiv1/doc.go | 2 +- .../apiv1/video_intelligence_client.go | 1 + videointelligence/apiv1beta2/doc.go | 2 +- .../apiv1beta2/video_intelligence_client.go | 1 + vision/apiv1/doc.go | 2 +- vision/apiv1/image_annotator_client.go | 1 + vision/apiv1/product_search_client.go | 1 + vision/apiv1p1beta1/doc.go | 2 +- vision/apiv1p1beta1/image_annotator_client.go | 1 + vpcaccess/apiv1/doc.go | 2 +- vpcaccess/apiv1/vpc_access_client.go | 1 + webrisk/apiv1/doc.go | 2 +- webrisk/apiv1/web_risk_client.go | 1 + webrisk/apiv1beta1/doc.go | 2 +- .../web_risk_service_v1_beta1_client.go | 1 + websecurityscanner/apiv1/doc.go | 2 +- .../apiv1/web_security_scanner_client.go | 1 + workflows/apiv1beta/doc.go | 2 +- workflows/apiv1beta/workflows_client.go | 1 + workflows/executions/apiv1beta/doc.go | 2 +- .../executions/apiv1beta/executions_client.go | 1 + 474 files changed, 2949 insertions(+), 267 deletions(-) create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/FlexTemplatesClient/LaunchFlexTemplate/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/AggregatedListJobs/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CheckActiveJobs/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CreateJob/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/GetJob/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/ListJobs/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/SnapshotJob/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/UpdateJob/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/MessagesV1Beta3Client/ListJobMessages/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobExecutionDetails/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobMetrics/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetStageExecutionDetails/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/DeleteSnapshot/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/GetSnapshot/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/ListSnapshots/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/CreateJobFromTemplate/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/GetTemplate/main.go create mode 100644 internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/LaunchTemplate/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/CreateConnectionProfile/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/CreatePrivateConnection/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/CreateRoute/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/CreateStream/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteConnectionProfile/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/DeletePrivateConnection/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteRoute/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteStream/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/DiscoverConnectionProfile/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/FetchErrors/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/FetchStaticIps/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/GetConnectionProfile/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/GetPrivateConnection/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/GetRoute/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/GetStream/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/ListConnectionProfiles/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/ListPrivateConnections/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/ListRoutes/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/ListStreams/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateConnectionProfile/main.go create mode 100644 internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateStream/main.go create mode 100644 internal/generated/snippets/eventarc/apiv1/Client/CreateTrigger/main.go create mode 100644 internal/generated/snippets/eventarc/apiv1/Client/DeleteTrigger/main.go create mode 100644 internal/generated/snippets/eventarc/apiv1/Client/GetTrigger/main.go create mode 100644 internal/generated/snippets/eventarc/apiv1/Client/ListTriggers/main.go create mode 100644 internal/generated/snippets/eventarc/apiv1/Client/UpdateTrigger/main.go create mode 100644 internal/generated/snippets/workflows/executions/apiv1/Client/CancelExecution/main.go create mode 100644 internal/generated/snippets/workflows/executions/apiv1/Client/CreateExecution/main.go create mode 100644 internal/generated/snippets/workflows/executions/apiv1/Client/GetExecution/main.go create mode 100644 internal/generated/snippets/workflows/executions/apiv1/Client/ListExecutions/main.go diff --git a/accessapproval/apiv1/access_approval_client.go b/accessapproval/apiv1/access_approval_client.go index 0ae5314bc9f0..fec2c79abc95 100644 --- a/accessapproval/apiv1/access_approval_client.go +++ b/accessapproval/apiv1/access_approval_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("accessapproval.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://accessapproval.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index a4d44187f42d..4c149e1b44e4 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/aiplatform/apiv1/dataset_client.go b/aiplatform/apiv1/dataset_client.go index 99e8c1d70387..4214aeaab7db 100644 --- a/aiplatform/apiv1/dataset_client.go +++ b/aiplatform/apiv1/dataset_client.go @@ -59,6 +59,7 @@ func defaultDatasetGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/doc.go b/aiplatform/apiv1/doc.go index c86f004cf393..c78bb382cab8 100644 --- a/aiplatform/apiv1/doc.go +++ b/aiplatform/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/aiplatform/apiv1/endpoint_client.go b/aiplatform/apiv1/endpoint_client.go index 05df63101480..636c46e522ed 100644 --- a/aiplatform/apiv1/endpoint_client.go +++ b/aiplatform/apiv1/endpoint_client.go @@ -56,6 +56,7 @@ func defaultEndpointGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/job_client.go b/aiplatform/apiv1/job_client.go index ae209e9642ed..c4fecf637db9 100644 --- a/aiplatform/apiv1/job_client.go +++ b/aiplatform/apiv1/job_client.go @@ -69,6 +69,7 @@ func defaultJobGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/migration_client.go b/aiplatform/apiv1/migration_client.go index ad671a950120..447fc83ba474 100644 --- a/aiplatform/apiv1/migration_client.go +++ b/aiplatform/apiv1/migration_client.go @@ -51,6 +51,7 @@ func defaultMigrationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/model_client.go b/aiplatform/apiv1/model_client.go index 03dda8ed87f5..2b52406a393b 100644 --- a/aiplatform/apiv1/model_client.go +++ b/aiplatform/apiv1/model_client.go @@ -59,6 +59,7 @@ func defaultModelGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/pipeline_client.go b/aiplatform/apiv1/pipeline_client.go index 08527d61ed3e..757da517ef5d 100644 --- a/aiplatform/apiv1/pipeline_client.go +++ b/aiplatform/apiv1/pipeline_client.go @@ -54,6 +54,7 @@ func defaultPipelineGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/prediction_client.go b/aiplatform/apiv1/prediction_client.go index 5308483dbc79..2230c25f34ee 100644 --- a/aiplatform/apiv1/prediction_client.go +++ b/aiplatform/apiv1/prediction_client.go @@ -45,6 +45,7 @@ func defaultPredictionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/aiplatform/apiv1/specialist_pool_client.go b/aiplatform/apiv1/specialist_pool_client.go index 0e6c910fad09..1e43a1f661b7 100644 --- a/aiplatform/apiv1/specialist_pool_client.go +++ b/aiplatform/apiv1/specialist_pool_client.go @@ -54,6 +54,7 @@ func defaultSpecialistPoolGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/analytics/admin/apiv1alpha/analytics_admin_client.go b/analytics/admin/apiv1alpha/analytics_admin_client.go index 8146580822ed..66ac56428a2a 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client.go @@ -115,6 +115,7 @@ func defaultAnalyticsAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("analyticsadmin.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://analyticsadmin.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index 9325b1374cc1..99bd441af93a 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/data/apiv1alpha/alpha_analytics_data_client.go b/analytics/data/apiv1alpha/alpha_analytics_data_client.go index 36941b6eb24b..af4865312cad 100644 --- a/analytics/data/apiv1alpha/alpha_analytics_data_client.go +++ b/analytics/data/apiv1alpha/alpha_analytics_data_client.go @@ -51,6 +51,7 @@ func defaultAlphaAnalyticsDataGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("analyticsdata.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://analyticsdata.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/analytics/data/apiv1alpha/doc.go b/analytics/data/apiv1alpha/doc.go index 64fe21a0a2b8..51e245cecb2c 100644 --- a/analytics/data/apiv1alpha/doc.go +++ b/analytics/data/apiv1alpha/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigateway/apiv1/api_gateway_client.go b/apigateway/apiv1/api_gateway_client.go index f77136e95075..e84288806e81 100644 --- a/apigateway/apiv1/api_gateway_client.go +++ b/apigateway/apiv1/api_gateway_client.go @@ -65,6 +65,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("apigateway.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://apigateway.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/apigateway/apiv1/doc.go b/apigateway/apiv1/doc.go index 84e6b503ee3b..4662a1ac1b58 100644 --- a/apigateway/apiv1/doc.go +++ b/apigateway/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigeeconnect/apiv1/connection_client.go b/apigeeconnect/apiv1/connection_client.go index bb387f12ac8b..479a5ebcf3c9 100644 --- a/apigeeconnect/apiv1/connection_client.go +++ b/apigeeconnect/apiv1/connection_client.go @@ -48,6 +48,7 @@ func defaultConnectionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("apigeeconnect.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://apigeeconnect.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/apigeeconnect/apiv1/doc.go b/apigeeconnect/apiv1/doc.go index 5b437a3a1941..d1f218d91fed 100644 --- a/apigeeconnect/apiv1/doc.go +++ b/apigeeconnect/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210629" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigeeconnect/apiv1/tether_client.go b/apigeeconnect/apiv1/tether_client.go index 374bc70cffb1..e6aec6a875a5 100644 --- a/apigeeconnect/apiv1/tether_client.go +++ b/apigeeconnect/apiv1/tether_client.go @@ -42,6 +42,7 @@ func defaultTetherGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("apigeeconnect.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://apigeeconnect.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/applications_client.go b/appengine/apiv1/applications_client.go index 73b624338c78..fa9757bd434c 100644 --- a/appengine/apiv1/applications_client.go +++ b/appengine/apiv1/applications_client.go @@ -51,6 +51,7 @@ func defaultApplicationsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/authorized_certificates_client.go b/appengine/apiv1/authorized_certificates_client.go index 341f69752d1e..7f70f751d432 100644 --- a/appengine/apiv1/authorized_certificates_client.go +++ b/appengine/apiv1/authorized_certificates_client.go @@ -50,6 +50,7 @@ func defaultAuthorizedCertificatesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/authorized_domains_client.go b/appengine/apiv1/authorized_domains_client.go index 40d3bc37b4a2..970a0b907453 100644 --- a/appengine/apiv1/authorized_domains_client.go +++ b/appengine/apiv1/authorized_domains_client.go @@ -46,6 +46,7 @@ func defaultAuthorizedDomainsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/doc.go b/appengine/apiv1/doc.go index 73ed39d498fc..fc37155009a5 100644 --- a/appengine/apiv1/doc.go +++ b/appengine/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/appengine/apiv1/domain_mappings_client.go b/appengine/apiv1/domain_mappings_client.go index f28220e6928a..3b6c6b6f83a3 100644 --- a/appengine/apiv1/domain_mappings_client.go +++ b/appengine/apiv1/domain_mappings_client.go @@ -54,6 +54,7 @@ func defaultDomainMappingsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/firewall_client.go b/appengine/apiv1/firewall_client.go index 931f057918ac..f31e79829dfa 100644 --- a/appengine/apiv1/firewall_client.go +++ b/appengine/apiv1/firewall_client.go @@ -51,6 +51,7 @@ func defaultFirewallGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/instances_client.go b/appengine/apiv1/instances_client.go index f4512dd8fe3b..9e1cfec8beca 100644 --- a/appengine/apiv1/instances_client.go +++ b/appengine/apiv1/instances_client.go @@ -53,6 +53,7 @@ func defaultInstancesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/services_client.go b/appengine/apiv1/services_client.go index 4fa5ef0bfce9..1f4f79193b93 100644 --- a/appengine/apiv1/services_client.go +++ b/appengine/apiv1/services_client.go @@ -53,6 +53,7 @@ func defaultServicesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/appengine/apiv1/versions_client.go b/appengine/apiv1/versions_client.go index 81c88c3d3599..33cf343a08f3 100644 --- a/appengine/apiv1/versions_client.go +++ b/appengine/apiv1/versions_client.go @@ -54,6 +54,7 @@ func defaultVersionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("appengine.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://appengine.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index 42f4c1ee7abc..8e4a5072d9e2 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/area120/tables/apiv1alpha1/tables_client.go b/area120/tables/apiv1alpha1/tables_client.go index b5ac43890a89..d165f012a5b0 100644 --- a/area120/tables/apiv1alpha1/tables_client.go +++ b/area120/tables/apiv1alpha1/tables_client.go @@ -58,6 +58,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("area120tables.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://area120tables.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/artifactregistry/apiv1beta2/artifact_registry_client.go b/artifactregistry/apiv1beta2/artifact_registry_client.go index 425e01f9eba9..684affc170f2 100644 --- a/artifactregistry/apiv1beta2/artifact_registry_client.go +++ b/artifactregistry/apiv1beta2/artifact_registry_client.go @@ -72,6 +72,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("artifactregistry.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://artifactregistry.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index 353bdb592296..0c527b5f917f 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/asset_client.go b/asset/apiv1/asset_client.go index c1005cd63d98..3dae3b1a3ae9 100644 --- a/asset/apiv1/asset_client.go +++ b/asset/apiv1/asset_client.go @@ -62,6 +62,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudasset.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudasset.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index ecf4935fca93..4ad5c306d791 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p2beta1/asset_client.go b/asset/apiv1p2beta1/asset_client.go index 2822bcfc9357..40417c17638c 100644 --- a/asset/apiv1p2beta1/asset_client.go +++ b/asset/apiv1p2beta1/asset_client.go @@ -50,6 +50,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudasset.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudasset.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index 071b7424e9ee..30cd912a40ae 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p5beta1/asset_client.go b/asset/apiv1p5beta1/asset_client.go index f075b1ca1b19..3b08aff4bbcb 100644 --- a/asset/apiv1p5beta1/asset_client.go +++ b/asset/apiv1p5beta1/asset_client.go @@ -48,6 +48,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudasset.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudasset.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/asset/apiv1p5beta1/doc.go b/asset/apiv1p5beta1/doc.go index a820baf58c9c..a48287b7d9fa 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/assuredworkloads/apiv1beta1/assured_workloads_client.go b/assuredworkloads/apiv1beta1/assured_workloads_client.go index 3af6175f310b..c6cdd18b7b97 100644 --- a/assuredworkloads/apiv1beta1/assured_workloads_client.go +++ b/assuredworkloads/apiv1beta1/assured_workloads_client.go @@ -55,6 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("assuredworkloads.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://assuredworkloads.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index 0a41bd280b27..b60af3decbbb 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1/auto_ml_client.go b/automl/apiv1/auto_ml_client.go index 30e4cadafa23..c1cf25f4abec 100644 --- a/automl/apiv1/auto_ml_client.go +++ b/automl/apiv1/auto_ml_client.go @@ -68,6 +68,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("automl.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://automl.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index cb7251363a39..108dd72b6cf1 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1/prediction_client.go b/automl/apiv1/prediction_client.go index 8402aaa72fb3..c11ee2a0cb2e 100644 --- a/automl/apiv1/prediction_client.go +++ b/automl/apiv1/prediction_client.go @@ -49,6 +49,7 @@ func defaultPredictionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("automl.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://automl.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/automl/apiv1beta1/auto_ml_client.go b/automl/apiv1beta1/auto_ml_client.go index cb8b9e076099..47e36dfc3f1e 100644 --- a/automl/apiv1beta1/auto_ml_client.go +++ b/automl/apiv1beta1/auto_ml_client.go @@ -74,6 +74,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("automl.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://automl.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index bf0e3ddba401..eecc7286463f 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1beta1/prediction_client.go b/automl/apiv1beta1/prediction_client.go index c145b55204e4..69d982c8246b 100644 --- a/automl/apiv1beta1/prediction_client.go +++ b/automl/apiv1beta1/prediction_client.go @@ -49,6 +49,7 @@ func defaultPredictionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("automl.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://automl.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/connection/apiv1/connection_client.go b/bigquery/connection/apiv1/connection_client.go index d345b06ed401..3f2f69330f74 100644 --- a/bigquery/connection/apiv1/connection_client.go +++ b/bigquery/connection/apiv1/connection_client.go @@ -56,6 +56,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigqueryconnection.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigqueryconnection.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/connection/apiv1/doc.go b/bigquery/connection/apiv1/doc.go index 5a23ce1087f7..bf98d3aa7ea5 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1beta1/connection_client.go b/bigquery/connection/apiv1beta1/connection_client.go index 61f9881a4bd4..dfa7fad606a7 100644 --- a/bigquery/connection/apiv1beta1/connection_client.go +++ b/bigquery/connection/apiv1beta1/connection_client.go @@ -55,6 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigqueryconnection.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigqueryconnection.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/connection/apiv1beta1/doc.go b/bigquery/connection/apiv1beta1/doc.go index 8689f326f648..b4388c5c3432 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/datatransfer/apiv1/data_transfer_client.go b/bigquery/datatransfer/apiv1/data_transfer_client.go index 352edbdcbd98..43ad4d4f6af9 100644 --- a/bigquery/datatransfer/apiv1/data_transfer_client.go +++ b/bigquery/datatransfer/apiv1/data_transfer_client.go @@ -61,6 +61,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigquerydatatransfer.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigquerydatatransfer.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index f3377268f1d7..750648a95cc3 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/go.mod b/bigquery/go.mod index 48b9e8098bb7..42a6f09a84cd 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -9,8 +9,8 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 96aa2e4a6bcb..fca947c80259 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -253,8 +253,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -400,8 +400,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -453,9 +453,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index 7b5da64b285a..82c6a2d0b3c8 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1/reservation_client.go b/bigquery/reservation/apiv1/reservation_client.go index ee600def6b66..9e8a419ff2b9 100644 --- a/bigquery/reservation/apiv1/reservation_client.go +++ b/bigquery/reservation/apiv1/reservation_client.go @@ -66,6 +66,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigqueryreservation.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigqueryreservation.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go index c994cb989a08..96ce44a977e3 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1beta1/reservation_client.go b/bigquery/reservation/apiv1beta1/reservation_client.go index 548db39e8a04..dfc99636407a 100644 --- a/bigquery/reservation/apiv1beta1/reservation_client.go +++ b/bigquery/reservation/apiv1beta1/reservation_client.go @@ -66,6 +66,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigqueryreservation.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigqueryreservation.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/storage/apiv1/big_query_read_client.go b/bigquery/storage/apiv1/big_query_read_client.go index 215191faa896..30d7cdc51466 100644 --- a/bigquery/storage/apiv1/big_query_read_client.go +++ b/bigquery/storage/apiv1/big_query_read_client.go @@ -48,6 +48,7 @@ func defaultBigQueryReadGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigquerystorage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigquerystorage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 8137ce3e85f0..02df1ac6f65f 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta1/big_query_storage_client.go b/bigquery/storage/apiv1beta1/big_query_storage_client.go index 3f6a87fe7667..a43b98eeca3b 100644 --- a/bigquery/storage/apiv1beta1/big_query_storage_client.go +++ b/bigquery/storage/apiv1beta1/big_query_storage_client.go @@ -50,6 +50,7 @@ func defaultBigQueryStorageGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigquerystorage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigquerystorage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index eff5d0a4023c..ab478691d4aa 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta2/big_query_read_client.go b/bigquery/storage/apiv1beta2/big_query_read_client.go index fd3d79d23895..463243152218 100644 --- a/bigquery/storage/apiv1beta2/big_query_read_client.go +++ b/bigquery/storage/apiv1beta2/big_query_read_client.go @@ -48,6 +48,7 @@ func defaultBigQueryReadGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigquerystorage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigquerystorage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/storage/apiv1beta2/big_query_write_client.go b/bigquery/storage/apiv1beta2/big_query_write_client.go index 74ceab7123b9..659031bb4a30 100644 --- a/bigquery/storage/apiv1beta2/big_query_write_client.go +++ b/bigquery/storage/apiv1beta2/big_query_write_client.go @@ -51,6 +51,7 @@ func defaultBigQueryWriteGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("bigquerystorage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://bigquerystorage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index c84226ca0dc5..8f795615d123 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigtable/go.mod b/bigtable/go.mod index bdb3ed4432d3..a8eaf5a94a1d 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -10,8 +10,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 rsc.io/binaryregexp v0.2.0 diff --git a/bigtable/go.sum b/bigtable/go.sum index 44672e225535..d9e76a2b7464 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -251,7 +251,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -399,8 +398,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -452,9 +451,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/billing/apiv1/cloud_billing_client.go b/billing/apiv1/cloud_billing_client.go index 2d2fe53936dd..bc013828f465 100644 --- a/billing/apiv1/cloud_billing_client.go +++ b/billing/apiv1/cloud_billing_client.go @@ -58,6 +58,7 @@ func defaultCloudBillingGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudbilling.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudbilling.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/billing/apiv1/cloud_catalog_client.go b/billing/apiv1/cloud_catalog_client.go index b262b8f57350..302e5881473f 100644 --- a/billing/apiv1/cloud_catalog_client.go +++ b/billing/apiv1/cloud_catalog_client.go @@ -47,6 +47,7 @@ func defaultCloudCatalogGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudbilling.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudbilling.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index 982c7dbabc24..fccd6324baeb 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1/budget_client.go b/billing/budgets/apiv1/budget_client.go index e98a11e9eac4..3def92243699 100644 --- a/billing/budgets/apiv1/budget_client.go +++ b/billing/budgets/apiv1/budget_client.go @@ -52,6 +52,7 @@ func defaultBudgetGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("billingbudgets.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://billingbudgets.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/billing/budgets/apiv1/doc.go b/billing/budgets/apiv1/doc.go index 67718c838ba3..bc4554fe66cf 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1beta1/budget_client.go b/billing/budgets/apiv1beta1/budget_client.go index 65a7cbb86ec2..fc0901098bd5 100644 --- a/billing/budgets/apiv1beta1/budget_client.go +++ b/billing/budgets/apiv1beta1/budget_client.go @@ -52,6 +52,7 @@ func defaultBudgetGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("billingbudgets.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://billingbudgets.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/billing/budgets/apiv1beta1/doc.go b/billing/budgets/apiv1beta1/doc.go index 7a578a17eb06..fbe74d4920c9 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go index ad959919841b..d54617644645 100644 --- a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go +++ b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go @@ -54,6 +54,7 @@ func defaultBinauthzManagementServiceV1Beta1GRPCClientOptions() []option.ClientO internaloption.WithDefaultMTLSEndpoint("binaryauthorization.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://binaryauthorization.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/binaryauthorization/apiv1beta1/doc.go b/binaryauthorization/apiv1beta1/doc.go index 9b909abfec3c..7dc21d77aceb 100644 --- a/binaryauthorization/apiv1beta1/doc.go +++ b/binaryauthorization/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/channel/apiv1/cloud_channel_client.go b/channel/apiv1/cloud_channel_client.go index ad45dc9f2d81..c42f798684cc 100644 --- a/channel/apiv1/cloud_channel_client.go +++ b/channel/apiv1/cloud_channel_client.go @@ -84,6 +84,7 @@ func defaultCloudChannelGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudchannel.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudchannel.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index e5be880ab39c..2ea403dc0fa0 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/cloud_build_client.go b/cloudbuild/apiv1/v2/cloud_build_client.go index 1ca6670a0126..9cbf64437f16 100644 --- a/cloudbuild/apiv1/v2/cloud_build_client.go +++ b/cloudbuild/apiv1/v2/cloud_build_client.go @@ -67,6 +67,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudbuild.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudbuild.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 95c1596f973e..80e595707a57 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210629" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/clouddms/apiv1/data_migration_client.go b/clouddms/apiv1/data_migration_client.go index ea8ee366eb54..c8bb77072c14 100644 --- a/clouddms/apiv1/data_migration_client.go +++ b/clouddms/apiv1/data_migration_client.go @@ -66,6 +66,7 @@ func defaultDataMigrationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datamigration.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datamigration.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/clouddms/apiv1/doc.go b/clouddms/apiv1/doc.go index e1caa5859a1a..49978276c815 100644 --- a/clouddms/apiv1/doc.go +++ b/clouddms/apiv1/doc.go @@ -20,8 +20,6 @@ // Manage Cloud Database Migration Service resources on Google Cloud // Platform. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -51,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2/cloud_tasks_client.go b/cloudtasks/apiv2/cloud_tasks_client.go index ddba0312eb80..62eac06b08ea 100644 --- a/cloudtasks/apiv2/cloud_tasks_client.go +++ b/cloudtasks/apiv2/cloud_tasks_client.go @@ -64,6 +64,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudtasks.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudtasks.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index 0629315db3c9..79dbb36ceb53 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta2/cloud_tasks_client.go b/cloudtasks/apiv2beta2/cloud_tasks_client.go index eb77d9e83ca3..a07f21d6395e 100644 --- a/cloudtasks/apiv2beta2/cloud_tasks_client.go +++ b/cloudtasks/apiv2beta2/cloud_tasks_client.go @@ -68,6 +68,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudtasks.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudtasks.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index b87521ebac0f..1271a8e3ba43 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta3/cloud_tasks_client.go b/cloudtasks/apiv2beta3/cloud_tasks_client.go index 25d19947ca03..95e972096640 100644 --- a/cloudtasks/apiv2beta3/cloud_tasks_client.go +++ b/cloudtasks/apiv2beta3/cloud_tasks_client.go @@ -64,6 +64,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudtasks.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudtasks.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index e782b1752472..2b44d88b1ae8 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/container/apiv1/cluster_manager_client.go b/container/apiv1/cluster_manager_client.go index eb8b77248aaa..c922b2eb4d5d 100644 --- a/container/apiv1/cluster_manager_client.go +++ b/container/apiv1/cluster_manager_client.go @@ -79,6 +79,7 @@ func defaultClusterManagerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("container.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://container.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index 34c204eb39f5..f7566c5e524d 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go b/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go index fc81bf43fb5d..341abafb6c12 100644 --- a/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go +++ b/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go @@ -54,6 +54,7 @@ func defaultContainerAnalysisV1Beta1GRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("containeranalysis.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://containeranalysis.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index 5948917e79e4..05c5104f2453 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go b/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go index 483a2c26235a..6ba9a5b0a68a 100644 --- a/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go +++ b/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go @@ -62,6 +62,7 @@ func defaultGrafeasV1Beta1GRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("containeranalysis.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://containeranalysis.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1/data_catalog_client.go b/datacatalog/apiv1/data_catalog_client.go index fbc68db5f61f..567e84f10fa8 100644 --- a/datacatalog/apiv1/data_catalog_client.go +++ b/datacatalog/apiv1/data_catalog_client.go @@ -76,6 +76,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index 8e11b57656c4..d0c0e0ed78ea 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/policy_tag_manager_client.go b/datacatalog/apiv1/policy_tag_manager_client.go index ebc7691c9dd1..09e41c757c54 100644 --- a/datacatalog/apiv1/policy_tag_manager_client.go +++ b/datacatalog/apiv1/policy_tag_manager_client.go @@ -60,6 +60,7 @@ func defaultPolicyTagManagerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1/policy_tag_manager_serialization_client.go b/datacatalog/apiv1/policy_tag_manager_serialization_client.go index b863c393c170..cea7c6579c5e 100644 --- a/datacatalog/apiv1/policy_tag_manager_serialization_client.go +++ b/datacatalog/apiv1/policy_tag_manager_serialization_client.go @@ -46,6 +46,7 @@ func defaultPolicyTagManagerSerializationGRPCClientOptions() []option.ClientOpti internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1beta1/data_catalog_client.go b/datacatalog/apiv1beta1/data_catalog_client.go index 539ecfec043f..e3d6a16f4483 100644 --- a/datacatalog/apiv1beta1/data_catalog_client.go +++ b/datacatalog/apiv1beta1/data_catalog_client.go @@ -75,6 +75,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go index 8cec8c617c4d..8bfccbc4b5dc 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1beta1/policy_tag_manager_client.go b/datacatalog/apiv1beta1/policy_tag_manager_client.go index 4b3eb72a48dd..9028e6e7776e 100644 --- a/datacatalog/apiv1beta1/policy_tag_manager_client.go +++ b/datacatalog/apiv1beta1/policy_tag_manager_client.go @@ -59,6 +59,7 @@ func defaultPolicyTagManagerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go b/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go index aea423fce339..46723d2ba02a 100644 --- a/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go +++ b/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go @@ -45,6 +45,7 @@ func defaultPolicyTagManagerSerializationGRPCClientOptions() []option.ClientOpti internaloption.WithDefaultMTLSEndpoint("datacatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datacatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datalabeling/apiv1beta1/data_labeling_client.go b/datalabeling/apiv1beta1/data_labeling_client.go index 76a49b2be03c..61a191faaafb 100644 --- a/datalabeling/apiv1beta1/data_labeling_client.go +++ b/datalabeling/apiv1beta1/data_labeling_client.go @@ -84,6 +84,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datalabeling.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datalabeling.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datalabeling/apiv1beta1/doc.go b/datalabeling/apiv1beta1/doc.go index 52dabea2efd0..7712dc3e77a6 100644 --- a/datalabeling/apiv1beta1/doc.go +++ b/datalabeling/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/autoscaling_policy_client.go b/dataproc/apiv1/autoscaling_policy_client.go index 8c0c5c82033c..a94c109486a1 100644 --- a/dataproc/apiv1/autoscaling_policy_client.go +++ b/dataproc/apiv1/autoscaling_policy_client.go @@ -52,6 +52,7 @@ func defaultAutoscalingPolicyGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1/cluster_controller_client.go b/dataproc/apiv1/cluster_controller_client.go index 64198e225c1f..d56b657af72f 100644 --- a/dataproc/apiv1/cluster_controller_client.go +++ b/dataproc/apiv1/cluster_controller_client.go @@ -58,6 +58,7 @@ func defaultClusterControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index 5219788372da..22f8479d6d1d 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/job_controller_client.go b/dataproc/apiv1/job_controller_client.go index ea4ddc303933..55f7e6f68e5d 100644 --- a/dataproc/apiv1/job_controller_client.go +++ b/dataproc/apiv1/job_controller_client.go @@ -57,6 +57,7 @@ func defaultJobControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1/workflow_template_client.go b/dataproc/apiv1/workflow_template_client.go index 7a542d0311a9..20b85241a68f 100644 --- a/dataproc/apiv1/workflow_template_client.go +++ b/dataproc/apiv1/workflow_template_client.go @@ -57,6 +57,7 @@ func defaultWorkflowTemplateGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1beta2/autoscaling_policy_client.go b/dataproc/apiv1beta2/autoscaling_policy_client.go index 4694494ce228..13232d64c498 100644 --- a/dataproc/apiv1beta2/autoscaling_policy_client.go +++ b/dataproc/apiv1beta2/autoscaling_policy_client.go @@ -52,6 +52,7 @@ func defaultAutoscalingPolicyGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1beta2/cluster_controller_client.go b/dataproc/apiv1beta2/cluster_controller_client.go index 40d74b6bcaf9..f7847cbff803 100644 --- a/dataproc/apiv1beta2/cluster_controller_client.go +++ b/dataproc/apiv1beta2/cluster_controller_client.go @@ -56,6 +56,7 @@ func defaultClusterControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go index be2ba6dcd112..659062ed7beb 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1beta2/job_controller_client.go b/dataproc/apiv1beta2/job_controller_client.go index 70a9e09c0d42..4910000d2b1d 100644 --- a/dataproc/apiv1beta2/job_controller_client.go +++ b/dataproc/apiv1beta2/job_controller_client.go @@ -57,6 +57,7 @@ func defaultJobControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataproc/apiv1beta2/workflow_template_client.go b/dataproc/apiv1beta2/workflow_template_client.go index a2ae274917c6..620f9441a5d8 100644 --- a/dataproc/apiv1beta2/workflow_template_client.go +++ b/dataproc/apiv1beta2/workflow_template_client.go @@ -57,6 +57,7 @@ func defaultWorkflowTemplateGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataqna/apiv1alpha/auto_suggestion_client.go b/dataqna/apiv1alpha/auto_suggestion_client.go index 0ca05d234dc6..783980ac9fd1 100644 --- a/dataqna/apiv1alpha/auto_suggestion_client.go +++ b/dataqna/apiv1alpha/auto_suggestion_client.go @@ -45,6 +45,7 @@ func defaultAutoSuggestionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataqna.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataqna.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dataqna/apiv1alpha/doc.go b/dataqna/apiv1alpha/doc.go index fdf5a72013d0..c9bbb72d570b 100644 --- a/dataqna/apiv1alpha/doc.go +++ b/dataqna/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataqna/apiv1alpha/question_client.go b/dataqna/apiv1alpha/question_client.go index 198a6334fd40..7958afba6fec 100644 --- a/dataqna/apiv1alpha/question_client.go +++ b/dataqna/apiv1alpha/question_client.go @@ -50,6 +50,7 @@ func defaultQuestionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dataqna.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dataqna.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datastore/admin/apiv1/datastore_admin_client.go b/datastore/admin/apiv1/datastore_admin_client.go index 7a58fc84f5f2..a2225bf5a6db 100644 --- a/datastore/admin/apiv1/datastore_admin_client.go +++ b/datastore/admin/apiv1/datastore_admin_client.go @@ -56,6 +56,7 @@ func defaultDatastoreAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("datastore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://datastore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index 9148bebfbc14..6e5c06d83714 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index 2f5b25325441..74bd1b788955 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -7,8 +7,8 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/datastore/go.sum b/datastore/go.sum index 8b897debcbfc..9e44f7fc0b63 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -249,8 +249,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -396,8 +396,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -449,9 +449,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/datastream/apiv1alpha1/datastream_client.go b/datastream/apiv1alpha1/datastream_client.go index 37d76bb99e94..ad4aa195e4fd 100644 --- a/datastream/apiv1alpha1/datastream_client.go +++ b/datastream/apiv1alpha1/datastream_client.go @@ -214,7 +214,7 @@ func defaultCallOptions() *CallOptions { } } -// internalClient is an interface that defines the methods availaible from DataStream API. +// internalClient is an interface that defines the methods availaible from Datastream API. type internalClient interface { Close() error setGoogleClientInfo(...string) @@ -253,7 +253,7 @@ type internalClient interface { DeleteRouteOperation(name string) *DeleteRouteOperation } -// Client is a client for interacting with DataStream API. +// Client is a client for interacting with Datastream API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // // Datastream service @@ -472,7 +472,7 @@ func (c *Client) DeleteRouteOperation(name string) *DeleteRouteOperation { return c.internalClient.DeleteRouteOperation(name) } -// gRPCClient is a client for interacting with DataStream API over gRPC transport. +// gRPCClient is a client for interacting with Datastream API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. type gRPCClient struct { diff --git a/datastream/apiv1alpha1/doc.go b/datastream/apiv1alpha1/doc.go index d435cf0162bf..29837f62a938 100644 --- a/datastream/apiv1alpha1/doc.go +++ b/datastream/apiv1alpha1/doc.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. // Package datastream is an auto-generated package for the -// DataStream API. +// Datastream API. // // NOTE: This package is in alpha. It is not stable, and is likely to change. // @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "UNKNOWN" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/debugger/apiv2/controller2_client.go b/debugger/apiv2/controller2_client.go index d8e887be4395..5e06b37bcf7d 100644 --- a/debugger/apiv2/controller2_client.go +++ b/debugger/apiv2/controller2_client.go @@ -48,6 +48,7 @@ func defaultController2GRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("clouddebugger.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://clouddebugger.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/debugger/apiv2/debugger2_client.go b/debugger/apiv2/debugger2_client.go index 868b90dee0dc..ed6af24d20b8 100644 --- a/debugger/apiv2/debugger2_client.go +++ b/debugger/apiv2/debugger2_client.go @@ -50,6 +50,7 @@ func defaultDebugger2GRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("clouddebugger.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://clouddebugger.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index c8aebec454f7..46c1001d4462 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/agents_client.go b/dialogflow/apiv2/agents_client.go index 49004cc92af1..c7af082de257 100644 --- a/dialogflow/apiv2/agents_client.go +++ b/dialogflow/apiv2/agents_client.go @@ -60,6 +60,7 @@ func defaultAgentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/answer_records_client.go b/dialogflow/apiv2/answer_records_client.go index 29e728230e21..d5b415361743 100644 --- a/dialogflow/apiv2/answer_records_client.go +++ b/dialogflow/apiv2/answer_records_client.go @@ -49,6 +49,7 @@ func defaultAnswerRecordsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/contexts_client.go b/dialogflow/apiv2/contexts_client.go index 6b90b50a834b..88148448c87e 100644 --- a/dialogflow/apiv2/contexts_client.go +++ b/dialogflow/apiv2/contexts_client.go @@ -53,6 +53,7 @@ func defaultContextsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/conversation_profiles_client.go b/dialogflow/apiv2/conversation_profiles_client.go index 3cb9c771f3f3..71adba384d66 100644 --- a/dialogflow/apiv2/conversation_profiles_client.go +++ b/dialogflow/apiv2/conversation_profiles_client.go @@ -52,6 +52,7 @@ func defaultConversationProfilesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/conversations_client.go b/dialogflow/apiv2/conversations_client.go index d1497245dce0..66450e377a46 100644 --- a/dialogflow/apiv2/conversations_client.go +++ b/dialogflow/apiv2/conversations_client.go @@ -52,6 +52,7 @@ func defaultConversationsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index 90292d8d2c91..9bcf37c93e11 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/documents_client.go b/dialogflow/apiv2/documents_client.go index 21614f56fe74..9ccc6e10b610 100644 --- a/dialogflow/apiv2/documents_client.go +++ b/dialogflow/apiv2/documents_client.go @@ -56,6 +56,7 @@ func defaultDocumentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/entity_types_client.go b/dialogflow/apiv2/entity_types_client.go index 99af19d68cc8..81431a15203a 100644 --- a/dialogflow/apiv2/entity_types_client.go +++ b/dialogflow/apiv2/entity_types_client.go @@ -61,6 +61,7 @@ func defaultEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/environments_client.go b/dialogflow/apiv2/environments_client.go index a91f65842fbf..4710977241f8 100644 --- a/dialogflow/apiv2/environments_client.go +++ b/dialogflow/apiv2/environments_client.go @@ -53,6 +53,7 @@ func defaultEnvironmentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/fulfillments_client.go b/dialogflow/apiv2/fulfillments_client.go index 0853a8bcee2f..06fcd7116fcc 100644 --- a/dialogflow/apiv2/fulfillments_client.go +++ b/dialogflow/apiv2/fulfillments_client.go @@ -47,6 +47,7 @@ func defaultFulfillmentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/intents_client.go b/dialogflow/apiv2/intents_client.go index e6b0158a7089..943fcad720b0 100644 --- a/dialogflow/apiv2/intents_client.go +++ b/dialogflow/apiv2/intents_client.go @@ -58,6 +58,7 @@ func defaultIntentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/knowledge_bases_client.go b/dialogflow/apiv2/knowledge_bases_client.go index f57400e31b6b..7772de6bf357 100644 --- a/dialogflow/apiv2/knowledge_bases_client.go +++ b/dialogflow/apiv2/knowledge_bases_client.go @@ -52,6 +52,7 @@ func defaultKnowledgeBasesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/participants_client.go b/dialogflow/apiv2/participants_client.go index 1706d5317f42..3e10e0ce495a 100644 --- a/dialogflow/apiv2/participants_client.go +++ b/dialogflow/apiv2/participants_client.go @@ -54,6 +54,7 @@ func defaultParticipantsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/session_entity_types_client.go b/dialogflow/apiv2/session_entity_types_client.go index 2342f4060fe9..077bf4ab0833 100644 --- a/dialogflow/apiv2/session_entity_types_client.go +++ b/dialogflow/apiv2/session_entity_types_client.go @@ -52,6 +52,7 @@ func defaultSessionEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/sessions_client.go b/dialogflow/apiv2/sessions_client.go index 05dd73c3229c..878f22f45d6e 100644 --- a/dialogflow/apiv2/sessions_client.go +++ b/dialogflow/apiv2/sessions_client.go @@ -47,6 +47,7 @@ func defaultSessionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/apiv2/versions_client.go b/dialogflow/apiv2/versions_client.go index 4eb375f68555..b813a24bce66 100644 --- a/dialogflow/apiv2/versions_client.go +++ b/dialogflow/apiv2/versions_client.go @@ -52,6 +52,7 @@ func defaultVersionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/agents_client.go b/dialogflow/cx/apiv3/agents_client.go index f7671d8a97bb..21623d410fb8 100644 --- a/dialogflow/cx/apiv3/agents_client.go +++ b/dialogflow/cx/apiv3/agents_client.go @@ -60,6 +60,7 @@ func defaultAgentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/doc.go b/dialogflow/cx/apiv3/doc.go index 6623135f9756..731cf46746e6 100644 --- a/dialogflow/cx/apiv3/doc.go +++ b/dialogflow/cx/apiv3/doc.go @@ -20,8 +20,6 @@ // Builds conversational interfaces (for example, chatbots, and voice-powered // apps and devices). // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -51,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3/entity_types_client.go b/dialogflow/cx/apiv3/entity_types_client.go index e8d99c6f5c3f..b83a0712ee2d 100644 --- a/dialogflow/cx/apiv3/entity_types_client.go +++ b/dialogflow/cx/apiv3/entity_types_client.go @@ -52,6 +52,7 @@ func defaultEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/environments_client.go b/dialogflow/cx/apiv3/environments_client.go index 2d87bdd6b937..fe106fbf7310 100644 --- a/dialogflow/cx/apiv3/environments_client.go +++ b/dialogflow/cx/apiv3/environments_client.go @@ -59,6 +59,7 @@ func defaultEnvironmentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/experiments_client.go b/dialogflow/cx/apiv3/experiments_client.go index d42b703f3de3..e3effcf44bee 100644 --- a/dialogflow/cx/apiv3/experiments_client.go +++ b/dialogflow/cx/apiv3/experiments_client.go @@ -54,6 +54,7 @@ func defaultExperimentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/flows_client.go b/dialogflow/cx/apiv3/flows_client.go index 9f2c6c758460..925c3737c076 100644 --- a/dialogflow/cx/apiv3/flows_client.go +++ b/dialogflow/cx/apiv3/flows_client.go @@ -61,6 +61,7 @@ func defaultFlowsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/intents_client.go b/dialogflow/cx/apiv3/intents_client.go index e2b2fb76862e..bcd010bb58dc 100644 --- a/dialogflow/cx/apiv3/intents_client.go +++ b/dialogflow/cx/apiv3/intents_client.go @@ -52,6 +52,7 @@ func defaultIntentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/pages_client.go b/dialogflow/cx/apiv3/pages_client.go index 4bb883a80015..72666daa72b9 100644 --- a/dialogflow/cx/apiv3/pages_client.go +++ b/dialogflow/cx/apiv3/pages_client.go @@ -52,6 +52,7 @@ func defaultPagesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/security_settings_client.go b/dialogflow/cx/apiv3/security_settings_client.go index 19525b722f5c..9c6fe1246707 100644 --- a/dialogflow/cx/apiv3/security_settings_client.go +++ b/dialogflow/cx/apiv3/security_settings_client.go @@ -52,6 +52,7 @@ func defaultSecuritySettingsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/session_entity_types_client.go b/dialogflow/cx/apiv3/session_entity_types_client.go index f8ef1c50ce6d..c9f0380baff6 100644 --- a/dialogflow/cx/apiv3/session_entity_types_client.go +++ b/dialogflow/cx/apiv3/session_entity_types_client.go @@ -52,6 +52,7 @@ func defaultSessionEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/sessions_client.go b/dialogflow/cx/apiv3/sessions_client.go index d83dd24d87b9..54de3d9551e3 100644 --- a/dialogflow/cx/apiv3/sessions_client.go +++ b/dialogflow/cx/apiv3/sessions_client.go @@ -49,6 +49,7 @@ func defaultSessionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/test_cases_client.go b/dialogflow/cx/apiv3/test_cases_client.go index cb243cafc068..c780c3c5c952 100644 --- a/dialogflow/cx/apiv3/test_cases_client.go +++ b/dialogflow/cx/apiv3/test_cases_client.go @@ -62,6 +62,7 @@ func defaultTestCasesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/transition_route_groups_client.go b/dialogflow/cx/apiv3/transition_route_groups_client.go index a71d3bf795d2..9963cdc20731 100644 --- a/dialogflow/cx/apiv3/transition_route_groups_client.go +++ b/dialogflow/cx/apiv3/transition_route_groups_client.go @@ -52,6 +52,7 @@ func defaultTransitionRouteGroupsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/versions_client.go b/dialogflow/cx/apiv3/versions_client.go index 0191353c143e..b400500eaf1d 100644 --- a/dialogflow/cx/apiv3/versions_client.go +++ b/dialogflow/cx/apiv3/versions_client.go @@ -57,6 +57,7 @@ func defaultVersionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3/webhooks_client.go b/dialogflow/cx/apiv3/webhooks_client.go index a159f717d74a..b589171ae2ef 100644 --- a/dialogflow/cx/apiv3/webhooks_client.go +++ b/dialogflow/cx/apiv3/webhooks_client.go @@ -52,6 +52,7 @@ func defaultWebhooksGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/agents_client.go b/dialogflow/cx/apiv3beta1/agents_client.go index 3522935de1e6..2aadca15813b 100644 --- a/dialogflow/cx/apiv3beta1/agents_client.go +++ b/dialogflow/cx/apiv3beta1/agents_client.go @@ -60,6 +60,7 @@ func defaultAgentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index bf72fa8fde0e..4f5d85327590 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3beta1/entity_types_client.go b/dialogflow/cx/apiv3beta1/entity_types_client.go index 532e475b2a59..1356e6a40b81 100644 --- a/dialogflow/cx/apiv3beta1/entity_types_client.go +++ b/dialogflow/cx/apiv3beta1/entity_types_client.go @@ -52,6 +52,7 @@ func defaultEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/environments_client.go b/dialogflow/cx/apiv3beta1/environments_client.go index b15e83faa7c3..d5262806e2ea 100644 --- a/dialogflow/cx/apiv3beta1/environments_client.go +++ b/dialogflow/cx/apiv3beta1/environments_client.go @@ -59,6 +59,7 @@ func defaultEnvironmentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/experiments_client.go b/dialogflow/cx/apiv3beta1/experiments_client.go index e19e4a96c5c0..60a5d6e51f00 100644 --- a/dialogflow/cx/apiv3beta1/experiments_client.go +++ b/dialogflow/cx/apiv3beta1/experiments_client.go @@ -54,6 +54,7 @@ func defaultExperimentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/flows_client.go b/dialogflow/cx/apiv3beta1/flows_client.go index b83da23f24da..ba2b783d087a 100644 --- a/dialogflow/cx/apiv3beta1/flows_client.go +++ b/dialogflow/cx/apiv3beta1/flows_client.go @@ -61,6 +61,7 @@ func defaultFlowsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/intents_client.go b/dialogflow/cx/apiv3beta1/intents_client.go index baac27b6c38c..e321664e981d 100644 --- a/dialogflow/cx/apiv3beta1/intents_client.go +++ b/dialogflow/cx/apiv3beta1/intents_client.go @@ -52,6 +52,7 @@ func defaultIntentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/pages_client.go b/dialogflow/cx/apiv3beta1/pages_client.go index 7f1ea6f0112d..9e980d34e3f0 100644 --- a/dialogflow/cx/apiv3beta1/pages_client.go +++ b/dialogflow/cx/apiv3beta1/pages_client.go @@ -52,6 +52,7 @@ func defaultPagesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/security_settings_client.go b/dialogflow/cx/apiv3beta1/security_settings_client.go index e9ea29c26f1c..36ab26c693ed 100644 --- a/dialogflow/cx/apiv3beta1/security_settings_client.go +++ b/dialogflow/cx/apiv3beta1/security_settings_client.go @@ -52,6 +52,7 @@ func defaultSecuritySettingsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/session_entity_types_client.go b/dialogflow/cx/apiv3beta1/session_entity_types_client.go index c00d1bec4b62..08799a170475 100644 --- a/dialogflow/cx/apiv3beta1/session_entity_types_client.go +++ b/dialogflow/cx/apiv3beta1/session_entity_types_client.go @@ -52,6 +52,7 @@ func defaultSessionEntityTypesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/sessions_client.go b/dialogflow/cx/apiv3beta1/sessions_client.go index 7206183b8979..4fea31d5e439 100644 --- a/dialogflow/cx/apiv3beta1/sessions_client.go +++ b/dialogflow/cx/apiv3beta1/sessions_client.go @@ -49,6 +49,7 @@ func defaultSessionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/test_cases_client.go b/dialogflow/cx/apiv3beta1/test_cases_client.go index 9b35caef34a7..5b8729fcd047 100644 --- a/dialogflow/cx/apiv3beta1/test_cases_client.go +++ b/dialogflow/cx/apiv3beta1/test_cases_client.go @@ -62,6 +62,7 @@ func defaultTestCasesGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/transition_route_groups_client.go b/dialogflow/cx/apiv3beta1/transition_route_groups_client.go index 159d3ab7813d..46117280f8bd 100644 --- a/dialogflow/cx/apiv3beta1/transition_route_groups_client.go +++ b/dialogflow/cx/apiv3beta1/transition_route_groups_client.go @@ -52,6 +52,7 @@ func defaultTransitionRouteGroupsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/versions_client.go b/dialogflow/cx/apiv3beta1/versions_client.go index 7d68c971a59e..0035da11c550 100644 --- a/dialogflow/cx/apiv3beta1/versions_client.go +++ b/dialogflow/cx/apiv3beta1/versions_client.go @@ -57,6 +57,7 @@ func defaultVersionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dialogflow/cx/apiv3beta1/webhooks_client.go b/dialogflow/cx/apiv3beta1/webhooks_client.go index f9dcf20328fc..56e62b184052 100644 --- a/dialogflow/cx/apiv3beta1/webhooks_client.go +++ b/dialogflow/cx/apiv3beta1/webhooks_client.go @@ -52,6 +52,7 @@ func defaultWebhooksGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dlp/apiv2/dlp_client.go b/dlp/apiv2/dlp_client.go index 9f058c730412..810a3565c0bb 100644 --- a/dlp/apiv2/dlp_client.go +++ b/dlp/apiv2/dlp_client.go @@ -81,6 +81,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("dlp.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://dlp.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index 75d8a69a7d10..ccd03828adf9 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1/doc.go b/documentai/apiv1/doc.go index 013c010e2ebe..8e9c17eb985b 100644 --- a/documentai/apiv1/doc.go +++ b/documentai/apiv1/doc.go @@ -21,8 +21,6 @@ // semi-structured documents using state-of-the-art Google AI such as natural // language, computer vision, translation, and AutoML. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -52,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1/document_processor_client.go b/documentai/apiv1/document_processor_client.go index 775ce5195caf..8e87c607dac7 100644 --- a/documentai/apiv1/document_processor_client.go +++ b/documentai/apiv1/document_processor_client.go @@ -51,6 +51,7 @@ func defaultDocumentProcessorGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("documentai.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://documentai.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/documentai/apiv1beta3/doc.go b/documentai/apiv1beta3/doc.go index be6d9be4fa22..511ee4e97582 100644 --- a/documentai/apiv1beta3/doc.go +++ b/documentai/apiv1beta3/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1beta3/document_processor_client.go b/documentai/apiv1beta3/document_processor_client.go index 10b4694eb14e..1a006861380a 100644 --- a/documentai/apiv1beta3/document_processor_client.go +++ b/documentai/apiv1beta3/document_processor_client.go @@ -59,6 +59,7 @@ func defaultDocumentProcessorGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("documentai.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://documentai.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/domains/apiv1beta1/doc.go b/domains/apiv1beta1/doc.go index 797b22f48dc2..1a4eaf1ce67b 100644 --- a/domains/apiv1beta1/doc.go +++ b/domains/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/domains/apiv1beta1/domains_client.go b/domains/apiv1beta1/domains_client.go index 02bc17a425c9..a298686dc7fc 100644 --- a/domains/apiv1beta1/domains_client.go +++ b/domains/apiv1beta1/domains_client.go @@ -62,6 +62,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("domains.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://domains.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index 68ab73653176..d305ddc76c5f 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/errorreporting/apiv1beta1/error_group_client.go b/errorreporting/apiv1beta1/error_group_client.go index 12409a232b5b..9440d1f0cc05 100644 --- a/errorreporting/apiv1beta1/error_group_client.go +++ b/errorreporting/apiv1beta1/error_group_client.go @@ -47,6 +47,7 @@ func defaultErrorGroupGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("clouderrorreporting.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://clouderrorreporting.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/errorreporting/apiv1beta1/error_stats_client.go b/errorreporting/apiv1beta1/error_stats_client.go index 5f1069f9ce23..e12bc96f20c4 100644 --- a/errorreporting/apiv1beta1/error_stats_client.go +++ b/errorreporting/apiv1beta1/error_stats_client.go @@ -50,6 +50,7 @@ func defaultErrorStatsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("clouderrorreporting.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://clouderrorreporting.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/errorreporting/apiv1beta1/report_errors_client.go b/errorreporting/apiv1beta1/report_errors_client.go index 3c91faa42965..796e5675d86b 100644 --- a/errorreporting/apiv1beta1/report_errors_client.go +++ b/errorreporting/apiv1beta1/report_errors_client.go @@ -45,6 +45,7 @@ func defaultReportErrorsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("clouderrorreporting.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://clouderrorreporting.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/essentialcontacts/apiv1/doc.go b/essentialcontacts/apiv1/doc.go index 6f479d2d71ce..436f0358d875 100644 --- a/essentialcontacts/apiv1/doc.go +++ b/essentialcontacts/apiv1/doc.go @@ -17,8 +17,6 @@ // Package essentialcontacts is an auto-generated package for the // Essential Contacts API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -48,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/essentialcontacts/apiv1/essential_contacts_client.go b/essentialcontacts/apiv1/essential_contacts_client.go index f9feae3c37c7..7485c6c69b2a 100644 --- a/essentialcontacts/apiv1/essential_contacts_client.go +++ b/essentialcontacts/apiv1/essential_contacts_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("essentialcontacts.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://essentialcontacts.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index a883dcae01fb..85034acb541f 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/admin/firestore_admin_client.go b/firestore/apiv1/admin/firestore_admin_client.go index bb192c5c35f6..5dcbbdd2152d 100644 --- a/firestore/apiv1/admin/firestore_admin_client.go +++ b/firestore/apiv1/admin/firestore_admin_client.go @@ -59,6 +59,7 @@ func defaultFirestoreAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("firestore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://firestore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go index 32d814326149..fbb012af1f57 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/firestore_client.go b/firestore/apiv1/firestore_client.go index 0459cf95be87..deec0b20090a 100644 --- a/firestore/apiv1/firestore_client.go +++ b/firestore/apiv1/firestore_client.go @@ -62,6 +62,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("firestore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://firestore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/firestore/go.mod b/firestore/go.mod index 2663995e148c..1c2b1f034886 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -7,8 +7,8 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/firestore/go.sum b/firestore/go.sum index 8b897debcbfc..9e44f7fc0b63 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -249,8 +249,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -396,8 +396,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -449,9 +449,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/functions/apiv1/cloud_functions_client.go b/functions/apiv1/cloud_functions_client.go index 06958d19ee7a..4f342917b6bc 100644 --- a/functions/apiv1/cloud_functions_client.go +++ b/functions/apiv1/cloud_functions_client.go @@ -62,6 +62,7 @@ func defaultCloudFunctionsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudfunctions.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudfunctions.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index 624d14df15fc..9651891f9750 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1/doc.go b/gaming/apiv1/doc.go index 0e4f481fc599..aebd85c3fb09 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1/game_server_clusters_client.go b/gaming/apiv1/game_server_clusters_client.go index dea79cd4f30a..85b83e1c8b8f 100644 --- a/gaming/apiv1/game_server_clusters_client.go +++ b/gaming/apiv1/game_server_clusters_client.go @@ -58,6 +58,7 @@ func defaultGameServerClustersGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1/game_server_configs_client.go b/gaming/apiv1/game_server_configs_client.go index f428810bddd4..63cbca4f35dd 100644 --- a/gaming/apiv1/game_server_configs_client.go +++ b/gaming/apiv1/game_server_configs_client.go @@ -54,6 +54,7 @@ func defaultGameServerConfigsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1/game_server_deployments_client.go b/gaming/apiv1/game_server_deployments_client.go index fa13c8c20aa3..c393a74567c6 100644 --- a/gaming/apiv1/game_server_deployments_client.go +++ b/gaming/apiv1/game_server_deployments_client.go @@ -59,6 +59,7 @@ func defaultGameServerDeploymentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1/realms_client.go b/gaming/apiv1/realms_client.go index 98383d25dc9e..75e54f399cf0 100644 --- a/gaming/apiv1/realms_client.go +++ b/gaming/apiv1/realms_client.go @@ -56,6 +56,7 @@ func defaultRealmsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1beta/doc.go b/gaming/apiv1beta/doc.go index f4f31b443498..fee932c7861c 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1beta/game_server_clusters_client.go b/gaming/apiv1beta/game_server_clusters_client.go index 3bfd481ac662..e780ddb8094e 100644 --- a/gaming/apiv1beta/game_server_clusters_client.go +++ b/gaming/apiv1beta/game_server_clusters_client.go @@ -58,6 +58,7 @@ func defaultGameServerClustersGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1beta/game_server_configs_client.go b/gaming/apiv1beta/game_server_configs_client.go index 033f65f6e32d..0d60f4411fc5 100644 --- a/gaming/apiv1beta/game_server_configs_client.go +++ b/gaming/apiv1beta/game_server_configs_client.go @@ -54,6 +54,7 @@ func defaultGameServerConfigsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1beta/game_server_deployments_client.go b/gaming/apiv1beta/game_server_deployments_client.go index 959bd647ec1b..04f2749fe6ce 100644 --- a/gaming/apiv1beta/game_server_deployments_client.go +++ b/gaming/apiv1beta/game_server_deployments_client.go @@ -59,6 +59,7 @@ func defaultGameServerDeploymentsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gaming/apiv1beta/realms_client.go b/gaming/apiv1beta/realms_client.go index 72cb1ad841ed..0c719ea776b0 100644 --- a/gaming/apiv1beta/realms_client.go +++ b/gaming/apiv1beta/realms_client.go @@ -56,6 +56,7 @@ func defaultRealmsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gameservices.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gameservices.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gkeconnect/gateway/apiv1beta1/doc.go b/gkeconnect/gateway/apiv1beta1/doc.go index 0212560c4d40..9a8af36e3ea7 100644 --- a/gkeconnect/gateway/apiv1beta1/doc.go +++ b/gkeconnect/gateway/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gkeconnect/gateway/apiv1beta1/gateway_client.go b/gkeconnect/gateway/apiv1beta1/gateway_client.go index fdfa650992b3..756cbbf38fe3 100644 --- a/gkeconnect/gateway/apiv1beta1/gateway_client.go +++ b/gkeconnect/gateway/apiv1beta1/gateway_client.go @@ -47,6 +47,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("connectgateway.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://connectgateway.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/gkehub/apiv1beta1/doc.go b/gkehub/apiv1beta1/doc.go index 6ffdf1e8317c..b840f51faa04 100644 --- a/gkehub/apiv1beta1/doc.go +++ b/gkehub/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210629" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gkehub/apiv1beta1/gke_hub_membership_client.go b/gkehub/apiv1beta1/gke_hub_membership_client.go index cc33c60b5455..7eb98cdd428e 100644 --- a/gkehub/apiv1beta1/gke_hub_membership_client.go +++ b/gkehub/apiv1beta1/gke_hub_membership_client.go @@ -58,6 +58,7 @@ func defaultGkeHubMembershipGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gkehub.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gkehub.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/go.mod b/go.mod index f9ff5016b5cb..e3f528d34907 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/text v0.3.6 golang.org/x/tools v0.1.4 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index a13fe6fe1e47..e72672ec7de0 100644 --- a/go.sum +++ b/go.sum @@ -256,7 +256,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -405,8 +404,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -458,9 +457,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/gsuiteaddons/apiv1/doc.go b/gsuiteaddons/apiv1/doc.go index 236663d7d715..90625432e326 100644 --- a/gsuiteaddons/apiv1/doc.go +++ b/gsuiteaddons/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gsuiteaddons/apiv1/g_suite_add_ons_client.go b/gsuiteaddons/apiv1/g_suite_add_ons_client.go index 117ee4610892..2ca35d0799f0 100644 --- a/gsuiteaddons/apiv1/g_suite_add_ons_client.go +++ b/gsuiteaddons/apiv1/g_suite_add_ons_client.go @@ -56,6 +56,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("gsuiteaddons.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://gsuiteaddons.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 78abc51b6329..6053de60b6b0 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/iam/credentials/apiv1/iam_credentials_client.go b/iam/credentials/apiv1/iam_credentials_client.go index 8569451ac300..e9924a15354c 100644 --- a/iam/credentials/apiv1/iam_credentials_client.go +++ b/iam/credentials/apiv1/iam_credentials_client.go @@ -49,6 +49,7 @@ func defaultIamCredentialsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("iamcredentials.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://iamcredentials.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 13bb34a67ca4..1d782ddcefa2 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -284,7 +284,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/clouddms/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/cloudtasks/apiv2": { @@ -359,6 +359,15 @@ "release_level": "beta", "library_type": "" }, + "cloud.google.com/go/dataflow/apiv1beta3": { + "distribution_name": "cloud.google.com/go/dataflow/apiv1beta3", + "description": "Dataflow API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/dataflow/apiv1beta3", + "release_level": "beta", + "library_type": "" + }, "cloud.google.com/go/datalabeling/apiv1beta1": { "distribution_name": "cloud.google.com/go/datalabeling/apiv1beta1", "description": "Data Labeling API", @@ -413,6 +422,15 @@ "release_level": "alpha", "library_type": "" }, + "cloud.google.com/go/datastream/apiv1alpha1": { + "distribution_name": "cloud.google.com/go/datastream/apiv1alpha1", + "description": "Datastream API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/datastream/apiv1alpha1", + "release_level": "alpha", + "library_type": "" + }, "cloud.google.com/go/debugger/apiv2": { "distribution_name": "cloud.google.com/go/debugger/apiv2", "description": "Stackdriver Debugger API", @@ -437,7 +455,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/dialogflow/cx/apiv3", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/dialogflow/cx/apiv3beta1": { @@ -464,7 +482,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/documentai/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/documentai/apiv1beta3": { @@ -509,6 +527,15 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/essentialcontacts/apiv1", + "release_level": "ga", + "library_type": "" + }, + "cloud.google.com/go/eventarc/apiv1": { + "distribution_name": "cloud.google.com/go/eventarc/apiv1", + "description": "Eventarc API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/eventarc/apiv1", "release_level": "beta", "library_type": "" }, @@ -734,7 +761,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/metastore/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/metastore/apiv1alpha": { @@ -1013,7 +1040,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/resourcesettings/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/retail/apiv2": { @@ -1076,7 +1103,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/security/privateca/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/security/privateca/apiv1beta1": { @@ -1166,7 +1193,7 @@ "language": "Go", "client_library_type": "generated", "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/serviceusage/apiv1", - "release_level": "beta", + "release_level": "ga", "library_type": "" }, "cloud.google.com/go/shell/apiv1": { @@ -1241,6 +1268,15 @@ "release_level": "ga", "library_type": "GAPIC_MANUAL" }, + "cloud.google.com/go/storage/internal/apiv1": { + "distribution_name": "cloud.google.com/go/storage/internal/apiv1", + "description": "Cloud Storage API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/storage/internal/apiv1", + "release_level": "alpha", + "library_type": "" + }, "cloud.google.com/go/talent/apiv4": { "distribution_name": "cloud.google.com/go/talent/apiv4", "description": "Cloud Talent Solution API", @@ -1394,6 +1430,15 @@ "release_level": "beta", "library_type": "" }, + "cloud.google.com/go/workflows/executions/apiv1": { + "distribution_name": "cloud.google.com/go/workflows/executions/apiv1", + "description": "Workflow Executions API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/workflows/executions/apiv1", + "release_level": "beta", + "library_type": "" + }, "cloud.google.com/go/workflows/executions/apiv1beta": { "distribution_name": "cloud.google.com/go/workflows/executions/apiv1beta", "description": "Workflow Executions API", diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index 00a09169a041..c0c4fb663e2b 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -5,6 +5,6 @@ go 1.15 require ( cloud.google.com/go v0.84.0 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index 5cb73adaa907..a536cf14e914 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -446,8 +446,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index 50df88ef0475..acc420a8cb64 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -7,5 +7,5 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index e8c633cd3dde..6869245539fc 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -95,8 +95,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/gapicgen/go.mod b/internal/gapicgen/go.mod index 9130fbdb720b..05519980cae5 100644 --- a/internal/gapicgen/go.mod +++ b/internal/gapicgen/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/protobuf v1.27.1 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/internal/gapicgen/go.sum b/internal/gapicgen/go.sum index 0a16bd5b57e5..caf147b10f43 100644 --- a/internal/gapicgen/go.sum +++ b/internal/gapicgen/go.sum @@ -503,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/generated/snippets/dataflow/apiv1beta3/FlexTemplatesClient/LaunchFlexTemplate/main.go b/internal/generated/snippets/dataflow/apiv1beta3/FlexTemplatesClient/LaunchFlexTemplate/main.go new file mode 100644 index 000000000000..cd47c65b129f --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/FlexTemplatesClient/LaunchFlexTemplate/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewFlexTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.LaunchFlexTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LaunchFlexTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_FlexTemplatesService_LaunchFlexTemplate_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/AggregatedListJobs/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/AggregatedListJobs/main.go new file mode 100644 index 000000000000..1cdb96de836b --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/AggregatedListJobs/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.AggregatedListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_AggregatedListJobs_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CheckActiveJobs/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CheckActiveJobs/main.go new file mode 100644 index 000000000000..30533616e1cc --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CheckActiveJobs/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CheckActiveJobsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CheckActiveJobs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_CheckActiveJobs_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CreateJob/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CreateJob/main.go new file mode 100644 index 000000000000..32087203c33c --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/CreateJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CreateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_CreateJob_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/GetJob/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/GetJob/main.go new file mode 100644 index 000000000000..8a57334e4a10 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/GetJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_GetJob_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_GetJob_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/ListJobs/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/ListJobs/main.go new file mode 100644 index 000000000000..81dd44e621fe --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/ListJobs/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_ListJobs_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/SnapshotJob/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/SnapshotJob/main.go new file mode 100644 index 000000000000..be232a1cadc3 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/SnapshotJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.SnapshotJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SnapshotJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_SnapshotJob_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/UpdateJob/main.go b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/UpdateJob/main.go new file mode 100644 index 000000000000..5e4912c751ee --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/JobsV1Beta3Client/UpdateJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewJobsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.UpdateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_JobsV1Beta3_UpdateJob_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/MessagesV1Beta3Client/ListJobMessages/main.go b/internal/generated/snippets/dataflow/apiv1beta3/MessagesV1Beta3Client/ListJobMessages/main.go new file mode 100644 index 000000000000..f1c51e885ed0 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/MessagesV1Beta3Client/ListJobMessages/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewMessagesV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListJobMessagesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobMessages(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataflow_v1beta3_generated_MessagesV1Beta3_ListJobMessages_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobExecutionDetails/main.go b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobExecutionDetails/main.go new file mode 100644 index 000000000000..92445f656124 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobExecutionDetails/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobExecutionDetailsRequest{ + // TODO: Fill request struct fields. + } + it := c.GetJobExecutionDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobExecutionDetails_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobMetrics/main.go b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobMetrics/main.go new file mode 100644 index 000000000000..accdb4ba03a5 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetJobMetrics/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetJobMetricsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJobMetrics(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_MetricsV1Beta3_GetJobMetrics_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetStageExecutionDetails/main.go b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetStageExecutionDetails/main.go new file mode 100644 index 000000000000..fcb77b62f805 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/MetricsV1Beta3Client/GetStageExecutionDetails/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + "google.golang.org/api/iterator" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewMetricsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetStageExecutionDetailsRequest{ + // TODO: Fill request struct fields. + } + it := c.GetStageExecutionDetails(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataflow_v1beta3_generated_MetricsV1Beta3_GetStageExecutionDetails_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/DeleteSnapshot/main.go b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/DeleteSnapshot/main.go new file mode 100644 index 000000000000..cd6f98438f63 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/DeleteSnapshot/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.DeleteSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_SnapshotsV1Beta3_DeleteSnapshot_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/GetSnapshot/main.go b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/GetSnapshot/main.go new file mode 100644 index 000000000000..bddb53d155fb --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/GetSnapshot/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_SnapshotsV1Beta3_GetSnapshot_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/ListSnapshots/main.go b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/ListSnapshots/main.go new file mode 100644 index 000000000000..5a0542fea0ab --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/SnapshotsV1Beta3Client/ListSnapshots/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.ListSnapshotsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListSnapshots(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_SnapshotsV1Beta3_ListSnapshots_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/CreateJobFromTemplate/main.go b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/CreateJobFromTemplate/main.go new file mode 100644 index 000000000000..861997eb98ec --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/CreateJobFromTemplate/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.CreateJobFromTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJobFromTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_TemplatesService_CreateJobFromTemplate_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/GetTemplate/main.go b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/GetTemplate/main.go new file mode 100644 index 000000000000..e4c49448997d --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/GetTemplate/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_TemplatesService_GetTemplate_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.GetTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_TemplatesService_GetTemplate_sync] diff --git a/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/LaunchTemplate/main.go b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/LaunchTemplate/main.go new file mode 100644 index 000000000000..6331330a8a71 --- /dev/null +++ b/internal/generated/snippets/dataflow/apiv1beta3/TemplatesClient/LaunchTemplate/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_sync] + +package main + +import ( + "context" + + dataflow "cloud.google.com/go/dataflow/apiv1beta3" + dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3" +) + +func main() { + ctx := context.Background() + c, err := dataflow.NewTemplatesClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataflowpb.LaunchTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LaunchTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataflow_v1beta3_generated_TemplatesService_LaunchTemplate_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateConnectionProfile/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateConnectionProfile/main.go new file mode 100644 index 000000000000..e723189121cc --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateConnectionProfile/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/CreatePrivateConnection/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreatePrivateConnection/main.go new file mode 100644 index 000000000000..e7c955af5a10 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreatePrivateConnection/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreatePrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreatePrivateConnection(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateRoute/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateRoute/main.go new file mode 100644 index 000000000000..22f97c8e0ba7 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateRoute/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_CreateRoute_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateRouteRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateRoute(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_CreateRoute_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateStream/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateStream/main.go new file mode 100644 index 000000000000..f574bf4c3308 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/CreateStream/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_CreateStream_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.CreateStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_CreateStream_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteConnectionProfile/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteConnectionProfile/main.go new file mode 100644 index 000000000000..7cf078c85e11 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteConnectionProfile/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/DeletePrivateConnection/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeletePrivateConnection/main.go new file mode 100644 index 000000000000..3578a7bb0bbe --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeletePrivateConnection/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeletePrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeletePrivateConnection(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteRoute/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteRoute/main.go new file mode 100644 index 000000000000..9a9ddedb4e97 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteRoute/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteRouteRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteRoute(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END datastream_v1alpha1_generated_Datastream_DeleteRoute_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteStream/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteStream/main.go new file mode 100644 index 000000000000..4ca4c07c4148 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/DeleteStream/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_DeleteStream_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DeleteStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END datastream_v1alpha1_generated_Datastream_DeleteStream_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/DiscoverConnectionProfile/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/DiscoverConnectionProfile/main.go new file mode 100644 index 000000000000..e616aa7abff8 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/DiscoverConnectionProfile/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.DiscoverConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DiscoverConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchErrors/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchErrors/main.go new file mode 100644 index 000000000000..e5cd267aff73 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchErrors/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_FetchErrors_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.FetchErrorsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.FetchErrors(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_FetchErrors_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchStaticIps/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchStaticIps/main.go new file mode 100644 index 000000000000..deb583ac14ed --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/FetchStaticIps/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.FetchStaticIpsRequest{ + // TODO: Fill request struct fields. + } + it := c.FetchStaticIps(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/GetConnectionProfile/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetConnectionProfile/main.go new file mode 100644 index 000000000000..61392165af49 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetConnectionProfile/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/GetPrivateConnection/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetPrivateConnection/main.go new file mode 100644 index 000000000000..05cd5a6f28ee --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetPrivateConnection/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetPrivateConnectionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetPrivateConnection(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/GetRoute/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetRoute/main.go new file mode 100644 index 000000000000..67fd497cce2c --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetRoute/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_GetRoute_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetRouteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRoute(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_GetRoute_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/GetStream/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetStream/main.go new file mode 100644 index 000000000000..3f312d5ca986 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/GetStream/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_GetStream_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.GetStreamRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_GetStream_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/ListConnectionProfiles/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListConnectionProfiles/main.go new file mode 100644 index 000000000000..4b90347cbcc4 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListConnectionProfiles/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListConnectionProfilesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConnectionProfiles(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/ListPrivateConnections/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListPrivateConnections/main.go new file mode 100644 index 000000000000..b2c5a56afd97 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListPrivateConnections/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListPrivateConnectionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListPrivateConnections(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/ListRoutes/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListRoutes/main.go new file mode 100644 index 000000000000..c3e3964067b0 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListRoutes/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_ListRoutes_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListRoutesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListRoutes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END datastream_v1alpha1_generated_Datastream_ListRoutes_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/ListStreams/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListStreams/main.go new file mode 100644 index 000000000000..33a20779315d --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/ListStreams/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_ListStreams_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + "google.golang.org/api/iterator" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.ListStreamsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListStreams(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END datastream_v1alpha1_generated_Datastream_ListStreams_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateConnectionProfile/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateConnectionProfile/main.go new file mode 100644 index 000000000000..805f8dd36d4c --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateConnectionProfile/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.UpdateConnectionProfileRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateConnectionProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_sync] diff --git a/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateStream/main.go b/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateStream/main.go new file mode 100644 index 000000000000..f276bbfe4162 --- /dev/null +++ b/internal/generated/snippets/datastream/apiv1alpha1/Client/UpdateStream/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datastream_v1alpha1_generated_Datastream_UpdateStream_sync] + +package main + +import ( + "context" + + datastream "cloud.google.com/go/datastream/apiv1alpha1" + datastreampb "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1" +) + +func main() { + ctx := context.Background() + c, err := datastream.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datastreampb.UpdateStreamRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datastream_v1alpha1_generated_Datastream_UpdateStream_sync] diff --git a/internal/generated/snippets/eventarc/apiv1/Client/CreateTrigger/main.go b/internal/generated/snippets/eventarc/apiv1/Client/CreateTrigger/main.go new file mode 100644 index 000000000000..74fac44dd114 --- /dev/null +++ b/internal/generated/snippets/eventarc/apiv1/Client/CreateTrigger/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START eventarc_v1_generated_Eventarc_CreateTrigger_sync] + +package main + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func main() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.CreateTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END eventarc_v1_generated_Eventarc_CreateTrigger_sync] diff --git a/internal/generated/snippets/eventarc/apiv1/Client/DeleteTrigger/main.go b/internal/generated/snippets/eventarc/apiv1/Client/DeleteTrigger/main.go new file mode 100644 index 000000000000..0e75aeff8fbe --- /dev/null +++ b/internal/generated/snippets/eventarc/apiv1/Client/DeleteTrigger/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START eventarc_v1_generated_Eventarc_DeleteTrigger_sync] + +package main + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func main() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.DeleteTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END eventarc_v1_generated_Eventarc_DeleteTrigger_sync] diff --git a/internal/generated/snippets/eventarc/apiv1/Client/GetTrigger/main.go b/internal/generated/snippets/eventarc/apiv1/Client/GetTrigger/main.go new file mode 100644 index 000000000000..ff021d175a65 --- /dev/null +++ b/internal/generated/snippets/eventarc/apiv1/Client/GetTrigger/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START eventarc_v1_generated_Eventarc_GetTrigger_sync] + +package main + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func main() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.GetTriggerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END eventarc_v1_generated_Eventarc_GetTrigger_sync] diff --git a/internal/generated/snippets/eventarc/apiv1/Client/ListTriggers/main.go b/internal/generated/snippets/eventarc/apiv1/Client/ListTriggers/main.go new file mode 100644 index 000000000000..02fb96631e22 --- /dev/null +++ b/internal/generated/snippets/eventarc/apiv1/Client/ListTriggers/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START eventarc_v1_generated_Eventarc_ListTriggers_sync] + +package main + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + "google.golang.org/api/iterator" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func main() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.ListTriggersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTriggers(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END eventarc_v1_generated_Eventarc_ListTriggers_sync] diff --git a/internal/generated/snippets/eventarc/apiv1/Client/UpdateTrigger/main.go b/internal/generated/snippets/eventarc/apiv1/Client/UpdateTrigger/main.go new file mode 100644 index 000000000000..9b5748b2dfc4 --- /dev/null +++ b/internal/generated/snippets/eventarc/apiv1/Client/UpdateTrigger/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START eventarc_v1_generated_Eventarc_UpdateTrigger_sync] + +package main + +import ( + "context" + + eventarc "cloud.google.com/go/eventarc/apiv1" + eventarcpb "google.golang.org/genproto/googleapis/cloud/eventarc/v1" +) + +func main() { + ctx := context.Background() + c, err := eventarc.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &eventarcpb.UpdateTriggerRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END eventarc_v1_generated_Eventarc_UpdateTrigger_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index ffe17313edc1..23d7f936c8e2 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -32,5 +32,5 @@ require ( cloud.google.com/go/pubsublite v0.84.0 cloud.google.com/go/spanner v0.84.0 google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index c3d12cb8f302..4d8866856df4 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -134,8 +134,9 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/generated/snippets/workflows/executions/apiv1/Client/CancelExecution/main.go b/internal/generated/snippets/workflows/executions/apiv1/Client/CancelExecution/main.go new file mode 100644 index 000000000000..5b3b578c7e7e --- /dev/null +++ b/internal/generated/snippets/workflows/executions/apiv1/Client/CancelExecution/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START workflowexecutions_v1_generated_Executions_CancelExecution_sync] + +package main + +import ( + "context" + + executions "cloud.google.com/go/workflows/executions/apiv1" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" +) + +func main() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.CancelExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CancelExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END workflowexecutions_v1_generated_Executions_CancelExecution_sync] diff --git a/internal/generated/snippets/workflows/executions/apiv1/Client/CreateExecution/main.go b/internal/generated/snippets/workflows/executions/apiv1/Client/CreateExecution/main.go new file mode 100644 index 000000000000..6e897df78ff0 --- /dev/null +++ b/internal/generated/snippets/workflows/executions/apiv1/Client/CreateExecution/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START workflowexecutions_v1_generated_Executions_CreateExecution_sync] + +package main + +import ( + "context" + + executions "cloud.google.com/go/workflows/executions/apiv1" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" +) + +func main() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.CreateExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END workflowexecutions_v1_generated_Executions_CreateExecution_sync] diff --git a/internal/generated/snippets/workflows/executions/apiv1/Client/GetExecution/main.go b/internal/generated/snippets/workflows/executions/apiv1/Client/GetExecution/main.go new file mode 100644 index 000000000000..6cd08576fee3 --- /dev/null +++ b/internal/generated/snippets/workflows/executions/apiv1/Client/GetExecution/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START workflowexecutions_v1_generated_Executions_GetExecution_sync] + +package main + +import ( + "context" + + executions "cloud.google.com/go/workflows/executions/apiv1" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" +) + +func main() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.GetExecutionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END workflowexecutions_v1_generated_Executions_GetExecution_sync] diff --git a/internal/generated/snippets/workflows/executions/apiv1/Client/ListExecutions/main.go b/internal/generated/snippets/workflows/executions/apiv1/Client/ListExecutions/main.go new file mode 100644 index 000000000000..875a9825717b --- /dev/null +++ b/internal/generated/snippets/workflows/executions/apiv1/Client/ListExecutions/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 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 +// +// http://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 cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START workflowexecutions_v1_generated_Executions_ListExecutions_sync] + +package main + +import ( + "context" + + executions "cloud.google.com/go/workflows/executions/apiv1" + "google.golang.org/api/iterator" + executionspb "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1" +) + +func main() { + ctx := context.Background() + c, err := executions.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &executionspb.ListExecutionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListExecutions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END workflowexecutions_v1_generated_Executions_ListExecutions_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index a519bf7fe51f..390cdff2ac31 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -298,8 +298,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200827165113-ac2560b5e952/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/iot/apiv1/device_manager_client.go b/iot/apiv1/device_manager_client.go index f4eff633406f..fe512496d000 100644 --- a/iot/apiv1/device_manager_client.go +++ b/iot/apiv1/device_manager_client.go @@ -67,6 +67,7 @@ func defaultDeviceManagerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudiot.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudiot.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index cec8d20d98e5..3c0d3ab6fad4 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 06b3b2f3fefe..43162dae4321 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/key_management_client.go b/kms/apiv1/key_management_client.go index d68b1d5626f4..9f25b6d6fca2 100644 --- a/kms/apiv1/key_management_client.go +++ b/kms/apiv1/key_management_client.go @@ -74,6 +74,7 @@ func defaultKeyManagementGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudkms.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudkms.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 2e28b2a2ec65..67e00822880f 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1/language_client.go b/language/apiv1/language_client.go index 1eaca05eb5b5..2ab47ab42596 100644 --- a/language/apiv1/language_client.go +++ b/language/apiv1/language_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("language.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://language.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index 293b4a3a19e3..b2c16b145ee9 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/language_client.go b/language/apiv1beta2/language_client.go index 4cec1c63fb15..2b6e0ae509c0 100644 --- a/language/apiv1beta2/language_client.go +++ b/language/apiv1beta2/language_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("language.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://language.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/lifesciences/apiv2beta/doc.go b/lifesciences/apiv2beta/doc.go index 47994d7136bb..ffd83191ee90 100644 --- a/lifesciences/apiv2beta/doc.go +++ b/lifesciences/apiv2beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/lifesciences/apiv2beta/workflows_service_v2_beta_client.go b/lifesciences/apiv2beta/workflows_service_v2_beta_client.go index 1f4c81814a40..13dcac8ab09d 100644 --- a/lifesciences/apiv2beta/workflows_service_v2_beta_client.go +++ b/lifesciences/apiv2beta/workflows_service_v2_beta_client.go @@ -48,6 +48,7 @@ func defaultWorkflowsServiceV2BetaGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("lifesciences.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://lifesciences.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/logging/apiv2/config_client.go b/logging/apiv2/config_client.go index c61a17d2dd50..e6ff0a9a0d31 100644 --- a/logging/apiv2/config_client.go +++ b/logging/apiv2/config_client.go @@ -70,6 +70,7 @@ func defaultConfigGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://logging.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index 03ddaa30e6a4..157799f9ebb4 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/apiv2/logging_client.go b/logging/apiv2/logging_client.go index b937729eedb9..42c529d019ec 100644 --- a/logging/apiv2/logging_client.go +++ b/logging/apiv2/logging_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://logging.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/logging/apiv2/metrics_client.go b/logging/apiv2/metrics_client.go index c6c8fef46774..0eb53c5bf7b1 100644 --- a/logging/apiv2/metrics_client.go +++ b/logging/apiv2/metrics_client.go @@ -52,6 +52,7 @@ func defaultMetricsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://logging.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/logging/go.mod b/logging/go.mod index f86d8fcfe355..5842c20700ef 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -10,8 +10,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/logging/go.sum b/logging/go.sum index 5a67c1ea1d18..ccd16df4d1b7 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -253,7 +253,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -402,8 +401,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -455,9 +454,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index 6f783b4a3711..7aee7d39003e 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/longrunning/autogen/operations_client.go b/longrunning/autogen/operations_client.go index 72704acc4f80..4d96cbc08c3d 100644 --- a/longrunning/autogen/operations_client.go +++ b/longrunning/autogen/operations_client.go @@ -52,6 +52,7 @@ func defaultOperationsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("longrunning.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://longrunning.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/managedidentities/apiv1/doc.go b/managedidentities/apiv1/doc.go index a72b7b76bc75..6225a551cdd2 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/managedidentities/apiv1/managed_identities_client.go b/managedidentities/apiv1/managed_identities_client.go index 519bca9cd499..6f9f83464f48 100644 --- a/managedidentities/apiv1/managed_identities_client.go +++ b/managedidentities/apiv1/managed_identities_client.go @@ -59,6 +59,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("managedidentities.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://managedidentities.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/mediatranslation/apiv1beta1/doc.go b/mediatranslation/apiv1beta1/doc.go index 61521b5dc13e..8b6811bef261 100644 --- a/mediatranslation/apiv1beta1/doc.go +++ b/mediatranslation/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/mediatranslation/apiv1beta1/speech_translation_client.go b/mediatranslation/apiv1beta1/speech_translation_client.go index 22e27a76ebd7..3108120637cb 100644 --- a/mediatranslation/apiv1beta1/speech_translation_client.go +++ b/mediatranslation/apiv1beta1/speech_translation_client.go @@ -42,6 +42,7 @@ func defaultSpeechTranslationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("mediatranslation.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://mediatranslation.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/memcache/apiv1/cloud_memcache_client.go b/memcache/apiv1/cloud_memcache_client.go index 21433cb99458..0980f4432934 100644 --- a/memcache/apiv1/cloud_memcache_client.go +++ b/memcache/apiv1/cloud_memcache_client.go @@ -56,6 +56,7 @@ func defaultCloudMemcacheGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("memcache.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://memcache.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/memcache/apiv1/doc.go b/memcache/apiv1/doc.go index a20fc3620c59..53c4fa8bf595 100644 --- a/memcache/apiv1/doc.go +++ b/memcache/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1beta2/cloud_memcache_client.go b/memcache/apiv1beta2/cloud_memcache_client.go index 5524ec0b0938..02c60899004e 100644 --- a/memcache/apiv1beta2/cloud_memcache_client.go +++ b/memcache/apiv1beta2/cloud_memcache_client.go @@ -57,6 +57,7 @@ func defaultCloudMemcacheGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("memcache.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://memcache.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/memcache/apiv1beta2/doc.go b/memcache/apiv1beta2/doc.go index 7200a3862d47..f4fcbf8e7af2 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1/dataproc_metastore_client.go b/metastore/apiv1/dataproc_metastore_client.go index 626216134b81..4563813e357e 100644 --- a/metastore/apiv1/dataproc_metastore_client.go +++ b/metastore/apiv1/dataproc_metastore_client.go @@ -60,6 +60,7 @@ func defaultDataprocMetastoreGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("metastore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://metastore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/metastore/apiv1/doc.go b/metastore/apiv1/doc.go index d5416465e8ce..30a894666f87 100644 --- a/metastore/apiv1/doc.go +++ b/metastore/apiv1/doc.go @@ -20,8 +20,6 @@ // The Dataproc Metastore API is used to manage the lifecycle and // configuration of metastore services. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -51,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1alpha/dataproc_metastore_client.go b/metastore/apiv1alpha/dataproc_metastore_client.go index 22c922a3e13e..dd5d147d91f5 100644 --- a/metastore/apiv1alpha/dataproc_metastore_client.go +++ b/metastore/apiv1alpha/dataproc_metastore_client.go @@ -65,6 +65,7 @@ func defaultDataprocMetastoreGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("metastore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://metastore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/metastore/apiv1alpha/doc.go b/metastore/apiv1alpha/doc.go index 96f60b3506c2..157b3d777239 100644 --- a/metastore/apiv1alpha/doc.go +++ b/metastore/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1beta/dataproc_metastore_client.go b/metastore/apiv1beta/dataproc_metastore_client.go index 15edd30c42a6..f949c53524e4 100644 --- a/metastore/apiv1beta/dataproc_metastore_client.go +++ b/metastore/apiv1beta/dataproc_metastore_client.go @@ -65,6 +65,7 @@ func defaultDataprocMetastoreGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("metastore.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://metastore.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/metastore/apiv1beta/doc.go b/metastore/apiv1beta/doc.go index d70b86ef8475..22c07e96de8c 100644 --- a/metastore/apiv1beta/doc.go +++ b/metastore/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/apiv3/v2/alert_policy_client.go b/monitoring/apiv3/v2/alert_policy_client.go index 08cbaea0f1d1..e875fec123ed 100644 --- a/monitoring/apiv3/v2/alert_policy_client.go +++ b/monitoring/apiv3/v2/alert_policy_client.go @@ -52,6 +52,7 @@ func defaultAlertPolicyGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index c4273f0d1c66..27fe565031fd 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/apiv3/v2/group_client.go b/monitoring/apiv3/v2/group_client.go index 3ee8f498ab8a..29291c164c63 100644 --- a/monitoring/apiv3/v2/group_client.go +++ b/monitoring/apiv3/v2/group_client.go @@ -54,6 +54,7 @@ func defaultGroupGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/metric_client.go b/monitoring/apiv3/v2/metric_client.go index f294f7e08ba6..59949cb7bfdb 100644 --- a/monitoring/apiv3/v2/metric_client.go +++ b/monitoring/apiv3/v2/metric_client.go @@ -57,6 +57,7 @@ func defaultMetricGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/notification_channel_client.go b/monitoring/apiv3/v2/notification_channel_client.go index b1f50db8b53e..a7d17a011055 100644 --- a/monitoring/apiv3/v2/notification_channel_client.go +++ b/monitoring/apiv3/v2/notification_channel_client.go @@ -57,6 +57,7 @@ func defaultNotificationChannelGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/query_client.go b/monitoring/apiv3/v2/query_client.go index e2f8cbba0abd..adef424e0021 100644 --- a/monitoring/apiv3/v2/query_client.go +++ b/monitoring/apiv3/v2/query_client.go @@ -46,6 +46,7 @@ func defaultQueryGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/service_monitoring_client.go b/monitoring/apiv3/v2/service_monitoring_client.go index 07cff2f8a410..84ad1a302f88 100644 --- a/monitoring/apiv3/v2/service_monitoring_client.go +++ b/monitoring/apiv3/v2/service_monitoring_client.go @@ -57,6 +57,7 @@ func defaultServiceMonitoringGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/apiv3/v2/uptime_check_client.go b/monitoring/apiv3/v2/uptime_check_client.go index 37634947dd21..cb9591d708e8 100644 --- a/monitoring/apiv3/v2/uptime_check_client.go +++ b/monitoring/apiv3/v2/uptime_check_client.go @@ -53,6 +53,7 @@ func defaultUptimeCheckGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/dashboard/apiv1/dashboards_client.go b/monitoring/dashboard/apiv1/dashboards_client.go index 70e39b89c8b1..3d0b2951c705 100644 --- a/monitoring/dashboard/apiv1/dashboards_client.go +++ b/monitoring/dashboard/apiv1/dashboards_client.go @@ -52,6 +52,7 @@ func defaultDashboardsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index e6039b0085c0..729b4640d952 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/networkconnectivity/apiv1alpha1/doc.go b/networkconnectivity/apiv1alpha1/doc.go index f9e121de6253..e60114823606 100644 --- a/networkconnectivity/apiv1alpha1/doc.go +++ b/networkconnectivity/apiv1alpha1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/networkconnectivity/apiv1alpha1/hub_client.go b/networkconnectivity/apiv1alpha1/hub_client.go index 20b4e2088e2f..21dda2292ef1 100644 --- a/networkconnectivity/apiv1alpha1/hub_client.go +++ b/networkconnectivity/apiv1alpha1/hub_client.go @@ -60,6 +60,7 @@ func defaultHubGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("networkconnectivity.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://networkconnectivity.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/notebooks/apiv1beta1/doc.go b/notebooks/apiv1beta1/doc.go index f47af480b545..0c93c0dcf6c7 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/notebooks/apiv1beta1/notebook_client.go b/notebooks/apiv1beta1/notebook_client.go index 58557df52d9c..dd8dc76fd891 100644 --- a/notebooks/apiv1beta1/notebook_client.go +++ b/notebooks/apiv1beta1/notebook_client.go @@ -68,6 +68,7 @@ func defaultNotebookGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("notebooks.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://notebooks.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/orgpolicy/apiv2/doc.go b/orgpolicy/apiv2/doc.go index 576f37df1669..d55489e4dec6 100644 --- a/orgpolicy/apiv2/doc.go +++ b/orgpolicy/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/orgpolicy/apiv2/org_policy_client.go b/orgpolicy/apiv2/org_policy_client.go index 53c4803ca714..d61e2ff57dd4 100644 --- a/orgpolicy/apiv2/org_policy_client.go +++ b/orgpolicy/apiv2/org_policy_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("orgpolicy.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://orgpolicy.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/osconfig/agentendpoint/apiv1/agent_endpoint_client.go b/osconfig/agentendpoint/apiv1/agent_endpoint_client.go index 90e9fdbb100b..ec28aef02c54 100644 --- a/osconfig/agentendpoint/apiv1/agent_endpoint_client.go +++ b/osconfig/agentendpoint/apiv1/agent_endpoint_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("osconfig.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://osconfig.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/osconfig/agentendpoint/apiv1/doc.go b/osconfig/agentendpoint/apiv1/doc.go index c79007e5f3d0..89b757f3fa24 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go b/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go index f66140bac7ee..67a079bc9fb0 100644 --- a/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go +++ b/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("osconfig.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://osconfig.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go index a6d659fcc8bb..10b866c4d9e4 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index ad284825e88f..7f30e0d4f362 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1/os_config_client.go b/osconfig/apiv1/os_config_client.go index 46398532f8ee..3da4c4e7d243 100644 --- a/osconfig/apiv1/os_config_client.go +++ b/osconfig/apiv1/os_config_client.go @@ -56,6 +56,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("osconfig.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://osconfig.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/osconfig/apiv1alpha/doc.go b/osconfig/apiv1alpha/doc.go index a60f17c6a53a..f536fe15e1b9 100644 --- a/osconfig/apiv1alpha/doc.go +++ b/osconfig/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1alpha/os_config_zonal_client.go b/osconfig/apiv1alpha/os_config_zonal_client.go index f97528abef37..05cd54e5c0f5 100644 --- a/osconfig/apiv1alpha/os_config_zonal_client.go +++ b/osconfig/apiv1alpha/os_config_zonal_client.go @@ -62,6 +62,7 @@ func defaultOsConfigZonalGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("osconfig.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://osconfig.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go index bd797ba1fcda..28a1bacd5f9b 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1beta/os_config_client.go b/osconfig/apiv1beta/os_config_client.go index 0a727347fc27..eed122d4b108 100644 --- a/osconfig/apiv1beta/os_config_client.go +++ b/osconfig/apiv1beta/os_config_client.go @@ -62,6 +62,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("osconfig.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://osconfig.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index d6e4f0131d35..29cd8bc06dda 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1/os_login_client.go b/oslogin/apiv1/os_login_client.go index 1594af36ba0b..7c8b2581864a 100644 --- a/oslogin/apiv1/os_login_client.go +++ b/oslogin/apiv1/os_login_client.go @@ -52,6 +52,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("oslogin.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://oslogin.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 14268a60b9d8..513a6d8f8315 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1beta/os_login_client.go b/oslogin/apiv1beta/os_login_client.go index 8e63d4706a8a..3bc85d090bff 100644 --- a/oslogin/apiv1beta/os_login_client.go +++ b/oslogin/apiv1beta/os_login_client.go @@ -52,6 +52,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("oslogin.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://oslogin.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index 27b119b671e7..f8d1981beb4f 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go b/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go index 64943acc5005..70769c204d2c 100644 --- a/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go +++ b/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go @@ -45,6 +45,7 @@ func defaultPhishingProtectionServiceV1Beta1GRPCClientOptions() []option.ClientO internaloption.WithDefaultMTLSEndpoint("phishingprotection.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://phishingprotection.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/policytroubleshooter/apiv1/doc.go b/policytroubleshooter/apiv1/doc.go index 3229d999a45e..98329ea8d120 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/policytroubleshooter/apiv1/iam_checker_client.go b/policytroubleshooter/apiv1/iam_checker_client.go index 47dcd1c9bb2c..e7286bb16e9d 100644 --- a/policytroubleshooter/apiv1/iam_checker_client.go +++ b/policytroubleshooter/apiv1/iam_checker_client.go @@ -43,6 +43,7 @@ func defaultIamCheckerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("policytroubleshooter.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://policytroubleshooter.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/privatecatalog/apiv1beta1/doc.go b/privatecatalog/apiv1beta1/doc.go index 2e2ed145a4cd..fc9e625eebb4 100644 --- a/privatecatalog/apiv1beta1/doc.go +++ b/privatecatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/privatecatalog/apiv1beta1/private_catalog_client.go b/privatecatalog/apiv1beta1/private_catalog_client.go index 9add8238b6f9..858e0a2a12a9 100644 --- a/privatecatalog/apiv1beta1/private_catalog_client.go +++ b/privatecatalog/apiv1beta1/private_catalog_client.go @@ -48,6 +48,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudprivatecatalog.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudprivatecatalog.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index 41af5aefd0e2..4f7c31c86b38 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/publisher_client.go b/pubsub/apiv1/publisher_client.go index ba42d687cbc5..c91def3a9059 100644 --- a/pubsub/apiv1/publisher_client.go +++ b/pubsub/apiv1/publisher_client.go @@ -60,6 +60,7 @@ func defaultPublisherGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsub.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsub.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsub/apiv1/schema_client.go b/pubsub/apiv1/schema_client.go index a66430ec0077..7d9774ef3f31 100644 --- a/pubsub/apiv1/schema_client.go +++ b/pubsub/apiv1/schema_client.go @@ -55,6 +55,7 @@ func defaultSchemaGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsub.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsub.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsub/apiv1/subscriber_client.go b/pubsub/apiv1/subscriber_client.go index be8b9908d6c1..eb78a4d41e87 100644 --- a/pubsub/apiv1/subscriber_client.go +++ b/pubsub/apiv1/subscriber_client.go @@ -67,6 +67,7 @@ func defaultSubscriberGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsub.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsub.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsub/go.mod b/pubsub/go.mod index ca89d5a3f3df..3b84c79b4a7d 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -11,8 +11,8 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index e1ca5a5cf44f..abf3e80d5431 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -249,7 +249,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -400,8 +399,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -453,9 +452,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/apiv1/admin_client.go b/pubsublite/apiv1/admin_client.go index 29181291c395..c4097fdcd549 100644 --- a/pubsublite/apiv1/admin_client.go +++ b/pubsublite/apiv1/admin_client.go @@ -69,6 +69,7 @@ func defaultAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/apiv1/cursor_client.go b/pubsublite/apiv1/cursor_client.go index aa07a7acc1cd..4bf0e3779a9c 100644 --- a/pubsublite/apiv1/cursor_client.go +++ b/pubsublite/apiv1/cursor_client.go @@ -50,6 +50,7 @@ func defaultCursorGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 8e6770380b53..facfd16cabce 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsublite/apiv1/partition_assignment_client.go b/pubsublite/apiv1/partition_assignment_client.go index 29b9ec8578f1..46fcdae435c8 100644 --- a/pubsublite/apiv1/partition_assignment_client.go +++ b/pubsublite/apiv1/partition_assignment_client.go @@ -42,6 +42,7 @@ func defaultPartitionAssignmentGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/apiv1/publisher_client.go b/pubsublite/apiv1/publisher_client.go index 41ed5b94ba0c..347220032526 100644 --- a/pubsublite/apiv1/publisher_client.go +++ b/pubsublite/apiv1/publisher_client.go @@ -42,6 +42,7 @@ func defaultPublisherGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/apiv1/subscriber_client.go b/pubsublite/apiv1/subscriber_client.go index 7b076748002a..995bc80c55e8 100644 --- a/pubsublite/apiv1/subscriber_client.go +++ b/pubsublite/apiv1/subscriber_client.go @@ -42,6 +42,7 @@ func defaultSubscriberGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/apiv1/topic_stats_client.go b/pubsublite/apiv1/topic_stats_client.go index 6b43a3a69bdd..dd1c5afc1cbd 100644 --- a/pubsublite/apiv1/topic_stats_client.go +++ b/pubsublite/apiv1/topic_stats_client.go @@ -48,6 +48,7 @@ func defaultTopicStatsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("pubsublite.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://pubsublite.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/pubsublite/go.mod b/pubsublite/go.mod index e632bb49b686..16fc15756cf0 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -11,8 +11,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index f57f8077c1e5..9c7faf2ef99a 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -255,8 +255,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -405,8 +405,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -460,9 +460,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index 90d720ca3e55..f71d43aa545f 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1/recaptcha_enterprise_client.go b/recaptchaenterprise/apiv1/recaptcha_enterprise_client.go index e656ee2a42a6..35c8184e0ade 100644 --- a/recaptchaenterprise/apiv1/recaptcha_enterprise_client.go +++ b/recaptchaenterprise/apiv1/recaptcha_enterprise_client.go @@ -53,6 +53,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("recaptchaenterprise.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://recaptchaenterprise.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index 80cb5e442135..f4a33838174b 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go b/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go index 3a154403baad..14f4f9d87897 100644 --- a/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go +++ b/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go @@ -53,6 +53,7 @@ func defaultRecaptchaEnterpriseServiceV1Beta1GRPCClientOptions() []option.Client internaloption.WithDefaultMTLSEndpoint("recaptchaenterprise.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://recaptchaenterprise.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go index 34cb493ec7a1..f487bf7ac7c2 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1/recommender_client.go b/recommender/apiv1/recommender_client.go index a6e5b228fa64..970818a5c335 100644 --- a/recommender/apiv1/recommender_client.go +++ b/recommender/apiv1/recommender_client.go @@ -55,6 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("recommender.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://recommender.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index 1df94bcdc528..439ea9ae9420 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1beta1/recommender_client.go b/recommender/apiv1beta1/recommender_client.go index 66b3632c9a23..78b7508dfc0d 100644 --- a/recommender/apiv1beta1/recommender_client.go +++ b/recommender/apiv1beta1/recommender_client.go @@ -55,6 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("recommender.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://recommender.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/redis/apiv1/cloud_redis_client.go b/redis/apiv1/cloud_redis_client.go index e5bd71f82981..513bb8ec2a57 100644 --- a/redis/apiv1/cloud_redis_client.go +++ b/redis/apiv1/cloud_redis_client.go @@ -58,6 +58,7 @@ func defaultCloudRedisGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("redis.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://redis.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index 40be1df0d29a..309eb9c97e9c 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1beta1/cloud_redis_client.go b/redis/apiv1beta1/cloud_redis_client.go index d739b5abe301..6d4ed1fe6b2a 100644 --- a/redis/apiv1beta1/cloud_redis_client.go +++ b/redis/apiv1beta1/cloud_redis_client.go @@ -59,6 +59,7 @@ func defaultCloudRedisGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("redis.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://redis.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index c9d684db7007..c11875d34c1d 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcemanager/apiv2/doc.go b/resourcemanager/apiv2/doc.go index 7c68c311aade..323ca943a43f 100644 --- a/resourcemanager/apiv2/doc.go +++ b/resourcemanager/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcemanager/apiv2/folders_client.go b/resourcemanager/apiv2/folders_client.go index f0436b3a02e0..647b4f421909 100644 --- a/resourcemanager/apiv2/folders_client.go +++ b/resourcemanager/apiv2/folders_client.go @@ -61,6 +61,7 @@ func defaultFoldersGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudresourcemanager.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudresourcemanager.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/resourcesettings/apiv1/doc.go b/resourcesettings/apiv1/doc.go index ace04f2ff04c..74794a8b9a5d 100644 --- a/resourcesettings/apiv1/doc.go +++ b/resourcesettings/apiv1/doc.go @@ -21,8 +21,6 @@ // of their GCP resources (e.g., VM, firewall, Project, etc.) across the // Cloud Resource Hierarchy. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -52,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcesettings/apiv1/resource_settings_client.go b/resourcesettings/apiv1/resource_settings_client.go index fd32386b65bc..90df08f74651 100644 --- a/resourcesettings/apiv1/resource_settings_client.go +++ b/resourcesettings/apiv1/resource_settings_client.go @@ -50,6 +50,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("resourcesettings.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://resourcesettings.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/retail/apiv2/catalog_client.go b/retail/apiv2/catalog_client.go index 062693c55d95..9dcf9fa8f79f 100644 --- a/retail/apiv2/catalog_client.go +++ b/retail/apiv2/catalog_client.go @@ -49,6 +49,7 @@ func defaultCatalogGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://retail.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go index b79f98340518..06b272ce5b1b 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/retail/apiv2/prediction_client.go b/retail/apiv2/prediction_client.go index a07bba9331da..6e0f384adcc6 100644 --- a/retail/apiv2/prediction_client.go +++ b/retail/apiv2/prediction_client.go @@ -46,6 +46,7 @@ func defaultPredictionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://retail.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/retail/apiv2/product_client.go b/retail/apiv2/product_client.go index 93054baf4145..44cb5bbc0ead 100644 --- a/retail/apiv2/product_client.go +++ b/retail/apiv2/product_client.go @@ -53,6 +53,7 @@ func defaultProductGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://retail.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/retail/apiv2/user_event_client.go b/retail/apiv2/user_event_client.go index 28f6e7ec2335..b4cc464f4f63 100644 --- a/retail/apiv2/user_event_client.go +++ b/retail/apiv2/user_event_client.go @@ -54,6 +54,7 @@ func defaultUserEventGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://retail.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/scheduler/apiv1/cloud_scheduler_client.go b/scheduler/apiv1/cloud_scheduler_client.go index 8c71458d9cc9..b8452e56e525 100644 --- a/scheduler/apiv1/cloud_scheduler_client.go +++ b/scheduler/apiv1/cloud_scheduler_client.go @@ -55,6 +55,7 @@ func defaultCloudSchedulerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudscheduler.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudscheduler.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index 796b6a156f73..b4576410e7a8 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1beta1/cloud_scheduler_client.go b/scheduler/apiv1beta1/cloud_scheduler_client.go index df096a802279..3c9e663d9788 100644 --- a/scheduler/apiv1beta1/cloud_scheduler_client.go +++ b/scheduler/apiv1beta1/cloud_scheduler_client.go @@ -55,6 +55,7 @@ func defaultCloudSchedulerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudscheduler.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudscheduler.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index 6bacfce11e19..6751ab7c0533 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index e6b672bcebde..1c0eb0450b70 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1/secret_manager_client.go b/secretmanager/apiv1/secret_manager_client.go index def41a41941b..eb17f812bed1 100644 --- a/secretmanager/apiv1/secret_manager_client.go +++ b/secretmanager/apiv1/secret_manager_client.go @@ -63,6 +63,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("secretmanager.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://secretmanager.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go index 2291878c721e..14e5b7cefdf9 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1beta1/secret_manager_client.go b/secretmanager/apiv1beta1/secret_manager_client.go index e7230938ef64..6a5dcab83957 100644 --- a/secretmanager/apiv1beta1/secret_manager_client.go +++ b/secretmanager/apiv1beta1/secret_manager_client.go @@ -63,6 +63,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("secretmanager.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://secretmanager.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/security/privateca/apiv1/certificate_authority_client.go b/security/privateca/apiv1/certificate_authority_client.go index 014e1f46527d..e85266267695 100644 --- a/security/privateca/apiv1/certificate_authority_client.go +++ b/security/privateca/apiv1/certificate_authority_client.go @@ -79,6 +79,7 @@ func defaultCertificateAuthorityGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("privateca.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://privateca.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/security/privateca/apiv1/doc.go b/security/privateca/apiv1/doc.go index b742d7d407b8..b905a6daf0fc 100644 --- a/security/privateca/apiv1/doc.go +++ b/security/privateca/apiv1/doc.go @@ -22,8 +22,6 @@ // private certificate authorities (CAs) while staying in control of your // private keys." // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -53,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1beta1/certificate_authority_client.go b/security/privateca/apiv1beta1/certificate_authority_client.go index b63606c9d87e..4f5f9c043e54 100644 --- a/security/privateca/apiv1beta1/certificate_authority_client.go +++ b/security/privateca/apiv1beta1/certificate_authority_client.go @@ -70,6 +70,7 @@ func defaultCertificateAuthorityGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("privateca.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://privateca.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/security/privateca/apiv1beta1/doc.go b/security/privateca/apiv1beta1/doc.go index 576b02875bcc..008aaa9c967a 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index 45e0e45ea5ad..bcd3fc0248be 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/security_center_client.go b/securitycenter/apiv1/security_center_client.go index 2472574f889b..f9fa23a6181f 100644 --- a/securitycenter/apiv1/security_center_client.go +++ b/securitycenter/apiv1/security_center_client.go @@ -75,6 +75,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("securitycenter.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://securitycenter.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index f52331442694..63d23ba9a0a6 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1beta1/security_center_client.go b/securitycenter/apiv1beta1/security_center_client.go index 2770a2c189a7..1068c0c2b9a3 100644 --- a/securitycenter/apiv1beta1/security_center_client.go +++ b/securitycenter/apiv1beta1/security_center_client.go @@ -70,6 +70,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("securitycenter.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://securitycenter.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/securitycenter/apiv1p1beta1/doc.go b/securitycenter/apiv1p1beta1/doc.go index 886323d2b359..f49364ff423b 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1p1beta1/security_center_client.go b/securitycenter/apiv1p1beta1/security_center_client.go index 3bbad64a6254..a61c3830b4ce 100644 --- a/securitycenter/apiv1p1beta1/security_center_client.go +++ b/securitycenter/apiv1p1beta1/security_center_client.go @@ -75,6 +75,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("securitycenter.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://securitycenter.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index 420f9b870517..9043c6fdb9d2 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/settings/apiv1beta1/security_center_settings_client.go b/securitycenter/settings/apiv1beta1/security_center_settings_client.go index ed95707e8e27..4e97fad52f43 100644 --- a/securitycenter/settings/apiv1beta1/security_center_settings_client.go +++ b/securitycenter/settings/apiv1beta1/security_center_settings_client.go @@ -60,6 +60,7 @@ func defaultSecurityCenterSettingsGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("securitycenter.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://securitycenter.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicecontrol/apiv1/doc.go b/servicecontrol/apiv1/doc.go index 4f98398eb1ad..790142cb65ae 100644 --- a/servicecontrol/apiv1/doc.go +++ b/servicecontrol/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210629" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicecontrol/apiv1/quota_controller_client.go b/servicecontrol/apiv1/quota_controller_client.go index da8125e0393d..d8fe6b93b861 100644 --- a/servicecontrol/apiv1/quota_controller_client.go +++ b/servicecontrol/apiv1/quota_controller_client.go @@ -44,6 +44,7 @@ func defaultQuotaControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicecontrol.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicecontrol.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicecontrol/apiv1/service_controller_client.go b/servicecontrol/apiv1/service_controller_client.go index 019856243421..6755e31039aa 100644 --- a/servicecontrol/apiv1/service_controller_client.go +++ b/servicecontrol/apiv1/service_controller_client.go @@ -45,6 +45,7 @@ func defaultServiceControllerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicecontrol.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicecontrol.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go index e6d205a52980..991a0be48e2a 100644 --- a/servicedirectory/apiv1/doc.go +++ b/servicedirectory/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1/lookup_client.go b/servicedirectory/apiv1/lookup_client.go index 703884d96129..c11a74ac8d40 100644 --- a/servicedirectory/apiv1/lookup_client.go +++ b/servicedirectory/apiv1/lookup_client.go @@ -46,6 +46,7 @@ func defaultLookupGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicedirectory.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicedirectory.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicedirectory/apiv1/registration_client.go b/servicedirectory/apiv1/registration_client.go index 84a6433bb106..00256e4996e5 100644 --- a/servicedirectory/apiv1/registration_client.go +++ b/servicedirectory/apiv1/registration_client.go @@ -66,6 +66,7 @@ func defaultRegistrationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicedirectory.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicedirectory.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicedirectory/apiv1beta1/doc.go b/servicedirectory/apiv1beta1/doc.go index 84eaaa761a1c..b63b25ff36d2 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1beta1/lookup_client.go b/servicedirectory/apiv1beta1/lookup_client.go index 5d2aa982639b..c0ff1660231f 100644 --- a/servicedirectory/apiv1beta1/lookup_client.go +++ b/servicedirectory/apiv1beta1/lookup_client.go @@ -46,6 +46,7 @@ func defaultLookupGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicedirectory.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicedirectory.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicedirectory/apiv1beta1/registration_client.go b/servicedirectory/apiv1beta1/registration_client.go index 793c87234f33..deda537b10e9 100644 --- a/servicedirectory/apiv1beta1/registration_client.go +++ b/servicedirectory/apiv1beta1/registration_client.go @@ -66,6 +66,7 @@ func defaultRegistrationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicedirectory.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicedirectory.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/servicemanagement/apiv1/doc.go b/servicemanagement/apiv1/doc.go index c756a1413098..a9a150052eb5 100644 --- a/servicemanagement/apiv1/doc.go +++ b/servicemanagement/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicemanagement/apiv1/service_manager_client.go b/servicemanagement/apiv1/service_manager_client.go index f667221e4960..c9ee320b88c9 100644 --- a/servicemanagement/apiv1/service_manager_client.go +++ b/servicemanagement/apiv1/service_manager_client.go @@ -65,6 +65,7 @@ func defaultServiceManagerGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("servicemanagement.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://servicemanagement.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/serviceusage/apiv1/doc.go b/serviceusage/apiv1/doc.go index 321e23d599dd..e3e2054b1f73 100644 --- a/serviceusage/apiv1/doc.go +++ b/serviceusage/apiv1/doc.go @@ -21,8 +21,6 @@ // Platform, lists the available or enabled services, or disables services // that service consumers no longer use. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -52,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/serviceusage/apiv1/service_usage_client.go b/serviceusage/apiv1/service_usage_client.go index 6647a47d09a7..acba7fe148db 100644 --- a/serviceusage/apiv1/service_usage_client.go +++ b/serviceusage/apiv1/service_usage_client.go @@ -55,6 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("serviceusage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://serviceusage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/shell/apiv1/cloud_shell_client.go b/shell/apiv1/cloud_shell_client.go index 8917de486346..6f3affcf05ba 100644 --- a/shell/apiv1/cloud_shell_client.go +++ b/shell/apiv1/cloud_shell_client.go @@ -53,6 +53,7 @@ func defaultCloudShellGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudshell.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudshell.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/shell/apiv1/doc.go b/shell/apiv1/doc.go index 6e091e59893a..1f9641739593 100644 --- a/shell/apiv1/doc.go +++ b/shell/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/database/apiv1/database_admin_client.go b/spanner/admin/database/apiv1/database_admin_client.go index 01f8fa013037..6829ec0e5efd 100644 --- a/spanner/admin/database/apiv1/database_admin_client.go +++ b/spanner/admin/database/apiv1/database_admin_client.go @@ -68,6 +68,7 @@ func defaultDatabaseAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("spanner.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://spanner.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index 42f3fac44fc1..c31d02ef04eb 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index 792995f9482b..9aa40e6eab9f 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/instance/apiv1/instance_admin_client.go b/spanner/admin/instance/apiv1/instance_admin_client.go index 2353f7c498e1..a5441e56aaae 100644 --- a/spanner/admin/instance/apiv1/instance_admin_client.go +++ b/spanner/admin/instance/apiv1/instance_admin_client.go @@ -61,6 +61,7 @@ func defaultInstanceAdminGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("spanner.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://spanner.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index 2db56e4e302e..91c6e30ead7e 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/apiv1/spanner_client.go b/spanner/apiv1/spanner_client.go index 0ed8a259694b..1067e2f3885e 100644 --- a/spanner/apiv1/spanner_client.go +++ b/spanner/apiv1/spanner_client.go @@ -62,6 +62,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("spanner.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://spanner.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/spanner/go.mod b/spanner/go.mod index 18144dd61382..36160c00fc56 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -9,8 +9,8 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/spanner/go.sum b/spanner/go.sum index 8b897debcbfc..9e44f7fc0b63 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -249,8 +249,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1 h1:x622Z2o4hgCr/4CiKWc51jHVKaWdtVpBNmEI8wI9Qns= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -396,8 +396,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -449,9 +449,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index 897c3a18ea12..9457d7d7a5a0 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1/speech_client.go b/speech/apiv1/speech_client.go index a14239940c33..c418232d7e98 100644 --- a/speech/apiv1/speech_client.go +++ b/speech/apiv1/speech_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("speech.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://speech.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/speech/apiv1p1beta1/adaptation_client.go b/speech/apiv1p1beta1/adaptation_client.go index 9c1348c84f74..4c75b8e46c5e 100644 --- a/speech/apiv1p1beta1/adaptation_client.go +++ b/speech/apiv1p1beta1/adaptation_client.go @@ -55,6 +55,7 @@ func defaultAdaptationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("speech.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://speech.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 9d0317a959de..3da928467c2b 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1p1beta1/speech_client.go b/speech/apiv1p1beta1/speech_client.go index 115574e5ee03..32decf2ba5a2 100644 --- a/speech/apiv1p1beta1/speech_client.go +++ b/speech/apiv1p1beta1/speech_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("speech.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://speech.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/storage/go.mod b/storage/go.mod index 0e0c8018e85c..9bc831475036 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -9,7 +9,7 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 - google.golang.org/api v0.49.0 - google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 + google.golang.org/api v0.50.0 + google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 google.golang.org/grpc v1.38.0 ) diff --git a/storage/go.sum b/storage/go.sum index cf41d224d751..936f162bac73 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -252,7 +252,6 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -400,8 +399,8 @@ google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBz google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -453,9 +452,9 @@ google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 h1:H/uPzsolsGjhl3CVT6Wb7bK+mf+hmkEvUVu+FBKyNlc= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/storage/internal/apiv1/doc.go b/storage/internal/apiv1/doc.go index ea45239e75cf..3a6b9595fde1 100644 --- a/storage/internal/apiv1/doc.go +++ b/storage/internal/apiv1/doc.go @@ -19,6 +19,8 @@ // // Lets you store and retrieve potentially-large, immutable data objects. // +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -48,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "UNKNOWN" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4/company_client.go b/talent/apiv4/company_client.go index 9466b8deb75f..5ab5da229ef7 100644 --- a/talent/apiv4/company_client.go +++ b/talent/apiv4/company_client.go @@ -52,6 +52,7 @@ func defaultCompanyGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4/completion_client.go b/talent/apiv4/completion_client.go index b87afb21b22f..86e33e837666 100644 --- a/talent/apiv4/completion_client.go +++ b/talent/apiv4/completion_client.go @@ -46,6 +46,7 @@ func defaultCompletionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index fd584b935671..80d229064f90 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4/event_client.go b/talent/apiv4/event_client.go index ae43881bb5db..24a7b46360a4 100644 --- a/talent/apiv4/event_client.go +++ b/talent/apiv4/event_client.go @@ -45,6 +45,7 @@ func defaultEventGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4/job_client.go b/talent/apiv4/job_client.go index a47197170b86..835d0bd99572 100644 --- a/talent/apiv4/job_client.go +++ b/talent/apiv4/job_client.go @@ -60,6 +60,7 @@ func defaultJobGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4/tenant_client.go b/talent/apiv4/tenant_client.go index d12b895a2318..5e7623443b55 100644 --- a/talent/apiv4/tenant_client.go +++ b/talent/apiv4/tenant_client.go @@ -52,6 +52,7 @@ func defaultTenantGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/application_client.go b/talent/apiv4beta1/application_client.go index ffd562915c2a..aaf972f68f47 100644 --- a/talent/apiv4beta1/application_client.go +++ b/talent/apiv4beta1/application_client.go @@ -52,6 +52,7 @@ func defaultApplicationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/company_client.go b/talent/apiv4beta1/company_client.go index 6e2f976e7940..0d1ff8027e2b 100644 --- a/talent/apiv4beta1/company_client.go +++ b/talent/apiv4beta1/company_client.go @@ -52,6 +52,7 @@ func defaultCompanyGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/completion_client.go b/talent/apiv4beta1/completion_client.go index 9ce07f67213d..47ee671726ff 100644 --- a/talent/apiv4beta1/completion_client.go +++ b/talent/apiv4beta1/completion_client.go @@ -46,6 +46,7 @@ func defaultCompletionGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index ffb43e644cfb..1d595b4bfa4c 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4beta1/event_client.go b/talent/apiv4beta1/event_client.go index 0b4fb355e95e..bd75be01c44c 100644 --- a/talent/apiv4beta1/event_client.go +++ b/talent/apiv4beta1/event_client.go @@ -45,6 +45,7 @@ func defaultEventGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/job_client.go b/talent/apiv4beta1/job_client.go index 82361f32844f..6b177c3802de 100644 --- a/talent/apiv4beta1/job_client.go +++ b/talent/apiv4beta1/job_client.go @@ -60,6 +60,7 @@ func defaultJobGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/profile_client.go b/talent/apiv4beta1/profile_client.go index 107ddff8bad5..059aa352933b 100644 --- a/talent/apiv4beta1/profile_client.go +++ b/talent/apiv4beta1/profile_client.go @@ -53,6 +53,7 @@ func defaultProfileGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/talent/apiv4beta1/tenant_client.go b/talent/apiv4beta1/tenant_client.go index 0a387119e50c..c3e95c8afc19 100644 --- a/talent/apiv4beta1/tenant_client.go +++ b/talent/apiv4beta1/tenant_client.go @@ -52,6 +52,7 @@ func defaultTenantGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("jobs.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://jobs.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index 14ec6d91de77..97ce4c977a51 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/texttospeech/apiv1/text_to_speech_client.go b/texttospeech/apiv1/text_to_speech_client.go index 6d13f31d4bac..aae16301c18f 100644 --- a/texttospeech/apiv1/text_to_speech_client.go +++ b/texttospeech/apiv1/text_to_speech_client.go @@ -45,6 +45,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("texttospeech.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://texttospeech.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/tpu/apiv1/doc.go b/tpu/apiv1/doc.go index cfebc7eb24d6..5b6b64837151 100644 --- a/tpu/apiv1/doc.go +++ b/tpu/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/tpu/apiv1/tpu_client.go b/tpu/apiv1/tpu_client.go index ba66f1e388c4..6852cce80a5c 100644 --- a/tpu/apiv1/tpu_client.go +++ b/tpu/apiv1/tpu_client.go @@ -60,6 +60,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("tpu.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://tpu.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index 407e7783902f..90f7779e41d2 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv1/trace_client.go b/trace/apiv1/trace_client.go index 3b06fbf58459..f9ad4b2a1303 100644 --- a/trace/apiv1/trace_client.go +++ b/trace/apiv1/trace_client.go @@ -50,6 +50,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudtrace.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudtrace.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index 7929e74396df..c24cb4af159a 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv2/trace_client.go b/trace/apiv2/trace_client.go index e0b33f60c755..3159d1fbd657 100644 --- a/trace/apiv2/trace_client.go +++ b/trace/apiv2/trace_client.go @@ -47,6 +47,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("cloudtrace.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://cloudtrace.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index 498366c5a4e0..04cb0f9e719e 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/translate/apiv3/translation_client.go b/translate/apiv3/translation_client.go index e13dc053ae55..d350b0276f58 100644 --- a/translate/apiv3/translation_client.go +++ b/translate/apiv3/translation_client.go @@ -58,6 +58,7 @@ func defaultTranslationGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("translate.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://translate.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/video/transcoder/apiv1beta1/doc.go b/video/transcoder/apiv1beta1/doc.go index 71dcd8bbf55a..0bd836c86096 100644 --- a/video/transcoder/apiv1beta1/doc.go +++ b/video/transcoder/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/video/transcoder/apiv1beta1/transcoder_client.go b/video/transcoder/apiv1beta1/transcoder_client.go index d7ab587b238f..8bf2e8ceb155 100644 --- a/video/transcoder/apiv1beta1/transcoder_client.go +++ b/video/transcoder/apiv1beta1/transcoder_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("transcoder.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://transcoder.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index 9c4cc354253f..830d968e4a2d 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1/video_intelligence_client.go b/videointelligence/apiv1/video_intelligence_client.go index 1f113b788653..1cb25f30be7f 100644 --- a/videointelligence/apiv1/video_intelligence_client.go +++ b/videointelligence/apiv1/video_intelligence_client.go @@ -47,6 +47,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("videointelligence.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://videointelligence.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index 5e585c32abd8..65d81c707343 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1beta2/video_intelligence_client.go b/videointelligence/apiv1beta2/video_intelligence_client.go index f33c1ece815e..d83c966514b1 100644 --- a/videointelligence/apiv1beta2/video_intelligence_client.go +++ b/videointelligence/apiv1beta2/video_intelligence_client.go @@ -47,6 +47,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("videointelligence.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://videointelligence.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index 40a388e6fa1c..74aa0a134b6c 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1/image_annotator_client.go b/vision/apiv1/image_annotator_client.go index c2b8198f946d..2d0f169cf583 100644 --- a/vision/apiv1/image_annotator_client.go +++ b/vision/apiv1/image_annotator_client.go @@ -52,6 +52,7 @@ func defaultImageAnnotatorGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("vision.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://vision.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/vision/apiv1/product_search_client.go b/vision/apiv1/product_search_client.go index 4cb9a6256300..695b7553b04e 100644 --- a/vision/apiv1/product_search_client.go +++ b/vision/apiv1/product_search_client.go @@ -69,6 +69,7 @@ func defaultProductSearchGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("vision.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://vision.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index 702b6762f5be..806c795fda5c 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1p1beta1/image_annotator_client.go b/vision/apiv1p1beta1/image_annotator_client.go index ba8fcbd3cc2f..13c3299477a2 100644 --- a/vision/apiv1p1beta1/image_annotator_client.go +++ b/vision/apiv1p1beta1/image_annotator_client.go @@ -44,6 +44,7 @@ func defaultImageAnnotatorGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("vision.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://vision.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/vpcaccess/apiv1/doc.go b/vpcaccess/apiv1/doc.go index d4324508ed14..3cc5efa3233b 100644 --- a/vpcaccess/apiv1/doc.go +++ b/vpcaccess/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vpcaccess/apiv1/vpc_access_client.go b/vpcaccess/apiv1/vpc_access_client.go index 6064885a8ee1..f1a0dee1e7fd 100644 --- a/vpcaccess/apiv1/vpc_access_client.go +++ b/vpcaccess/apiv1/vpc_access_client.go @@ -53,6 +53,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("vpcaccess.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://vpcaccess.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/webrisk/apiv1/doc.go b/webrisk/apiv1/doc.go index 466d0d464f63..05153fe95905 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1/web_risk_client.go b/webrisk/apiv1/web_risk_client.go index a0bf0628c112..96c72b018f63 100644 --- a/webrisk/apiv1/web_risk_client.go +++ b/webrisk/apiv1/web_risk_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("webrisk.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://webrisk.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index 4747efdf6b93..9eead0d77c49 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go b/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go index 346b784f0702..639818d30a08 100644 --- a/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go +++ b/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go @@ -46,6 +46,7 @@ func defaultWebRiskServiceV1Beta1GRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("webrisk.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://webrisk.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/websecurityscanner/apiv1/doc.go b/websecurityscanner/apiv1/doc.go index a0d4a10a859b..ce6539a3d194 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/websecurityscanner/apiv1/web_security_scanner_client.go b/websecurityscanner/apiv1/web_security_scanner_client.go index 42bdb777dd89..02474402de75 100644 --- a/websecurityscanner/apiv1/web_security_scanner_client.go +++ b/websecurityscanner/apiv1/web_security_scanner_client.go @@ -60,6 +60,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("websecurityscanner.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://websecurityscanner.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/workflows/apiv1beta/doc.go b/workflows/apiv1beta/doc.go index 5d122965998d..54b8d3320174 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/apiv1beta/workflows_client.go b/workflows/apiv1beta/workflows_client.go index 741652714de2..9169f065f0c5 100644 --- a/workflows/apiv1beta/workflows_client.go +++ b/workflows/apiv1beta/workflows_client.go @@ -54,6 +54,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("workflows.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://workflows.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/workflows/executions/apiv1beta/doc.go b/workflows/executions/apiv1beta/doc.go index 2df764e3581c..c358413800a5 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210624" +const versionClient = "20210630" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/executions/apiv1beta/executions_client.go b/workflows/executions/apiv1beta/executions_client.go index 6140dabac94b..a074fd6e3b11 100644 --- a/workflows/executions/apiv1beta/executions_client.go +++ b/workflows/executions/apiv1beta/executions_client.go @@ -49,6 +49,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("workflowexecutions.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://workflowexecutions.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), From 7aa0e195a5536dd060a1fca871bd3c6f946d935e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 1 Jul 2021 09:03:25 -0700 Subject: [PATCH 10/18] chore(all): auto-regenerate gapics (#4360) * chore(all): auto-regenerate gapics This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/629 Changes: feat(spanner/admin/database): add leader_options to InstanceConfig and default_leader to Database PiperOrigin-RevId: 382409094 Source-Link: https://github.com/googleapis/googleapis/commit/2c6e4dd22260e34403b468cc6d19aa43a9c684ed build(privatecatalog): name should be @google-cloud/private-cataglog PiperOrigin-RevId: 382382058 Source-Link: https://github.com/googleapis/googleapis/commit/b8b50f18a68f695a4623021b99d1901a6ebd3ec8 --- accessapproval/apiv1/doc.go | 2 +- accessapproval/apiv1/gapic_metadata.json | 50 +- aiplatform/apiv1/doc.go | 2 +- aiplatform/apiv1/gapic_metadata.json | 332 +++++------ analytics/admin/apiv1alpha/doc.go | 2 +- .../admin/apiv1alpha/gapic_metadata.json | 294 +++++----- analytics/data/apiv1alpha/doc.go | 2 +- analytics/data/apiv1alpha/gapic_metadata.json | 46 +- apigateway/apiv1/doc.go | 2 +- apigateway/apiv1/gapic_metadata.json | 82 +-- apigeeconnect/apiv1/doc.go | 2 +- apigeeconnect/apiv1/gapic_metadata.json | 40 +- appengine/apiv1/doc.go | 2 +- appengine/apiv1/gapic_metadata.json | 228 ++++---- area120/tables/apiv1alpha1/doc.go | 2 +- .../tables/apiv1alpha1/gapic_metadata.json | 70 +-- artifactregistry/apiv1beta2/doc.go | 2 +- .../apiv1beta2/gapic_metadata.json | 106 ++-- asset/apiv1/doc.go | 2 +- asset/apiv1/gapic_metadata.json | 70 +-- asset/apiv1p2beta1/doc.go | 2 +- asset/apiv1p2beta1/gapic_metadata.json | 42 +- asset/apiv1p5beta1/doc.go | 2 +- asset/apiv1p5beta1/gapic_metadata.json | 26 +- assuredworkloads/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 42 +- automl/apiv1/doc.go | 2 +- automl/apiv1/gapic_metadata.json | 112 ++-- automl/apiv1beta1/doc.go | 2 +- automl/apiv1beta1/gapic_metadata.json | 136 ++--- bigquery/connection/apiv1/doc.go | 2 +- bigquery/connection/apiv1/gapic_metadata.json | 54 +- bigquery/connection/apiv1beta1/doc.go | 2 +- .../connection/apiv1beta1/gapic_metadata.json | 58 +- bigquery/datatransfer/apiv1/doc.go | 2 +- .../datatransfer/apiv1/gapic_metadata.json | 78 +-- bigquery/go.mod | 2 +- bigquery/go.sum | 4 +- bigquery/reservation/apiv1/doc.go | 2 +- .../reservation/apiv1/gapic_metadata.json | 98 ++-- bigquery/reservation/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 98 ++-- bigquery/storage/apiv1/doc.go | 2 +- bigquery/storage/apiv1/gapic_metadata.json | 34 +- bigquery/storage/apiv1beta1/doc.go | 2 +- .../storage/apiv1beta1/gapic_metadata.json | 42 +- bigquery/storage/apiv1beta2/doc.go | 2 +- .../storage/apiv1beta2/gapic_metadata.json | 68 +-- billing/apiv1/doc.go | 2 +- billing/apiv1/gapic_metadata.json | 80 +-- billing/budgets/apiv1/doc.go | 2 +- billing/budgets/apiv1/gapic_metadata.json | 42 +- billing/budgets/apiv1beta1/doc.go | 2 +- .../budgets/apiv1beta1/gapic_metadata.json | 42 +- binaryauthorization/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 50 +- channel/apiv1/doc.go | 2 +- channel/apiv1/gapic_metadata.json | 158 +++--- cloudbuild/apiv1/v2/doc.go | 2 +- cloudbuild/apiv1/v2/gapic_metadata.json | 90 +-- clouddms/apiv1/doc.go | 2 +- clouddms/apiv1/gapic_metadata.json | 90 +-- cloudtasks/apiv2/doc.go | 2 +- cloudtasks/apiv2/gapic_metadata.json | 86 +-- cloudtasks/apiv2beta2/doc.go | 2 +- cloudtasks/apiv2beta2/gapic_metadata.json | 102 ++-- cloudtasks/apiv2beta3/doc.go | 2 +- cloudtasks/apiv2beta3/gapic_metadata.json | 86 +-- container/apiv1/doc.go | 2 +- container/apiv1/gapic_metadata.json | 150 ++--- containeranalysis/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 82 +-- datacatalog/apiv1/doc.go | 2 +- datacatalog/apiv1/gapic_metadata.json | 214 ++++---- datacatalog/apiv1beta1/doc.go | 2 +- datacatalog/apiv1beta1/gapic_metadata.json | 210 +++---- dataflow/apiv1beta3/doc.go | 2 +- dataflow/apiv1beta3/gapic_metadata.json | 144 ++--- datalabeling/apiv1beta1/doc.go | 2 +- datalabeling/apiv1beta1/gapic_metadata.json | 158 +++--- dataproc/apiv1/doc.go | 2 +- dataproc/apiv1/gapic_metadata.json | 160 +++--- dataproc/apiv1beta2/doc.go | 2 +- dataproc/apiv1beta2/gapic_metadata.json | 152 +++--- dataqna/apiv1alpha/doc.go | 2 +- dataqna/apiv1alpha/gapic_metadata.json | 56 +- datastore/admin/apiv1/doc.go | 2 +- datastore/admin/apiv1/gapic_metadata.json | 46 +- datastore/go.mod | 2 +- datastore/go.sum | 4 +- datastream/apiv1alpha1/doc.go | 2 +- datastream/apiv1alpha1/gapic_metadata.json | 106 ++-- debugger/apiv2/doc.go | 2 +- debugger/apiv2/gapic_metadata.json | 64 +-- dialogflow/apiv2/doc.go | 2 +- dialogflow/apiv2/gapic_metadata.json | 490 ++++++++--------- dialogflow/cx/apiv3/doc.go | 2 +- dialogflow/cx/apiv3/gapic_metadata.json | 516 +++++++++--------- dialogflow/cx/apiv3beta1/doc.go | 2 +- dialogflow/cx/apiv3beta1/gapic_metadata.json | 516 +++++++++--------- dlp/apiv2/doc.go | 2 +- dlp/apiv2/gapic_metadata.json | 158 +++--- documentai/apiv1/doc.go | 2 +- documentai/apiv1/gapic_metadata.json | 34 +- documentai/apiv1beta3/doc.go | 2 +- documentai/apiv1beta3/gapic_metadata.json | 58 +- domains/apiv1beta1/doc.go | 2 +- domains/apiv1beta1/gapic_metadata.json | 74 +-- errorreporting/apiv1beta1/doc.go | 2 +- errorreporting/apiv1beta1/gapic_metadata.json | 66 +-- essentialcontacts/apiv1/doc.go | 2 +- essentialcontacts/apiv1/gapic_metadata.json | 50 +- eventarc/apiv1/doc.go | 2 +- eventarc/apiv1/gapic_metadata.json | 42 +- firestore/apiv1/admin/doc.go | 2 +- firestore/apiv1/admin/gapic_metadata.json | 58 +- firestore/apiv1/doc.go | 2 +- firestore/apiv1/gapic_metadata.json | 82 +-- firestore/go.mod | 2 +- firestore/go.sum | 4 +- functions/apiv1/doc.go | 2 +- functions/apiv1/gapic_metadata.json | 66 +-- gaming/apiv1/doc.go | 2 +- gaming/apiv1/gapic_metadata.json | 160 +++--- gaming/apiv1beta/doc.go | 2 +- gaming/apiv1beta/gapic_metadata.json | 160 +++--- gkeconnect/gateway/apiv1beta1/doc.go | 2 +- .../gateway/apiv1beta1/gapic_metadata.json | 42 +- gkehub/apiv1beta1/doc.go | 2 +- gkehub/apiv1beta1/gapic_metadata.json | 54 +- go.mod | 2 +- go.sum | 4 +- gsuiteaddons/apiv1/doc.go | 2 +- gsuiteaddons/apiv1/gapic_metadata.json | 58 +- iam/credentials/apiv1/doc.go | 2 +- iam/credentials/apiv1/gapic_metadata.json | 38 +- .../CreateIosAppDataStream/main.go | 46 -- internal/generated/snippets/go.mod | 2 +- internal/generated/snippets/go.sum | 8 +- iot/apiv1/doc.go | 2 +- iot/apiv1/gapic_metadata.json | 98 ++-- kms/apiv1/doc.go | 2 +- kms/apiv1/gapic_metadata.json | 126 ++--- language/apiv1/doc.go | 2 +- language/apiv1/gapic_metadata.json | 46 +- language/apiv1beta2/doc.go | 2 +- language/apiv1beta2/gapic_metadata.json | 46 +- lifesciences/apiv2beta/doc.go | 2 +- lifesciences/apiv2beta/gapic_metadata.json | 26 +- logging/apiv2/doc.go | 2 +- logging/apiv2/gapic_metadata.json | 178 +++--- logging/go.mod | 2 +- logging/go.sum | 4 +- longrunning/autogen/doc.go | 2 +- longrunning/autogen/gapic_metadata.json | 42 +- managedidentities/apiv1/doc.go | 2 +- managedidentities/apiv1/gapic_metadata.json | 62 +-- mediatranslation/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 26 +- memcache/apiv1/doc.go | 2 +- memcache/apiv1/gapic_metadata.json | 50 +- memcache/apiv1beta2/doc.go | 2 +- memcache/apiv1beta2/gapic_metadata.json | 54 +- metastore/apiv1/doc.go | 2 +- metastore/apiv1/gapic_metadata.json | 62 +-- metastore/apiv1alpha/doc.go | 2 +- metastore/apiv1alpha/gapic_metadata.json | 82 +-- metastore/apiv1beta/doc.go | 2 +- metastore/apiv1beta/gapic_metadata.json | 82 +-- monitoring/apiv3/v2/doc.go | 2 +- monitoring/apiv3/v2/gapic_metadata.json | 266 ++++----- monitoring/dashboard/apiv1/doc.go | 2 +- .../dashboard/apiv1/gapic_metadata.json | 42 +- networkconnectivity/apiv1alpha1/doc.go | 2 +- .../apiv1alpha1/gapic_metadata.json | 62 +-- notebooks/apiv1beta1/doc.go | 2 +- notebooks/apiv1beta1/gapic_metadata.json | 98 ++-- orgpolicy/apiv2/doc.go | 2 +- orgpolicy/apiv2/gapic_metadata.json | 50 +- osconfig/agentendpoint/apiv1/doc.go | 2 +- .../agentendpoint/apiv1/gapic_metadata.json | 46 +- osconfig/agentendpoint/apiv1beta/doc.go | 2 +- .../apiv1beta/gapic_metadata.json | 46 +- osconfig/apiv1/doc.go | 2 +- osconfig/apiv1/gapic_metadata.json | 58 +- osconfig/apiv1alpha/doc.go | 2 +- osconfig/apiv1alpha/gapic_metadata.json | 70 +-- osconfig/apiv1beta/doc.go | 2 +- osconfig/apiv1beta/gapic_metadata.json | 82 +-- oslogin/apiv1/doc.go | 2 +- oslogin/apiv1/gapic_metadata.json | 46 +- oslogin/apiv1beta/doc.go | 2 +- oslogin/apiv1beta/gapic_metadata.json | 46 +- phishingprotection/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 26 +- policytroubleshooter/apiv1/doc.go | 2 +- .../apiv1/gapic_metadata.json | 26 +- privatecatalog/apiv1beta1/doc.go | 2 +- privatecatalog/apiv1beta1/gapic_metadata.json | 34 +- pubsub/apiv1/doc.go | 2 +- pubsub/apiv1/gapic_metadata.json | 202 +++---- pubsub/go.mod | 2 +- pubsub/go.sum | 4 +- pubsublite/apiv1/doc.go | 2 +- pubsublite/apiv1/gapic_metadata.json | 184 +++---- pubsublite/go.mod | 2 +- pubsublite/go.sum | 4 +- recaptchaenterprise/apiv1/doc.go | 2 +- recaptchaenterprise/apiv1/gapic_metadata.json | 50 +- recaptchaenterprise/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 50 +- recommender/apiv1/doc.go | 2 +- recommender/apiv1/gapic_metadata.json | 54 +- recommender/apiv1beta1/doc.go | 2 +- recommender/apiv1beta1/gapic_metadata.json | 54 +- redis/apiv1/doc.go | 2 +- redis/apiv1/gapic_metadata.json | 58 +- redis/apiv1beta1/doc.go | 2 +- redis/apiv1beta1/gapic_metadata.json | 58 +- resourcemanager/apiv2/doc.go | 2 +- resourcemanager/apiv2/gapic_metadata.json | 66 +-- resourcesettings/apiv1/doc.go | 2 +- resourcesettings/apiv1/gapic_metadata.json | 34 +- retail/apiv2/doc.go | 2 +- retail/apiv2/gapic_metadata.json | 104 ++-- scheduler/apiv1/doc.go | 2 +- scheduler/apiv1/gapic_metadata.json | 54 +- scheduler/apiv1beta1/doc.go | 2 +- scheduler/apiv1beta1/gapic_metadata.json | 54 +- secretmanager/apiv1/doc.go | 2 +- secretmanager/apiv1/gapic_metadata.json | 82 +-- secretmanager/apiv1beta1/doc.go | 2 +- secretmanager/apiv1beta1/gapic_metadata.json | 82 +-- security/privateca/apiv1/doc.go | 2 +- security/privateca/apiv1/gapic_metadata.json | 138 ++--- security/privateca/apiv1beta1/doc.go | 2 +- .../privateca/apiv1beta1/gapic_metadata.json | 102 ++-- securitycenter/apiv1/doc.go | 2 +- securitycenter/apiv1/gapic_metadata.json | 114 ++-- securitycenter/apiv1beta1/doc.go | 2 +- securitycenter/apiv1beta1/gapic_metadata.json | 94 ++-- securitycenter/apiv1p1beta1/doc.go | 2 +- .../apiv1p1beta1/gapic_metadata.json | 114 ++-- securitycenter/settings/apiv1beta1/doc.go | 2 +- .../settings/apiv1beta1/gapic_metadata.json | 74 +-- servicecontrol/apiv1/doc.go | 2 +- servicecontrol/apiv1/gapic_metadata.json | 44 +- servicedirectory/apiv1/doc.go | 2 +- servicedirectory/apiv1/gapic_metadata.json | 108 ++-- servicedirectory/apiv1beta1/doc.go | 2 +- .../apiv1beta1/gapic_metadata.json | 108 ++-- servicemanagement/apiv1/doc.go | 2 +- servicemanagement/apiv1/gapic_metadata.json | 82 +-- serviceusage/apiv1/doc.go | 2 +- serviceusage/apiv1/gapic_metadata.json | 46 +- shell/apiv1/doc.go | 2 +- shell/apiv1/gapic_metadata.json | 42 +- spanner/admin/database/apiv1/doc.go | 2 +- .../admin/database/apiv1/gapic_metadata.json | 90 +-- spanner/admin/instance/apiv1/doc.go | 2 +- .../admin/instance/apiv1/gapic_metadata.json | 62 +-- spanner/apiv1/doc.go | 2 +- spanner/apiv1/gapic_metadata.json | 82 +-- spanner/go.mod | 2 +- spanner/go.sum | 4 +- speech/apiv1/doc.go | 2 +- speech/apiv1/gapic_metadata.json | 34 +- speech/apiv1p1beta1/doc.go | 2 +- speech/apiv1p1beta1/gapic_metadata.json | 84 +-- storage/go.mod | 2 +- storage/go.sum | 4 +- storage/internal/apiv1/doc.go | 2 +- storage/internal/apiv1/gapic_metadata.json | 246 ++++----- talent/apiv4/doc.go | 2 +- talent/apiv4/gapic_metadata.json | 150 ++--- talent/apiv4beta1/doc.go | 2 +- talent/apiv4beta1/gapic_metadata.json | 214 ++++---- texttospeech/apiv1/doc.go | 2 +- texttospeech/apiv1/gapic_metadata.json | 30 +- tpu/apiv1/doc.go | 2 +- tpu/apiv1/gapic_metadata.json | 66 +-- trace/apiv1/doc.go | 2 +- trace/apiv1/gapic_metadata.json | 34 +- trace/apiv2/doc.go | 2 +- trace/apiv2/gapic_metadata.json | 30 +- translate/apiv3/doc.go | 2 +- translate/apiv3/gapic_metadata.json | 54 +- video/transcoder/apiv1beta1/doc.go | 2 +- .../transcoder/apiv1beta1/gapic_metadata.json | 54 +- videointelligence/apiv1/doc.go | 2 +- videointelligence/apiv1/gapic_metadata.json | 26 +- videointelligence/apiv1beta2/doc.go | 2 +- .../apiv1beta2/gapic_metadata.json | 26 +- vision/apiv1/doc.go | 2 +- vision/apiv1/gapic_metadata.json | 124 ++--- vision/apiv1p1beta1/doc.go | 2 +- vision/apiv1p1beta1/gapic_metadata.json | 26 +- vpcaccess/apiv1/doc.go | 2 +- vpcaccess/apiv1/gapic_metadata.json | 38 +- webrisk/apiv1/doc.go | 2 +- webrisk/apiv1/gapic_metadata.json | 38 +- webrisk/apiv1beta1/doc.go | 2 +- webrisk/apiv1beta1/gapic_metadata.json | 34 +- websecurityscanner/apiv1/doc.go | 2 +- websecurityscanner/apiv1/gapic_metadata.json | 74 +-- workflows/apiv1beta/doc.go | 2 +- workflows/apiv1beta/gapic_metadata.json | 42 +- workflows/executions/apiv1/doc.go | 2 +- .../executions/apiv1/gapic_metadata.json | 38 +- workflows/executions/apiv1beta/doc.go | 2 +- .../executions/apiv1beta/gapic_metadata.json | 38 +- 311 files changed, 6806 insertions(+), 6854 deletions(-) delete mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateIosAppDataStream/main.go diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index 4c149e1b44e4..aee0b5b99f4c 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/accessapproval/apiv1/gapic_metadata.json b/accessapproval/apiv1/gapic_metadata.json index 51393e9d3f18..25dd99519b28 100644 --- a/accessapproval/apiv1/gapic_metadata.json +++ b/accessapproval/apiv1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.accessapproval.v1", - "libraryPackage": "cloud.google.com/go/accessapproval/apiv1", - "services": { - "AccessApproval": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ApproveApprovalRequest": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.accessapproval.v1", + "libraryPackage": "cloud.google.com/go/accessapproval/apiv1", + "services": { + "AccessApproval": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ApproveApprovalRequest": { + "methods": [ "ApproveApprovalRequest" ] }, - "DeleteAccessApprovalSettings": { - "methods": [ + "DeleteAccessApprovalSettings": { + "methods": [ "DeleteAccessApprovalSettings" ] }, - "DismissApprovalRequest": { - "methods": [ + "DismissApprovalRequest": { + "methods": [ "DismissApprovalRequest" ] }, - "GetAccessApprovalSettings": { - "methods": [ + "GetAccessApprovalSettings": { + "methods": [ "GetAccessApprovalSettings" ] }, - "GetApprovalRequest": { - "methods": [ + "GetApprovalRequest": { + "methods": [ "GetApprovalRequest" ] }, - "ListApprovalRequests": { - "methods": [ + "ListApprovalRequests": { + "methods": [ "ListApprovalRequests" ] }, - "UpdateAccessApprovalSettings": { - "methods": [ + "UpdateAccessApprovalSettings": { + "methods": [ "UpdateAccessApprovalSettings" ] } diff --git a/aiplatform/apiv1/doc.go b/aiplatform/apiv1/doc.go index c78bb382cab8..ed83992c68fd 100644 --- a/aiplatform/apiv1/doc.go +++ b/aiplatform/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/aiplatform/apiv1/gapic_metadata.json b/aiplatform/apiv1/gapic_metadata.json index da1d3982b2a3..b0e687801dd7 100644 --- a/aiplatform/apiv1/gapic_metadata.json +++ b/aiplatform/apiv1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.aiplatform.v1", - "libraryPackage": "cloud.google.com/go/aiplatform/apiv1", - "services": { - "DatasetService": { - "clients": { - "grpc": { - "libraryClient": "DatasetClient", - "rpcs": { - "CreateDataset": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.aiplatform.v1", + "libraryPackage": "cloud.google.com/go/aiplatform/apiv1", + "services": { + "DatasetService": { + "clients": { + "grpc": { + "libraryClient": "DatasetClient", + "rpcs": { + "CreateDataset": { + "methods": [ "CreateDataset" ] }, - "DeleteDataset": { - "methods": [ + "DeleteDataset": { + "methods": [ "DeleteDataset" ] }, - "ExportData": { - "methods": [ + "ExportData": { + "methods": [ "ExportData" ] }, - "GetAnnotationSpec": { - "methods": [ + "GetAnnotationSpec": { + "methods": [ "GetAnnotationSpec" ] }, - "GetDataset": { - "methods": [ + "GetDataset": { + "methods": [ "GetDataset" ] }, - "ImportData": { - "methods": [ + "ImportData": { + "methods": [ "ImportData" ] }, - "ListAnnotations": { - "methods": [ + "ListAnnotations": { + "methods": [ "ListAnnotations" ] }, - "ListDataItems": { - "methods": [ + "ListDataItems": { + "methods": [ "ListDataItems" ] }, - "ListDatasets": { - "methods": [ + "ListDatasets": { + "methods": [ "ListDatasets" ] }, - "UpdateDataset": { - "methods": [ + "UpdateDataset": { + "methods": [ "UpdateDataset" ] } @@ -64,43 +64,43 @@ } } }, - "EndpointService": { - "clients": { - "grpc": { - "libraryClient": "EndpointClient", - "rpcs": { - "CreateEndpoint": { - "methods": [ + "EndpointService": { + "clients": { + "grpc": { + "libraryClient": "EndpointClient", + "rpcs": { + "CreateEndpoint": { + "methods": [ "CreateEndpoint" ] }, - "DeleteEndpoint": { - "methods": [ + "DeleteEndpoint": { + "methods": [ "DeleteEndpoint" ] }, - "DeployModel": { - "methods": [ + "DeployModel": { + "methods": [ "DeployModel" ] }, - "GetEndpoint": { - "methods": [ + "GetEndpoint": { + "methods": [ "GetEndpoint" ] }, - "ListEndpoints": { - "methods": [ + "ListEndpoints": { + "methods": [ "ListEndpoints" ] }, - "UndeployModel": { - "methods": [ + "UndeployModel": { + "methods": [ "UndeployModel" ] }, - "UpdateEndpoint": { - "methods": [ + "UpdateEndpoint": { + "methods": [ "UpdateEndpoint" ] } @@ -108,108 +108,108 @@ } } }, - "JobService": { - "clients": { - "grpc": { - "libraryClient": "JobClient", - "rpcs": { - "CancelBatchPredictionJob": { - "methods": [ + "JobService": { + "clients": { + "grpc": { + "libraryClient": "JobClient", + "rpcs": { + "CancelBatchPredictionJob": { + "methods": [ "CancelBatchPredictionJob" ] }, - "CancelCustomJob": { - "methods": [ + "CancelCustomJob": { + "methods": [ "CancelCustomJob" ] }, - "CancelDataLabelingJob": { - "methods": [ + "CancelDataLabelingJob": { + "methods": [ "CancelDataLabelingJob" ] }, - "CancelHyperparameterTuningJob": { - "methods": [ + "CancelHyperparameterTuningJob": { + "methods": [ "CancelHyperparameterTuningJob" ] }, - "CreateBatchPredictionJob": { - "methods": [ + "CreateBatchPredictionJob": { + "methods": [ "CreateBatchPredictionJob" ] }, - "CreateCustomJob": { - "methods": [ + "CreateCustomJob": { + "methods": [ "CreateCustomJob" ] }, - "CreateDataLabelingJob": { - "methods": [ + "CreateDataLabelingJob": { + "methods": [ "CreateDataLabelingJob" ] }, - "CreateHyperparameterTuningJob": { - "methods": [ + "CreateHyperparameterTuningJob": { + "methods": [ "CreateHyperparameterTuningJob" ] }, - "DeleteBatchPredictionJob": { - "methods": [ + "DeleteBatchPredictionJob": { + "methods": [ "DeleteBatchPredictionJob" ] }, - "DeleteCustomJob": { - "methods": [ + "DeleteCustomJob": { + "methods": [ "DeleteCustomJob" ] }, - "DeleteDataLabelingJob": { - "methods": [ + "DeleteDataLabelingJob": { + "methods": [ "DeleteDataLabelingJob" ] }, - "DeleteHyperparameterTuningJob": { - "methods": [ + "DeleteHyperparameterTuningJob": { + "methods": [ "DeleteHyperparameterTuningJob" ] }, - "GetBatchPredictionJob": { - "methods": [ + "GetBatchPredictionJob": { + "methods": [ "GetBatchPredictionJob" ] }, - "GetCustomJob": { - "methods": [ + "GetCustomJob": { + "methods": [ "GetCustomJob" ] }, - "GetDataLabelingJob": { - "methods": [ + "GetDataLabelingJob": { + "methods": [ "GetDataLabelingJob" ] }, - "GetHyperparameterTuningJob": { - "methods": [ + "GetHyperparameterTuningJob": { + "methods": [ "GetHyperparameterTuningJob" ] }, - "ListBatchPredictionJobs": { - "methods": [ + "ListBatchPredictionJobs": { + "methods": [ "ListBatchPredictionJobs" ] }, - "ListCustomJobs": { - "methods": [ + "ListCustomJobs": { + "methods": [ "ListCustomJobs" ] }, - "ListDataLabelingJobs": { - "methods": [ + "ListDataLabelingJobs": { + "methods": [ "ListDataLabelingJobs" ] }, - "ListHyperparameterTuningJobs": { - "methods": [ + "ListHyperparameterTuningJobs": { + "methods": [ "ListHyperparameterTuningJobs" ] } @@ -217,18 +217,18 @@ } } }, - "MigrationService": { - "clients": { - "grpc": { - "libraryClient": "MigrationClient", - "rpcs": { - "BatchMigrateResources": { - "methods": [ + "MigrationService": { + "clients": { + "grpc": { + "libraryClient": "MigrationClient", + "rpcs": { + "BatchMigrateResources": { + "methods": [ "BatchMigrateResources" ] }, - "SearchMigratableResources": { - "methods": [ + "SearchMigratableResources": { + "methods": [ "SearchMigratableResources" ] } @@ -236,58 +236,58 @@ } } }, - "ModelService": { - "clients": { - "grpc": { - "libraryClient": "ModelClient", - "rpcs": { - "DeleteModel": { - "methods": [ + "ModelService": { + "clients": { + "grpc": { + "libraryClient": "ModelClient", + "rpcs": { + "DeleteModel": { + "methods": [ "DeleteModel" ] }, - "ExportModel": { - "methods": [ + "ExportModel": { + "methods": [ "ExportModel" ] }, - "GetModel": { - "methods": [ + "GetModel": { + "methods": [ "GetModel" ] }, - "GetModelEvaluation": { - "methods": [ + "GetModelEvaluation": { + "methods": [ "GetModelEvaluation" ] }, - "GetModelEvaluationSlice": { - "methods": [ + "GetModelEvaluationSlice": { + "methods": [ "GetModelEvaluationSlice" ] }, - "ListModelEvaluationSlices": { - "methods": [ + "ListModelEvaluationSlices": { + "methods": [ "ListModelEvaluationSlices" ] }, - "ListModelEvaluations": { - "methods": [ + "ListModelEvaluations": { + "methods": [ "ListModelEvaluations" ] }, - "ListModels": { - "methods": [ + "ListModels": { + "methods": [ "ListModels" ] }, - "UpdateModel": { - "methods": [ + "UpdateModel": { + "methods": [ "UpdateModel" ] }, - "UploadModel": { - "methods": [ + "UploadModel": { + "methods": [ "UploadModel" ] } @@ -295,33 +295,33 @@ } } }, - "PipelineService": { - "clients": { - "grpc": { - "libraryClient": "PipelineClient", - "rpcs": { - "CancelTrainingPipeline": { - "methods": [ + "PipelineService": { + "clients": { + "grpc": { + "libraryClient": "PipelineClient", + "rpcs": { + "CancelTrainingPipeline": { + "methods": [ "CancelTrainingPipeline" ] }, - "CreateTrainingPipeline": { - "methods": [ + "CreateTrainingPipeline": { + "methods": [ "CreateTrainingPipeline" ] }, - "DeleteTrainingPipeline": { - "methods": [ + "DeleteTrainingPipeline": { + "methods": [ "DeleteTrainingPipeline" ] }, - "GetTrainingPipeline": { - "methods": [ + "GetTrainingPipeline": { + "methods": [ "GetTrainingPipeline" ] }, - "ListTrainingPipelines": { - "methods": [ + "ListTrainingPipelines": { + "methods": [ "ListTrainingPipelines" ] } @@ -329,13 +329,13 @@ } } }, - "PredictionService": { - "clients": { - "grpc": { - "libraryClient": "PredictionClient", - "rpcs": { - "Predict": { - "methods": [ + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionClient", + "rpcs": { + "Predict": { + "methods": [ "Predict" ] } @@ -343,33 +343,33 @@ } } }, - "SpecialistPoolService": { - "clients": { - "grpc": { - "libraryClient": "SpecialistPoolClient", - "rpcs": { - "CreateSpecialistPool": { - "methods": [ + "SpecialistPoolService": { + "clients": { + "grpc": { + "libraryClient": "SpecialistPoolClient", + "rpcs": { + "CreateSpecialistPool": { + "methods": [ "CreateSpecialistPool" ] }, - "DeleteSpecialistPool": { - "methods": [ + "DeleteSpecialistPool": { + "methods": [ "DeleteSpecialistPool" ] }, - "GetSpecialistPool": { - "methods": [ + "GetSpecialistPool": { + "methods": [ "GetSpecialistPool" ] }, - "ListSpecialistPools": { - "methods": [ + "ListSpecialistPools": { + "methods": [ "ListSpecialistPools" ] }, - "UpdateSpecialistPool": { - "methods": [ + "UpdateSpecialistPool": { + "methods": [ "UpdateSpecialistPool" ] } diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index 99bd441af93a..45b5491c685d 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/admin/apiv1alpha/gapic_metadata.json b/analytics/admin/apiv1alpha/gapic_metadata.json index b7e9628c956f..582fd4892aae 100644 --- a/analytics/admin/apiv1alpha/gapic_metadata.json +++ b/analytics/admin/apiv1alpha/gapic_metadata.json @@ -1,352 +1,352 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.analytics.admin.v1alpha", - "libraryPackage": "cloud.google.com/go/analytics/admin/apiv1alpha", - "services": { - "AnalyticsAdminService": { - "clients": { - "grpc": { - "libraryClient": "AnalyticsAdminClient", - "rpcs": { - "ArchiveCustomDimension": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.analytics.admin.v1alpha", + "libraryPackage": "cloud.google.com/go/analytics/admin/apiv1alpha", + "services": { + "AnalyticsAdminService": { + "clients": { + "grpc": { + "libraryClient": "AnalyticsAdminClient", + "rpcs": { + "ArchiveCustomDimension": { + "methods": [ "ArchiveCustomDimension" ] }, - "ArchiveCustomMetric": { - "methods": [ + "ArchiveCustomMetric": { + "methods": [ "ArchiveCustomMetric" ] }, - "AuditUserLinks": { - "methods": [ + "AuditUserLinks": { + "methods": [ "AuditUserLinks" ] }, - "BatchCreateUserLinks": { - "methods": [ + "BatchCreateUserLinks": { + "methods": [ "BatchCreateUserLinks" ] }, - "BatchDeleteUserLinks": { - "methods": [ + "BatchDeleteUserLinks": { + "methods": [ "BatchDeleteUserLinks" ] }, - "BatchGetUserLinks": { - "methods": [ + "BatchGetUserLinks": { + "methods": [ "BatchGetUserLinks" ] }, - "BatchUpdateUserLinks": { - "methods": [ + "BatchUpdateUserLinks": { + "methods": [ "BatchUpdateUserLinks" ] }, - "CreateConversionEvent": { - "methods": [ + "CreateConversionEvent": { + "methods": [ "CreateConversionEvent" ] }, - "CreateCustomDimension": { - "methods": [ + "CreateCustomDimension": { + "methods": [ "CreateCustomDimension" ] }, - "CreateCustomMetric": { - "methods": [ + "CreateCustomMetric": { + "methods": [ "CreateCustomMetric" ] }, - "CreateFirebaseLink": { - "methods": [ + "CreateFirebaseLink": { + "methods": [ "CreateFirebaseLink" ] }, - "CreateGoogleAdsLink": { - "methods": [ + "CreateGoogleAdsLink": { + "methods": [ "CreateGoogleAdsLink" ] }, - "CreateMeasurementProtocolSecret": { - "methods": [ + "CreateMeasurementProtocolSecret": { + "methods": [ "CreateMeasurementProtocolSecret" ] }, - "CreateProperty": { - "methods": [ + "CreateProperty": { + "methods": [ "CreateProperty" ] }, - "CreateUserLink": { - "methods": [ + "CreateUserLink": { + "methods": [ "CreateUserLink" ] }, - "CreateWebDataStream": { - "methods": [ + "CreateWebDataStream": { + "methods": [ "CreateWebDataStream" ] }, - "DeleteAccount": { - "methods": [ + "DeleteAccount": { + "methods": [ "DeleteAccount" ] }, - "DeleteAndroidAppDataStream": { - "methods": [ + "DeleteAndroidAppDataStream": { + "methods": [ "DeleteAndroidAppDataStream" ] }, - "DeleteConversionEvent": { - "methods": [ + "DeleteConversionEvent": { + "methods": [ "DeleteConversionEvent" ] }, - "DeleteFirebaseLink": { - "methods": [ + "DeleteFirebaseLink": { + "methods": [ "DeleteFirebaseLink" ] }, - "DeleteGoogleAdsLink": { - "methods": [ + "DeleteGoogleAdsLink": { + "methods": [ "DeleteGoogleAdsLink" ] }, - "DeleteIosAppDataStream": { - "methods": [ + "DeleteIosAppDataStream": { + "methods": [ "DeleteIosAppDataStream" ] }, - "DeleteMeasurementProtocolSecret": { - "methods": [ + "DeleteMeasurementProtocolSecret": { + "methods": [ "DeleteMeasurementProtocolSecret" ] }, - "DeleteProperty": { - "methods": [ + "DeleteProperty": { + "methods": [ "DeleteProperty" ] }, - "DeleteUserLink": { - "methods": [ + "DeleteUserLink": { + "methods": [ "DeleteUserLink" ] }, - "DeleteWebDataStream": { - "methods": [ + "DeleteWebDataStream": { + "methods": [ "DeleteWebDataStream" ] }, - "GetAccount": { - "methods": [ + "GetAccount": { + "methods": [ "GetAccount" ] }, - "GetAndroidAppDataStream": { - "methods": [ + "GetAndroidAppDataStream": { + "methods": [ "GetAndroidAppDataStream" ] }, - "GetConversionEvent": { - "methods": [ + "GetConversionEvent": { + "methods": [ "GetConversionEvent" ] }, - "GetCustomDimension": { - "methods": [ + "GetCustomDimension": { + "methods": [ "GetCustomDimension" ] }, - "GetCustomMetric": { - "methods": [ + "GetCustomMetric": { + "methods": [ "GetCustomMetric" ] }, - "GetDataSharingSettings": { - "methods": [ + "GetDataSharingSettings": { + "methods": [ "GetDataSharingSettings" ] }, - "GetEnhancedMeasurementSettings": { - "methods": [ + "GetEnhancedMeasurementSettings": { + "methods": [ "GetEnhancedMeasurementSettings" ] }, - "GetGlobalSiteTag": { - "methods": [ + "GetGlobalSiteTag": { + "methods": [ "GetGlobalSiteTag" ] }, - "GetGoogleSignalsSettings": { - "methods": [ + "GetGoogleSignalsSettings": { + "methods": [ "GetGoogleSignalsSettings" ] }, - "GetIosAppDataStream": { - "methods": [ + "GetIosAppDataStream": { + "methods": [ "GetIosAppDataStream" ] }, - "GetMeasurementProtocolSecret": { - "methods": [ + "GetMeasurementProtocolSecret": { + "methods": [ "GetMeasurementProtocolSecret" ] }, - "GetProperty": { - "methods": [ + "GetProperty": { + "methods": [ "GetProperty" ] }, - "GetUserLink": { - "methods": [ + "GetUserLink": { + "methods": [ "GetUserLink" ] }, - "GetWebDataStream": { - "methods": [ + "GetWebDataStream": { + "methods": [ "GetWebDataStream" ] }, - "ListAccountSummaries": { - "methods": [ + "ListAccountSummaries": { + "methods": [ "ListAccountSummaries" ] }, - "ListAccounts": { - "methods": [ + "ListAccounts": { + "methods": [ "ListAccounts" ] }, - "ListAndroidAppDataStreams": { - "methods": [ + "ListAndroidAppDataStreams": { + "methods": [ "ListAndroidAppDataStreams" ] }, - "ListConversionEvents": { - "methods": [ + "ListConversionEvents": { + "methods": [ "ListConversionEvents" ] }, - "ListCustomDimensions": { - "methods": [ + "ListCustomDimensions": { + "methods": [ "ListCustomDimensions" ] }, - "ListCustomMetrics": { - "methods": [ + "ListCustomMetrics": { + "methods": [ "ListCustomMetrics" ] }, - "ListFirebaseLinks": { - "methods": [ + "ListFirebaseLinks": { + "methods": [ "ListFirebaseLinks" ] }, - "ListGoogleAdsLinks": { - "methods": [ + "ListGoogleAdsLinks": { + "methods": [ "ListGoogleAdsLinks" ] }, - "ListIosAppDataStreams": { - "methods": [ + "ListIosAppDataStreams": { + "methods": [ "ListIosAppDataStreams" ] }, - "ListMeasurementProtocolSecrets": { - "methods": [ + "ListMeasurementProtocolSecrets": { + "methods": [ "ListMeasurementProtocolSecrets" ] }, - "ListProperties": { - "methods": [ + "ListProperties": { + "methods": [ "ListProperties" ] }, - "ListUserLinks": { - "methods": [ + "ListUserLinks": { + "methods": [ "ListUserLinks" ] }, - "ListWebDataStreams": { - "methods": [ + "ListWebDataStreams": { + "methods": [ "ListWebDataStreams" ] }, - "ProvisionAccountTicket": { - "methods": [ + "ProvisionAccountTicket": { + "methods": [ "ProvisionAccountTicket" ] }, - "SearchChangeHistoryEvents": { - "methods": [ + "SearchChangeHistoryEvents": { + "methods": [ "SearchChangeHistoryEvents" ] }, - "UpdateAccount": { - "methods": [ + "UpdateAccount": { + "methods": [ "UpdateAccount" ] }, - "UpdateAndroidAppDataStream": { - "methods": [ + "UpdateAndroidAppDataStream": { + "methods": [ "UpdateAndroidAppDataStream" ] }, - "UpdateCustomDimension": { - "methods": [ + "UpdateCustomDimension": { + "methods": [ "UpdateCustomDimension" ] }, - "UpdateCustomMetric": { - "methods": [ + "UpdateCustomMetric": { + "methods": [ "UpdateCustomMetric" ] }, - "UpdateEnhancedMeasurementSettings": { - "methods": [ + "UpdateEnhancedMeasurementSettings": { + "methods": [ "UpdateEnhancedMeasurementSettings" ] }, - "UpdateFirebaseLink": { - "methods": [ + "UpdateFirebaseLink": { + "methods": [ "UpdateFirebaseLink" ] }, - "UpdateGoogleAdsLink": { - "methods": [ + "UpdateGoogleAdsLink": { + "methods": [ "UpdateGoogleAdsLink" ] }, - "UpdateGoogleSignalsSettings": { - "methods": [ + "UpdateGoogleSignalsSettings": { + "methods": [ "UpdateGoogleSignalsSettings" ] }, - "UpdateIosAppDataStream": { - "methods": [ + "UpdateIosAppDataStream": { + "methods": [ "UpdateIosAppDataStream" ] }, - "UpdateMeasurementProtocolSecret": { - "methods": [ + "UpdateMeasurementProtocolSecret": { + "methods": [ "UpdateMeasurementProtocolSecret" ] }, - "UpdateProperty": { - "methods": [ + "UpdateProperty": { + "methods": [ "UpdateProperty" ] }, - "UpdateUserLink": { - "methods": [ + "UpdateUserLink": { + "methods": [ "UpdateUserLink" ] }, - "UpdateWebDataStream": { - "methods": [ + "UpdateWebDataStream": { + "methods": [ "UpdateWebDataStream" ] } diff --git a/analytics/data/apiv1alpha/doc.go b/analytics/data/apiv1alpha/doc.go index 51e245cecb2c..910b0e116d2e 100644 --- a/analytics/data/apiv1alpha/doc.go +++ b/analytics/data/apiv1alpha/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/data/apiv1alpha/gapic_metadata.json b/analytics/data/apiv1alpha/gapic_metadata.json index 5ad1bb6317eb..88df4f94f55f 100644 --- a/analytics/data/apiv1alpha/gapic_metadata.json +++ b/analytics/data/apiv1alpha/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.analytics.data.v1alpha", - "libraryPackage": "cloud.google.com/go/analytics/data/apiv1alpha", - "services": { - "AlphaAnalyticsData": { - "clients": { - "grpc": { - "libraryClient": "AlphaAnalyticsDataClient", - "rpcs": { - "BatchRunPivotReports": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.analytics.data.v1alpha", + "libraryPackage": "cloud.google.com/go/analytics/data/apiv1alpha", + "services": { + "AlphaAnalyticsData": { + "clients": { + "grpc": { + "libraryClient": "AlphaAnalyticsDataClient", + "rpcs": { + "BatchRunPivotReports": { + "methods": [ "BatchRunPivotReports" ] }, - "BatchRunReports": { - "methods": [ + "BatchRunReports": { + "methods": [ "BatchRunReports" ] }, - "GetMetadata": { - "methods": [ + "GetMetadata": { + "methods": [ "GetMetadata" ] }, - "RunPivotReport": { - "methods": [ + "RunPivotReport": { + "methods": [ "RunPivotReport" ] }, - "RunRealtimeReport": { - "methods": [ + "RunRealtimeReport": { + "methods": [ "RunRealtimeReport" ] }, - "RunReport": { - "methods": [ + "RunReport": { + "methods": [ "RunReport" ] } diff --git a/apigateway/apiv1/doc.go b/apigateway/apiv1/doc.go index 4662a1ac1b58..c82a2e66029c 100644 --- a/apigateway/apiv1/doc.go +++ b/apigateway/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigateway/apiv1/gapic_metadata.json b/apigateway/apiv1/gapic_metadata.json index af901b73b0f9..80e7cec7f006 100644 --- a/apigateway/apiv1/gapic_metadata.json +++ b/apigateway/apiv1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.apigateway.v1", - "libraryPackage": "cloud.google.com/go/apigateway/apiv1", - "services": { - "ApiGatewayService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateApi": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.apigateway.v1", + "libraryPackage": "cloud.google.com/go/apigateway/apiv1", + "services": { + "ApiGatewayService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateApi": { + "methods": [ "CreateApi" ] }, - "CreateApiConfig": { - "methods": [ + "CreateApiConfig": { + "methods": [ "CreateApiConfig" ] }, - "CreateGateway": { - "methods": [ + "CreateGateway": { + "methods": [ "CreateGateway" ] }, - "DeleteApi": { - "methods": [ + "DeleteApi": { + "methods": [ "DeleteApi" ] }, - "DeleteApiConfig": { - "methods": [ + "DeleteApiConfig": { + "methods": [ "DeleteApiConfig" ] }, - "DeleteGateway": { - "methods": [ + "DeleteGateway": { + "methods": [ "DeleteGateway" ] }, - "GetApi": { - "methods": [ + "GetApi": { + "methods": [ "GetApi" ] }, - "GetApiConfig": { - "methods": [ + "GetApiConfig": { + "methods": [ "GetApiConfig" ] }, - "GetGateway": { - "methods": [ + "GetGateway": { + "methods": [ "GetGateway" ] }, - "ListApiConfigs": { - "methods": [ + "ListApiConfigs": { + "methods": [ "ListApiConfigs" ] }, - "ListApis": { - "methods": [ + "ListApis": { + "methods": [ "ListApis" ] }, - "ListGateways": { - "methods": [ + "ListGateways": { + "methods": [ "ListGateways" ] }, - "UpdateApi": { - "methods": [ + "UpdateApi": { + "methods": [ "UpdateApi" ] }, - "UpdateApiConfig": { - "methods": [ + "UpdateApiConfig": { + "methods": [ "UpdateApiConfig" ] }, - "UpdateGateway": { - "methods": [ + "UpdateGateway": { + "methods": [ "UpdateGateway" ] } diff --git a/apigeeconnect/apiv1/doc.go b/apigeeconnect/apiv1/doc.go index d1f218d91fed..0cd7905ed55c 100644 --- a/apigeeconnect/apiv1/doc.go +++ b/apigeeconnect/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/apigeeconnect/apiv1/gapic_metadata.json b/apigeeconnect/apiv1/gapic_metadata.json index c07a734a1f4e..9840b14ee63e 100644 --- a/apigeeconnect/apiv1/gapic_metadata.json +++ b/apigeeconnect/apiv1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.apigeeconnect.v1", - "libraryPackage": "cloud.google.com/go/apigeeconnect/apiv1", - "services": { - "ConnectionService": { - "clients": { - "grpc": { - "libraryClient": "ConnectionClient", - "rpcs": { - "ListConnections": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.apigeeconnect.v1", + "libraryPackage": "cloud.google.com/go/apigeeconnect/apiv1", + "services": { + "ConnectionService": { + "clients": { + "grpc": { + "libraryClient": "ConnectionClient", + "rpcs": { + "ListConnections": { + "methods": [ "ListConnections" ] } @@ -19,13 +19,13 @@ } } }, - "Tether": { - "clients": { - "grpc": { - "libraryClient": "TetherClient", - "rpcs": { - "Egress": { - "methods": [ + "Tether": { + "clients": { + "grpc": { + "libraryClient": "TetherClient", + "rpcs": { + "Egress": { + "methods": [ "Egress" ] } diff --git a/appengine/apiv1/doc.go b/appengine/apiv1/doc.go index fc37155009a5..a2deb21f60e9 100644 --- a/appengine/apiv1/doc.go +++ b/appengine/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/appengine/apiv1/gapic_metadata.json b/appengine/apiv1/gapic_metadata.json index aa7fd1943330..c8dde65ebcc2 100644 --- a/appengine/apiv1/gapic_metadata.json +++ b/appengine/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.appengine.v1", - "libraryPackage": "cloud.google.com/go/appengine/apiv1", - "services": { - "Applications": { - "clients": { - "grpc": { - "libraryClient": "ApplicationsClient", - "rpcs": { - "CreateApplication": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.appengine.v1", + "libraryPackage": "cloud.google.com/go/appengine/apiv1", + "services": { + "Applications": { + "clients": { + "grpc": { + "libraryClient": "ApplicationsClient", + "rpcs": { + "CreateApplication": { + "methods": [ "CreateApplication" ] }, - "GetApplication": { - "methods": [ + "GetApplication": { + "methods": [ "GetApplication" ] }, - "RepairApplication": { - "methods": [ + "RepairApplication": { + "methods": [ "RepairApplication" ] }, - "UpdateApplication": { - "methods": [ + "UpdateApplication": { + "methods": [ "UpdateApplication" ] } @@ -34,33 +34,33 @@ } } }, - "AuthorizedCertificates": { - "clients": { - "grpc": { - "libraryClient": "AuthorizedCertificatesClient", - "rpcs": { - "CreateAuthorizedCertificate": { - "methods": [ + "AuthorizedCertificates": { + "clients": { + "grpc": { + "libraryClient": "AuthorizedCertificatesClient", + "rpcs": { + "CreateAuthorizedCertificate": { + "methods": [ "CreateAuthorizedCertificate" ] }, - "DeleteAuthorizedCertificate": { - "methods": [ + "DeleteAuthorizedCertificate": { + "methods": [ "DeleteAuthorizedCertificate" ] }, - "GetAuthorizedCertificate": { - "methods": [ + "GetAuthorizedCertificate": { + "methods": [ "GetAuthorizedCertificate" ] }, - "ListAuthorizedCertificates": { - "methods": [ + "ListAuthorizedCertificates": { + "methods": [ "ListAuthorizedCertificates" ] }, - "UpdateAuthorizedCertificate": { - "methods": [ + "UpdateAuthorizedCertificate": { + "methods": [ "UpdateAuthorizedCertificate" ] } @@ -68,13 +68,13 @@ } } }, - "AuthorizedDomains": { - "clients": { - "grpc": { - "libraryClient": "AuthorizedDomainsClient", - "rpcs": { - "ListAuthorizedDomains": { - "methods": [ + "AuthorizedDomains": { + "clients": { + "grpc": { + "libraryClient": "AuthorizedDomainsClient", + "rpcs": { + "ListAuthorizedDomains": { + "methods": [ "ListAuthorizedDomains" ] } @@ -82,33 +82,33 @@ } } }, - "DomainMappings": { - "clients": { - "grpc": { - "libraryClient": "DomainMappingsClient", - "rpcs": { - "CreateDomainMapping": { - "methods": [ + "DomainMappings": { + "clients": { + "grpc": { + "libraryClient": "DomainMappingsClient", + "rpcs": { + "CreateDomainMapping": { + "methods": [ "CreateDomainMapping" ] }, - "DeleteDomainMapping": { - "methods": [ + "DeleteDomainMapping": { + "methods": [ "DeleteDomainMapping" ] }, - "GetDomainMapping": { - "methods": [ + "GetDomainMapping": { + "methods": [ "GetDomainMapping" ] }, - "ListDomainMappings": { - "methods": [ + "ListDomainMappings": { + "methods": [ "ListDomainMappings" ] }, - "UpdateDomainMapping": { - "methods": [ + "UpdateDomainMapping": { + "methods": [ "UpdateDomainMapping" ] } @@ -116,38 +116,38 @@ } } }, - "Firewall": { - "clients": { - "grpc": { - "libraryClient": "FirewallClient", - "rpcs": { - "BatchUpdateIngressRules": { - "methods": [ + "Firewall": { + "clients": { + "grpc": { + "libraryClient": "FirewallClient", + "rpcs": { + "BatchUpdateIngressRules": { + "methods": [ "BatchUpdateIngressRules" ] }, - "CreateIngressRule": { - "methods": [ + "CreateIngressRule": { + "methods": [ "CreateIngressRule" ] }, - "DeleteIngressRule": { - "methods": [ + "DeleteIngressRule": { + "methods": [ "DeleteIngressRule" ] }, - "GetIngressRule": { - "methods": [ + "GetIngressRule": { + "methods": [ "GetIngressRule" ] }, - "ListIngressRules": { - "methods": [ + "ListIngressRules": { + "methods": [ "ListIngressRules" ] }, - "UpdateIngressRule": { - "methods": [ + "UpdateIngressRule": { + "methods": [ "UpdateIngressRule" ] } @@ -155,28 +155,28 @@ } } }, - "Instances": { - "clients": { - "grpc": { - "libraryClient": "InstancesClient", - "rpcs": { - "DebugInstance": { - "methods": [ + "Instances": { + "clients": { + "grpc": { + "libraryClient": "InstancesClient", + "rpcs": { + "DebugInstance": { + "methods": [ "DebugInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] } @@ -184,28 +184,28 @@ } } }, - "Services": { - "clients": { - "grpc": { - "libraryClient": "ServicesClient", - "rpcs": { - "DeleteService": { - "methods": [ + "Services": { + "clients": { + "grpc": { + "libraryClient": "ServicesClient", + "rpcs": { + "DeleteService": { + "methods": [ "DeleteService" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } @@ -213,33 +213,33 @@ } } }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "CreateVersion": { - "methods": [ + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ "CreateVersion" ] }, - "DeleteVersion": { - "methods": [ + "DeleteVersion": { + "methods": [ "DeleteVersion" ] }, - "GetVersion": { - "methods": [ + "GetVersion": { + "methods": [ "GetVersion" ] }, - "ListVersions": { - "methods": [ + "ListVersions": { + "methods": [ "ListVersions" ] }, - "UpdateVersion": { - "methods": [ + "UpdateVersion": { + "methods": [ "UpdateVersion" ] } diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index 8e4a5072d9e2..8ad0b3b2cda1 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/area120/tables/apiv1alpha1/gapic_metadata.json b/area120/tables/apiv1alpha1/gapic_metadata.json index 784712b0fcbb..5e6200fc68e3 100644 --- a/area120/tables/apiv1alpha1/gapic_metadata.json +++ b/area120/tables/apiv1alpha1/gapic_metadata.json @@ -1,72 +1,72 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.area120.tables.v1alpha1", - "libraryPackage": "cloud.google.com/go/area120/tables/apiv1alpha1", - "services": { - "TablesService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "BatchCreateRows": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.area120.tables.v1alpha1", + "libraryPackage": "cloud.google.com/go/area120/tables/apiv1alpha1", + "services": { + "TablesService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "BatchCreateRows": { + "methods": [ "BatchCreateRows" ] }, - "BatchDeleteRows": { - "methods": [ + "BatchDeleteRows": { + "methods": [ "BatchDeleteRows" ] }, - "BatchUpdateRows": { - "methods": [ + "BatchUpdateRows": { + "methods": [ "BatchUpdateRows" ] }, - "CreateRow": { - "methods": [ + "CreateRow": { + "methods": [ "CreateRow" ] }, - "DeleteRow": { - "methods": [ + "DeleteRow": { + "methods": [ "DeleteRow" ] }, - "GetRow": { - "methods": [ + "GetRow": { + "methods": [ "GetRow" ] }, - "GetTable": { - "methods": [ + "GetTable": { + "methods": [ "GetTable" ] }, - "GetWorkspace": { - "methods": [ + "GetWorkspace": { + "methods": [ "GetWorkspace" ] }, - "ListRows": { - "methods": [ + "ListRows": { + "methods": [ "ListRows" ] }, - "ListTables": { - "methods": [ + "ListTables": { + "methods": [ "ListTables" ] }, - "ListWorkspaces": { - "methods": [ + "ListWorkspaces": { + "methods": [ "ListWorkspaces" ] }, - "UpdateRow": { - "methods": [ + "UpdateRow": { + "methods": [ "UpdateRow" ] } diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index 0c527b5f917f..b9b06bfa24eb 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/artifactregistry/apiv1beta2/gapic_metadata.json b/artifactregistry/apiv1beta2/gapic_metadata.json index 796c707d3a8f..8777a1d7cce5 100644 --- a/artifactregistry/apiv1beta2/gapic_metadata.json +++ b/artifactregistry/apiv1beta2/gapic_metadata.json @@ -1,117 +1,117 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.artifactregistry.v1beta2", - "libraryPackage": "cloud.google.com/go/artifactregistry/apiv1beta2", - "services": { - "ArtifactRegistry": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateRepository": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.artifactregistry.v1beta2", + "libraryPackage": "cloud.google.com/go/artifactregistry/apiv1beta2", + "services": { + "ArtifactRegistry": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateRepository": { + "methods": [ "CreateRepository" ] }, - "CreateTag": { - "methods": [ + "CreateTag": { + "methods": [ "CreateTag" ] }, - "DeletePackage": { - "methods": [ + "DeletePackage": { + "methods": [ "DeletePackage" ] }, - "DeleteRepository": { - "methods": [ + "DeleteRepository": { + "methods": [ "DeleteRepository" ] }, - "DeleteTag": { - "methods": [ + "DeleteTag": { + "methods": [ "DeleteTag" ] }, - "DeleteVersion": { - "methods": [ + "DeleteVersion": { + "methods": [ "DeleteVersion" ] }, - "GetFile": { - "methods": [ + "GetFile": { + "methods": [ "GetFile" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetPackage": { - "methods": [ + "GetPackage": { + "methods": [ "GetPackage" ] }, - "GetRepository": { - "methods": [ + "GetRepository": { + "methods": [ "GetRepository" ] }, - "GetTag": { - "methods": [ + "GetTag": { + "methods": [ "GetTag" ] }, - "GetVersion": { - "methods": [ + "GetVersion": { + "methods": [ "GetVersion" ] }, - "ListFiles": { - "methods": [ + "ListFiles": { + "methods": [ "ListFiles" ] }, - "ListPackages": { - "methods": [ + "ListPackages": { + "methods": [ "ListPackages" ] }, - "ListRepositories": { - "methods": [ + "ListRepositories": { + "methods": [ "ListRepositories" ] }, - "ListTags": { - "methods": [ + "ListTags": { + "methods": [ "ListTags" ] }, - "ListVersions": { - "methods": [ + "ListVersions": { + "methods": [ "ListVersions" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateRepository": { - "methods": [ + "UpdateRepository": { + "methods": [ "UpdateRepository" ] }, - "UpdateTag": { - "methods": [ + "UpdateTag": { + "methods": [ "UpdateTag" ] } diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index 4ad5c306d791..daac2897766a 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/gapic_metadata.json b/asset/apiv1/gapic_metadata.json index 9fac653bb97c..dd6e9fda56a2 100644 --- a/asset/apiv1/gapic_metadata.json +++ b/asset/apiv1/gapic_metadata.json @@ -1,72 +1,72 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.asset.v1", - "libraryPackage": "cloud.google.com/go/asset/apiv1", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnalyzeIamPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.asset.v1", + "libraryPackage": "cloud.google.com/go/asset/apiv1", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnalyzeIamPolicy": { + "methods": [ "AnalyzeIamPolicy" ] }, - "AnalyzeIamPolicyLongrunning": { - "methods": [ + "AnalyzeIamPolicyLongrunning": { + "methods": [ "AnalyzeIamPolicyLongrunning" ] }, - "BatchGetAssetsHistory": { - "methods": [ + "BatchGetAssetsHistory": { + "methods": [ "BatchGetAssetsHistory" ] }, - "CreateFeed": { - "methods": [ + "CreateFeed": { + "methods": [ "CreateFeed" ] }, - "DeleteFeed": { - "methods": [ + "DeleteFeed": { + "methods": [ "DeleteFeed" ] }, - "ExportAssets": { - "methods": [ + "ExportAssets": { + "methods": [ "ExportAssets" ] }, - "GetFeed": { - "methods": [ + "GetFeed": { + "methods": [ "GetFeed" ] }, - "ListAssets": { - "methods": [ + "ListAssets": { + "methods": [ "ListAssets" ] }, - "ListFeeds": { - "methods": [ + "ListFeeds": { + "methods": [ "ListFeeds" ] }, - "SearchAllIamPolicies": { - "methods": [ + "SearchAllIamPolicies": { + "methods": [ "SearchAllIamPolicies" ] }, - "SearchAllResources": { - "methods": [ + "SearchAllResources": { + "methods": [ "SearchAllResources" ] }, - "UpdateFeed": { - "methods": [ + "UpdateFeed": { + "methods": [ "UpdateFeed" ] } diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index 30cd912a40ae..6016dbea501b 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p2beta1/gapic_metadata.json b/asset/apiv1p2beta1/gapic_metadata.json index 606a6f8f023e..ea91937f1006 100644 --- a/asset/apiv1p2beta1/gapic_metadata.json +++ b/asset/apiv1p2beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.asset.v1p2beta1", - "libraryPackage": "cloud.google.com/go/asset/apiv1p2beta1", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateFeed": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.asset.v1p2beta1", + "libraryPackage": "cloud.google.com/go/asset/apiv1p2beta1", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateFeed": { + "methods": [ "CreateFeed" ] }, - "DeleteFeed": { - "methods": [ + "DeleteFeed": { + "methods": [ "DeleteFeed" ] }, - "GetFeed": { - "methods": [ + "GetFeed": { + "methods": [ "GetFeed" ] }, - "ListFeeds": { - "methods": [ + "ListFeeds": { + "methods": [ "ListFeeds" ] }, - "UpdateFeed": { - "methods": [ + "UpdateFeed": { + "methods": [ "UpdateFeed" ] } diff --git a/asset/apiv1p5beta1/doc.go b/asset/apiv1p5beta1/doc.go index a48287b7d9fa..ea4ba08b1e5e 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1p5beta1/gapic_metadata.json b/asset/apiv1p5beta1/gapic_metadata.json index 19e22893b65a..f8255c2a8b36 100644 --- a/asset/apiv1p5beta1/gapic_metadata.json +++ b/asset/apiv1p5beta1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.asset.v1p5beta1", - "libraryPackage": "cloud.google.com/go/asset/apiv1p5beta1", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ListAssets": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.asset.v1p5beta1", + "libraryPackage": "cloud.google.com/go/asset/apiv1p5beta1", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ListAssets": { + "methods": [ "ListAssets" ] } diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index b60af3decbbb..4045dda7a787 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/assuredworkloads/apiv1beta1/gapic_metadata.json b/assuredworkloads/apiv1beta1/gapic_metadata.json index a7cf211d9cec..fca15a740bd1 100644 --- a/assuredworkloads/apiv1beta1/gapic_metadata.json +++ b/assuredworkloads/apiv1beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.assuredworkloads.v1beta1", - "libraryPackage": "cloud.google.com/go/assuredworkloads/apiv1beta1", - "services": { - "AssuredWorkloadsService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateWorkload": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.assuredworkloads.v1beta1", + "libraryPackage": "cloud.google.com/go/assuredworkloads/apiv1beta1", + "services": { + "AssuredWorkloadsService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateWorkload": { + "methods": [ "CreateWorkload" ] }, - "DeleteWorkload": { - "methods": [ + "DeleteWorkload": { + "methods": [ "DeleteWorkload" ] }, - "GetWorkload": { - "methods": [ + "GetWorkload": { + "methods": [ "GetWorkload" ] }, - "ListWorkloads": { - "methods": [ + "ListWorkloads": { + "methods": [ "ListWorkloads" ] }, - "UpdateWorkload": { - "methods": [ + "UpdateWorkload": { + "methods": [ "UpdateWorkload" ] } diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index 108dd72b6cf1..6fac611d1b1f 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1/gapic_metadata.json b/automl/apiv1/gapic_metadata.json index 4f529c50ce0c..e31b1eb209b6 100644 --- a/automl/apiv1/gapic_metadata.json +++ b/automl/apiv1/gapic_metadata.json @@ -1,102 +1,102 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.automl.v1", - "libraryPackage": "cloud.google.com/go/automl/apiv1", - "services": { - "AutoMl": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateDataset": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.automl.v1", + "libraryPackage": "cloud.google.com/go/automl/apiv1", + "services": { + "AutoMl": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateDataset": { + "methods": [ "CreateDataset" ] }, - "CreateModel": { - "methods": [ + "CreateModel": { + "methods": [ "CreateModel" ] }, - "DeleteDataset": { - "methods": [ + "DeleteDataset": { + "methods": [ "DeleteDataset" ] }, - "DeleteModel": { - "methods": [ + "DeleteModel": { + "methods": [ "DeleteModel" ] }, - "DeployModel": { - "methods": [ + "DeployModel": { + "methods": [ "DeployModel" ] }, - "ExportData": { - "methods": [ + "ExportData": { + "methods": [ "ExportData" ] }, - "ExportModel": { - "methods": [ + "ExportModel": { + "methods": [ "ExportModel" ] }, - "GetAnnotationSpec": { - "methods": [ + "GetAnnotationSpec": { + "methods": [ "GetAnnotationSpec" ] }, - "GetDataset": { - "methods": [ + "GetDataset": { + "methods": [ "GetDataset" ] }, - "GetModel": { - "methods": [ + "GetModel": { + "methods": [ "GetModel" ] }, - "GetModelEvaluation": { - "methods": [ + "GetModelEvaluation": { + "methods": [ "GetModelEvaluation" ] }, - "ImportData": { - "methods": [ + "ImportData": { + "methods": [ "ImportData" ] }, - "ListDatasets": { - "methods": [ + "ListDatasets": { + "methods": [ "ListDatasets" ] }, - "ListModelEvaluations": { - "methods": [ + "ListModelEvaluations": { + "methods": [ "ListModelEvaluations" ] }, - "ListModels": { - "methods": [ + "ListModels": { + "methods": [ "ListModels" ] }, - "UndeployModel": { - "methods": [ + "UndeployModel": { + "methods": [ "UndeployModel" ] }, - "UpdateDataset": { - "methods": [ + "UpdateDataset": { + "methods": [ "UpdateDataset" ] }, - "UpdateModel": { - "methods": [ + "UpdateModel": { + "methods": [ "UpdateModel" ] } @@ -104,18 +104,18 @@ } } }, - "PredictionService": { - "clients": { - "grpc": { - "libraryClient": "PredictionClient", - "rpcs": { - "BatchPredict": { - "methods": [ + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionClient", + "rpcs": { + "BatchPredict": { + "methods": [ "BatchPredict" ] }, - "Predict": { - "methods": [ + "Predict": { + "methods": [ "Predict" ] } diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index eecc7286463f..047fd5676a84 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/automl/apiv1beta1/gapic_metadata.json b/automl/apiv1beta1/gapic_metadata.json index c53df53d62fd..d7f1ce28366e 100644 --- a/automl/apiv1beta1/gapic_metadata.json +++ b/automl/apiv1beta1/gapic_metadata.json @@ -1,132 +1,132 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.automl.v1beta1", - "libraryPackage": "cloud.google.com/go/automl/apiv1beta1", - "services": { - "AutoMl": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateDataset": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.automl.v1beta1", + "libraryPackage": "cloud.google.com/go/automl/apiv1beta1", + "services": { + "AutoMl": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateDataset": { + "methods": [ "CreateDataset" ] }, - "CreateModel": { - "methods": [ + "CreateModel": { + "methods": [ "CreateModel" ] }, - "DeleteDataset": { - "methods": [ + "DeleteDataset": { + "methods": [ "DeleteDataset" ] }, - "DeleteModel": { - "methods": [ + "DeleteModel": { + "methods": [ "DeleteModel" ] }, - "DeployModel": { - "methods": [ + "DeployModel": { + "methods": [ "DeployModel" ] }, - "ExportData": { - "methods": [ + "ExportData": { + "methods": [ "ExportData" ] }, - "ExportEvaluatedExamples": { - "methods": [ + "ExportEvaluatedExamples": { + "methods": [ "ExportEvaluatedExamples" ] }, - "ExportModel": { - "methods": [ + "ExportModel": { + "methods": [ "ExportModel" ] }, - "GetAnnotationSpec": { - "methods": [ + "GetAnnotationSpec": { + "methods": [ "GetAnnotationSpec" ] }, - "GetColumnSpec": { - "methods": [ + "GetColumnSpec": { + "methods": [ "GetColumnSpec" ] }, - "GetDataset": { - "methods": [ + "GetDataset": { + "methods": [ "GetDataset" ] }, - "GetModel": { - "methods": [ + "GetModel": { + "methods": [ "GetModel" ] }, - "GetModelEvaluation": { - "methods": [ + "GetModelEvaluation": { + "methods": [ "GetModelEvaluation" ] }, - "GetTableSpec": { - "methods": [ + "GetTableSpec": { + "methods": [ "GetTableSpec" ] }, - "ImportData": { - "methods": [ + "ImportData": { + "methods": [ "ImportData" ] }, - "ListColumnSpecs": { - "methods": [ + "ListColumnSpecs": { + "methods": [ "ListColumnSpecs" ] }, - "ListDatasets": { - "methods": [ + "ListDatasets": { + "methods": [ "ListDatasets" ] }, - "ListModelEvaluations": { - "methods": [ + "ListModelEvaluations": { + "methods": [ "ListModelEvaluations" ] }, - "ListModels": { - "methods": [ + "ListModels": { + "methods": [ "ListModels" ] }, - "ListTableSpecs": { - "methods": [ + "ListTableSpecs": { + "methods": [ "ListTableSpecs" ] }, - "UndeployModel": { - "methods": [ + "UndeployModel": { + "methods": [ "UndeployModel" ] }, - "UpdateColumnSpec": { - "methods": [ + "UpdateColumnSpec": { + "methods": [ "UpdateColumnSpec" ] }, - "UpdateDataset": { - "methods": [ + "UpdateDataset": { + "methods": [ "UpdateDataset" ] }, - "UpdateTableSpec": { - "methods": [ + "UpdateTableSpec": { + "methods": [ "UpdateTableSpec" ] } @@ -134,18 +134,18 @@ } } }, - "PredictionService": { - "clients": { - "grpc": { - "libraryClient": "PredictionClient", - "rpcs": { - "BatchPredict": { - "methods": [ + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionClient", + "rpcs": { + "BatchPredict": { + "methods": [ "BatchPredict" ] }, - "Predict": { - "methods": [ + "Predict": { + "methods": [ "Predict" ] } diff --git a/bigquery/connection/apiv1/doc.go b/bigquery/connection/apiv1/doc.go index bf98d3aa7ea5..1822652c996b 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1/gapic_metadata.json b/bigquery/connection/apiv1/gapic_metadata.json index 378c994be019..c073c217bfb1 100644 --- a/bigquery/connection/apiv1/gapic_metadata.json +++ b/bigquery/connection/apiv1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.connection.v1", - "libraryPackage": "cloud.google.com/go/bigquery/connection/apiv1", - "services": { - "ConnectionService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateConnection": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.connection.v1", + "libraryPackage": "cloud.google.com/go/bigquery/connection/apiv1", + "services": { + "ConnectionService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateConnection": { + "methods": [ "CreateConnection" ] }, - "DeleteConnection": { - "methods": [ + "DeleteConnection": { + "methods": [ "DeleteConnection" ] }, - "GetConnection": { - "methods": [ + "GetConnection": { + "methods": [ "GetConnection" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListConnections": { - "methods": [ + "ListConnections": { + "methods": [ "ListConnections" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateConnection": { - "methods": [ + "UpdateConnection": { + "methods": [ "UpdateConnection" ] } diff --git a/bigquery/connection/apiv1beta1/doc.go b/bigquery/connection/apiv1beta1/doc.go index b4388c5c3432..85a960e57969 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/connection/apiv1beta1/gapic_metadata.json b/bigquery/connection/apiv1beta1/gapic_metadata.json index d3e727f89c51..380ae9f12c38 100644 --- a/bigquery/connection/apiv1beta1/gapic_metadata.json +++ b/bigquery/connection/apiv1beta1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.connection.v1beta1", - "libraryPackage": "cloud.google.com/go/bigquery/connection/apiv1beta1", - "services": { - "ConnectionService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateConnection": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.connection.v1beta1", + "libraryPackage": "cloud.google.com/go/bigquery/connection/apiv1beta1", + "services": { + "ConnectionService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateConnection": { + "methods": [ "CreateConnection" ] }, - "DeleteConnection": { - "methods": [ + "DeleteConnection": { + "methods": [ "DeleteConnection" ] }, - "GetConnection": { - "methods": [ + "GetConnection": { + "methods": [ "GetConnection" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListConnections": { - "methods": [ + "ListConnections": { + "methods": [ "ListConnections" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateConnection": { - "methods": [ + "UpdateConnection": { + "methods": [ "UpdateConnection" ] }, - "UpdateConnectionCredential": { - "methods": [ + "UpdateConnectionCredential": { + "methods": [ "UpdateConnectionCredential" ] } diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index 750648a95cc3..b55bc21e9aad 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/datatransfer/apiv1/gapic_metadata.json b/bigquery/datatransfer/apiv1/gapic_metadata.json index caa81c5a3c4f..fd8f604f9b83 100644 --- a/bigquery/datatransfer/apiv1/gapic_metadata.json +++ b/bigquery/datatransfer/apiv1/gapic_metadata.json @@ -1,82 +1,82 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.datatransfer.v1", - "libraryPackage": "cloud.google.com/go/bigquery/datatransfer/apiv1", - "services": { - "DataTransferService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CheckValidCreds": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.datatransfer.v1", + "libraryPackage": "cloud.google.com/go/bigquery/datatransfer/apiv1", + "services": { + "DataTransferService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CheckValidCreds": { + "methods": [ "CheckValidCreds" ] }, - "CreateTransferConfig": { - "methods": [ + "CreateTransferConfig": { + "methods": [ "CreateTransferConfig" ] }, - "DeleteTransferConfig": { - "methods": [ + "DeleteTransferConfig": { + "methods": [ "DeleteTransferConfig" ] }, - "DeleteTransferRun": { - "methods": [ + "DeleteTransferRun": { + "methods": [ "DeleteTransferRun" ] }, - "GetDataSource": { - "methods": [ + "GetDataSource": { + "methods": [ "GetDataSource" ] }, - "GetTransferConfig": { - "methods": [ + "GetTransferConfig": { + "methods": [ "GetTransferConfig" ] }, - "GetTransferRun": { - "methods": [ + "GetTransferRun": { + "methods": [ "GetTransferRun" ] }, - "ListDataSources": { - "methods": [ + "ListDataSources": { + "methods": [ "ListDataSources" ] }, - "ListTransferConfigs": { - "methods": [ + "ListTransferConfigs": { + "methods": [ "ListTransferConfigs" ] }, - "ListTransferLogs": { - "methods": [ + "ListTransferLogs": { + "methods": [ "ListTransferLogs" ] }, - "ListTransferRuns": { - "methods": [ + "ListTransferRuns": { + "methods": [ "ListTransferRuns" ] }, - "ScheduleTransferRuns": { - "methods": [ + "ScheduleTransferRuns": { + "methods": [ "ScheduleTransferRuns" ] }, - "StartManualTransferRuns": { - "methods": [ + "StartManualTransferRuns": { + "methods": [ "StartManualTransferRuns" ] }, - "UpdateTransferConfig": { - "methods": [ + "UpdateTransferConfig": { + "methods": [ "UpdateTransferConfig" ] } diff --git a/bigquery/go.mod b/bigquery/go.mod index 42a6f09a84cd..5a64aeeb87de 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -10,7 +10,7 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index fca947c80259..cb33ac8204cf 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -454,8 +454,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index 82c6a2d0b3c8..fe2140eba81f 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1/gapic_metadata.json b/bigquery/reservation/apiv1/gapic_metadata.json index 4fc5a04ad6be..091d66bb8459 100644 --- a/bigquery/reservation/apiv1/gapic_metadata.json +++ b/bigquery/reservation/apiv1/gapic_metadata.json @@ -1,107 +1,107 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.reservation.v1", - "libraryPackage": "cloud.google.com/go/bigquery/reservation/apiv1", - "services": { - "ReservationService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateAssignment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.reservation.v1", + "libraryPackage": "cloud.google.com/go/bigquery/reservation/apiv1", + "services": { + "ReservationService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateAssignment": { + "methods": [ "CreateAssignment" ] }, - "CreateCapacityCommitment": { - "methods": [ + "CreateCapacityCommitment": { + "methods": [ "CreateCapacityCommitment" ] }, - "CreateReservation": { - "methods": [ + "CreateReservation": { + "methods": [ "CreateReservation" ] }, - "DeleteAssignment": { - "methods": [ + "DeleteAssignment": { + "methods": [ "DeleteAssignment" ] }, - "DeleteCapacityCommitment": { - "methods": [ + "DeleteCapacityCommitment": { + "methods": [ "DeleteCapacityCommitment" ] }, - "DeleteReservation": { - "methods": [ + "DeleteReservation": { + "methods": [ "DeleteReservation" ] }, - "GetBiReservation": { - "methods": [ + "GetBiReservation": { + "methods": [ "GetBiReservation" ] }, - "GetCapacityCommitment": { - "methods": [ + "GetCapacityCommitment": { + "methods": [ "GetCapacityCommitment" ] }, - "GetReservation": { - "methods": [ + "GetReservation": { + "methods": [ "GetReservation" ] }, - "ListAssignments": { - "methods": [ + "ListAssignments": { + "methods": [ "ListAssignments" ] }, - "ListCapacityCommitments": { - "methods": [ + "ListCapacityCommitments": { + "methods": [ "ListCapacityCommitments" ] }, - "ListReservations": { - "methods": [ + "ListReservations": { + "methods": [ "ListReservations" ] }, - "MergeCapacityCommitments": { - "methods": [ + "MergeCapacityCommitments": { + "methods": [ "MergeCapacityCommitments" ] }, - "MoveAssignment": { - "methods": [ + "MoveAssignment": { + "methods": [ "MoveAssignment" ] }, - "SearchAssignments": { - "methods": [ + "SearchAssignments": { + "methods": [ "SearchAssignments" ] }, - "SplitCapacityCommitment": { - "methods": [ + "SplitCapacityCommitment": { + "methods": [ "SplitCapacityCommitment" ] }, - "UpdateBiReservation": { - "methods": [ + "UpdateBiReservation": { + "methods": [ "UpdateBiReservation" ] }, - "UpdateCapacityCommitment": { - "methods": [ + "UpdateCapacityCommitment": { + "methods": [ "UpdateCapacityCommitment" ] }, - "UpdateReservation": { - "methods": [ + "UpdateReservation": { + "methods": [ "UpdateReservation" ] } diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go index 96ce44a977e3..fe50baf00b93 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1beta1/gapic_metadata.json b/bigquery/reservation/apiv1beta1/gapic_metadata.json index c3240ac48df4..25fd839f9e26 100644 --- a/bigquery/reservation/apiv1beta1/gapic_metadata.json +++ b/bigquery/reservation/apiv1beta1/gapic_metadata.json @@ -1,107 +1,107 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.reservation.v1beta1", - "libraryPackage": "cloud.google.com/go/bigquery/reservation/apiv1beta1", - "services": { - "ReservationService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateAssignment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.reservation.v1beta1", + "libraryPackage": "cloud.google.com/go/bigquery/reservation/apiv1beta1", + "services": { + "ReservationService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateAssignment": { + "methods": [ "CreateAssignment" ] }, - "CreateCapacityCommitment": { - "methods": [ + "CreateCapacityCommitment": { + "methods": [ "CreateCapacityCommitment" ] }, - "CreateReservation": { - "methods": [ + "CreateReservation": { + "methods": [ "CreateReservation" ] }, - "DeleteAssignment": { - "methods": [ + "DeleteAssignment": { + "methods": [ "DeleteAssignment" ] }, - "DeleteCapacityCommitment": { - "methods": [ + "DeleteCapacityCommitment": { + "methods": [ "DeleteCapacityCommitment" ] }, - "DeleteReservation": { - "methods": [ + "DeleteReservation": { + "methods": [ "DeleteReservation" ] }, - "GetBiReservation": { - "methods": [ + "GetBiReservation": { + "methods": [ "GetBiReservation" ] }, - "GetCapacityCommitment": { - "methods": [ + "GetCapacityCommitment": { + "methods": [ "GetCapacityCommitment" ] }, - "GetReservation": { - "methods": [ + "GetReservation": { + "methods": [ "GetReservation" ] }, - "ListAssignments": { - "methods": [ + "ListAssignments": { + "methods": [ "ListAssignments" ] }, - "ListCapacityCommitments": { - "methods": [ + "ListCapacityCommitments": { + "methods": [ "ListCapacityCommitments" ] }, - "ListReservations": { - "methods": [ + "ListReservations": { + "methods": [ "ListReservations" ] }, - "MergeCapacityCommitments": { - "methods": [ + "MergeCapacityCommitments": { + "methods": [ "MergeCapacityCommitments" ] }, - "MoveAssignment": { - "methods": [ + "MoveAssignment": { + "methods": [ "MoveAssignment" ] }, - "SearchAssignments": { - "methods": [ + "SearchAssignments": { + "methods": [ "SearchAssignments" ] }, - "SplitCapacityCommitment": { - "methods": [ + "SplitCapacityCommitment": { + "methods": [ "SplitCapacityCommitment" ] }, - "UpdateBiReservation": { - "methods": [ + "UpdateBiReservation": { + "methods": [ "UpdateBiReservation" ] }, - "UpdateCapacityCommitment": { - "methods": [ + "UpdateCapacityCommitment": { + "methods": [ "UpdateCapacityCommitment" ] }, - "UpdateReservation": { - "methods": [ + "UpdateReservation": { + "methods": [ "UpdateReservation" ] } diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 02df1ac6f65f..928b143116bc 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1/gapic_metadata.json b/bigquery/storage/apiv1/gapic_metadata.json index 42c1fad16df9..2c9099af3682 100644 --- a/bigquery/storage/apiv1/gapic_metadata.json +++ b/bigquery/storage/apiv1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.storage.v1", - "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1", - "services": { - "BigQueryRead": { - "clients": { - "grpc": { - "libraryClient": "BigQueryReadClient", - "rpcs": { - "CreateReadSession": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.storage.v1", + "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1", + "services": { + "BigQueryRead": { + "clients": { + "grpc": { + "libraryClient": "BigQueryReadClient", + "rpcs": { + "CreateReadSession": { + "methods": [ "CreateReadSession" ] }, - "ReadRows": { - "methods": [ + "ReadRows": { + "methods": [ "ReadRows" ] }, - "SplitReadStream": { - "methods": [ + "SplitReadStream": { + "methods": [ "SplitReadStream" ] } diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index ab478691d4aa..d0873afd2bc4 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta1/gapic_metadata.json b/bigquery/storage/apiv1beta1/gapic_metadata.json index 6d78fdb0d840..95235bc516a5 100644 --- a/bigquery/storage/apiv1beta1/gapic_metadata.json +++ b/bigquery/storage/apiv1beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.storage.v1beta1", - "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1beta1", - "services": { - "BigQueryStorage": { - "clients": { - "grpc": { - "libraryClient": "BigQueryStorageClient", - "rpcs": { - "BatchCreateReadSessionStreams": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.storage.v1beta1", + "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1beta1", + "services": { + "BigQueryStorage": { + "clients": { + "grpc": { + "libraryClient": "BigQueryStorageClient", + "rpcs": { + "BatchCreateReadSessionStreams": { + "methods": [ "BatchCreateReadSessionStreams" ] }, - "CreateReadSession": { - "methods": [ + "CreateReadSession": { + "methods": [ "CreateReadSession" ] }, - "FinalizeStream": { - "methods": [ + "FinalizeStream": { + "methods": [ "FinalizeStream" ] }, - "ReadRows": { - "methods": [ + "ReadRows": { + "methods": [ "ReadRows" ] }, - "SplitReadStream": { - "methods": [ + "SplitReadStream": { + "methods": [ "SplitReadStream" ] } diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index 8f795615d123..aa879f71d406 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/storage/apiv1beta2/gapic_metadata.json b/bigquery/storage/apiv1beta2/gapic_metadata.json index 052802eb4eb2..13e265e06a73 100644 --- a/bigquery/storage/apiv1beta2/gapic_metadata.json +++ b/bigquery/storage/apiv1beta2/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.bigquery.storage.v1beta2", - "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1beta2", - "services": { - "BigQueryRead": { - "clients": { - "grpc": { - "libraryClient": "BigQueryReadClient", - "rpcs": { - "CreateReadSession": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.bigquery.storage.v1beta2", + "libraryPackage": "cloud.google.com/go/bigquery/storage/apiv1beta2", + "services": { + "BigQueryRead": { + "clients": { + "grpc": { + "libraryClient": "BigQueryReadClient", + "rpcs": { + "CreateReadSession": { + "methods": [ "CreateReadSession" ] }, - "ReadRows": { - "methods": [ + "ReadRows": { + "methods": [ "ReadRows" ] }, - "SplitReadStream": { - "methods": [ + "SplitReadStream": { + "methods": [ "SplitReadStream" ] } @@ -29,38 +29,38 @@ } } }, - "BigQueryWrite": { - "clients": { - "grpc": { - "libraryClient": "BigQueryWriteClient", - "rpcs": { - "AppendRows": { - "methods": [ + "BigQueryWrite": { + "clients": { + "grpc": { + "libraryClient": "BigQueryWriteClient", + "rpcs": { + "AppendRows": { + "methods": [ "AppendRows" ] }, - "BatchCommitWriteStreams": { - "methods": [ + "BatchCommitWriteStreams": { + "methods": [ "BatchCommitWriteStreams" ] }, - "CreateWriteStream": { - "methods": [ + "CreateWriteStream": { + "methods": [ "CreateWriteStream" ] }, - "FinalizeWriteStream": { - "methods": [ + "FinalizeWriteStream": { + "methods": [ "FinalizeWriteStream" ] }, - "FlushRows": { - "methods": [ + "FlushRows": { + "methods": [ "FlushRows" ] }, - "GetWriteStream": { - "methods": [ + "GetWriteStream": { + "methods": [ "GetWriteStream" ] } diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index fccd6324baeb..deece9709c2b 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/apiv1/gapic_metadata.json b/billing/apiv1/gapic_metadata.json index b74bdd800f75..b5571d8762f5 100644 --- a/billing/apiv1/gapic_metadata.json +++ b/billing/apiv1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.billing.v1", - "libraryPackage": "cloud.google.com/go/billing/apiv1", - "services": { - "CloudBilling": { - "clients": { - "grpc": { - "libraryClient": "CloudBillingClient", - "rpcs": { - "CreateBillingAccount": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.billing.v1", + "libraryPackage": "cloud.google.com/go/billing/apiv1", + "services": { + "CloudBilling": { + "clients": { + "grpc": { + "libraryClient": "CloudBillingClient", + "rpcs": { + "CreateBillingAccount": { + "methods": [ "CreateBillingAccount" ] }, - "GetBillingAccount": { - "methods": [ + "GetBillingAccount": { + "methods": [ "GetBillingAccount" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetProjectBillingInfo": { - "methods": [ + "GetProjectBillingInfo": { + "methods": [ "GetProjectBillingInfo" ] }, - "ListBillingAccounts": { - "methods": [ + "ListBillingAccounts": { + "methods": [ "ListBillingAccounts" ] }, - "ListProjectBillingInfo": { - "methods": [ + "ListProjectBillingInfo": { + "methods": [ "ListProjectBillingInfo" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateBillingAccount": { - "methods": [ + "UpdateBillingAccount": { + "methods": [ "UpdateBillingAccount" ] }, - "UpdateProjectBillingInfo": { - "methods": [ + "UpdateProjectBillingInfo": { + "methods": [ "UpdateProjectBillingInfo" ] } @@ -64,18 +64,18 @@ } } }, - "CloudCatalog": { - "clients": { - "grpc": { - "libraryClient": "CloudCatalogClient", - "rpcs": { - "ListServices": { - "methods": [ + "CloudCatalog": { + "clients": { + "grpc": { + "libraryClient": "CloudCatalogClient", + "rpcs": { + "ListServices": { + "methods": [ "ListServices" ] }, - "ListSkus": { - "methods": [ + "ListSkus": { + "methods": [ "ListSkus" ] } diff --git a/billing/budgets/apiv1/doc.go b/billing/budgets/apiv1/doc.go index bc4554fe66cf..c451523c8d63 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1/gapic_metadata.json b/billing/budgets/apiv1/gapic_metadata.json index 05ad6bfd1d1f..71de553dd86c 100644 --- a/billing/budgets/apiv1/gapic_metadata.json +++ b/billing/budgets/apiv1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.billing.budgets.v1", - "libraryPackage": "cloud.google.com/go/billing/budgets/apiv1", - "services": { - "BudgetService": { - "clients": { - "grpc": { - "libraryClient": "BudgetClient", - "rpcs": { - "CreateBudget": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.billing.budgets.v1", + "libraryPackage": "cloud.google.com/go/billing/budgets/apiv1", + "services": { + "BudgetService": { + "clients": { + "grpc": { + "libraryClient": "BudgetClient", + "rpcs": { + "CreateBudget": { + "methods": [ "CreateBudget" ] }, - "DeleteBudget": { - "methods": [ + "DeleteBudget": { + "methods": [ "DeleteBudget" ] }, - "GetBudget": { - "methods": [ + "GetBudget": { + "methods": [ "GetBudget" ] }, - "ListBudgets": { - "methods": [ + "ListBudgets": { + "methods": [ "ListBudgets" ] }, - "UpdateBudget": { - "methods": [ + "UpdateBudget": { + "methods": [ "UpdateBudget" ] } diff --git a/billing/budgets/apiv1beta1/doc.go b/billing/budgets/apiv1beta1/doc.go index fbe74d4920c9..db1fb0a076d3 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/billing/budgets/apiv1beta1/gapic_metadata.json b/billing/budgets/apiv1beta1/gapic_metadata.json index 986d7e625440..912efba0ed83 100644 --- a/billing/budgets/apiv1beta1/gapic_metadata.json +++ b/billing/budgets/apiv1beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.billing.budgets.v1beta1", - "libraryPackage": "cloud.google.com/go/billing/budgets/apiv1beta1", - "services": { - "BudgetService": { - "clients": { - "grpc": { - "libraryClient": "BudgetClient", - "rpcs": { - "CreateBudget": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.billing.budgets.v1beta1", + "libraryPackage": "cloud.google.com/go/billing/budgets/apiv1beta1", + "services": { + "BudgetService": { + "clients": { + "grpc": { + "libraryClient": "BudgetClient", + "rpcs": { + "CreateBudget": { + "methods": [ "CreateBudget" ] }, - "DeleteBudget": { - "methods": [ + "DeleteBudget": { + "methods": [ "DeleteBudget" ] }, - "GetBudget": { - "methods": [ + "GetBudget": { + "methods": [ "GetBudget" ] }, - "ListBudgets": { - "methods": [ + "ListBudgets": { + "methods": [ "ListBudgets" ] }, - "UpdateBudget": { - "methods": [ + "UpdateBudget": { + "methods": [ "UpdateBudget" ] } diff --git a/binaryauthorization/apiv1beta1/doc.go b/binaryauthorization/apiv1beta1/doc.go index 7dc21d77aceb..bae4dabd1d08 100644 --- a/binaryauthorization/apiv1beta1/doc.go +++ b/binaryauthorization/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/binaryauthorization/apiv1beta1/gapic_metadata.json b/binaryauthorization/apiv1beta1/gapic_metadata.json index 0e6b17f4296a..fb591a2cbb15 100644 --- a/binaryauthorization/apiv1beta1/gapic_metadata.json +++ b/binaryauthorization/apiv1beta1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.binaryauthorization.v1beta1", - "libraryPackage": "cloud.google.com/go/binaryauthorization/apiv1beta1", - "services": { - "BinauthzManagementServiceV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "BinauthzManagementServiceV1Beta1Client", - "rpcs": { - "CreateAttestor": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.binaryauthorization.v1beta1", + "libraryPackage": "cloud.google.com/go/binaryauthorization/apiv1beta1", + "services": { + "BinauthzManagementServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "BinauthzManagementServiceV1Beta1Client", + "rpcs": { + "CreateAttestor": { + "methods": [ "CreateAttestor" ] }, - "DeleteAttestor": { - "methods": [ + "DeleteAttestor": { + "methods": [ "DeleteAttestor" ] }, - "GetAttestor": { - "methods": [ + "GetAttestor": { + "methods": [ "GetAttestor" ] }, - "GetPolicy": { - "methods": [ + "GetPolicy": { + "methods": [ "GetPolicy" ] }, - "ListAttestors": { - "methods": [ + "ListAttestors": { + "methods": [ "ListAttestors" ] }, - "UpdateAttestor": { - "methods": [ + "UpdateAttestor": { + "methods": [ "UpdateAttestor" ] }, - "UpdatePolicy": { - "methods": [ + "UpdatePolicy": { + "methods": [ "UpdatePolicy" ] } diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 2ea403dc0fa0..61e96c5bf756 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/channel/apiv1/gapic_metadata.json b/channel/apiv1/gapic_metadata.json index 879d86e7189f..70fd450e2eb9 100644 --- a/channel/apiv1/gapic_metadata.json +++ b/channel/apiv1/gapic_metadata.json @@ -1,182 +1,182 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.channel.v1", - "libraryPackage": "cloud.google.com/go/channel/apiv1", - "services": { - "CloudChannelService": { - "clients": { - "grpc": { - "libraryClient": "CloudChannelClient", - "rpcs": { - "ActivateEntitlement": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.channel.v1", + "libraryPackage": "cloud.google.com/go/channel/apiv1", + "services": { + "CloudChannelService": { + "clients": { + "grpc": { + "libraryClient": "CloudChannelClient", + "rpcs": { + "ActivateEntitlement": { + "methods": [ "ActivateEntitlement" ] }, - "CancelEntitlement": { - "methods": [ + "CancelEntitlement": { + "methods": [ "CancelEntitlement" ] }, - "ChangeOffer": { - "methods": [ + "ChangeOffer": { + "methods": [ "ChangeOffer" ] }, - "ChangeParameters": { - "methods": [ + "ChangeParameters": { + "methods": [ "ChangeParameters" ] }, - "ChangeRenewalSettings": { - "methods": [ + "ChangeRenewalSettings": { + "methods": [ "ChangeRenewalSettings" ] }, - "CheckCloudIdentityAccountsExist": { - "methods": [ + "CheckCloudIdentityAccountsExist": { + "methods": [ "CheckCloudIdentityAccountsExist" ] }, - "CreateChannelPartnerLink": { - "methods": [ + "CreateChannelPartnerLink": { + "methods": [ "CreateChannelPartnerLink" ] }, - "CreateCustomer": { - "methods": [ + "CreateCustomer": { + "methods": [ "CreateCustomer" ] }, - "CreateEntitlement": { - "methods": [ + "CreateEntitlement": { + "methods": [ "CreateEntitlement" ] }, - "DeleteCustomer": { - "methods": [ + "DeleteCustomer": { + "methods": [ "DeleteCustomer" ] }, - "GetChannelPartnerLink": { - "methods": [ + "GetChannelPartnerLink": { + "methods": [ "GetChannelPartnerLink" ] }, - "GetCustomer": { - "methods": [ + "GetCustomer": { + "methods": [ "GetCustomer" ] }, - "GetEntitlement": { - "methods": [ + "GetEntitlement": { + "methods": [ "GetEntitlement" ] }, - "ListChannelPartnerLinks": { - "methods": [ + "ListChannelPartnerLinks": { + "methods": [ "ListChannelPartnerLinks" ] }, - "ListCustomers": { - "methods": [ + "ListCustomers": { + "methods": [ "ListCustomers" ] }, - "ListEntitlements": { - "methods": [ + "ListEntitlements": { + "methods": [ "ListEntitlements" ] }, - "ListOffers": { - "methods": [ + "ListOffers": { + "methods": [ "ListOffers" ] }, - "ListProducts": { - "methods": [ + "ListProducts": { + "methods": [ "ListProducts" ] }, - "ListPurchasableOffers": { - "methods": [ + "ListPurchasableOffers": { + "methods": [ "ListPurchasableOffers" ] }, - "ListPurchasableSkus": { - "methods": [ + "ListPurchasableSkus": { + "methods": [ "ListPurchasableSkus" ] }, - "ListSkus": { - "methods": [ + "ListSkus": { + "methods": [ "ListSkus" ] }, - "ListSubscribers": { - "methods": [ + "ListSubscribers": { + "methods": [ "ListSubscribers" ] }, - "ListTransferableOffers": { - "methods": [ + "ListTransferableOffers": { + "methods": [ "ListTransferableOffers" ] }, - "ListTransferableSkus": { - "methods": [ + "ListTransferableSkus": { + "methods": [ "ListTransferableSkus" ] }, - "LookupOffer": { - "methods": [ + "LookupOffer": { + "methods": [ "LookupOffer" ] }, - "ProvisionCloudIdentity": { - "methods": [ + "ProvisionCloudIdentity": { + "methods": [ "ProvisionCloudIdentity" ] }, - "RegisterSubscriber": { - "methods": [ + "RegisterSubscriber": { + "methods": [ "RegisterSubscriber" ] }, - "StartPaidService": { - "methods": [ + "StartPaidService": { + "methods": [ "StartPaidService" ] }, - "SuspendEntitlement": { - "methods": [ + "SuspendEntitlement": { + "methods": [ "SuspendEntitlement" ] }, - "TransferEntitlements": { - "methods": [ + "TransferEntitlements": { + "methods": [ "TransferEntitlements" ] }, - "TransferEntitlementsToGoogle": { - "methods": [ + "TransferEntitlementsToGoogle": { + "methods": [ "TransferEntitlementsToGoogle" ] }, - "UnregisterSubscriber": { - "methods": [ + "UnregisterSubscriber": { + "methods": [ "UnregisterSubscriber" ] }, - "UpdateChannelPartnerLink": { - "methods": [ + "UpdateChannelPartnerLink": { + "methods": [ "UpdateChannelPartnerLink" ] }, - "UpdateCustomer": { - "methods": [ + "UpdateCustomer": { + "methods": [ "UpdateCustomer" ] } diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 80e595707a57..6f01792addea 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/gapic_metadata.json b/cloudbuild/apiv1/v2/gapic_metadata.json index 6468ea5b2c69..a5ee7a289ed3 100644 --- a/cloudbuild/apiv1/v2/gapic_metadata.json +++ b/cloudbuild/apiv1/v2/gapic_metadata.json @@ -1,97 +1,97 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.cloudbuild.v1", - "libraryPackage": "cloud.google.com/go/cloudbuild/apiv1/v2", - "services": { - "CloudBuild": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CancelBuild": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.cloudbuild.v1", + "libraryPackage": "cloud.google.com/go/cloudbuild/apiv1/v2", + "services": { + "CloudBuild": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelBuild": { + "methods": [ "CancelBuild" ] }, - "CreateBuild": { - "methods": [ + "CreateBuild": { + "methods": [ "CreateBuild" ] }, - "CreateBuildTrigger": { - "methods": [ + "CreateBuildTrigger": { + "methods": [ "CreateBuildTrigger" ] }, - "CreateWorkerPool": { - "methods": [ + "CreateWorkerPool": { + "methods": [ "CreateWorkerPool" ] }, - "DeleteBuildTrigger": { - "methods": [ + "DeleteBuildTrigger": { + "methods": [ "DeleteBuildTrigger" ] }, - "DeleteWorkerPool": { - "methods": [ + "DeleteWorkerPool": { + "methods": [ "DeleteWorkerPool" ] }, - "GetBuild": { - "methods": [ + "GetBuild": { + "methods": [ "GetBuild" ] }, - "GetBuildTrigger": { - "methods": [ + "GetBuildTrigger": { + "methods": [ "GetBuildTrigger" ] }, - "GetWorkerPool": { - "methods": [ + "GetWorkerPool": { + "methods": [ "GetWorkerPool" ] }, - "ListBuildTriggers": { - "methods": [ + "ListBuildTriggers": { + "methods": [ "ListBuildTriggers" ] }, - "ListBuilds": { - "methods": [ + "ListBuilds": { + "methods": [ "ListBuilds" ] }, - "ListWorkerPools": { - "methods": [ + "ListWorkerPools": { + "methods": [ "ListWorkerPools" ] }, - "ReceiveTriggerWebhook": { - "methods": [ + "ReceiveTriggerWebhook": { + "methods": [ "ReceiveTriggerWebhook" ] }, - "RetryBuild": { - "methods": [ + "RetryBuild": { + "methods": [ "RetryBuild" ] }, - "RunBuildTrigger": { - "methods": [ + "RunBuildTrigger": { + "methods": [ "RunBuildTrigger" ] }, - "UpdateBuildTrigger": { - "methods": [ + "UpdateBuildTrigger": { + "methods": [ "UpdateBuildTrigger" ] }, - "UpdateWorkerPool": { - "methods": [ + "UpdateWorkerPool": { + "methods": [ "UpdateWorkerPool" ] } diff --git a/clouddms/apiv1/doc.go b/clouddms/apiv1/doc.go index 49978276c815..ade8234dd7b2 100644 --- a/clouddms/apiv1/doc.go +++ b/clouddms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/clouddms/apiv1/gapic_metadata.json b/clouddms/apiv1/gapic_metadata.json index ad5aefcbeba5..b6b1c33804f2 100644 --- a/clouddms/apiv1/gapic_metadata.json +++ b/clouddms/apiv1/gapic_metadata.json @@ -1,97 +1,97 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.clouddms.v1", - "libraryPackage": "cloud.google.com/go/clouddms/apiv1", - "services": { - "DataMigrationService": { - "clients": { - "grpc": { - "libraryClient": "DataMigrationClient", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.clouddms.v1", + "libraryPackage": "cloud.google.com/go/clouddms/apiv1", + "services": { + "DataMigrationService": { + "clients": { + "grpc": { + "libraryClient": "DataMigrationClient", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ "CreateConnectionProfile" ] }, - "CreateMigrationJob": { - "methods": [ + "CreateMigrationJob": { + "methods": [ "CreateMigrationJob" ] }, - "DeleteConnectionProfile": { - "methods": [ + "DeleteConnectionProfile": { + "methods": [ "DeleteConnectionProfile" ] }, - "DeleteMigrationJob": { - "methods": [ + "DeleteMigrationJob": { + "methods": [ "DeleteMigrationJob" ] }, - "GenerateSshScript": { - "methods": [ + "GenerateSshScript": { + "methods": [ "GenerateSshScript" ] }, - "GetConnectionProfile": { - "methods": [ + "GetConnectionProfile": { + "methods": [ "GetConnectionProfile" ] }, - "GetMigrationJob": { - "methods": [ + "GetMigrationJob": { + "methods": [ "GetMigrationJob" ] }, - "ListConnectionProfiles": { - "methods": [ + "ListConnectionProfiles": { + "methods": [ "ListConnectionProfiles" ] }, - "ListMigrationJobs": { - "methods": [ + "ListMigrationJobs": { + "methods": [ "ListMigrationJobs" ] }, - "PromoteMigrationJob": { - "methods": [ + "PromoteMigrationJob": { + "methods": [ "PromoteMigrationJob" ] }, - "RestartMigrationJob": { - "methods": [ + "RestartMigrationJob": { + "methods": [ "RestartMigrationJob" ] }, - "ResumeMigrationJob": { - "methods": [ + "ResumeMigrationJob": { + "methods": [ "ResumeMigrationJob" ] }, - "StartMigrationJob": { - "methods": [ + "StartMigrationJob": { + "methods": [ "StartMigrationJob" ] }, - "StopMigrationJob": { - "methods": [ + "StopMigrationJob": { + "methods": [ "StopMigrationJob" ] }, - "UpdateConnectionProfile": { - "methods": [ + "UpdateConnectionProfile": { + "methods": [ "UpdateConnectionProfile" ] }, - "UpdateMigrationJob": { - "methods": [ + "UpdateMigrationJob": { + "methods": [ "UpdateMigrationJob" ] }, - "VerifyMigrationJob": { - "methods": [ + "VerifyMigrationJob": { + "methods": [ "VerifyMigrationJob" ] } diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index 79dbb36ceb53..6c085c3411fb 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2/gapic_metadata.json b/cloudtasks/apiv2/gapic_metadata.json index 8a4b72b27777..ade36c0dc6fe 100644 --- a/cloudtasks/apiv2/gapic_metadata.json +++ b/cloudtasks/apiv2/gapic_metadata.json @@ -1,92 +1,92 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.tasks.v2", - "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2", - "services": { - "CloudTasks": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateQueue": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.tasks.v2", + "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2", + "services": { + "CloudTasks": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateQueue": { + "methods": [ "CreateQueue" ] }, - "CreateTask": { - "methods": [ + "CreateTask": { + "methods": [ "CreateTask" ] }, - "DeleteQueue": { - "methods": [ + "DeleteQueue": { + "methods": [ "DeleteQueue" ] }, - "DeleteTask": { - "methods": [ + "DeleteTask": { + "methods": [ "DeleteTask" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetQueue": { - "methods": [ + "GetQueue": { + "methods": [ "GetQueue" ] }, - "GetTask": { - "methods": [ + "GetTask": { + "methods": [ "GetTask" ] }, - "ListQueues": { - "methods": [ + "ListQueues": { + "methods": [ "ListQueues" ] }, - "ListTasks": { - "methods": [ + "ListTasks": { + "methods": [ "ListTasks" ] }, - "PauseQueue": { - "methods": [ + "PauseQueue": { + "methods": [ "PauseQueue" ] }, - "PurgeQueue": { - "methods": [ + "PurgeQueue": { + "methods": [ "PurgeQueue" ] }, - "ResumeQueue": { - "methods": [ + "ResumeQueue": { + "methods": [ "ResumeQueue" ] }, - "RunTask": { - "methods": [ + "RunTask": { + "methods": [ "RunTask" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateQueue": { - "methods": [ + "UpdateQueue": { + "methods": [ "UpdateQueue" ] } diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 1271a8e3ba43..dc193f5d5350 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta2/gapic_metadata.json b/cloudtasks/apiv2beta2/gapic_metadata.json index 7ff48b0895bc..c88b99835e2d 100644 --- a/cloudtasks/apiv2beta2/gapic_metadata.json +++ b/cloudtasks/apiv2beta2/gapic_metadata.json @@ -1,112 +1,112 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.tasks.v2beta2", - "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2beta2", - "services": { - "CloudTasks": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AcknowledgeTask": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.tasks.v2beta2", + "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2beta2", + "services": { + "CloudTasks": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AcknowledgeTask": { + "methods": [ "AcknowledgeTask" ] }, - "CancelLease": { - "methods": [ + "CancelLease": { + "methods": [ "CancelLease" ] }, - "CreateQueue": { - "methods": [ + "CreateQueue": { + "methods": [ "CreateQueue" ] }, - "CreateTask": { - "methods": [ + "CreateTask": { + "methods": [ "CreateTask" ] }, - "DeleteQueue": { - "methods": [ + "DeleteQueue": { + "methods": [ "DeleteQueue" ] }, - "DeleteTask": { - "methods": [ + "DeleteTask": { + "methods": [ "DeleteTask" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetQueue": { - "methods": [ + "GetQueue": { + "methods": [ "GetQueue" ] }, - "GetTask": { - "methods": [ + "GetTask": { + "methods": [ "GetTask" ] }, - "LeaseTasks": { - "methods": [ + "LeaseTasks": { + "methods": [ "LeaseTasks" ] }, - "ListQueues": { - "methods": [ + "ListQueues": { + "methods": [ "ListQueues" ] }, - "ListTasks": { - "methods": [ + "ListTasks": { + "methods": [ "ListTasks" ] }, - "PauseQueue": { - "methods": [ + "PauseQueue": { + "methods": [ "PauseQueue" ] }, - "PurgeQueue": { - "methods": [ + "PurgeQueue": { + "methods": [ "PurgeQueue" ] }, - "RenewLease": { - "methods": [ + "RenewLease": { + "methods": [ "RenewLease" ] }, - "ResumeQueue": { - "methods": [ + "ResumeQueue": { + "methods": [ "ResumeQueue" ] }, - "RunTask": { - "methods": [ + "RunTask": { + "methods": [ "RunTask" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateQueue": { - "methods": [ + "UpdateQueue": { + "methods": [ "UpdateQueue" ] } diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index 2b44d88b1ae8..9c040fa674b3 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudtasks/apiv2beta3/gapic_metadata.json b/cloudtasks/apiv2beta3/gapic_metadata.json index 358e340ee54e..1a5f03a6d03e 100644 --- a/cloudtasks/apiv2beta3/gapic_metadata.json +++ b/cloudtasks/apiv2beta3/gapic_metadata.json @@ -1,92 +1,92 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.tasks.v2beta3", - "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2beta3", - "services": { - "CloudTasks": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateQueue": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.tasks.v2beta3", + "libraryPackage": "cloud.google.com/go/cloudtasks/apiv2beta3", + "services": { + "CloudTasks": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateQueue": { + "methods": [ "CreateQueue" ] }, - "CreateTask": { - "methods": [ + "CreateTask": { + "methods": [ "CreateTask" ] }, - "DeleteQueue": { - "methods": [ + "DeleteQueue": { + "methods": [ "DeleteQueue" ] }, - "DeleteTask": { - "methods": [ + "DeleteTask": { + "methods": [ "DeleteTask" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetQueue": { - "methods": [ + "GetQueue": { + "methods": [ "GetQueue" ] }, - "GetTask": { - "methods": [ + "GetTask": { + "methods": [ "GetTask" ] }, - "ListQueues": { - "methods": [ + "ListQueues": { + "methods": [ "ListQueues" ] }, - "ListTasks": { - "methods": [ + "ListTasks": { + "methods": [ "ListTasks" ] }, - "PauseQueue": { - "methods": [ + "PauseQueue": { + "methods": [ "PauseQueue" ] }, - "PurgeQueue": { - "methods": [ + "PurgeQueue": { + "methods": [ "PurgeQueue" ] }, - "ResumeQueue": { - "methods": [ + "ResumeQueue": { + "methods": [ "ResumeQueue" ] }, - "RunTask": { - "methods": [ + "RunTask": { + "methods": [ "RunTask" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateQueue": { - "methods": [ + "UpdateQueue": { + "methods": [ "UpdateQueue" ] } diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index f7566c5e524d..787945ededac 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/container/apiv1/gapic_metadata.json b/container/apiv1/gapic_metadata.json index 832be1264738..7cdf466eea3b 100644 --- a/container/apiv1/gapic_metadata.json +++ b/container/apiv1/gapic_metadata.json @@ -1,172 +1,172 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.container.v1", - "libraryPackage": "cloud.google.com/go/container/apiv1", - "services": { - "ClusterManager": { - "clients": { - "grpc": { - "libraryClient": "ClusterManagerClient", - "rpcs": { - "CancelOperation": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.container.v1", + "libraryPackage": "cloud.google.com/go/container/apiv1", + "services": { + "ClusterManager": { + "clients": { + "grpc": { + "libraryClient": "ClusterManagerClient", + "rpcs": { + "CancelOperation": { + "methods": [ "CancelOperation" ] }, - "CompleteIPRotation": { - "methods": [ + "CompleteIPRotation": { + "methods": [ "CompleteIPRotation" ] }, - "CreateCluster": { - "methods": [ + "CreateCluster": { + "methods": [ "CreateCluster" ] }, - "CreateNodePool": { - "methods": [ + "CreateNodePool": { + "methods": [ "CreateNodePool" ] }, - "DeleteCluster": { - "methods": [ + "DeleteCluster": { + "methods": [ "DeleteCluster" ] }, - "DeleteNodePool": { - "methods": [ + "DeleteNodePool": { + "methods": [ "DeleteNodePool" ] }, - "GetCluster": { - "methods": [ + "GetCluster": { + "methods": [ "GetCluster" ] }, - "GetJSONWebKeys": { - "methods": [ + "GetJSONWebKeys": { + "methods": [ "GetJSONWebKeys" ] }, - "GetNodePool": { - "methods": [ + "GetNodePool": { + "methods": [ "GetNodePool" ] }, - "GetOperation": { - "methods": [ + "GetOperation": { + "methods": [ "GetOperation" ] }, - "GetServerConfig": { - "methods": [ + "GetServerConfig": { + "methods": [ "GetServerConfig" ] }, - "ListClusters": { - "methods": [ + "ListClusters": { + "methods": [ "ListClusters" ] }, - "ListNodePools": { - "methods": [ + "ListNodePools": { + "methods": [ "ListNodePools" ] }, - "ListOperations": { - "methods": [ + "ListOperations": { + "methods": [ "ListOperations" ] }, - "ListUsableSubnetworks": { - "methods": [ + "ListUsableSubnetworks": { + "methods": [ "ListUsableSubnetworks" ] }, - "RollbackNodePoolUpgrade": { - "methods": [ + "RollbackNodePoolUpgrade": { + "methods": [ "RollbackNodePoolUpgrade" ] }, - "SetAddonsConfig": { - "methods": [ + "SetAddonsConfig": { + "methods": [ "SetAddonsConfig" ] }, - "SetLabels": { - "methods": [ + "SetLabels": { + "methods": [ "SetLabels" ] }, - "SetLegacyAbac": { - "methods": [ + "SetLegacyAbac": { + "methods": [ "SetLegacyAbac" ] }, - "SetLocations": { - "methods": [ + "SetLocations": { + "methods": [ "SetLocations" ] }, - "SetLoggingService": { - "methods": [ + "SetLoggingService": { + "methods": [ "SetLoggingService" ] }, - "SetMaintenancePolicy": { - "methods": [ + "SetMaintenancePolicy": { + "methods": [ "SetMaintenancePolicy" ] }, - "SetMasterAuth": { - "methods": [ + "SetMasterAuth": { + "methods": [ "SetMasterAuth" ] }, - "SetMonitoringService": { - "methods": [ + "SetMonitoringService": { + "methods": [ "SetMonitoringService" ] }, - "SetNetworkPolicy": { - "methods": [ + "SetNetworkPolicy": { + "methods": [ "SetNetworkPolicy" ] }, - "SetNodePoolAutoscaling": { - "methods": [ + "SetNodePoolAutoscaling": { + "methods": [ "SetNodePoolAutoscaling" ] }, - "SetNodePoolManagement": { - "methods": [ + "SetNodePoolManagement": { + "methods": [ "SetNodePoolManagement" ] }, - "SetNodePoolSize": { - "methods": [ + "SetNodePoolSize": { + "methods": [ "SetNodePoolSize" ] }, - "StartIPRotation": { - "methods": [ + "StartIPRotation": { + "methods": [ "StartIPRotation" ] }, - "UpdateCluster": { - "methods": [ + "UpdateCluster": { + "methods": [ "UpdateCluster" ] }, - "UpdateMaster": { - "methods": [ + "UpdateMaster": { + "methods": [ "UpdateMaster" ] }, - "UpdateNodePool": { - "methods": [ + "UpdateNodePool": { + "methods": [ "UpdateNodePool" ] } diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index 05c5104f2453..0f7c7c8a7732 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/containeranalysis/apiv1beta1/gapic_metadata.json b/containeranalysis/apiv1beta1/gapic_metadata.json index d00dcf37233c..a6ea786a1c56 100644 --- a/containeranalysis/apiv1beta1/gapic_metadata.json +++ b/containeranalysis/apiv1beta1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "grafeas.v1beta1", - "libraryPackage": "cloud.google.com/go/containeranalysis/apiv1beta1", - "services": { - "GrafeasV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "GrafeasV1Beta1Client", - "rpcs": { - "BatchCreateNotes": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "grafeas.v1beta1", + "libraryPackage": "cloud.google.com/go/containeranalysis/apiv1beta1", + "services": { + "GrafeasV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "GrafeasV1Beta1Client", + "rpcs": { + "BatchCreateNotes": { + "methods": [ "BatchCreateNotes" ] }, - "BatchCreateOccurrences": { - "methods": [ + "BatchCreateOccurrences": { + "methods": [ "BatchCreateOccurrences" ] }, - "CreateNote": { - "methods": [ + "CreateNote": { + "methods": [ "CreateNote" ] }, - "CreateOccurrence": { - "methods": [ + "CreateOccurrence": { + "methods": [ "CreateOccurrence" ] }, - "DeleteNote": { - "methods": [ + "DeleteNote": { + "methods": [ "DeleteNote" ] }, - "DeleteOccurrence": { - "methods": [ + "DeleteOccurrence": { + "methods": [ "DeleteOccurrence" ] }, - "GetNote": { - "methods": [ + "GetNote": { + "methods": [ "GetNote" ] }, - "GetOccurrence": { - "methods": [ + "GetOccurrence": { + "methods": [ "GetOccurrence" ] }, - "GetOccurrenceNote": { - "methods": [ + "GetOccurrenceNote": { + "methods": [ "GetOccurrenceNote" ] }, - "GetVulnerabilityOccurrencesSummary": { - "methods": [ + "GetVulnerabilityOccurrencesSummary": { + "methods": [ "GetVulnerabilityOccurrencesSummary" ] }, - "ListNoteOccurrences": { - "methods": [ + "ListNoteOccurrences": { + "methods": [ "ListNoteOccurrences" ] }, - "ListNotes": { - "methods": [ + "ListNotes": { + "methods": [ "ListNotes" ] }, - "ListOccurrences": { - "methods": [ + "ListOccurrences": { + "methods": [ "ListOccurrences" ] }, - "UpdateNote": { - "methods": [ + "UpdateNote": { + "methods": [ "UpdateNote" ] }, - "UpdateOccurrence": { - "methods": [ + "UpdateOccurrence": { + "methods": [ "UpdateOccurrence" ] } diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index d0c0e0ed78ea..2168e44843da 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/gapic_metadata.json b/datacatalog/apiv1/gapic_metadata.json index a219e3399241..0af976774099 100644 --- a/datacatalog/apiv1/gapic_metadata.json +++ b/datacatalog/apiv1/gapic_metadata.json @@ -1,152 +1,152 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.datacatalog.v1", - "libraryPackage": "cloud.google.com/go/datacatalog/apiv1", - "services": { - "DataCatalog": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateEntry": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.datacatalog.v1", + "libraryPackage": "cloud.google.com/go/datacatalog/apiv1", + "services": { + "DataCatalog": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateEntry": { + "methods": [ "CreateEntry" ] }, - "CreateEntryGroup": { - "methods": [ + "CreateEntryGroup": { + "methods": [ "CreateEntryGroup" ] }, - "CreateTag": { - "methods": [ + "CreateTag": { + "methods": [ "CreateTag" ] }, - "CreateTagTemplate": { - "methods": [ + "CreateTagTemplate": { + "methods": [ "CreateTagTemplate" ] }, - "CreateTagTemplateField": { - "methods": [ + "CreateTagTemplateField": { + "methods": [ "CreateTagTemplateField" ] }, - "DeleteEntry": { - "methods": [ + "DeleteEntry": { + "methods": [ "DeleteEntry" ] }, - "DeleteEntryGroup": { - "methods": [ + "DeleteEntryGroup": { + "methods": [ "DeleteEntryGroup" ] }, - "DeleteTag": { - "methods": [ + "DeleteTag": { + "methods": [ "DeleteTag" ] }, - "DeleteTagTemplate": { - "methods": [ + "DeleteTagTemplate": { + "methods": [ "DeleteTagTemplate" ] }, - "DeleteTagTemplateField": { - "methods": [ + "DeleteTagTemplateField": { + "methods": [ "DeleteTagTemplateField" ] }, - "GetEntry": { - "methods": [ + "GetEntry": { + "methods": [ "GetEntry" ] }, - "GetEntryGroup": { - "methods": [ + "GetEntryGroup": { + "methods": [ "GetEntryGroup" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetTagTemplate": { - "methods": [ + "GetTagTemplate": { + "methods": [ "GetTagTemplate" ] }, - "ListEntries": { - "methods": [ + "ListEntries": { + "methods": [ "ListEntries" ] }, - "ListEntryGroups": { - "methods": [ + "ListEntryGroups": { + "methods": [ "ListEntryGroups" ] }, - "ListTags": { - "methods": [ + "ListTags": { + "methods": [ "ListTags" ] }, - "LookupEntry": { - "methods": [ + "LookupEntry": { + "methods": [ "LookupEntry" ] }, - "RenameTagTemplateField": { - "methods": [ + "RenameTagTemplateField": { + "methods": [ "RenameTagTemplateField" ] }, - "RenameTagTemplateFieldEnumValue": { - "methods": [ + "RenameTagTemplateFieldEnumValue": { + "methods": [ "RenameTagTemplateFieldEnumValue" ] }, - "SearchCatalog": { - "methods": [ + "SearchCatalog": { + "methods": [ "SearchCatalog" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateEntry": { - "methods": [ + "UpdateEntry": { + "methods": [ "UpdateEntry" ] }, - "UpdateEntryGroup": { - "methods": [ + "UpdateEntryGroup": { + "methods": [ "UpdateEntryGroup" ] }, - "UpdateTag": { - "methods": [ + "UpdateTag": { + "methods": [ "UpdateTag" ] }, - "UpdateTagTemplate": { - "methods": [ + "UpdateTagTemplate": { + "methods": [ "UpdateTagTemplate" ] }, - "UpdateTagTemplateField": { - "methods": [ + "UpdateTagTemplateField": { + "methods": [ "UpdateTagTemplateField" ] } @@ -154,73 +154,73 @@ } } }, - "PolicyTagManager": { - "clients": { - "grpc": { - "libraryClient": "PolicyTagManagerClient", - "rpcs": { - "CreatePolicyTag": { - "methods": [ + "PolicyTagManager": { + "clients": { + "grpc": { + "libraryClient": "PolicyTagManagerClient", + "rpcs": { + "CreatePolicyTag": { + "methods": [ "CreatePolicyTag" ] }, - "CreateTaxonomy": { - "methods": [ + "CreateTaxonomy": { + "methods": [ "CreateTaxonomy" ] }, - "DeletePolicyTag": { - "methods": [ + "DeletePolicyTag": { + "methods": [ "DeletePolicyTag" ] }, - "DeleteTaxonomy": { - "methods": [ + "DeleteTaxonomy": { + "methods": [ "DeleteTaxonomy" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetPolicyTag": { - "methods": [ + "GetPolicyTag": { + "methods": [ "GetPolicyTag" ] }, - "GetTaxonomy": { - "methods": [ + "GetTaxonomy": { + "methods": [ "GetTaxonomy" ] }, - "ListPolicyTags": { - "methods": [ + "ListPolicyTags": { + "methods": [ "ListPolicyTags" ] }, - "ListTaxonomies": { - "methods": [ + "ListTaxonomies": { + "methods": [ "ListTaxonomies" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdatePolicyTag": { - "methods": [ + "UpdatePolicyTag": { + "methods": [ "UpdatePolicyTag" ] }, - "UpdateTaxonomy": { - "methods": [ + "UpdateTaxonomy": { + "methods": [ "UpdateTaxonomy" ] } @@ -228,18 +228,18 @@ } } }, - "PolicyTagManagerSerialization": { - "clients": { - "grpc": { - "libraryClient": "PolicyTagManagerSerializationClient", - "rpcs": { - "ExportTaxonomies": { - "methods": [ + "PolicyTagManagerSerialization": { + "clients": { + "grpc": { + "libraryClient": "PolicyTagManagerSerializationClient", + "rpcs": { + "ExportTaxonomies": { + "methods": [ "ExportTaxonomies" ] }, - "ImportTaxonomies": { - "methods": [ + "ImportTaxonomies": { + "methods": [ "ImportTaxonomies" ] } diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go index 8bfccbc4b5dc..fd5ad470493a 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1beta1/gapic_metadata.json b/datacatalog/apiv1beta1/gapic_metadata.json index 0d47ee7d3c61..7d06dd470a03 100644 --- a/datacatalog/apiv1beta1/gapic_metadata.json +++ b/datacatalog/apiv1beta1/gapic_metadata.json @@ -1,147 +1,147 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.datacatalog.v1beta1", - "libraryPackage": "cloud.google.com/go/datacatalog/apiv1beta1", - "services": { - "DataCatalog": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateEntry": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.datacatalog.v1beta1", + "libraryPackage": "cloud.google.com/go/datacatalog/apiv1beta1", + "services": { + "DataCatalog": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateEntry": { + "methods": [ "CreateEntry" ] }, - "CreateEntryGroup": { - "methods": [ + "CreateEntryGroup": { + "methods": [ "CreateEntryGroup" ] }, - "CreateTag": { - "methods": [ + "CreateTag": { + "methods": [ "CreateTag" ] }, - "CreateTagTemplate": { - "methods": [ + "CreateTagTemplate": { + "methods": [ "CreateTagTemplate" ] }, - "CreateTagTemplateField": { - "methods": [ + "CreateTagTemplateField": { + "methods": [ "CreateTagTemplateField" ] }, - "DeleteEntry": { - "methods": [ + "DeleteEntry": { + "methods": [ "DeleteEntry" ] }, - "DeleteEntryGroup": { - "methods": [ + "DeleteEntryGroup": { + "methods": [ "DeleteEntryGroup" ] }, - "DeleteTag": { - "methods": [ + "DeleteTag": { + "methods": [ "DeleteTag" ] }, - "DeleteTagTemplate": { - "methods": [ + "DeleteTagTemplate": { + "methods": [ "DeleteTagTemplate" ] }, - "DeleteTagTemplateField": { - "methods": [ + "DeleteTagTemplateField": { + "methods": [ "DeleteTagTemplateField" ] }, - "GetEntry": { - "methods": [ + "GetEntry": { + "methods": [ "GetEntry" ] }, - "GetEntryGroup": { - "methods": [ + "GetEntryGroup": { + "methods": [ "GetEntryGroup" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetTagTemplate": { - "methods": [ + "GetTagTemplate": { + "methods": [ "GetTagTemplate" ] }, - "ListEntries": { - "methods": [ + "ListEntries": { + "methods": [ "ListEntries" ] }, - "ListEntryGroups": { - "methods": [ + "ListEntryGroups": { + "methods": [ "ListEntryGroups" ] }, - "ListTags": { - "methods": [ + "ListTags": { + "methods": [ "ListTags" ] }, - "LookupEntry": { - "methods": [ + "LookupEntry": { + "methods": [ "LookupEntry" ] }, - "RenameTagTemplateField": { - "methods": [ + "RenameTagTemplateField": { + "methods": [ "RenameTagTemplateField" ] }, - "SearchCatalog": { - "methods": [ + "SearchCatalog": { + "methods": [ "SearchCatalog" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateEntry": { - "methods": [ + "UpdateEntry": { + "methods": [ "UpdateEntry" ] }, - "UpdateEntryGroup": { - "methods": [ + "UpdateEntryGroup": { + "methods": [ "UpdateEntryGroup" ] }, - "UpdateTag": { - "methods": [ + "UpdateTag": { + "methods": [ "UpdateTag" ] }, - "UpdateTagTemplate": { - "methods": [ + "UpdateTagTemplate": { + "methods": [ "UpdateTagTemplate" ] }, - "UpdateTagTemplateField": { - "methods": [ + "UpdateTagTemplateField": { + "methods": [ "UpdateTagTemplateField" ] } @@ -149,73 +149,73 @@ } } }, - "PolicyTagManager": { - "clients": { - "grpc": { - "libraryClient": "PolicyTagManagerClient", - "rpcs": { - "CreatePolicyTag": { - "methods": [ + "PolicyTagManager": { + "clients": { + "grpc": { + "libraryClient": "PolicyTagManagerClient", + "rpcs": { + "CreatePolicyTag": { + "methods": [ "CreatePolicyTag" ] }, - "CreateTaxonomy": { - "methods": [ + "CreateTaxonomy": { + "methods": [ "CreateTaxonomy" ] }, - "DeletePolicyTag": { - "methods": [ + "DeletePolicyTag": { + "methods": [ "DeletePolicyTag" ] }, - "DeleteTaxonomy": { - "methods": [ + "DeleteTaxonomy": { + "methods": [ "DeleteTaxonomy" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetPolicyTag": { - "methods": [ + "GetPolicyTag": { + "methods": [ "GetPolicyTag" ] }, - "GetTaxonomy": { - "methods": [ + "GetTaxonomy": { + "methods": [ "GetTaxonomy" ] }, - "ListPolicyTags": { - "methods": [ + "ListPolicyTags": { + "methods": [ "ListPolicyTags" ] }, - "ListTaxonomies": { - "methods": [ + "ListTaxonomies": { + "methods": [ "ListTaxonomies" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdatePolicyTag": { - "methods": [ + "UpdatePolicyTag": { + "methods": [ "UpdatePolicyTag" ] }, - "UpdateTaxonomy": { - "methods": [ + "UpdateTaxonomy": { + "methods": [ "UpdateTaxonomy" ] } @@ -223,18 +223,18 @@ } } }, - "PolicyTagManagerSerialization": { - "clients": { - "grpc": { - "libraryClient": "PolicyTagManagerSerializationClient", - "rpcs": { - "ExportTaxonomies": { - "methods": [ + "PolicyTagManagerSerialization": { + "clients": { + "grpc": { + "libraryClient": "PolicyTagManagerSerializationClient", + "rpcs": { + "ExportTaxonomies": { + "methods": [ "ExportTaxonomies" ] }, - "ImportTaxonomies": { - "methods": [ + "ImportTaxonomies": { + "methods": [ "ImportTaxonomies" ] } diff --git a/dataflow/apiv1beta3/doc.go b/dataflow/apiv1beta3/doc.go index 850564f3c3ad..4b8ebff9155e 100644 --- a/dataflow/apiv1beta3/doc.go +++ b/dataflow/apiv1beta3/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "UNKNOWN" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataflow/apiv1beta3/gapic_metadata.json b/dataflow/apiv1beta3/gapic_metadata.json index b918aaea24e0..9dcbc9db6707 100644 --- a/dataflow/apiv1beta3/gapic_metadata.json +++ b/dataflow/apiv1beta3/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.dataflow.v1beta3", - "libraryPackage": "cloud.google.com/go/dataflow/apiv1beta3", - "services": { - "FlexTemplatesService": { - "clients": { - "grpc": { - "libraryClient": "FlexTemplatesClient", - "rpcs": { - "LaunchFlexTemplate": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.dataflow.v1beta3", + "libraryPackage": "cloud.google.com/go/dataflow/apiv1beta3", + "services": { + "FlexTemplatesService": { + "clients": { + "grpc": { + "libraryClient": "FlexTemplatesClient", + "rpcs": { + "LaunchFlexTemplate": { + "methods": [ "LaunchFlexTemplate" ] } @@ -19,43 +19,43 @@ } } }, - "JobsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "JobsV1Beta3Client", - "rpcs": { - "AggregatedListJobs": { - "methods": [ + "JobsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "JobsV1Beta3Client", + "rpcs": { + "AggregatedListJobs": { + "methods": [ "AggregatedListJobs" ] }, - "CheckActiveJobs": { - "methods": [ + "CheckActiveJobs": { + "methods": [ "CheckActiveJobs" ] }, - "CreateJob": { - "methods": [ + "CreateJob": { + "methods": [ "CreateJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "SnapshotJob": { - "methods": [ + "SnapshotJob": { + "methods": [ "SnapshotJob" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } @@ -63,13 +63,13 @@ } } }, - "MessagesV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "MessagesV1Beta3Client", - "rpcs": { - "ListJobMessages": { - "methods": [ + "MessagesV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MessagesV1Beta3Client", + "rpcs": { + "ListJobMessages": { + "methods": [ "ListJobMessages" ] } @@ -77,23 +77,23 @@ } } }, - "MetricsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "MetricsV1Beta3Client", - "rpcs": { - "GetJobExecutionDetails": { - "methods": [ + "MetricsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "MetricsV1Beta3Client", + "rpcs": { + "GetJobExecutionDetails": { + "methods": [ "GetJobExecutionDetails" ] }, - "GetJobMetrics": { - "methods": [ + "GetJobMetrics": { + "methods": [ "GetJobMetrics" ] }, - "GetStageExecutionDetails": { - "methods": [ + "GetStageExecutionDetails": { + "methods": [ "GetStageExecutionDetails" ] } @@ -101,23 +101,23 @@ } } }, - "SnapshotsV1Beta3": { - "clients": { - "grpc": { - "libraryClient": "SnapshotsV1Beta3Client", - "rpcs": { - "DeleteSnapshot": { - "methods": [ + "SnapshotsV1Beta3": { + "clients": { + "grpc": { + "libraryClient": "SnapshotsV1Beta3Client", + "rpcs": { + "DeleteSnapshot": { + "methods": [ "DeleteSnapshot" ] }, - "GetSnapshot": { - "methods": [ + "GetSnapshot": { + "methods": [ "GetSnapshot" ] }, - "ListSnapshots": { - "methods": [ + "ListSnapshots": { + "methods": [ "ListSnapshots" ] } @@ -125,23 +125,23 @@ } } }, - "TemplatesService": { - "clients": { - "grpc": { - "libraryClient": "TemplatesClient", - "rpcs": { - "CreateJobFromTemplate": { - "methods": [ + "TemplatesService": { + "clients": { + "grpc": { + "libraryClient": "TemplatesClient", + "rpcs": { + "CreateJobFromTemplate": { + "methods": [ "CreateJobFromTemplate" ] }, - "GetTemplate": { - "methods": [ + "GetTemplate": { + "methods": [ "GetTemplate" ] }, - "LaunchTemplate": { - "methods": [ + "LaunchTemplate": { + "methods": [ "LaunchTemplate" ] } diff --git a/datalabeling/apiv1beta1/doc.go b/datalabeling/apiv1beta1/doc.go index 7712dc3e77a6..8058caf4596f 100644 --- a/datalabeling/apiv1beta1/doc.go +++ b/datalabeling/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datalabeling/apiv1beta1/gapic_metadata.json b/datalabeling/apiv1beta1/gapic_metadata.json index 69afd996bb3a..bc3f8733da35 100644 --- a/datalabeling/apiv1beta1/gapic_metadata.json +++ b/datalabeling/apiv1beta1/gapic_metadata.json @@ -1,182 +1,182 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.datalabeling.v1beta1", - "libraryPackage": "cloud.google.com/go/datalabeling/apiv1beta1", - "services": { - "DataLabelingService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateAnnotationSpecSet": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.datalabeling.v1beta1", + "libraryPackage": "cloud.google.com/go/datalabeling/apiv1beta1", + "services": { + "DataLabelingService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateAnnotationSpecSet": { + "methods": [ "CreateAnnotationSpecSet" ] }, - "CreateDataset": { - "methods": [ + "CreateDataset": { + "methods": [ "CreateDataset" ] }, - "CreateEvaluationJob": { - "methods": [ + "CreateEvaluationJob": { + "methods": [ "CreateEvaluationJob" ] }, - "CreateInstruction": { - "methods": [ + "CreateInstruction": { + "methods": [ "CreateInstruction" ] }, - "DeleteAnnotatedDataset": { - "methods": [ + "DeleteAnnotatedDataset": { + "methods": [ "DeleteAnnotatedDataset" ] }, - "DeleteAnnotationSpecSet": { - "methods": [ + "DeleteAnnotationSpecSet": { + "methods": [ "DeleteAnnotationSpecSet" ] }, - "DeleteDataset": { - "methods": [ + "DeleteDataset": { + "methods": [ "DeleteDataset" ] }, - "DeleteEvaluationJob": { - "methods": [ + "DeleteEvaluationJob": { + "methods": [ "DeleteEvaluationJob" ] }, - "DeleteInstruction": { - "methods": [ + "DeleteInstruction": { + "methods": [ "DeleteInstruction" ] }, - "ExportData": { - "methods": [ + "ExportData": { + "methods": [ "ExportData" ] }, - "GetAnnotatedDataset": { - "methods": [ + "GetAnnotatedDataset": { + "methods": [ "GetAnnotatedDataset" ] }, - "GetAnnotationSpecSet": { - "methods": [ + "GetAnnotationSpecSet": { + "methods": [ "GetAnnotationSpecSet" ] }, - "GetDataItem": { - "methods": [ + "GetDataItem": { + "methods": [ "GetDataItem" ] }, - "GetDataset": { - "methods": [ + "GetDataset": { + "methods": [ "GetDataset" ] }, - "GetEvaluation": { - "methods": [ + "GetEvaluation": { + "methods": [ "GetEvaluation" ] }, - "GetEvaluationJob": { - "methods": [ + "GetEvaluationJob": { + "methods": [ "GetEvaluationJob" ] }, - "GetExample": { - "methods": [ + "GetExample": { + "methods": [ "GetExample" ] }, - "GetInstruction": { - "methods": [ + "GetInstruction": { + "methods": [ "GetInstruction" ] }, - "ImportData": { - "methods": [ + "ImportData": { + "methods": [ "ImportData" ] }, - "LabelImage": { - "methods": [ + "LabelImage": { + "methods": [ "LabelImage" ] }, - "LabelText": { - "methods": [ + "LabelText": { + "methods": [ "LabelText" ] }, - "LabelVideo": { - "methods": [ + "LabelVideo": { + "methods": [ "LabelVideo" ] }, - "ListAnnotatedDatasets": { - "methods": [ + "ListAnnotatedDatasets": { + "methods": [ "ListAnnotatedDatasets" ] }, - "ListAnnotationSpecSets": { - "methods": [ + "ListAnnotationSpecSets": { + "methods": [ "ListAnnotationSpecSets" ] }, - "ListDataItems": { - "methods": [ + "ListDataItems": { + "methods": [ "ListDataItems" ] }, - "ListDatasets": { - "methods": [ + "ListDatasets": { + "methods": [ "ListDatasets" ] }, - "ListEvaluationJobs": { - "methods": [ + "ListEvaluationJobs": { + "methods": [ "ListEvaluationJobs" ] }, - "ListExamples": { - "methods": [ + "ListExamples": { + "methods": [ "ListExamples" ] }, - "ListInstructions": { - "methods": [ + "ListInstructions": { + "methods": [ "ListInstructions" ] }, - "PauseEvaluationJob": { - "methods": [ + "PauseEvaluationJob": { + "methods": [ "PauseEvaluationJob" ] }, - "ResumeEvaluationJob": { - "methods": [ + "ResumeEvaluationJob": { + "methods": [ "ResumeEvaluationJob" ] }, - "SearchEvaluations": { - "methods": [ + "SearchEvaluations": { + "methods": [ "SearchEvaluations" ] }, - "SearchExampleComparisons": { - "methods": [ + "SearchExampleComparisons": { + "methods": [ "SearchExampleComparisons" ] }, - "UpdateEvaluationJob": { - "methods": [ + "UpdateEvaluationJob": { + "methods": [ "UpdateEvaluationJob" ] } diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index 22f8479d6d1d..69c90b1e10b7 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/gapic_metadata.json b/dataproc/apiv1/gapic_metadata.json index 533ee76f5c60..0d02cbf337d5 100644 --- a/dataproc/apiv1/gapic_metadata.json +++ b/dataproc/apiv1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dataproc.v1", - "libraryPackage": "cloud.google.com/go/dataproc/apiv1", - "services": { - "AutoscalingPolicyService": { - "clients": { - "grpc": { - "libraryClient": "AutoscalingPolicyClient", - "rpcs": { - "CreateAutoscalingPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dataproc.v1", + "libraryPackage": "cloud.google.com/go/dataproc/apiv1", + "services": { + "AutoscalingPolicyService": { + "clients": { + "grpc": { + "libraryClient": "AutoscalingPolicyClient", + "rpcs": { + "CreateAutoscalingPolicy": { + "methods": [ "CreateAutoscalingPolicy" ] }, - "DeleteAutoscalingPolicy": { - "methods": [ + "DeleteAutoscalingPolicy": { + "methods": [ "DeleteAutoscalingPolicy" ] }, - "GetAutoscalingPolicy": { - "methods": [ + "GetAutoscalingPolicy": { + "methods": [ "GetAutoscalingPolicy" ] }, - "ListAutoscalingPolicies": { - "methods": [ + "ListAutoscalingPolicies": { + "methods": [ "ListAutoscalingPolicies" ] }, - "UpdateAutoscalingPolicy": { - "methods": [ + "UpdateAutoscalingPolicy": { + "methods": [ "UpdateAutoscalingPolicy" ] } @@ -39,48 +39,48 @@ } } }, - "ClusterController": { - "clients": { - "grpc": { - "libraryClient": "ClusterControllerClient", - "rpcs": { - "CreateCluster": { - "methods": [ + "ClusterController": { + "clients": { + "grpc": { + "libraryClient": "ClusterControllerClient", + "rpcs": { + "CreateCluster": { + "methods": [ "CreateCluster" ] }, - "DeleteCluster": { - "methods": [ + "DeleteCluster": { + "methods": [ "DeleteCluster" ] }, - "DiagnoseCluster": { - "methods": [ + "DiagnoseCluster": { + "methods": [ "DiagnoseCluster" ] }, - "GetCluster": { - "methods": [ + "GetCluster": { + "methods": [ "GetCluster" ] }, - "ListClusters": { - "methods": [ + "ListClusters": { + "methods": [ "ListClusters" ] }, - "StartCluster": { - "methods": [ + "StartCluster": { + "methods": [ "StartCluster" ] }, - "StopCluster": { - "methods": [ + "StopCluster": { + "methods": [ "StopCluster" ] }, - "UpdateCluster": { - "methods": [ + "UpdateCluster": { + "methods": [ "UpdateCluster" ] } @@ -88,43 +88,43 @@ } } }, - "JobController": { - "clients": { - "grpc": { - "libraryClient": "JobControllerClient", - "rpcs": { - "CancelJob": { - "methods": [ + "JobController": { + "clients": { + "grpc": { + "libraryClient": "JobControllerClient", + "rpcs": { + "CancelJob": { + "methods": [ "CancelJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "SubmitJob": { - "methods": [ + "SubmitJob": { + "methods": [ "SubmitJob" ] }, - "SubmitJobAsOperation": { - "methods": [ + "SubmitJobAsOperation": { + "methods": [ "SubmitJobAsOperation" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } @@ -132,43 +132,43 @@ } } }, - "WorkflowTemplateService": { - "clients": { - "grpc": { - "libraryClient": "WorkflowTemplateClient", - "rpcs": { - "CreateWorkflowTemplate": { - "methods": [ + "WorkflowTemplateService": { + "clients": { + "grpc": { + "libraryClient": "WorkflowTemplateClient", + "rpcs": { + "CreateWorkflowTemplate": { + "methods": [ "CreateWorkflowTemplate" ] }, - "DeleteWorkflowTemplate": { - "methods": [ + "DeleteWorkflowTemplate": { + "methods": [ "DeleteWorkflowTemplate" ] }, - "GetWorkflowTemplate": { - "methods": [ + "GetWorkflowTemplate": { + "methods": [ "GetWorkflowTemplate" ] }, - "InstantiateInlineWorkflowTemplate": { - "methods": [ + "InstantiateInlineWorkflowTemplate": { + "methods": [ "InstantiateInlineWorkflowTemplate" ] }, - "InstantiateWorkflowTemplate": { - "methods": [ + "InstantiateWorkflowTemplate": { + "methods": [ "InstantiateWorkflowTemplate" ] }, - "ListWorkflowTemplates": { - "methods": [ + "ListWorkflowTemplates": { + "methods": [ "ListWorkflowTemplates" ] }, - "UpdateWorkflowTemplate": { - "methods": [ + "UpdateWorkflowTemplate": { + "methods": [ "UpdateWorkflowTemplate" ] } diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go index 659062ed7beb..667e018c5f07 100644 --- a/dataproc/apiv1beta2/doc.go +++ b/dataproc/apiv1beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1beta2/gapic_metadata.json b/dataproc/apiv1beta2/gapic_metadata.json index ca6dee8c5e79..2669636f437b 100644 --- a/dataproc/apiv1beta2/gapic_metadata.json +++ b/dataproc/apiv1beta2/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dataproc.v1beta2", - "libraryPackage": "cloud.google.com/go/dataproc/apiv1beta2", - "services": { - "AutoscalingPolicyService": { - "clients": { - "grpc": { - "libraryClient": "AutoscalingPolicyClient", - "rpcs": { - "CreateAutoscalingPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dataproc.v1beta2", + "libraryPackage": "cloud.google.com/go/dataproc/apiv1beta2", + "services": { + "AutoscalingPolicyService": { + "clients": { + "grpc": { + "libraryClient": "AutoscalingPolicyClient", + "rpcs": { + "CreateAutoscalingPolicy": { + "methods": [ "CreateAutoscalingPolicy" ] }, - "DeleteAutoscalingPolicy": { - "methods": [ + "DeleteAutoscalingPolicy": { + "methods": [ "DeleteAutoscalingPolicy" ] }, - "GetAutoscalingPolicy": { - "methods": [ + "GetAutoscalingPolicy": { + "methods": [ "GetAutoscalingPolicy" ] }, - "ListAutoscalingPolicies": { - "methods": [ + "ListAutoscalingPolicies": { + "methods": [ "ListAutoscalingPolicies" ] }, - "UpdateAutoscalingPolicy": { - "methods": [ + "UpdateAutoscalingPolicy": { + "methods": [ "UpdateAutoscalingPolicy" ] } @@ -39,38 +39,38 @@ } } }, - "ClusterController": { - "clients": { - "grpc": { - "libraryClient": "ClusterControllerClient", - "rpcs": { - "CreateCluster": { - "methods": [ + "ClusterController": { + "clients": { + "grpc": { + "libraryClient": "ClusterControllerClient", + "rpcs": { + "CreateCluster": { + "methods": [ "CreateCluster" ] }, - "DeleteCluster": { - "methods": [ + "DeleteCluster": { + "methods": [ "DeleteCluster" ] }, - "DiagnoseCluster": { - "methods": [ + "DiagnoseCluster": { + "methods": [ "DiagnoseCluster" ] }, - "GetCluster": { - "methods": [ + "GetCluster": { + "methods": [ "GetCluster" ] }, - "ListClusters": { - "methods": [ + "ListClusters": { + "methods": [ "ListClusters" ] }, - "UpdateCluster": { - "methods": [ + "UpdateCluster": { + "methods": [ "UpdateCluster" ] } @@ -78,43 +78,43 @@ } } }, - "JobController": { - "clients": { - "grpc": { - "libraryClient": "JobControllerClient", - "rpcs": { - "CancelJob": { - "methods": [ + "JobController": { + "clients": { + "grpc": { + "libraryClient": "JobControllerClient", + "rpcs": { + "CancelJob": { + "methods": [ "CancelJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "SubmitJob": { - "methods": [ + "SubmitJob": { + "methods": [ "SubmitJob" ] }, - "SubmitJobAsOperation": { - "methods": [ + "SubmitJobAsOperation": { + "methods": [ "SubmitJobAsOperation" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } @@ -122,43 +122,43 @@ } } }, - "WorkflowTemplateService": { - "clients": { - "grpc": { - "libraryClient": "WorkflowTemplateClient", - "rpcs": { - "CreateWorkflowTemplate": { - "methods": [ + "WorkflowTemplateService": { + "clients": { + "grpc": { + "libraryClient": "WorkflowTemplateClient", + "rpcs": { + "CreateWorkflowTemplate": { + "methods": [ "CreateWorkflowTemplate" ] }, - "DeleteWorkflowTemplate": { - "methods": [ + "DeleteWorkflowTemplate": { + "methods": [ "DeleteWorkflowTemplate" ] }, - "GetWorkflowTemplate": { - "methods": [ + "GetWorkflowTemplate": { + "methods": [ "GetWorkflowTemplate" ] }, - "InstantiateInlineWorkflowTemplate": { - "methods": [ + "InstantiateInlineWorkflowTemplate": { + "methods": [ "InstantiateInlineWorkflowTemplate" ] }, - "InstantiateWorkflowTemplate": { - "methods": [ + "InstantiateWorkflowTemplate": { + "methods": [ "InstantiateWorkflowTemplate" ] }, - "ListWorkflowTemplates": { - "methods": [ + "ListWorkflowTemplates": { + "methods": [ "ListWorkflowTemplates" ] }, - "UpdateWorkflowTemplate": { - "methods": [ + "UpdateWorkflowTemplate": { + "methods": [ "UpdateWorkflowTemplate" ] } diff --git a/dataqna/apiv1alpha/doc.go b/dataqna/apiv1alpha/doc.go index c9bbb72d570b..5d3e59576c63 100644 --- a/dataqna/apiv1alpha/doc.go +++ b/dataqna/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataqna/apiv1alpha/gapic_metadata.json b/dataqna/apiv1alpha/gapic_metadata.json index b5acffa08f0c..5ed6988e3fa2 100644 --- a/dataqna/apiv1alpha/gapic_metadata.json +++ b/dataqna/apiv1alpha/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dataqna.v1alpha", - "libraryPackage": "cloud.google.com/go/dataqna/apiv1alpha", - "services": { - "AutoSuggestionService": { - "clients": { - "grpc": { - "libraryClient": "AutoSuggestionClient", - "rpcs": { - "SuggestQueries": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dataqna.v1alpha", + "libraryPackage": "cloud.google.com/go/dataqna/apiv1alpha", + "services": { + "AutoSuggestionService": { + "clients": { + "grpc": { + "libraryClient": "AutoSuggestionClient", + "rpcs": { + "SuggestQueries": { + "methods": [ "SuggestQueries" ] } @@ -19,33 +19,33 @@ } } }, - "QuestionService": { - "clients": { - "grpc": { - "libraryClient": "QuestionClient", - "rpcs": { - "CreateQuestion": { - "methods": [ + "QuestionService": { + "clients": { + "grpc": { + "libraryClient": "QuestionClient", + "rpcs": { + "CreateQuestion": { + "methods": [ "CreateQuestion" ] }, - "ExecuteQuestion": { - "methods": [ + "ExecuteQuestion": { + "methods": [ "ExecuteQuestion" ] }, - "GetQuestion": { - "methods": [ + "GetQuestion": { + "methods": [ "GetQuestion" ] }, - "GetUserFeedback": { - "methods": [ + "GetUserFeedback": { + "methods": [ "GetUserFeedback" ] }, - "UpdateUserFeedback": { - "methods": [ + "UpdateUserFeedback": { + "methods": [ "UpdateUserFeedback" ] } diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index 6e5c06d83714..fad25e838c2a 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/admin/apiv1/gapic_metadata.json b/datastore/admin/apiv1/gapic_metadata.json index 07d60ee93bed..12ca2f15ef35 100644 --- a/datastore/admin/apiv1/gapic_metadata.json +++ b/datastore/admin/apiv1/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.datastore.admin.v1", - "libraryPackage": "cloud.google.com/go/datastore/admin/apiv1", - "services": { - "DatastoreAdmin": { - "clients": { - "grpc": { - "libraryClient": "DatastoreAdminClient", - "rpcs": { - "CreateIndex": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.datastore.admin.v1", + "libraryPackage": "cloud.google.com/go/datastore/admin/apiv1", + "services": { + "DatastoreAdmin": { + "clients": { + "grpc": { + "libraryClient": "DatastoreAdminClient", + "rpcs": { + "CreateIndex": { + "methods": [ "CreateIndex" ] }, - "DeleteIndex": { - "methods": [ + "DeleteIndex": { + "methods": [ "DeleteIndex" ] }, - "ExportEntities": { - "methods": [ + "ExportEntities": { + "methods": [ "ExportEntities" ] }, - "GetIndex": { - "methods": [ + "GetIndex": { + "methods": [ "GetIndex" ] }, - "ImportEntities": { - "methods": [ + "ImportEntities": { + "methods": [ "ImportEntities" ] }, - "ListIndexes": { - "methods": [ + "ListIndexes": { + "methods": [ "ListIndexes" ] } diff --git a/datastore/go.mod b/datastore/go.mod index 74bd1b788955..d9b084df589f 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/datastore/go.sum b/datastore/go.sum index 9e44f7fc0b63..aa8fd5de0a26 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -450,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/datastream/apiv1alpha1/doc.go b/datastream/apiv1alpha1/doc.go index 29837f62a938..b110d9efea79 100644 --- a/datastream/apiv1alpha1/doc.go +++ b/datastream/apiv1alpha1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastream/apiv1alpha1/gapic_metadata.json b/datastream/apiv1alpha1/gapic_metadata.json index 86d55bde2210..417ecf9c4390 100644 --- a/datastream/apiv1alpha1/gapic_metadata.json +++ b/datastream/apiv1alpha1/gapic_metadata.json @@ -1,117 +1,117 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.datastream.v1alpha1", - "libraryPackage": "cloud.google.com/go/datastream/apiv1alpha1", - "services": { - "Datastream": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateConnectionProfile": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.datastream.v1alpha1", + "libraryPackage": "cloud.google.com/go/datastream/apiv1alpha1", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateConnectionProfile": { + "methods": [ "CreateConnectionProfile" ] }, - "CreatePrivateConnection": { - "methods": [ + "CreatePrivateConnection": { + "methods": [ "CreatePrivateConnection" ] }, - "CreateRoute": { - "methods": [ + "CreateRoute": { + "methods": [ "CreateRoute" ] }, - "CreateStream": { - "methods": [ + "CreateStream": { + "methods": [ "CreateStream" ] }, - "DeleteConnectionProfile": { - "methods": [ + "DeleteConnectionProfile": { + "methods": [ "DeleteConnectionProfile" ] }, - "DeletePrivateConnection": { - "methods": [ + "DeletePrivateConnection": { + "methods": [ "DeletePrivateConnection" ] }, - "DeleteRoute": { - "methods": [ + "DeleteRoute": { + "methods": [ "DeleteRoute" ] }, - "DeleteStream": { - "methods": [ + "DeleteStream": { + "methods": [ "DeleteStream" ] }, - "DiscoverConnectionProfile": { - "methods": [ + "DiscoverConnectionProfile": { + "methods": [ "DiscoverConnectionProfile" ] }, - "FetchErrors": { - "methods": [ + "FetchErrors": { + "methods": [ "FetchErrors" ] }, - "FetchStaticIps": { - "methods": [ + "FetchStaticIps": { + "methods": [ "FetchStaticIps" ] }, - "GetConnectionProfile": { - "methods": [ + "GetConnectionProfile": { + "methods": [ "GetConnectionProfile" ] }, - "GetPrivateConnection": { - "methods": [ + "GetPrivateConnection": { + "methods": [ "GetPrivateConnection" ] }, - "GetRoute": { - "methods": [ + "GetRoute": { + "methods": [ "GetRoute" ] }, - "GetStream": { - "methods": [ + "GetStream": { + "methods": [ "GetStream" ] }, - "ListConnectionProfiles": { - "methods": [ + "ListConnectionProfiles": { + "methods": [ "ListConnectionProfiles" ] }, - "ListPrivateConnections": { - "methods": [ + "ListPrivateConnections": { + "methods": [ "ListPrivateConnections" ] }, - "ListRoutes": { - "methods": [ + "ListRoutes": { + "methods": [ "ListRoutes" ] }, - "ListStreams": { - "methods": [ + "ListStreams": { + "methods": [ "ListStreams" ] }, - "UpdateConnectionProfile": { - "methods": [ + "UpdateConnectionProfile": { + "methods": [ "UpdateConnectionProfile" ] }, - "UpdateStream": { - "methods": [ + "UpdateStream": { + "methods": [ "UpdateStream" ] } diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 46c1001d4462..43dbfffd1ad0 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/debugger/apiv2/gapic_metadata.json b/debugger/apiv2/gapic_metadata.json index 1727a125a34d..e0790b9e7f7a 100644 --- a/debugger/apiv2/gapic_metadata.json +++ b/debugger/apiv2/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.clouddebugger.v2", - "libraryPackage": "cloud.google.com/go/debugger/apiv2", - "services": { - "Controller2": { - "clients": { - "grpc": { - "libraryClient": "Controller2Client", - "rpcs": { - "ListActiveBreakpoints": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.clouddebugger.v2", + "libraryPackage": "cloud.google.com/go/debugger/apiv2", + "services": { + "Controller2": { + "clients": { + "grpc": { + "libraryClient": "Controller2Client", + "rpcs": { + "ListActiveBreakpoints": { + "methods": [ "ListActiveBreakpoints" ] }, - "RegisterDebuggee": { - "methods": [ + "RegisterDebuggee": { + "methods": [ "RegisterDebuggee" ] }, - "UpdateActiveBreakpoint": { - "methods": [ + "UpdateActiveBreakpoint": { + "methods": [ "UpdateActiveBreakpoint" ] } @@ -29,33 +29,33 @@ } } }, - "Debugger2": { - "clients": { - "grpc": { - "libraryClient": "Debugger2Client", - "rpcs": { - "DeleteBreakpoint": { - "methods": [ + "Debugger2": { + "clients": { + "grpc": { + "libraryClient": "Debugger2Client", + "rpcs": { + "DeleteBreakpoint": { + "methods": [ "DeleteBreakpoint" ] }, - "GetBreakpoint": { - "methods": [ + "GetBreakpoint": { + "methods": [ "GetBreakpoint" ] }, - "ListBreakpoints": { - "methods": [ + "ListBreakpoints": { + "methods": [ "ListBreakpoints" ] }, - "ListDebuggees": { - "methods": [ + "ListDebuggees": { + "methods": [ "ListDebuggees" ] }, - "SetBreakpoint": { - "methods": [ + "SetBreakpoint": { + "methods": [ "SetBreakpoint" ] } diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index 9bcf37c93e11..32d95a11eb10 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/gapic_metadata.json b/dialogflow/apiv2/gapic_metadata.json index 0671534239af..d7b1922072c6 100644 --- a/dialogflow/apiv2/gapic_metadata.json +++ b/dialogflow/apiv2/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dialogflow.v2", - "libraryPackage": "cloud.google.com/go/dialogflow/apiv2", - "services": { - "Agents": { - "clients": { - "grpc": { - "libraryClient": "AgentsClient", - "rpcs": { - "DeleteAgent": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dialogflow.v2", + "libraryPackage": "cloud.google.com/go/dialogflow/apiv2", + "services": { + "Agents": { + "clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": { + "DeleteAgent": { + "methods": [ "DeleteAgent" ] }, - "ExportAgent": { - "methods": [ + "ExportAgent": { + "methods": [ "ExportAgent" ] }, - "GetAgent": { - "methods": [ + "GetAgent": { + "methods": [ "GetAgent" ] }, - "GetValidationResult": { - "methods": [ + "GetValidationResult": { + "methods": [ "GetValidationResult" ] }, - "ImportAgent": { - "methods": [ + "ImportAgent": { + "methods": [ "ImportAgent" ] }, - "RestoreAgent": { - "methods": [ + "RestoreAgent": { + "methods": [ "RestoreAgent" ] }, - "SearchAgents": { - "methods": [ + "SearchAgents": { + "methods": [ "SearchAgents" ] }, - "SetAgent": { - "methods": [ + "SetAgent": { + "methods": [ "SetAgent" ] }, - "TrainAgent": { - "methods": [ + "TrainAgent": { + "methods": [ "TrainAgent" ] } @@ -59,18 +59,18 @@ } } }, - "AnswerRecords": { - "clients": { - "grpc": { - "libraryClient": "AnswerRecordsClient", - "rpcs": { - "ListAnswerRecords": { - "methods": [ + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "ListAnswerRecords": { + "methods": [ "ListAnswerRecords" ] }, - "UpdateAnswerRecord": { - "methods": [ + "UpdateAnswerRecord": { + "methods": [ "UpdateAnswerRecord" ] } @@ -78,38 +78,38 @@ } } }, - "Contexts": { - "clients": { - "grpc": { - "libraryClient": "ContextsClient", - "rpcs": { - "CreateContext": { - "methods": [ + "Contexts": { + "clients": { + "grpc": { + "libraryClient": "ContextsClient", + "rpcs": { + "CreateContext": { + "methods": [ "CreateContext" ] }, - "DeleteAllContexts": { - "methods": [ + "DeleteAllContexts": { + "methods": [ "DeleteAllContexts" ] }, - "DeleteContext": { - "methods": [ + "DeleteContext": { + "methods": [ "DeleteContext" ] }, - "GetContext": { - "methods": [ + "GetContext": { + "methods": [ "GetContext" ] }, - "ListContexts": { - "methods": [ + "ListContexts": { + "methods": [ "ListContexts" ] }, - "UpdateContext": { - "methods": [ + "UpdateContext": { + "methods": [ "UpdateContext" ] } @@ -117,33 +117,33 @@ } } }, - "ConversationProfiles": { - "clients": { - "grpc": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "CreateConversationProfile": { - "methods": [ + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "CreateConversationProfile": { + "methods": [ "CreateConversationProfile" ] }, - "DeleteConversationProfile": { - "methods": [ + "DeleteConversationProfile": { + "methods": [ "DeleteConversationProfile" ] }, - "GetConversationProfile": { - "methods": [ + "GetConversationProfile": { + "methods": [ "GetConversationProfile" ] }, - "ListConversationProfiles": { - "methods": [ + "ListConversationProfiles": { + "methods": [ "ListConversationProfiles" ] }, - "UpdateConversationProfile": { - "methods": [ + "UpdateConversationProfile": { + "methods": [ "UpdateConversationProfile" ] } @@ -151,33 +151,33 @@ } } }, - "Conversations": { - "clients": { - "grpc": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CompleteConversation": { - "methods": [ + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CompleteConversation": { + "methods": [ "CompleteConversation" ] }, - "CreateConversation": { - "methods": [ + "CreateConversation": { + "methods": [ "CreateConversation" ] }, - "GetConversation": { - "methods": [ + "GetConversation": { + "methods": [ "GetConversation" ] }, - "ListConversations": { - "methods": [ + "ListConversations": { + "methods": [ "ListConversations" ] }, - "ListMessages": { - "methods": [ + "ListMessages": { + "methods": [ "ListMessages" ] } @@ -185,38 +185,38 @@ } } }, - "Documents": { - "clients": { - "grpc": { - "libraryClient": "DocumentsClient", - "rpcs": { - "CreateDocument": { - "methods": [ + "Documents": { + "clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": { + "CreateDocument": { + "methods": [ "CreateDocument" ] }, - "DeleteDocument": { - "methods": [ + "DeleteDocument": { + "methods": [ "DeleteDocument" ] }, - "GetDocument": { - "methods": [ + "GetDocument": { + "methods": [ "GetDocument" ] }, - "ListDocuments": { - "methods": [ + "ListDocuments": { + "methods": [ "ListDocuments" ] }, - "ReloadDocument": { - "methods": [ + "ReloadDocument": { + "methods": [ "ReloadDocument" ] }, - "UpdateDocument": { - "methods": [ + "UpdateDocument": { + "methods": [ "UpdateDocument" ] } @@ -224,58 +224,58 @@ } } }, - "EntityTypes": { - "clients": { - "grpc": { - "libraryClient": "EntityTypesClient", - "rpcs": { - "BatchCreateEntities": { - "methods": [ + "EntityTypes": { + "clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "BatchCreateEntities": { + "methods": [ "BatchCreateEntities" ] }, - "BatchDeleteEntities": { - "methods": [ + "BatchDeleteEntities": { + "methods": [ "BatchDeleteEntities" ] }, - "BatchDeleteEntityTypes": { - "methods": [ + "BatchDeleteEntityTypes": { + "methods": [ "BatchDeleteEntityTypes" ] }, - "BatchUpdateEntities": { - "methods": [ + "BatchUpdateEntities": { + "methods": [ "BatchUpdateEntities" ] }, - "BatchUpdateEntityTypes": { - "methods": [ + "BatchUpdateEntityTypes": { + "methods": [ "BatchUpdateEntityTypes" ] }, - "CreateEntityType": { - "methods": [ + "CreateEntityType": { + "methods": [ "CreateEntityType" ] }, - "DeleteEntityType": { - "methods": [ + "DeleteEntityType": { + "methods": [ "DeleteEntityType" ] }, - "GetEntityType": { - "methods": [ + "GetEntityType": { + "methods": [ "GetEntityType" ] }, - "ListEntityTypes": { - "methods": [ + "ListEntityTypes": { + "methods": [ "ListEntityTypes" ] }, - "UpdateEntityType": { - "methods": [ + "UpdateEntityType": { + "methods": [ "UpdateEntityType" ] } @@ -283,38 +283,38 @@ } } }, - "Environments": { - "clients": { - "grpc": { - "libraryClient": "EnvironmentsClient", - "rpcs": { - "CreateEnvironment": { - "methods": [ + "Environments": { + "clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "CreateEnvironment": { + "methods": [ "CreateEnvironment" ] }, - "DeleteEnvironment": { - "methods": [ + "DeleteEnvironment": { + "methods": [ "DeleteEnvironment" ] }, - "GetEnvironment": { - "methods": [ + "GetEnvironment": { + "methods": [ "GetEnvironment" ] }, - "GetEnvironmentHistory": { - "methods": [ + "GetEnvironmentHistory": { + "methods": [ "GetEnvironmentHistory" ] }, - "ListEnvironments": { - "methods": [ + "ListEnvironments": { + "methods": [ "ListEnvironments" ] }, - "UpdateEnvironment": { - "methods": [ + "UpdateEnvironment": { + "methods": [ "UpdateEnvironment" ] } @@ -322,18 +322,18 @@ } } }, - "Fulfillments": { - "clients": { - "grpc": { - "libraryClient": "FulfillmentsClient", - "rpcs": { - "GetFulfillment": { - "methods": [ + "Fulfillments": { + "clients": { + "grpc": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ "GetFulfillment" ] }, - "UpdateFulfillment": { - "methods": [ + "UpdateFulfillment": { + "methods": [ "UpdateFulfillment" ] } @@ -341,43 +341,43 @@ } } }, - "Intents": { - "clients": { - "grpc": { - "libraryClient": "IntentsClient", - "rpcs": { - "BatchDeleteIntents": { - "methods": [ + "Intents": { + "clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": { + "BatchDeleteIntents": { + "methods": [ "BatchDeleteIntents" ] }, - "BatchUpdateIntents": { - "methods": [ + "BatchUpdateIntents": { + "methods": [ "BatchUpdateIntents" ] }, - "CreateIntent": { - "methods": [ + "CreateIntent": { + "methods": [ "CreateIntent" ] }, - "DeleteIntent": { - "methods": [ + "DeleteIntent": { + "methods": [ "DeleteIntent" ] }, - "GetIntent": { - "methods": [ + "GetIntent": { + "methods": [ "GetIntent" ] }, - "ListIntents": { - "methods": [ + "ListIntents": { + "methods": [ "ListIntents" ] }, - "UpdateIntent": { - "methods": [ + "UpdateIntent": { + "methods": [ "UpdateIntent" ] } @@ -385,33 +385,33 @@ } } }, - "KnowledgeBases": { - "clients": { - "grpc": { - "libraryClient": "KnowledgeBasesClient", - "rpcs": { - "CreateKnowledgeBase": { - "methods": [ + "KnowledgeBases": { + "clients": { + "grpc": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "CreateKnowledgeBase": { + "methods": [ "CreateKnowledgeBase" ] }, - "DeleteKnowledgeBase": { - "methods": [ + "DeleteKnowledgeBase": { + "methods": [ "DeleteKnowledgeBase" ] }, - "GetKnowledgeBase": { - "methods": [ + "GetKnowledgeBase": { + "methods": [ "GetKnowledgeBase" ] }, - "ListKnowledgeBases": { - "methods": [ + "ListKnowledgeBases": { + "methods": [ "ListKnowledgeBases" ] }, - "UpdateKnowledgeBase": { - "methods": [ + "UpdateKnowledgeBase": { + "methods": [ "UpdateKnowledgeBase" ] } @@ -419,43 +419,43 @@ } } }, - "Participants": { - "clients": { - "grpc": { - "libraryClient": "ParticipantsClient", - "rpcs": { - "AnalyzeContent": { - "methods": [ + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "AnalyzeContent": { + "methods": [ "AnalyzeContent" ] }, - "CreateParticipant": { - "methods": [ + "CreateParticipant": { + "methods": [ "CreateParticipant" ] }, - "GetParticipant": { - "methods": [ + "GetParticipant": { + "methods": [ "GetParticipant" ] }, - "ListParticipants": { - "methods": [ + "ListParticipants": { + "methods": [ "ListParticipants" ] }, - "SuggestArticles": { - "methods": [ + "SuggestArticles": { + "methods": [ "SuggestArticles" ] }, - "SuggestFaqAnswers": { - "methods": [ + "SuggestFaqAnswers": { + "methods": [ "SuggestFaqAnswers" ] }, - "UpdateParticipant": { - "methods": [ + "UpdateParticipant": { + "methods": [ "UpdateParticipant" ] } @@ -463,33 +463,33 @@ } } }, - "SessionEntityTypes": { - "clients": { - "grpc": { - "libraryClient": "SessionEntityTypesClient", - "rpcs": { - "CreateSessionEntityType": { - "methods": [ + "SessionEntityTypes": { + "clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "CreateSessionEntityType": { + "methods": [ "CreateSessionEntityType" ] }, - "DeleteSessionEntityType": { - "methods": [ + "DeleteSessionEntityType": { + "methods": [ "DeleteSessionEntityType" ] }, - "GetSessionEntityType": { - "methods": [ + "GetSessionEntityType": { + "methods": [ "GetSessionEntityType" ] }, - "ListSessionEntityTypes": { - "methods": [ + "ListSessionEntityTypes": { + "methods": [ "ListSessionEntityTypes" ] }, - "UpdateSessionEntityType": { - "methods": [ + "UpdateSessionEntityType": { + "methods": [ "UpdateSessionEntityType" ] } @@ -497,18 +497,18 @@ } } }, - "Sessions": { - "clients": { - "grpc": { - "libraryClient": "SessionsClient", - "rpcs": { - "DetectIntent": { - "methods": [ + "Sessions": { + "clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ "DetectIntent" ] }, - "StreamingDetectIntent": { - "methods": [ + "StreamingDetectIntent": { + "methods": [ "StreamingDetectIntent" ] } @@ -516,33 +516,33 @@ } } }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "CreateVersion": { - "methods": [ + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ "CreateVersion" ] }, - "DeleteVersion": { - "methods": [ + "DeleteVersion": { + "methods": [ "DeleteVersion" ] }, - "GetVersion": { - "methods": [ + "GetVersion": { + "methods": [ "GetVersion" ] }, - "ListVersions": { - "methods": [ + "ListVersions": { + "methods": [ "ListVersions" ] }, - "UpdateVersion": { - "methods": [ + "UpdateVersion": { + "methods": [ "UpdateVersion" ] } diff --git a/dialogflow/cx/apiv3/doc.go b/dialogflow/cx/apiv3/doc.go index 731cf46746e6..9b11084fd7f1 100644 --- a/dialogflow/cx/apiv3/doc.go +++ b/dialogflow/cx/apiv3/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3/gapic_metadata.json b/dialogflow/cx/apiv3/gapic_metadata.json index c90368d52f5d..409bc550939f 100644 --- a/dialogflow/cx/apiv3/gapic_metadata.json +++ b/dialogflow/cx/apiv3/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dialogflow.cx.v3", - "libraryPackage": "cloud.google.com/go/dialogflow/cx/apiv3", - "services": { - "Agents": { - "clients": { - "grpc": { - "libraryClient": "AgentsClient", - "rpcs": { - "CreateAgent": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dialogflow.cx.v3", + "libraryPackage": "cloud.google.com/go/dialogflow/cx/apiv3", + "services": { + "Agents": { + "clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": { + "CreateAgent": { + "methods": [ "CreateAgent" ] }, - "DeleteAgent": { - "methods": [ + "DeleteAgent": { + "methods": [ "DeleteAgent" ] }, - "ExportAgent": { - "methods": [ + "ExportAgent": { + "methods": [ "ExportAgent" ] }, - "GetAgent": { - "methods": [ + "GetAgent": { + "methods": [ "GetAgent" ] }, - "GetAgentValidationResult": { - "methods": [ + "GetAgentValidationResult": { + "methods": [ "GetAgentValidationResult" ] }, - "ListAgents": { - "methods": [ + "ListAgents": { + "methods": [ "ListAgents" ] }, - "RestoreAgent": { - "methods": [ + "RestoreAgent": { + "methods": [ "RestoreAgent" ] }, - "UpdateAgent": { - "methods": [ + "UpdateAgent": { + "methods": [ "UpdateAgent" ] }, - "ValidateAgent": { - "methods": [ + "ValidateAgent": { + "methods": [ "ValidateAgent" ] } @@ -59,33 +59,33 @@ } } }, - "EntityTypes": { - "clients": { - "grpc": { - "libraryClient": "EntityTypesClient", - "rpcs": { - "CreateEntityType": { - "methods": [ + "EntityTypes": { + "clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "CreateEntityType": { + "methods": [ "CreateEntityType" ] }, - "DeleteEntityType": { - "methods": [ + "DeleteEntityType": { + "methods": [ "DeleteEntityType" ] }, - "GetEntityType": { - "methods": [ + "GetEntityType": { + "methods": [ "GetEntityType" ] }, - "ListEntityTypes": { - "methods": [ + "ListEntityTypes": { + "methods": [ "ListEntityTypes" ] }, - "UpdateEntityType": { - "methods": [ + "UpdateEntityType": { + "methods": [ "UpdateEntityType" ] } @@ -93,48 +93,48 @@ } } }, - "Environments": { - "clients": { - "grpc": { - "libraryClient": "EnvironmentsClient", - "rpcs": { - "CreateEnvironment": { - "methods": [ + "Environments": { + "clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "CreateEnvironment": { + "methods": [ "CreateEnvironment" ] }, - "DeleteEnvironment": { - "methods": [ + "DeleteEnvironment": { + "methods": [ "DeleteEnvironment" ] }, - "GetEnvironment": { - "methods": [ + "GetEnvironment": { + "methods": [ "GetEnvironment" ] }, - "ListContinuousTestResults": { - "methods": [ + "ListContinuousTestResults": { + "methods": [ "ListContinuousTestResults" ] }, - "ListEnvironments": { - "methods": [ + "ListEnvironments": { + "methods": [ "ListEnvironments" ] }, - "LookupEnvironmentHistory": { - "methods": [ + "LookupEnvironmentHistory": { + "methods": [ "LookupEnvironmentHistory" ] }, - "RunContinuousTest": { - "methods": [ + "RunContinuousTest": { + "methods": [ "RunContinuousTest" ] }, - "UpdateEnvironment": { - "methods": [ + "UpdateEnvironment": { + "methods": [ "UpdateEnvironment" ] } @@ -142,43 +142,43 @@ } } }, - "Experiments": { - "clients": { - "grpc": { - "libraryClient": "ExperimentsClient", - "rpcs": { - "CreateExperiment": { - "methods": [ + "Experiments": { + "clients": { + "grpc": { + "libraryClient": "ExperimentsClient", + "rpcs": { + "CreateExperiment": { + "methods": [ "CreateExperiment" ] }, - "DeleteExperiment": { - "methods": [ + "DeleteExperiment": { + "methods": [ "DeleteExperiment" ] }, - "GetExperiment": { - "methods": [ + "GetExperiment": { + "methods": [ "GetExperiment" ] }, - "ListExperiments": { - "methods": [ + "ListExperiments": { + "methods": [ "ListExperiments" ] }, - "StartExperiment": { - "methods": [ + "StartExperiment": { + "methods": [ "StartExperiment" ] }, - "StopExperiment": { - "methods": [ + "StopExperiment": { + "methods": [ "StopExperiment" ] }, - "UpdateExperiment": { - "methods": [ + "UpdateExperiment": { + "methods": [ "UpdateExperiment" ] } @@ -186,58 +186,58 @@ } } }, - "Flows": { - "clients": { - "grpc": { - "libraryClient": "FlowsClient", - "rpcs": { - "CreateFlow": { - "methods": [ + "Flows": { + "clients": { + "grpc": { + "libraryClient": "FlowsClient", + "rpcs": { + "CreateFlow": { + "methods": [ "CreateFlow" ] }, - "DeleteFlow": { - "methods": [ + "DeleteFlow": { + "methods": [ "DeleteFlow" ] }, - "ExportFlow": { - "methods": [ + "ExportFlow": { + "methods": [ "ExportFlow" ] }, - "GetFlow": { - "methods": [ + "GetFlow": { + "methods": [ "GetFlow" ] }, - "GetFlowValidationResult": { - "methods": [ + "GetFlowValidationResult": { + "methods": [ "GetFlowValidationResult" ] }, - "ImportFlow": { - "methods": [ + "ImportFlow": { + "methods": [ "ImportFlow" ] }, - "ListFlows": { - "methods": [ + "ListFlows": { + "methods": [ "ListFlows" ] }, - "TrainFlow": { - "methods": [ + "TrainFlow": { + "methods": [ "TrainFlow" ] }, - "UpdateFlow": { - "methods": [ + "UpdateFlow": { + "methods": [ "UpdateFlow" ] }, - "ValidateFlow": { - "methods": [ + "ValidateFlow": { + "methods": [ "ValidateFlow" ] } @@ -245,33 +245,33 @@ } } }, - "Intents": { - "clients": { - "grpc": { - "libraryClient": "IntentsClient", - "rpcs": { - "CreateIntent": { - "methods": [ + "Intents": { + "clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": { + "CreateIntent": { + "methods": [ "CreateIntent" ] }, - "DeleteIntent": { - "methods": [ + "DeleteIntent": { + "methods": [ "DeleteIntent" ] }, - "GetIntent": { - "methods": [ + "GetIntent": { + "methods": [ "GetIntent" ] }, - "ListIntents": { - "methods": [ + "ListIntents": { + "methods": [ "ListIntents" ] }, - "UpdateIntent": { - "methods": [ + "UpdateIntent": { + "methods": [ "UpdateIntent" ] } @@ -279,33 +279,33 @@ } } }, - "Pages": { - "clients": { - "grpc": { - "libraryClient": "PagesClient", - "rpcs": { - "CreatePage": { - "methods": [ + "Pages": { + "clients": { + "grpc": { + "libraryClient": "PagesClient", + "rpcs": { + "CreatePage": { + "methods": [ "CreatePage" ] }, - "DeletePage": { - "methods": [ + "DeletePage": { + "methods": [ "DeletePage" ] }, - "GetPage": { - "methods": [ + "GetPage": { + "methods": [ "GetPage" ] }, - "ListPages": { - "methods": [ + "ListPages": { + "methods": [ "ListPages" ] }, - "UpdatePage": { - "methods": [ + "UpdatePage": { + "methods": [ "UpdatePage" ] } @@ -313,33 +313,33 @@ } } }, - "SecuritySettingsService": { - "clients": { - "grpc": { - "libraryClient": "SecuritySettingsClient", - "rpcs": { - "CreateSecuritySettings": { - "methods": [ + "SecuritySettingsService": { + "clients": { + "grpc": { + "libraryClient": "SecuritySettingsClient", + "rpcs": { + "CreateSecuritySettings": { + "methods": [ "CreateSecuritySettings" ] }, - "DeleteSecuritySettings": { - "methods": [ + "DeleteSecuritySettings": { + "methods": [ "DeleteSecuritySettings" ] }, - "GetSecuritySettings": { - "methods": [ + "GetSecuritySettings": { + "methods": [ "GetSecuritySettings" ] }, - "ListSecuritySettings": { - "methods": [ + "ListSecuritySettings": { + "methods": [ "ListSecuritySettings" ] }, - "UpdateSecuritySettings": { - "methods": [ + "UpdateSecuritySettings": { + "methods": [ "UpdateSecuritySettings" ] } @@ -347,33 +347,33 @@ } } }, - "SessionEntityTypes": { - "clients": { - "grpc": { - "libraryClient": "SessionEntityTypesClient", - "rpcs": { - "CreateSessionEntityType": { - "methods": [ + "SessionEntityTypes": { + "clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "CreateSessionEntityType": { + "methods": [ "CreateSessionEntityType" ] }, - "DeleteSessionEntityType": { - "methods": [ + "DeleteSessionEntityType": { + "methods": [ "DeleteSessionEntityType" ] }, - "GetSessionEntityType": { - "methods": [ + "GetSessionEntityType": { + "methods": [ "GetSessionEntityType" ] }, - "ListSessionEntityTypes": { - "methods": [ + "ListSessionEntityTypes": { + "methods": [ "ListSessionEntityTypes" ] }, - "UpdateSessionEntityType": { - "methods": [ + "UpdateSessionEntityType": { + "methods": [ "UpdateSessionEntityType" ] } @@ -381,28 +381,28 @@ } } }, - "Sessions": { - "clients": { - "grpc": { - "libraryClient": "SessionsClient", - "rpcs": { - "DetectIntent": { - "methods": [ + "Sessions": { + "clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ "DetectIntent" ] }, - "FulfillIntent": { - "methods": [ + "FulfillIntent": { + "methods": [ "FulfillIntent" ] }, - "MatchIntent": { - "methods": [ + "MatchIntent": { + "methods": [ "MatchIntent" ] }, - "StreamingDetectIntent": { - "methods": [ + "StreamingDetectIntent": { + "methods": [ "StreamingDetectIntent" ] } @@ -410,68 +410,68 @@ } } }, - "TestCases": { - "clients": { - "grpc": { - "libraryClient": "TestCasesClient", - "rpcs": { - "BatchDeleteTestCases": { - "methods": [ + "TestCases": { + "clients": { + "grpc": { + "libraryClient": "TestCasesClient", + "rpcs": { + "BatchDeleteTestCases": { + "methods": [ "BatchDeleteTestCases" ] }, - "BatchRunTestCases": { - "methods": [ + "BatchRunTestCases": { + "methods": [ "BatchRunTestCases" ] }, - "CalculateCoverage": { - "methods": [ + "CalculateCoverage": { + "methods": [ "CalculateCoverage" ] }, - "CreateTestCase": { - "methods": [ + "CreateTestCase": { + "methods": [ "CreateTestCase" ] }, - "ExportTestCases": { - "methods": [ + "ExportTestCases": { + "methods": [ "ExportTestCases" ] }, - "GetTestCase": { - "methods": [ + "GetTestCase": { + "methods": [ "GetTestCase" ] }, - "GetTestCaseResult": { - "methods": [ + "GetTestCaseResult": { + "methods": [ "GetTestCaseResult" ] }, - "ImportTestCases": { - "methods": [ + "ImportTestCases": { + "methods": [ "ImportTestCases" ] }, - "ListTestCaseResults": { - "methods": [ + "ListTestCaseResults": { + "methods": [ "ListTestCaseResults" ] }, - "ListTestCases": { - "methods": [ + "ListTestCases": { + "methods": [ "ListTestCases" ] }, - "RunTestCase": { - "methods": [ + "RunTestCase": { + "methods": [ "RunTestCase" ] }, - "UpdateTestCase": { - "methods": [ + "UpdateTestCase": { + "methods": [ "UpdateTestCase" ] } @@ -479,33 +479,33 @@ } } }, - "TransitionRouteGroups": { - "clients": { - "grpc": { - "libraryClient": "TransitionRouteGroupsClient", - "rpcs": { - "CreateTransitionRouteGroup": { - "methods": [ + "TransitionRouteGroups": { + "clients": { + "grpc": { + "libraryClient": "TransitionRouteGroupsClient", + "rpcs": { + "CreateTransitionRouteGroup": { + "methods": [ "CreateTransitionRouteGroup" ] }, - "DeleteTransitionRouteGroup": { - "methods": [ + "DeleteTransitionRouteGroup": { + "methods": [ "DeleteTransitionRouteGroup" ] }, - "GetTransitionRouteGroup": { - "methods": [ + "GetTransitionRouteGroup": { + "methods": [ "GetTransitionRouteGroup" ] }, - "ListTransitionRouteGroups": { - "methods": [ + "ListTransitionRouteGroups": { + "methods": [ "ListTransitionRouteGroups" ] }, - "UpdateTransitionRouteGroup": { - "methods": [ + "UpdateTransitionRouteGroup": { + "methods": [ "UpdateTransitionRouteGroup" ] } @@ -513,38 +513,38 @@ } } }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "CreateVersion": { - "methods": [ + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ "CreateVersion" ] }, - "DeleteVersion": { - "methods": [ + "DeleteVersion": { + "methods": [ "DeleteVersion" ] }, - "GetVersion": { - "methods": [ + "GetVersion": { + "methods": [ "GetVersion" ] }, - "ListVersions": { - "methods": [ + "ListVersions": { + "methods": [ "ListVersions" ] }, - "LoadVersion": { - "methods": [ + "LoadVersion": { + "methods": [ "LoadVersion" ] }, - "UpdateVersion": { - "methods": [ + "UpdateVersion": { + "methods": [ "UpdateVersion" ] } @@ -552,33 +552,33 @@ } } }, - "Webhooks": { - "clients": { - "grpc": { - "libraryClient": "WebhooksClient", - "rpcs": { - "CreateWebhook": { - "methods": [ + "Webhooks": { + "clients": { + "grpc": { + "libraryClient": "WebhooksClient", + "rpcs": { + "CreateWebhook": { + "methods": [ "CreateWebhook" ] }, - "DeleteWebhook": { - "methods": [ + "DeleteWebhook": { + "methods": [ "DeleteWebhook" ] }, - "GetWebhook": { - "methods": [ + "GetWebhook": { + "methods": [ "GetWebhook" ] }, - "ListWebhooks": { - "methods": [ + "ListWebhooks": { + "methods": [ "ListWebhooks" ] }, - "UpdateWebhook": { - "methods": [ + "UpdateWebhook": { + "methods": [ "UpdateWebhook" ] } diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index 4f5d85327590..1c2c2e8e25fb 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3beta1/gapic_metadata.json b/dialogflow/cx/apiv3beta1/gapic_metadata.json index bf463ce0246a..3f3dd0e65162 100644 --- a/dialogflow/cx/apiv3beta1/gapic_metadata.json +++ b/dialogflow/cx/apiv3beta1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.dialogflow.cx.v3beta1", - "libraryPackage": "cloud.google.com/go/dialogflow/cx/apiv3beta1", - "services": { - "Agents": { - "clients": { - "grpc": { - "libraryClient": "AgentsClient", - "rpcs": { - "CreateAgent": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.dialogflow.cx.v3beta1", + "libraryPackage": "cloud.google.com/go/dialogflow/cx/apiv3beta1", + "services": { + "Agents": { + "clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": { + "CreateAgent": { + "methods": [ "CreateAgent" ] }, - "DeleteAgent": { - "methods": [ + "DeleteAgent": { + "methods": [ "DeleteAgent" ] }, - "ExportAgent": { - "methods": [ + "ExportAgent": { + "methods": [ "ExportAgent" ] }, - "GetAgent": { - "methods": [ + "GetAgent": { + "methods": [ "GetAgent" ] }, - "GetAgentValidationResult": { - "methods": [ + "GetAgentValidationResult": { + "methods": [ "GetAgentValidationResult" ] }, - "ListAgents": { - "methods": [ + "ListAgents": { + "methods": [ "ListAgents" ] }, - "RestoreAgent": { - "methods": [ + "RestoreAgent": { + "methods": [ "RestoreAgent" ] }, - "UpdateAgent": { - "methods": [ + "UpdateAgent": { + "methods": [ "UpdateAgent" ] }, - "ValidateAgent": { - "methods": [ + "ValidateAgent": { + "methods": [ "ValidateAgent" ] } @@ -59,33 +59,33 @@ } } }, - "EntityTypes": { - "clients": { - "grpc": { - "libraryClient": "EntityTypesClient", - "rpcs": { - "CreateEntityType": { - "methods": [ + "EntityTypes": { + "clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "CreateEntityType": { + "methods": [ "CreateEntityType" ] }, - "DeleteEntityType": { - "methods": [ + "DeleteEntityType": { + "methods": [ "DeleteEntityType" ] }, - "GetEntityType": { - "methods": [ + "GetEntityType": { + "methods": [ "GetEntityType" ] }, - "ListEntityTypes": { - "methods": [ + "ListEntityTypes": { + "methods": [ "ListEntityTypes" ] }, - "UpdateEntityType": { - "methods": [ + "UpdateEntityType": { + "methods": [ "UpdateEntityType" ] } @@ -93,48 +93,48 @@ } } }, - "Environments": { - "clients": { - "grpc": { - "libraryClient": "EnvironmentsClient", - "rpcs": { - "CreateEnvironment": { - "methods": [ + "Environments": { + "clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "CreateEnvironment": { + "methods": [ "CreateEnvironment" ] }, - "DeleteEnvironment": { - "methods": [ + "DeleteEnvironment": { + "methods": [ "DeleteEnvironment" ] }, - "GetEnvironment": { - "methods": [ + "GetEnvironment": { + "methods": [ "GetEnvironment" ] }, - "ListContinuousTestResults": { - "methods": [ + "ListContinuousTestResults": { + "methods": [ "ListContinuousTestResults" ] }, - "ListEnvironments": { - "methods": [ + "ListEnvironments": { + "methods": [ "ListEnvironments" ] }, - "LookupEnvironmentHistory": { - "methods": [ + "LookupEnvironmentHistory": { + "methods": [ "LookupEnvironmentHistory" ] }, - "RunContinuousTest": { - "methods": [ + "RunContinuousTest": { + "methods": [ "RunContinuousTest" ] }, - "UpdateEnvironment": { - "methods": [ + "UpdateEnvironment": { + "methods": [ "UpdateEnvironment" ] } @@ -142,43 +142,43 @@ } } }, - "Experiments": { - "clients": { - "grpc": { - "libraryClient": "ExperimentsClient", - "rpcs": { - "CreateExperiment": { - "methods": [ + "Experiments": { + "clients": { + "grpc": { + "libraryClient": "ExperimentsClient", + "rpcs": { + "CreateExperiment": { + "methods": [ "CreateExperiment" ] }, - "DeleteExperiment": { - "methods": [ + "DeleteExperiment": { + "methods": [ "DeleteExperiment" ] }, - "GetExperiment": { - "methods": [ + "GetExperiment": { + "methods": [ "GetExperiment" ] }, - "ListExperiments": { - "methods": [ + "ListExperiments": { + "methods": [ "ListExperiments" ] }, - "StartExperiment": { - "methods": [ + "StartExperiment": { + "methods": [ "StartExperiment" ] }, - "StopExperiment": { - "methods": [ + "StopExperiment": { + "methods": [ "StopExperiment" ] }, - "UpdateExperiment": { - "methods": [ + "UpdateExperiment": { + "methods": [ "UpdateExperiment" ] } @@ -186,58 +186,58 @@ } } }, - "Flows": { - "clients": { - "grpc": { - "libraryClient": "FlowsClient", - "rpcs": { - "CreateFlow": { - "methods": [ + "Flows": { + "clients": { + "grpc": { + "libraryClient": "FlowsClient", + "rpcs": { + "CreateFlow": { + "methods": [ "CreateFlow" ] }, - "DeleteFlow": { - "methods": [ + "DeleteFlow": { + "methods": [ "DeleteFlow" ] }, - "ExportFlow": { - "methods": [ + "ExportFlow": { + "methods": [ "ExportFlow" ] }, - "GetFlow": { - "methods": [ + "GetFlow": { + "methods": [ "GetFlow" ] }, - "GetFlowValidationResult": { - "methods": [ + "GetFlowValidationResult": { + "methods": [ "GetFlowValidationResult" ] }, - "ImportFlow": { - "methods": [ + "ImportFlow": { + "methods": [ "ImportFlow" ] }, - "ListFlows": { - "methods": [ + "ListFlows": { + "methods": [ "ListFlows" ] }, - "TrainFlow": { - "methods": [ + "TrainFlow": { + "methods": [ "TrainFlow" ] }, - "UpdateFlow": { - "methods": [ + "UpdateFlow": { + "methods": [ "UpdateFlow" ] }, - "ValidateFlow": { - "methods": [ + "ValidateFlow": { + "methods": [ "ValidateFlow" ] } @@ -245,33 +245,33 @@ } } }, - "Intents": { - "clients": { - "grpc": { - "libraryClient": "IntentsClient", - "rpcs": { - "CreateIntent": { - "methods": [ + "Intents": { + "clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": { + "CreateIntent": { + "methods": [ "CreateIntent" ] }, - "DeleteIntent": { - "methods": [ + "DeleteIntent": { + "methods": [ "DeleteIntent" ] }, - "GetIntent": { - "methods": [ + "GetIntent": { + "methods": [ "GetIntent" ] }, - "ListIntents": { - "methods": [ + "ListIntents": { + "methods": [ "ListIntents" ] }, - "UpdateIntent": { - "methods": [ + "UpdateIntent": { + "methods": [ "UpdateIntent" ] } @@ -279,33 +279,33 @@ } } }, - "Pages": { - "clients": { - "grpc": { - "libraryClient": "PagesClient", - "rpcs": { - "CreatePage": { - "methods": [ + "Pages": { + "clients": { + "grpc": { + "libraryClient": "PagesClient", + "rpcs": { + "CreatePage": { + "methods": [ "CreatePage" ] }, - "DeletePage": { - "methods": [ + "DeletePage": { + "methods": [ "DeletePage" ] }, - "GetPage": { - "methods": [ + "GetPage": { + "methods": [ "GetPage" ] }, - "ListPages": { - "methods": [ + "ListPages": { + "methods": [ "ListPages" ] }, - "UpdatePage": { - "methods": [ + "UpdatePage": { + "methods": [ "UpdatePage" ] } @@ -313,33 +313,33 @@ } } }, - "SecuritySettingsService": { - "clients": { - "grpc": { - "libraryClient": "SecuritySettingsClient", - "rpcs": { - "CreateSecuritySettings": { - "methods": [ + "SecuritySettingsService": { + "clients": { + "grpc": { + "libraryClient": "SecuritySettingsClient", + "rpcs": { + "CreateSecuritySettings": { + "methods": [ "CreateSecuritySettings" ] }, - "DeleteSecuritySettings": { - "methods": [ + "DeleteSecuritySettings": { + "methods": [ "DeleteSecuritySettings" ] }, - "GetSecuritySettings": { - "methods": [ + "GetSecuritySettings": { + "methods": [ "GetSecuritySettings" ] }, - "ListSecuritySettings": { - "methods": [ + "ListSecuritySettings": { + "methods": [ "ListSecuritySettings" ] }, - "UpdateSecuritySettings": { - "methods": [ + "UpdateSecuritySettings": { + "methods": [ "UpdateSecuritySettings" ] } @@ -347,33 +347,33 @@ } } }, - "SessionEntityTypes": { - "clients": { - "grpc": { - "libraryClient": "SessionEntityTypesClient", - "rpcs": { - "CreateSessionEntityType": { - "methods": [ + "SessionEntityTypes": { + "clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "CreateSessionEntityType": { + "methods": [ "CreateSessionEntityType" ] }, - "DeleteSessionEntityType": { - "methods": [ + "DeleteSessionEntityType": { + "methods": [ "DeleteSessionEntityType" ] }, - "GetSessionEntityType": { - "methods": [ + "GetSessionEntityType": { + "methods": [ "GetSessionEntityType" ] }, - "ListSessionEntityTypes": { - "methods": [ + "ListSessionEntityTypes": { + "methods": [ "ListSessionEntityTypes" ] }, - "UpdateSessionEntityType": { - "methods": [ + "UpdateSessionEntityType": { + "methods": [ "UpdateSessionEntityType" ] } @@ -381,28 +381,28 @@ } } }, - "Sessions": { - "clients": { - "grpc": { - "libraryClient": "SessionsClient", - "rpcs": { - "DetectIntent": { - "methods": [ + "Sessions": { + "clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ "DetectIntent" ] }, - "FulfillIntent": { - "methods": [ + "FulfillIntent": { + "methods": [ "FulfillIntent" ] }, - "MatchIntent": { - "methods": [ + "MatchIntent": { + "methods": [ "MatchIntent" ] }, - "StreamingDetectIntent": { - "methods": [ + "StreamingDetectIntent": { + "methods": [ "StreamingDetectIntent" ] } @@ -410,68 +410,68 @@ } } }, - "TestCases": { - "clients": { - "grpc": { - "libraryClient": "TestCasesClient", - "rpcs": { - "BatchDeleteTestCases": { - "methods": [ + "TestCases": { + "clients": { + "grpc": { + "libraryClient": "TestCasesClient", + "rpcs": { + "BatchDeleteTestCases": { + "methods": [ "BatchDeleteTestCases" ] }, - "BatchRunTestCases": { - "methods": [ + "BatchRunTestCases": { + "methods": [ "BatchRunTestCases" ] }, - "CalculateCoverage": { - "methods": [ + "CalculateCoverage": { + "methods": [ "CalculateCoverage" ] }, - "CreateTestCase": { - "methods": [ + "CreateTestCase": { + "methods": [ "CreateTestCase" ] }, - "ExportTestCases": { - "methods": [ + "ExportTestCases": { + "methods": [ "ExportTestCases" ] }, - "GetTestCase": { - "methods": [ + "GetTestCase": { + "methods": [ "GetTestCase" ] }, - "GetTestCaseResult": { - "methods": [ + "GetTestCaseResult": { + "methods": [ "GetTestCaseResult" ] }, - "ImportTestCases": { - "methods": [ + "ImportTestCases": { + "methods": [ "ImportTestCases" ] }, - "ListTestCaseResults": { - "methods": [ + "ListTestCaseResults": { + "methods": [ "ListTestCaseResults" ] }, - "ListTestCases": { - "methods": [ + "ListTestCases": { + "methods": [ "ListTestCases" ] }, - "RunTestCase": { - "methods": [ + "RunTestCase": { + "methods": [ "RunTestCase" ] }, - "UpdateTestCase": { - "methods": [ + "UpdateTestCase": { + "methods": [ "UpdateTestCase" ] } @@ -479,33 +479,33 @@ } } }, - "TransitionRouteGroups": { - "clients": { - "grpc": { - "libraryClient": "TransitionRouteGroupsClient", - "rpcs": { - "CreateTransitionRouteGroup": { - "methods": [ + "TransitionRouteGroups": { + "clients": { + "grpc": { + "libraryClient": "TransitionRouteGroupsClient", + "rpcs": { + "CreateTransitionRouteGroup": { + "methods": [ "CreateTransitionRouteGroup" ] }, - "DeleteTransitionRouteGroup": { - "methods": [ + "DeleteTransitionRouteGroup": { + "methods": [ "DeleteTransitionRouteGroup" ] }, - "GetTransitionRouteGroup": { - "methods": [ + "GetTransitionRouteGroup": { + "methods": [ "GetTransitionRouteGroup" ] }, - "ListTransitionRouteGroups": { - "methods": [ + "ListTransitionRouteGroups": { + "methods": [ "ListTransitionRouteGroups" ] }, - "UpdateTransitionRouteGroup": { - "methods": [ + "UpdateTransitionRouteGroup": { + "methods": [ "UpdateTransitionRouteGroup" ] } @@ -513,38 +513,38 @@ } } }, - "Versions": { - "clients": { - "grpc": { - "libraryClient": "VersionsClient", - "rpcs": { - "CreateVersion": { - "methods": [ + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "CreateVersion": { + "methods": [ "CreateVersion" ] }, - "DeleteVersion": { - "methods": [ + "DeleteVersion": { + "methods": [ "DeleteVersion" ] }, - "GetVersion": { - "methods": [ + "GetVersion": { + "methods": [ "GetVersion" ] }, - "ListVersions": { - "methods": [ + "ListVersions": { + "methods": [ "ListVersions" ] }, - "LoadVersion": { - "methods": [ + "LoadVersion": { + "methods": [ "LoadVersion" ] }, - "UpdateVersion": { - "methods": [ + "UpdateVersion": { + "methods": [ "UpdateVersion" ] } @@ -552,33 +552,33 @@ } } }, - "Webhooks": { - "clients": { - "grpc": { - "libraryClient": "WebhooksClient", - "rpcs": { - "CreateWebhook": { - "methods": [ + "Webhooks": { + "clients": { + "grpc": { + "libraryClient": "WebhooksClient", + "rpcs": { + "CreateWebhook": { + "methods": [ "CreateWebhook" ] }, - "DeleteWebhook": { - "methods": [ + "DeleteWebhook": { + "methods": [ "DeleteWebhook" ] }, - "GetWebhook": { - "methods": [ + "GetWebhook": { + "methods": [ "GetWebhook" ] }, - "ListWebhooks": { - "methods": [ + "ListWebhooks": { + "methods": [ "ListWebhooks" ] }, - "UpdateWebhook": { - "methods": [ + "UpdateWebhook": { + "methods": [ "UpdateWebhook" ] } diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index ccd03828adf9..78df191ef062 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dlp/apiv2/gapic_metadata.json b/dlp/apiv2/gapic_metadata.json index 9fac0297b7d5..fa53d4da4be2 100644 --- a/dlp/apiv2/gapic_metadata.json +++ b/dlp/apiv2/gapic_metadata.json @@ -1,182 +1,182 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.privacy.dlp.v2", - "libraryPackage": "cloud.google.com/go/dlp/apiv2", - "services": { - "DlpService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ActivateJobTrigger": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.privacy.dlp.v2", + "libraryPackage": "cloud.google.com/go/dlp/apiv2", + "services": { + "DlpService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ActivateJobTrigger": { + "methods": [ "ActivateJobTrigger" ] }, - "CancelDlpJob": { - "methods": [ + "CancelDlpJob": { + "methods": [ "CancelDlpJob" ] }, - "CreateDeidentifyTemplate": { - "methods": [ + "CreateDeidentifyTemplate": { + "methods": [ "CreateDeidentifyTemplate" ] }, - "CreateDlpJob": { - "methods": [ + "CreateDlpJob": { + "methods": [ "CreateDlpJob" ] }, - "CreateInspectTemplate": { - "methods": [ + "CreateInspectTemplate": { + "methods": [ "CreateInspectTemplate" ] }, - "CreateJobTrigger": { - "methods": [ + "CreateJobTrigger": { + "methods": [ "CreateJobTrigger" ] }, - "CreateStoredInfoType": { - "methods": [ + "CreateStoredInfoType": { + "methods": [ "CreateStoredInfoType" ] }, - "DeidentifyContent": { - "methods": [ + "DeidentifyContent": { + "methods": [ "DeidentifyContent" ] }, - "DeleteDeidentifyTemplate": { - "methods": [ + "DeleteDeidentifyTemplate": { + "methods": [ "DeleteDeidentifyTemplate" ] }, - "DeleteDlpJob": { - "methods": [ + "DeleteDlpJob": { + "methods": [ "DeleteDlpJob" ] }, - "DeleteInspectTemplate": { - "methods": [ + "DeleteInspectTemplate": { + "methods": [ "DeleteInspectTemplate" ] }, - "DeleteJobTrigger": { - "methods": [ + "DeleteJobTrigger": { + "methods": [ "DeleteJobTrigger" ] }, - "DeleteStoredInfoType": { - "methods": [ + "DeleteStoredInfoType": { + "methods": [ "DeleteStoredInfoType" ] }, - "FinishDlpJob": { - "methods": [ + "FinishDlpJob": { + "methods": [ "FinishDlpJob" ] }, - "GetDeidentifyTemplate": { - "methods": [ + "GetDeidentifyTemplate": { + "methods": [ "GetDeidentifyTemplate" ] }, - "GetDlpJob": { - "methods": [ + "GetDlpJob": { + "methods": [ "GetDlpJob" ] }, - "GetInspectTemplate": { - "methods": [ + "GetInspectTemplate": { + "methods": [ "GetInspectTemplate" ] }, - "GetJobTrigger": { - "methods": [ + "GetJobTrigger": { + "methods": [ "GetJobTrigger" ] }, - "GetStoredInfoType": { - "methods": [ + "GetStoredInfoType": { + "methods": [ "GetStoredInfoType" ] }, - "HybridInspectDlpJob": { - "methods": [ + "HybridInspectDlpJob": { + "methods": [ "HybridInspectDlpJob" ] }, - "HybridInspectJobTrigger": { - "methods": [ + "HybridInspectJobTrigger": { + "methods": [ "HybridInspectJobTrigger" ] }, - "InspectContent": { - "methods": [ + "InspectContent": { + "methods": [ "InspectContent" ] }, - "ListDeidentifyTemplates": { - "methods": [ + "ListDeidentifyTemplates": { + "methods": [ "ListDeidentifyTemplates" ] }, - "ListDlpJobs": { - "methods": [ + "ListDlpJobs": { + "methods": [ "ListDlpJobs" ] }, - "ListInfoTypes": { - "methods": [ + "ListInfoTypes": { + "methods": [ "ListInfoTypes" ] }, - "ListInspectTemplates": { - "methods": [ + "ListInspectTemplates": { + "methods": [ "ListInspectTemplates" ] }, - "ListJobTriggers": { - "methods": [ + "ListJobTriggers": { + "methods": [ "ListJobTriggers" ] }, - "ListStoredInfoTypes": { - "methods": [ + "ListStoredInfoTypes": { + "methods": [ "ListStoredInfoTypes" ] }, - "RedactImage": { - "methods": [ + "RedactImage": { + "methods": [ "RedactImage" ] }, - "ReidentifyContent": { - "methods": [ + "ReidentifyContent": { + "methods": [ "ReidentifyContent" ] }, - "UpdateDeidentifyTemplate": { - "methods": [ + "UpdateDeidentifyTemplate": { + "methods": [ "UpdateDeidentifyTemplate" ] }, - "UpdateInspectTemplate": { - "methods": [ + "UpdateInspectTemplate": { + "methods": [ "UpdateInspectTemplate" ] }, - "UpdateJobTrigger": { - "methods": [ + "UpdateJobTrigger": { + "methods": [ "UpdateJobTrigger" ] }, - "UpdateStoredInfoType": { - "methods": [ + "UpdateStoredInfoType": { + "methods": [ "UpdateStoredInfoType" ] } diff --git a/documentai/apiv1/doc.go b/documentai/apiv1/doc.go index 8e9c17eb985b..1eee9f2a7d39 100644 --- a/documentai/apiv1/doc.go +++ b/documentai/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1/gapic_metadata.json b/documentai/apiv1/gapic_metadata.json index 766c5629f923..0e0f7bb50653 100644 --- a/documentai/apiv1/gapic_metadata.json +++ b/documentai/apiv1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.documentai.v1", - "libraryPackage": "cloud.google.com/go/documentai/apiv1", - "services": { - "DocumentProcessorService": { - "clients": { - "grpc": { - "libraryClient": "DocumentProcessorClient", - "rpcs": { - "BatchProcessDocuments": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.documentai.v1", + "libraryPackage": "cloud.google.com/go/documentai/apiv1", + "services": { + "DocumentProcessorService": { + "clients": { + "grpc": { + "libraryClient": "DocumentProcessorClient", + "rpcs": { + "BatchProcessDocuments": { + "methods": [ "BatchProcessDocuments" ] }, - "ProcessDocument": { - "methods": [ + "ProcessDocument": { + "methods": [ "ProcessDocument" ] }, - "ReviewDocument": { - "methods": [ + "ReviewDocument": { + "methods": [ "ReviewDocument" ] } diff --git a/documentai/apiv1beta3/doc.go b/documentai/apiv1beta3/doc.go index 511ee4e97582..6db4adc466c9 100644 --- a/documentai/apiv1beta3/doc.go +++ b/documentai/apiv1beta3/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/documentai/apiv1beta3/gapic_metadata.json b/documentai/apiv1beta3/gapic_metadata.json index 9621d9c6b2d2..d63304cab99f 100644 --- a/documentai/apiv1beta3/gapic_metadata.json +++ b/documentai/apiv1beta3/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.documentai.v1beta3", - "libraryPackage": "cloud.google.com/go/documentai/apiv1beta3", - "services": { - "DocumentProcessorService": { - "clients": { - "grpc": { - "libraryClient": "DocumentProcessorClient", - "rpcs": { - "BatchProcessDocuments": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.documentai.v1beta3", + "libraryPackage": "cloud.google.com/go/documentai/apiv1beta3", + "services": { + "DocumentProcessorService": { + "clients": { + "grpc": { + "libraryClient": "DocumentProcessorClient", + "rpcs": { + "BatchProcessDocuments": { + "methods": [ "BatchProcessDocuments" ] }, - "CreateProcessor": { - "methods": [ + "CreateProcessor": { + "methods": [ "CreateProcessor" ] }, - "DeleteProcessor": { - "methods": [ + "DeleteProcessor": { + "methods": [ "DeleteProcessor" ] }, - "DisableProcessor": { - "methods": [ + "DisableProcessor": { + "methods": [ "DisableProcessor" ] }, - "EnableProcessor": { - "methods": [ + "EnableProcessor": { + "methods": [ "EnableProcessor" ] }, - "FetchProcessorTypes": { - "methods": [ + "FetchProcessorTypes": { + "methods": [ "FetchProcessorTypes" ] }, - "ListProcessors": { - "methods": [ + "ListProcessors": { + "methods": [ "ListProcessors" ] }, - "ProcessDocument": { - "methods": [ + "ProcessDocument": { + "methods": [ "ProcessDocument" ] }, - "ReviewDocument": { - "methods": [ + "ReviewDocument": { + "methods": [ "ReviewDocument" ] } diff --git a/domains/apiv1beta1/doc.go b/domains/apiv1beta1/doc.go index 1a4eaf1ce67b..52c7b825a9e1 100644 --- a/domains/apiv1beta1/doc.go +++ b/domains/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/domains/apiv1beta1/gapic_metadata.json b/domains/apiv1beta1/gapic_metadata.json index 4bb45dc1a513..3055d0779887 100644 --- a/domains/apiv1beta1/gapic_metadata.json +++ b/domains/apiv1beta1/gapic_metadata.json @@ -1,77 +1,77 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.domains.v1beta1", - "libraryPackage": "cloud.google.com/go/domains/apiv1beta1", - "services": { - "Domains": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ConfigureContactSettings": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.domains.v1beta1", + "libraryPackage": "cloud.google.com/go/domains/apiv1beta1", + "services": { + "Domains": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ConfigureContactSettings": { + "methods": [ "ConfigureContactSettings" ] }, - "ConfigureDnsSettings": { - "methods": [ + "ConfigureDnsSettings": { + "methods": [ "ConfigureDnsSettings" ] }, - "ConfigureManagementSettings": { - "methods": [ + "ConfigureManagementSettings": { + "methods": [ "ConfigureManagementSettings" ] }, - "DeleteRegistration": { - "methods": [ + "DeleteRegistration": { + "methods": [ "DeleteRegistration" ] }, - "ExportRegistration": { - "methods": [ + "ExportRegistration": { + "methods": [ "ExportRegistration" ] }, - "GetRegistration": { - "methods": [ + "GetRegistration": { + "methods": [ "GetRegistration" ] }, - "ListRegistrations": { - "methods": [ + "ListRegistrations": { + "methods": [ "ListRegistrations" ] }, - "RegisterDomain": { - "methods": [ + "RegisterDomain": { + "methods": [ "RegisterDomain" ] }, - "ResetAuthorizationCode": { - "methods": [ + "ResetAuthorizationCode": { + "methods": [ "ResetAuthorizationCode" ] }, - "RetrieveAuthorizationCode": { - "methods": [ + "RetrieveAuthorizationCode": { + "methods": [ "RetrieveAuthorizationCode" ] }, - "RetrieveRegisterParameters": { - "methods": [ + "RetrieveRegisterParameters": { + "methods": [ "RetrieveRegisterParameters" ] }, - "SearchDomains": { - "methods": [ + "SearchDomains": { + "methods": [ "SearchDomains" ] }, - "UpdateRegistration": { - "methods": [ + "UpdateRegistration": { + "methods": [ "UpdateRegistration" ] } diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index d305ddc76c5f..732bdb35079d 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/errorreporting/apiv1beta1/gapic_metadata.json b/errorreporting/apiv1beta1/gapic_metadata.json index 2c82cbeb583e..8e6727a953a6 100644 --- a/errorreporting/apiv1beta1/gapic_metadata.json +++ b/errorreporting/apiv1beta1/gapic_metadata.json @@ -1,22 +1,22 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.clouderrorreporting.v1beta1", - "libraryPackage": "cloud.google.com/go/errorreporting/apiv1beta1", - "services": { - "ErrorGroupService": { - "clients": { - "grpc": { - "libraryClient": "ErrorGroupClient", - "rpcs": { - "GetGroup": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.clouderrorreporting.v1beta1", + "libraryPackage": "cloud.google.com/go/errorreporting/apiv1beta1", + "services": { + "ErrorGroupService": { + "clients": { + "grpc": { + "libraryClient": "ErrorGroupClient", + "rpcs": { + "GetGroup": { + "methods": [ "GetGroup" ] }, - "UpdateGroup": { - "methods": [ + "UpdateGroup": { + "methods": [ "UpdateGroup" ] } @@ -24,23 +24,23 @@ } } }, - "ErrorStatsService": { - "clients": { - "grpc": { - "libraryClient": "ErrorStatsClient", - "rpcs": { - "DeleteEvents": { - "methods": [ + "ErrorStatsService": { + "clients": { + "grpc": { + "libraryClient": "ErrorStatsClient", + "rpcs": { + "DeleteEvents": { + "methods": [ "DeleteEvents" ] }, - "ListEvents": { - "methods": [ + "ListEvents": { + "methods": [ "ListEvents" ] }, - "ListGroupStats": { - "methods": [ + "ListGroupStats": { + "methods": [ "ListGroupStats" ] } @@ -48,13 +48,13 @@ } } }, - "ReportErrorsService": { - "clients": { - "grpc": { - "libraryClient": "ReportErrorsClient", - "rpcs": { - "ReportErrorEvent": { - "methods": [ + "ReportErrorsService": { + "clients": { + "grpc": { + "libraryClient": "ReportErrorsClient", + "rpcs": { + "ReportErrorEvent": { + "methods": [ "ReportErrorEvent" ] } diff --git a/essentialcontacts/apiv1/doc.go b/essentialcontacts/apiv1/doc.go index 436f0358d875..824133d10c32 100644 --- a/essentialcontacts/apiv1/doc.go +++ b/essentialcontacts/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/essentialcontacts/apiv1/gapic_metadata.json b/essentialcontacts/apiv1/gapic_metadata.json index b4d22d04984f..cfebdf9707d2 100644 --- a/essentialcontacts/apiv1/gapic_metadata.json +++ b/essentialcontacts/apiv1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.essentialcontacts.v1", - "libraryPackage": "cloud.google.com/go/essentialcontacts/apiv1", - "services": { - "EssentialContactsService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ComputeContacts": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.essentialcontacts.v1", + "libraryPackage": "cloud.google.com/go/essentialcontacts/apiv1", + "services": { + "EssentialContactsService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ComputeContacts": { + "methods": [ "ComputeContacts" ] }, - "CreateContact": { - "methods": [ + "CreateContact": { + "methods": [ "CreateContact" ] }, - "DeleteContact": { - "methods": [ + "DeleteContact": { + "methods": [ "DeleteContact" ] }, - "GetContact": { - "methods": [ + "GetContact": { + "methods": [ "GetContact" ] }, - "ListContacts": { - "methods": [ + "ListContacts": { + "methods": [ "ListContacts" ] }, - "SendTestMessage": { - "methods": [ + "SendTestMessage": { + "methods": [ "SendTestMessage" ] }, - "UpdateContact": { - "methods": [ + "UpdateContact": { + "methods": [ "UpdateContact" ] } diff --git a/eventarc/apiv1/doc.go b/eventarc/apiv1/doc.go index 917c37ef02e8..2100ac370f47 100644 --- a/eventarc/apiv1/doc.go +++ b/eventarc/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "UNKNOWN" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/eventarc/apiv1/gapic_metadata.json b/eventarc/apiv1/gapic_metadata.json index cc93d105421b..a71dacd0a3c5 100644 --- a/eventarc/apiv1/gapic_metadata.json +++ b/eventarc/apiv1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.eventarc.v1", - "libraryPackage": "cloud.google.com/go/eventarc/apiv1", - "services": { - "Eventarc": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateTrigger": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.eventarc.v1", + "libraryPackage": "cloud.google.com/go/eventarc/apiv1", + "services": { + "Eventarc": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateTrigger": { + "methods": [ "CreateTrigger" ] }, - "DeleteTrigger": { - "methods": [ + "DeleteTrigger": { + "methods": [ "DeleteTrigger" ] }, - "GetTrigger": { - "methods": [ + "GetTrigger": { + "methods": [ "GetTrigger" ] }, - "ListTriggers": { - "methods": [ + "ListTriggers": { + "methods": [ "ListTriggers" ] }, - "UpdateTrigger": { - "methods": [ + "UpdateTrigger": { + "methods": [ "UpdateTrigger" ] } diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index 85034acb541f..78ecef1f7cc6 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/admin/gapic_metadata.json b/firestore/apiv1/admin/gapic_metadata.json index 715aec1a3483..9cb25c1be647 100644 --- a/firestore/apiv1/admin/gapic_metadata.json +++ b/firestore/apiv1/admin/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.firestore.admin.v1", - "libraryPackage": "cloud.google.com/go/firestore/apiv1/admin", - "services": { - "FirestoreAdmin": { - "clients": { - "grpc": { - "libraryClient": "FirestoreAdminClient", - "rpcs": { - "CreateIndex": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.firestore.admin.v1", + "libraryPackage": "cloud.google.com/go/firestore/apiv1/admin", + "services": { + "FirestoreAdmin": { + "clients": { + "grpc": { + "libraryClient": "FirestoreAdminClient", + "rpcs": { + "CreateIndex": { + "methods": [ "CreateIndex" ] }, - "DeleteIndex": { - "methods": [ + "DeleteIndex": { + "methods": [ "DeleteIndex" ] }, - "ExportDocuments": { - "methods": [ + "ExportDocuments": { + "methods": [ "ExportDocuments" ] }, - "GetField": { - "methods": [ + "GetField": { + "methods": [ "GetField" ] }, - "GetIndex": { - "methods": [ + "GetIndex": { + "methods": [ "GetIndex" ] }, - "ImportDocuments": { - "methods": [ + "ImportDocuments": { + "methods": [ "ImportDocuments" ] }, - "ListFields": { - "methods": [ + "ListFields": { + "methods": [ "ListFields" ] }, - "ListIndexes": { - "methods": [ + "ListIndexes": { + "methods": [ "ListIndexes" ] }, - "UpdateField": { - "methods": [ + "UpdateField": { + "methods": [ "UpdateField" ] } diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go index fbb012af1f57..c1e56d75b519 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/firestore/apiv1/gapic_metadata.json b/firestore/apiv1/gapic_metadata.json index 60baab5f463f..f5503bc5d277 100644 --- a/firestore/apiv1/gapic_metadata.json +++ b/firestore/apiv1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.firestore.v1", - "libraryPackage": "cloud.google.com/go/firestore/apiv1", - "services": { - "Firestore": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "BatchGetDocuments": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.firestore.v1", + "libraryPackage": "cloud.google.com/go/firestore/apiv1", + "services": { + "Firestore": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "BatchGetDocuments": { + "methods": [ "BatchGetDocuments" ] }, - "BatchWrite": { - "methods": [ + "BatchWrite": { + "methods": [ "BatchWrite" ] }, - "BeginTransaction": { - "methods": [ + "BeginTransaction": { + "methods": [ "BeginTransaction" ] }, - "Commit": { - "methods": [ + "Commit": { + "methods": [ "Commit" ] }, - "CreateDocument": { - "methods": [ + "CreateDocument": { + "methods": [ "CreateDocument" ] }, - "DeleteDocument": { - "methods": [ + "DeleteDocument": { + "methods": [ "DeleteDocument" ] }, - "GetDocument": { - "methods": [ + "GetDocument": { + "methods": [ "GetDocument" ] }, - "ListCollectionIds": { - "methods": [ + "ListCollectionIds": { + "methods": [ "ListCollectionIds" ] }, - "ListDocuments": { - "methods": [ + "ListDocuments": { + "methods": [ "ListDocuments" ] }, - "Listen": { - "methods": [ + "Listen": { + "methods": [ "Listen" ] }, - "PartitionQuery": { - "methods": [ + "PartitionQuery": { + "methods": [ "PartitionQuery" ] }, - "Rollback": { - "methods": [ + "Rollback": { + "methods": [ "Rollback" ] }, - "RunQuery": { - "methods": [ + "RunQuery": { + "methods": [ "RunQuery" ] }, - "UpdateDocument": { - "methods": [ + "UpdateDocument": { + "methods": [ "UpdateDocument" ] }, - "Write": { - "methods": [ + "Write": { + "methods": [ "Write" ] } diff --git a/firestore/go.mod b/firestore/go.mod index 1c2b1f034886..42888a32e23e 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/firestore/go.sum b/firestore/go.sum index 9e44f7fc0b63..aa8fd5de0a26 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -450,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index 9651891f9750..a4585accc01a 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/functions/apiv1/gapic_metadata.json b/functions/apiv1/gapic_metadata.json index 311de14e0f4e..176b9f45521a 100644 --- a/functions/apiv1/gapic_metadata.json +++ b/functions/apiv1/gapic_metadata.json @@ -1,67 +1,67 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.functions.v1", - "libraryPackage": "cloud.google.com/go/functions/apiv1", - "services": { - "CloudFunctionsService": { - "clients": { - "grpc": { - "libraryClient": "CloudFunctionsClient", - "rpcs": { - "CallFunction": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.functions.v1", + "libraryPackage": "cloud.google.com/go/functions/apiv1", + "services": { + "CloudFunctionsService": { + "clients": { + "grpc": { + "libraryClient": "CloudFunctionsClient", + "rpcs": { + "CallFunction": { + "methods": [ "CallFunction" ] }, - "CreateFunction": { - "methods": [ + "CreateFunction": { + "methods": [ "CreateFunction" ] }, - "DeleteFunction": { - "methods": [ + "DeleteFunction": { + "methods": [ "DeleteFunction" ] }, - "GenerateDownloadUrl": { - "methods": [ + "GenerateDownloadUrl": { + "methods": [ "GenerateDownloadUrl" ] }, - "GenerateUploadUrl": { - "methods": [ + "GenerateUploadUrl": { + "methods": [ "GenerateUploadUrl" ] }, - "GetFunction": { - "methods": [ + "GetFunction": { + "methods": [ "GetFunction" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListFunctions": { - "methods": [ + "ListFunctions": { + "methods": [ "ListFunctions" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateFunction": { - "methods": [ + "UpdateFunction": { + "methods": [ "UpdateFunction" ] } diff --git a/gaming/apiv1/doc.go b/gaming/apiv1/doc.go index aebd85c3fb09..a76ed2f294db 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1/gapic_metadata.json b/gaming/apiv1/gapic_metadata.json index d72302d3de5c..a7aa70f78b60 100644 --- a/gaming/apiv1/gapic_metadata.json +++ b/gaming/apiv1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.gaming.v1", - "libraryPackage": "cloud.google.com/go/gaming/apiv1", - "services": { - "GameServerClustersService": { - "clients": { - "grpc": { - "libraryClient": "GameServerClustersClient", - "rpcs": { - "CreateGameServerCluster": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.gaming.v1", + "libraryPackage": "cloud.google.com/go/gaming/apiv1", + "services": { + "GameServerClustersService": { + "clients": { + "grpc": { + "libraryClient": "GameServerClustersClient", + "rpcs": { + "CreateGameServerCluster": { + "methods": [ "CreateGameServerCluster" ] }, - "DeleteGameServerCluster": { - "methods": [ + "DeleteGameServerCluster": { + "methods": [ "DeleteGameServerCluster" ] }, - "GetGameServerCluster": { - "methods": [ + "GetGameServerCluster": { + "methods": [ "GetGameServerCluster" ] }, - "ListGameServerClusters": { - "methods": [ + "ListGameServerClusters": { + "methods": [ "ListGameServerClusters" ] }, - "PreviewCreateGameServerCluster": { - "methods": [ + "PreviewCreateGameServerCluster": { + "methods": [ "PreviewCreateGameServerCluster" ] }, - "PreviewDeleteGameServerCluster": { - "methods": [ + "PreviewDeleteGameServerCluster": { + "methods": [ "PreviewDeleteGameServerCluster" ] }, - "PreviewUpdateGameServerCluster": { - "methods": [ + "PreviewUpdateGameServerCluster": { + "methods": [ "PreviewUpdateGameServerCluster" ] }, - "UpdateGameServerCluster": { - "methods": [ + "UpdateGameServerCluster": { + "methods": [ "UpdateGameServerCluster" ] } @@ -54,28 +54,28 @@ } } }, - "GameServerConfigsService": { - "clients": { - "grpc": { - "libraryClient": "GameServerConfigsClient", - "rpcs": { - "CreateGameServerConfig": { - "methods": [ + "GameServerConfigsService": { + "clients": { + "grpc": { + "libraryClient": "GameServerConfigsClient", + "rpcs": { + "CreateGameServerConfig": { + "methods": [ "CreateGameServerConfig" ] }, - "DeleteGameServerConfig": { - "methods": [ + "DeleteGameServerConfig": { + "methods": [ "DeleteGameServerConfig" ] }, - "GetGameServerConfig": { - "methods": [ + "GetGameServerConfig": { + "methods": [ "GetGameServerConfig" ] }, - "ListGameServerConfigs": { - "methods": [ + "ListGameServerConfigs": { + "methods": [ "ListGameServerConfigs" ] } @@ -83,53 +83,53 @@ } } }, - "GameServerDeploymentsService": { - "clients": { - "grpc": { - "libraryClient": "GameServerDeploymentsClient", - "rpcs": { - "CreateGameServerDeployment": { - "methods": [ + "GameServerDeploymentsService": { + "clients": { + "grpc": { + "libraryClient": "GameServerDeploymentsClient", + "rpcs": { + "CreateGameServerDeployment": { + "methods": [ "CreateGameServerDeployment" ] }, - "DeleteGameServerDeployment": { - "methods": [ + "DeleteGameServerDeployment": { + "methods": [ "DeleteGameServerDeployment" ] }, - "FetchDeploymentState": { - "methods": [ + "FetchDeploymentState": { + "methods": [ "FetchDeploymentState" ] }, - "GetGameServerDeployment": { - "methods": [ + "GetGameServerDeployment": { + "methods": [ "GetGameServerDeployment" ] }, - "GetGameServerDeploymentRollout": { - "methods": [ + "GetGameServerDeploymentRollout": { + "methods": [ "GetGameServerDeploymentRollout" ] }, - "ListGameServerDeployments": { - "methods": [ + "ListGameServerDeployments": { + "methods": [ "ListGameServerDeployments" ] }, - "PreviewGameServerDeploymentRollout": { - "methods": [ + "PreviewGameServerDeploymentRollout": { + "methods": [ "PreviewGameServerDeploymentRollout" ] }, - "UpdateGameServerDeployment": { - "methods": [ + "UpdateGameServerDeployment": { + "methods": [ "UpdateGameServerDeployment" ] }, - "UpdateGameServerDeploymentRollout": { - "methods": [ + "UpdateGameServerDeploymentRollout": { + "methods": [ "UpdateGameServerDeploymentRollout" ] } @@ -137,38 +137,38 @@ } } }, - "RealmsService": { - "clients": { - "grpc": { - "libraryClient": "RealmsClient", - "rpcs": { - "CreateRealm": { - "methods": [ + "RealmsService": { + "clients": { + "grpc": { + "libraryClient": "RealmsClient", + "rpcs": { + "CreateRealm": { + "methods": [ "CreateRealm" ] }, - "DeleteRealm": { - "methods": [ + "DeleteRealm": { + "methods": [ "DeleteRealm" ] }, - "GetRealm": { - "methods": [ + "GetRealm": { + "methods": [ "GetRealm" ] }, - "ListRealms": { - "methods": [ + "ListRealms": { + "methods": [ "ListRealms" ] }, - "PreviewRealmUpdate": { - "methods": [ + "PreviewRealmUpdate": { + "methods": [ "PreviewRealmUpdate" ] }, - "UpdateRealm": { - "methods": [ + "UpdateRealm": { + "methods": [ "UpdateRealm" ] } diff --git a/gaming/apiv1beta/doc.go b/gaming/apiv1beta/doc.go index fee932c7861c..c98ad69fa041 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gaming/apiv1beta/gapic_metadata.json b/gaming/apiv1beta/gapic_metadata.json index 14b4cbb680c9..110a8289a841 100644 --- a/gaming/apiv1beta/gapic_metadata.json +++ b/gaming/apiv1beta/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.gaming.v1beta", - "libraryPackage": "cloud.google.com/go/gaming/apiv1beta", - "services": { - "GameServerClustersService": { - "clients": { - "grpc": { - "libraryClient": "GameServerClustersClient", - "rpcs": { - "CreateGameServerCluster": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.gaming.v1beta", + "libraryPackage": "cloud.google.com/go/gaming/apiv1beta", + "services": { + "GameServerClustersService": { + "clients": { + "grpc": { + "libraryClient": "GameServerClustersClient", + "rpcs": { + "CreateGameServerCluster": { + "methods": [ "CreateGameServerCluster" ] }, - "DeleteGameServerCluster": { - "methods": [ + "DeleteGameServerCluster": { + "methods": [ "DeleteGameServerCluster" ] }, - "GetGameServerCluster": { - "methods": [ + "GetGameServerCluster": { + "methods": [ "GetGameServerCluster" ] }, - "ListGameServerClusters": { - "methods": [ + "ListGameServerClusters": { + "methods": [ "ListGameServerClusters" ] }, - "PreviewCreateGameServerCluster": { - "methods": [ + "PreviewCreateGameServerCluster": { + "methods": [ "PreviewCreateGameServerCluster" ] }, - "PreviewDeleteGameServerCluster": { - "methods": [ + "PreviewDeleteGameServerCluster": { + "methods": [ "PreviewDeleteGameServerCluster" ] }, - "PreviewUpdateGameServerCluster": { - "methods": [ + "PreviewUpdateGameServerCluster": { + "methods": [ "PreviewUpdateGameServerCluster" ] }, - "UpdateGameServerCluster": { - "methods": [ + "UpdateGameServerCluster": { + "methods": [ "UpdateGameServerCluster" ] } @@ -54,28 +54,28 @@ } } }, - "GameServerConfigsService": { - "clients": { - "grpc": { - "libraryClient": "GameServerConfigsClient", - "rpcs": { - "CreateGameServerConfig": { - "methods": [ + "GameServerConfigsService": { + "clients": { + "grpc": { + "libraryClient": "GameServerConfigsClient", + "rpcs": { + "CreateGameServerConfig": { + "methods": [ "CreateGameServerConfig" ] }, - "DeleteGameServerConfig": { - "methods": [ + "DeleteGameServerConfig": { + "methods": [ "DeleteGameServerConfig" ] }, - "GetGameServerConfig": { - "methods": [ + "GetGameServerConfig": { + "methods": [ "GetGameServerConfig" ] }, - "ListGameServerConfigs": { - "methods": [ + "ListGameServerConfigs": { + "methods": [ "ListGameServerConfigs" ] } @@ -83,53 +83,53 @@ } } }, - "GameServerDeploymentsService": { - "clients": { - "grpc": { - "libraryClient": "GameServerDeploymentsClient", - "rpcs": { - "CreateGameServerDeployment": { - "methods": [ + "GameServerDeploymentsService": { + "clients": { + "grpc": { + "libraryClient": "GameServerDeploymentsClient", + "rpcs": { + "CreateGameServerDeployment": { + "methods": [ "CreateGameServerDeployment" ] }, - "DeleteGameServerDeployment": { - "methods": [ + "DeleteGameServerDeployment": { + "methods": [ "DeleteGameServerDeployment" ] }, - "FetchDeploymentState": { - "methods": [ + "FetchDeploymentState": { + "methods": [ "FetchDeploymentState" ] }, - "GetGameServerDeployment": { - "methods": [ + "GetGameServerDeployment": { + "methods": [ "GetGameServerDeployment" ] }, - "GetGameServerDeploymentRollout": { - "methods": [ + "GetGameServerDeploymentRollout": { + "methods": [ "GetGameServerDeploymentRollout" ] }, - "ListGameServerDeployments": { - "methods": [ + "ListGameServerDeployments": { + "methods": [ "ListGameServerDeployments" ] }, - "PreviewGameServerDeploymentRollout": { - "methods": [ + "PreviewGameServerDeploymentRollout": { + "methods": [ "PreviewGameServerDeploymentRollout" ] }, - "UpdateGameServerDeployment": { - "methods": [ + "UpdateGameServerDeployment": { + "methods": [ "UpdateGameServerDeployment" ] }, - "UpdateGameServerDeploymentRollout": { - "methods": [ + "UpdateGameServerDeploymentRollout": { + "methods": [ "UpdateGameServerDeploymentRollout" ] } @@ -137,38 +137,38 @@ } } }, - "RealmsService": { - "clients": { - "grpc": { - "libraryClient": "RealmsClient", - "rpcs": { - "CreateRealm": { - "methods": [ + "RealmsService": { + "clients": { + "grpc": { + "libraryClient": "RealmsClient", + "rpcs": { + "CreateRealm": { + "methods": [ "CreateRealm" ] }, - "DeleteRealm": { - "methods": [ + "DeleteRealm": { + "methods": [ "DeleteRealm" ] }, - "GetRealm": { - "methods": [ + "GetRealm": { + "methods": [ "GetRealm" ] }, - "ListRealms": { - "methods": [ + "ListRealms": { + "methods": [ "ListRealms" ] }, - "PreviewRealmUpdate": { - "methods": [ + "PreviewRealmUpdate": { + "methods": [ "PreviewRealmUpdate" ] }, - "UpdateRealm": { - "methods": [ + "UpdateRealm": { + "methods": [ "UpdateRealm" ] } diff --git a/gkeconnect/gateway/apiv1beta1/doc.go b/gkeconnect/gateway/apiv1beta1/doc.go index 9a8af36e3ea7..c2078ca33f0e 100644 --- a/gkeconnect/gateway/apiv1beta1/doc.go +++ b/gkeconnect/gateway/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gkeconnect/gateway/apiv1beta1/gapic_metadata.json b/gkeconnect/gateway/apiv1beta1/gapic_metadata.json index c7a368a972c9..40cfe97e1d9f 100644 --- a/gkeconnect/gateway/apiv1beta1/gapic_metadata.json +++ b/gkeconnect/gateway/apiv1beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", - "libraryPackage": "cloud.google.com/go/gkeconnect/gateway/apiv1beta1", - "services": { - "GatewayService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "DeleteResource": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.gkeconnect.gateway.v1beta1", + "libraryPackage": "cloud.google.com/go/gkeconnect/gateway/apiv1beta1", + "services": { + "GatewayService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "DeleteResource": { + "methods": [ "DeleteResource" ] }, - "GetResource": { - "methods": [ + "GetResource": { + "methods": [ "GetResource" ] }, - "PatchResource": { - "methods": [ + "PatchResource": { + "methods": [ "PatchResource" ] }, - "PostResource": { - "methods": [ + "PostResource": { + "methods": [ "PostResource" ] }, - "PutResource": { - "methods": [ + "PutResource": { + "methods": [ "PutResource" ] } diff --git a/gkehub/apiv1beta1/doc.go b/gkehub/apiv1beta1/doc.go index b840f51faa04..4e52a500a58b 100644 --- a/gkehub/apiv1beta1/doc.go +++ b/gkehub/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gkehub/apiv1beta1/gapic_metadata.json b/gkehub/apiv1beta1/gapic_metadata.json index 7d081742c3ad..21ff5f263f93 100644 --- a/gkehub/apiv1beta1/gapic_metadata.json +++ b/gkehub/apiv1beta1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.gkehub.v1beta1", - "libraryPackage": "cloud.google.com/go/gkehub/apiv1beta1", - "services": { - "GkeHubMembershipService": { - "clients": { - "grpc": { - "libraryClient": "GkeHubMembershipClient", - "rpcs": { - "CreateMembership": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.gkehub.v1beta1", + "libraryPackage": "cloud.google.com/go/gkehub/apiv1beta1", + "services": { + "GkeHubMembershipService": { + "clients": { + "grpc": { + "libraryClient": "GkeHubMembershipClient", + "rpcs": { + "CreateMembership": { + "methods": [ "CreateMembership" ] }, - "DeleteMembership": { - "methods": [ + "DeleteMembership": { + "methods": [ "DeleteMembership" ] }, - "GenerateConnectManifest": { - "methods": [ + "GenerateConnectManifest": { + "methods": [ "GenerateConnectManifest" ] }, - "GenerateExclusivityManifest": { - "methods": [ + "GenerateExclusivityManifest": { + "methods": [ "GenerateExclusivityManifest" ] }, - "GetMembership": { - "methods": [ + "GetMembership": { + "methods": [ "GetMembership" ] }, - "ListMemberships": { - "methods": [ + "ListMemberships": { + "methods": [ "ListMemberships" ] }, - "UpdateMembership": { - "methods": [ + "UpdateMembership": { + "methods": [ "UpdateMembership" ] }, - "ValidateExclusivity": { - "methods": [ + "ValidateExclusivity": { + "methods": [ "ValidateExclusivity" ] } diff --git a/go.mod b/go.mod index e3f528d34907..ebfba10f281b 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.6 golang.org/x/tools v0.1.4 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index e72672ec7de0..cdf29627f57e 100644 --- a/go.sum +++ b/go.sum @@ -458,8 +458,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/gsuiteaddons/apiv1/doc.go b/gsuiteaddons/apiv1/doc.go index 90625432e326..2487b0bc497c 100644 --- a/gsuiteaddons/apiv1/doc.go +++ b/gsuiteaddons/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gsuiteaddons/apiv1/gapic_metadata.json b/gsuiteaddons/apiv1/gapic_metadata.json index d4725fdf9791..178d0b85085d 100644 --- a/gsuiteaddons/apiv1/gapic_metadata.json +++ b/gsuiteaddons/apiv1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.gsuiteaddons.v1", - "libraryPackage": "cloud.google.com/go/gsuiteaddons/apiv1", - "services": { - "GSuiteAddOns": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateDeployment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.gsuiteaddons.v1", + "libraryPackage": "cloud.google.com/go/gsuiteaddons/apiv1", + "services": { + "GSuiteAddOns": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateDeployment": { + "methods": [ "CreateDeployment" ] }, - "DeleteDeployment": { - "methods": [ + "DeleteDeployment": { + "methods": [ "DeleteDeployment" ] }, - "GetAuthorization": { - "methods": [ + "GetAuthorization": { + "methods": [ "GetAuthorization" ] }, - "GetDeployment": { - "methods": [ + "GetDeployment": { + "methods": [ "GetDeployment" ] }, - "GetInstallStatus": { - "methods": [ + "GetInstallStatus": { + "methods": [ "GetInstallStatus" ] }, - "InstallDeployment": { - "methods": [ + "InstallDeployment": { + "methods": [ "InstallDeployment" ] }, - "ListDeployments": { - "methods": [ + "ListDeployments": { + "methods": [ "ListDeployments" ] }, - "ReplaceDeployment": { - "methods": [ + "ReplaceDeployment": { + "methods": [ "ReplaceDeployment" ] }, - "UninstallDeployment": { - "methods": [ + "UninstallDeployment": { + "methods": [ "UninstallDeployment" ] } diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 6053de60b6b0..d2b85b8f7dc1 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/iam/credentials/apiv1/gapic_metadata.json b/iam/credentials/apiv1/gapic_metadata.json index 735b6169ffe6..7e1edb5bfd23 100644 --- a/iam/credentials/apiv1/gapic_metadata.json +++ b/iam/credentials/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.iam.credentials.v1", - "libraryPackage": "cloud.google.com/go/iam/credentials/apiv1", - "services": { - "IAMCredentials": { - "clients": { - "grpc": { - "libraryClient": "IamCredentialsClient", - "rpcs": { - "GenerateAccessToken": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.iam.credentials.v1", + "libraryPackage": "cloud.google.com/go/iam/credentials/apiv1", + "services": { + "IAMCredentials": { + "clients": { + "grpc": { + "libraryClient": "IamCredentialsClient", + "rpcs": { + "GenerateAccessToken": { + "methods": [ "GenerateAccessToken" ] }, - "GenerateIdToken": { - "methods": [ + "GenerateIdToken": { + "methods": [ "GenerateIdToken" ] }, - "SignBlob": { - "methods": [ + "SignBlob": { + "methods": [ "SignBlob" ] }, - "SignJwt": { - "methods": [ + "SignJwt": { + "methods": [ "SignJwt" ] } diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateIosAppDataStream/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateIosAppDataStream/main.go deleted file mode 100644 index efd03615068b..000000000000 --- a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateIosAppDataStream/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 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 -// -// http://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. - -// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateIosAppDataStream_sync] - -package main - -import ( - "context" - - admin "cloud.google.com/go/analytics/admin/apiv1alpha" - adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" -) - -func main() { - // import adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" - - ctx := context.Background() - c, err := admin.NewAnalyticsAdminClient(ctx) - if err != nil { - // TODO: Handle error. - } - - req := &adminpb.CreateIosAppDataStreamRequest{ - // TODO: Fill request struct fields. - } - resp, err := c.CreateIosAppDataStream(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateIosAppDataStream_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index 23d7f936c8e2..b4d069b007db 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -31,6 +31,6 @@ require ( cloud.google.com/go/pubsub v1.9.1 cloud.google.com/go/pubsublite v0.84.0 cloud.google.com/go/spanner v0.84.0 - google.golang.org/api v0.49.0 + google.golang.org/api v0.50.0 google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index 4d8866856df4..344e7341ff18 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -81,7 +81,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -123,8 +122,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.49.0 h1:gjIBDxlTG7vnzMmEnYwTnvLTF8Rjzo+ETCgEX1YZ/fY= -google.golang.org/api v0.49.0/go.mod h1:BECiH72wsfwUvOVn3+btPD5WHi0LzavZReBndi42L18= +google.golang.org/api v0.50.0 h1:LX7NFCFYOHzr7WHaYiRUpeipZe9o5L8T+2F4Z798VDw= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -133,8 +132,7 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index 3c0d3ab6fad4..bc1f04dd90b5 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/iot/apiv1/gapic_metadata.json b/iot/apiv1/gapic_metadata.json index d8c779156b31..75dfb965b17b 100644 --- a/iot/apiv1/gapic_metadata.json +++ b/iot/apiv1/gapic_metadata.json @@ -1,107 +1,107 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.iot.v1", - "libraryPackage": "cloud.google.com/go/iot/apiv1", - "services": { - "DeviceManager": { - "clients": { - "grpc": { - "libraryClient": "DeviceManagerClient", - "rpcs": { - "BindDeviceToGateway": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.iot.v1", + "libraryPackage": "cloud.google.com/go/iot/apiv1", + "services": { + "DeviceManager": { + "clients": { + "grpc": { + "libraryClient": "DeviceManagerClient", + "rpcs": { + "BindDeviceToGateway": { + "methods": [ "BindDeviceToGateway" ] }, - "CreateDevice": { - "methods": [ + "CreateDevice": { + "methods": [ "CreateDevice" ] }, - "CreateDeviceRegistry": { - "methods": [ + "CreateDeviceRegistry": { + "methods": [ "CreateDeviceRegistry" ] }, - "DeleteDevice": { - "methods": [ + "DeleteDevice": { + "methods": [ "DeleteDevice" ] }, - "DeleteDeviceRegistry": { - "methods": [ + "DeleteDeviceRegistry": { + "methods": [ "DeleteDeviceRegistry" ] }, - "GetDevice": { - "methods": [ + "GetDevice": { + "methods": [ "GetDevice" ] }, - "GetDeviceRegistry": { - "methods": [ + "GetDeviceRegistry": { + "methods": [ "GetDeviceRegistry" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListDeviceConfigVersions": { - "methods": [ + "ListDeviceConfigVersions": { + "methods": [ "ListDeviceConfigVersions" ] }, - "ListDeviceRegistries": { - "methods": [ + "ListDeviceRegistries": { + "methods": [ "ListDeviceRegistries" ] }, - "ListDeviceStates": { - "methods": [ + "ListDeviceStates": { + "methods": [ "ListDeviceStates" ] }, - "ListDevices": { - "methods": [ + "ListDevices": { + "methods": [ "ListDevices" ] }, - "ModifyCloudToDeviceConfig": { - "methods": [ + "ModifyCloudToDeviceConfig": { + "methods": [ "ModifyCloudToDeviceConfig" ] }, - "SendCommandToDevice": { - "methods": [ + "SendCommandToDevice": { + "methods": [ "SendCommandToDevice" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UnbindDeviceFromGateway": { - "methods": [ + "UnbindDeviceFromGateway": { + "methods": [ "UnbindDeviceFromGateway" ] }, - "UpdateDevice": { - "methods": [ + "UpdateDevice": { + "methods": [ "UpdateDevice" ] }, - "UpdateDeviceRegistry": { - "methods": [ + "UpdateDeviceRegistry": { + "methods": [ "UpdateDeviceRegistry" ] } diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 43162dae4321..a8d4ec31c4b0 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/gapic_metadata.json b/kms/apiv1/gapic_metadata.json index fdc6f4e75824..37d3fd6d5498 100644 --- a/kms/apiv1/gapic_metadata.json +++ b/kms/apiv1/gapic_metadata.json @@ -1,142 +1,142 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.kms.v1", - "libraryPackage": "cloud.google.com/go/kms/apiv1", - "services": { - "KeyManagementService": { - "clients": { - "grpc": { - "libraryClient": "KeyManagementClient", - "rpcs": { - "AsymmetricDecrypt": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.kms.v1", + "libraryPackage": "cloud.google.com/go/kms/apiv1", + "services": { + "KeyManagementService": { + "clients": { + "grpc": { + "libraryClient": "KeyManagementClient", + "rpcs": { + "AsymmetricDecrypt": { + "methods": [ "AsymmetricDecrypt" ] }, - "AsymmetricSign": { - "methods": [ + "AsymmetricSign": { + "methods": [ "AsymmetricSign" ] }, - "CreateCryptoKey": { - "methods": [ + "CreateCryptoKey": { + "methods": [ "CreateCryptoKey" ] }, - "CreateCryptoKeyVersion": { - "methods": [ + "CreateCryptoKeyVersion": { + "methods": [ "CreateCryptoKeyVersion" ] }, - "CreateImportJob": { - "methods": [ + "CreateImportJob": { + "methods": [ "CreateImportJob" ] }, - "CreateKeyRing": { - "methods": [ + "CreateKeyRing": { + "methods": [ "CreateKeyRing" ] }, - "Decrypt": { - "methods": [ + "Decrypt": { + "methods": [ "Decrypt" ] }, - "DestroyCryptoKeyVersion": { - "methods": [ + "DestroyCryptoKeyVersion": { + "methods": [ "DestroyCryptoKeyVersion" ] }, - "Encrypt": { - "methods": [ + "Encrypt": { + "methods": [ "Encrypt" ] }, - "GetCryptoKey": { - "methods": [ + "GetCryptoKey": { + "methods": [ "GetCryptoKey" ] }, - "GetCryptoKeyVersion": { - "methods": [ + "GetCryptoKeyVersion": { + "methods": [ "GetCryptoKeyVersion" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetImportJob": { - "methods": [ + "GetImportJob": { + "methods": [ "GetImportJob" ] }, - "GetKeyRing": { - "methods": [ + "GetKeyRing": { + "methods": [ "GetKeyRing" ] }, - "GetPublicKey": { - "methods": [ + "GetPublicKey": { + "methods": [ "GetPublicKey" ] }, - "ImportCryptoKeyVersion": { - "methods": [ + "ImportCryptoKeyVersion": { + "methods": [ "ImportCryptoKeyVersion" ] }, - "ListCryptoKeyVersions": { - "methods": [ + "ListCryptoKeyVersions": { + "methods": [ "ListCryptoKeyVersions" ] }, - "ListCryptoKeys": { - "methods": [ + "ListCryptoKeys": { + "methods": [ "ListCryptoKeys" ] }, - "ListImportJobs": { - "methods": [ + "ListImportJobs": { + "methods": [ "ListImportJobs" ] }, - "ListKeyRings": { - "methods": [ + "ListKeyRings": { + "methods": [ "ListKeyRings" ] }, - "RestoreCryptoKeyVersion": { - "methods": [ + "RestoreCryptoKeyVersion": { + "methods": [ "RestoreCryptoKeyVersion" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateCryptoKey": { - "methods": [ + "UpdateCryptoKey": { + "methods": [ "UpdateCryptoKey" ] }, - "UpdateCryptoKeyPrimaryVersion": { - "methods": [ + "UpdateCryptoKeyPrimaryVersion": { + "methods": [ "UpdateCryptoKeyPrimaryVersion" ] }, - "UpdateCryptoKeyVersion": { - "methods": [ + "UpdateCryptoKeyVersion": { + "methods": [ "UpdateCryptoKeyVersion" ] } diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 67e00822880f..5dc45017abd2 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1/gapic_metadata.json b/language/apiv1/gapic_metadata.json index 18ce7e22ac84..f49ef2f8a6a7 100644 --- a/language/apiv1/gapic_metadata.json +++ b/language/apiv1/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.language.v1", - "libraryPackage": "cloud.google.com/go/language/apiv1", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnalyzeEntities": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.language.v1", + "libraryPackage": "cloud.google.com/go/language/apiv1", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnalyzeEntities": { + "methods": [ "AnalyzeEntities" ] }, - "AnalyzeEntitySentiment": { - "methods": [ + "AnalyzeEntitySentiment": { + "methods": [ "AnalyzeEntitySentiment" ] }, - "AnalyzeSentiment": { - "methods": [ + "AnalyzeSentiment": { + "methods": [ "AnalyzeSentiment" ] }, - "AnalyzeSyntax": { - "methods": [ + "AnalyzeSyntax": { + "methods": [ "AnalyzeSyntax" ] }, - "AnnotateText": { - "methods": [ + "AnnotateText": { + "methods": [ "AnnotateText" ] }, - "ClassifyText": { - "methods": [ + "ClassifyText": { + "methods": [ "ClassifyText" ] } diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index b2c16b145ee9..c5464428fee7 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/gapic_metadata.json b/language/apiv1beta2/gapic_metadata.json index bf3be50c7f03..8e23997306ce 100644 --- a/language/apiv1beta2/gapic_metadata.json +++ b/language/apiv1beta2/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.language.v1beta2", - "libraryPackage": "cloud.google.com/go/language/apiv1beta2", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnalyzeEntities": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.language.v1beta2", + "libraryPackage": "cloud.google.com/go/language/apiv1beta2", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnalyzeEntities": { + "methods": [ "AnalyzeEntities" ] }, - "AnalyzeEntitySentiment": { - "methods": [ + "AnalyzeEntitySentiment": { + "methods": [ "AnalyzeEntitySentiment" ] }, - "AnalyzeSentiment": { - "methods": [ + "AnalyzeSentiment": { + "methods": [ "AnalyzeSentiment" ] }, - "AnalyzeSyntax": { - "methods": [ + "AnalyzeSyntax": { + "methods": [ "AnalyzeSyntax" ] }, - "AnnotateText": { - "methods": [ + "AnnotateText": { + "methods": [ "AnnotateText" ] }, - "ClassifyText": { - "methods": [ + "ClassifyText": { + "methods": [ "ClassifyText" ] } diff --git a/lifesciences/apiv2beta/doc.go b/lifesciences/apiv2beta/doc.go index ffd83191ee90..ef3dbf75a8bb 100644 --- a/lifesciences/apiv2beta/doc.go +++ b/lifesciences/apiv2beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/lifesciences/apiv2beta/gapic_metadata.json b/lifesciences/apiv2beta/gapic_metadata.json index c125f28e0803..d809365ae65e 100644 --- a/lifesciences/apiv2beta/gapic_metadata.json +++ b/lifesciences/apiv2beta/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.lifesciences.v2beta", - "libraryPackage": "cloud.google.com/go/lifesciences/apiv2beta", - "services": { - "WorkflowsServiceV2Beta": { - "clients": { - "grpc": { - "libraryClient": "WorkflowsServiceV2BetaClient", - "rpcs": { - "RunPipeline": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.lifesciences.v2beta", + "libraryPackage": "cloud.google.com/go/lifesciences/apiv2beta", + "services": { + "WorkflowsServiceV2Beta": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsServiceV2BetaClient", + "rpcs": { + "RunPipeline": { + "methods": [ "RunPipeline" ] } diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index 157799f9ebb4..4958f8c808fc 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/logging/apiv2/gapic_metadata.json b/logging/apiv2/gapic_metadata.json index 63cb6a90b3d0..9636e5a0ceda 100644 --- a/logging/apiv2/gapic_metadata.json +++ b/logging/apiv2/gapic_metadata.json @@ -1,127 +1,127 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.logging.v2", - "libraryPackage": "cloud.google.com/go/logging/apiv2", - "services": { - "ConfigServiceV2": { - "clients": { - "grpc": { - "libraryClient": "ConfigClient", - "rpcs": { - "CreateBucket": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.logging.v2", + "libraryPackage": "cloud.google.com/go/logging/apiv2", + "services": { + "ConfigServiceV2": { + "clients": { + "grpc": { + "libraryClient": "ConfigClient", + "rpcs": { + "CreateBucket": { + "methods": [ "CreateBucket" ] }, - "CreateExclusion": { - "methods": [ + "CreateExclusion": { + "methods": [ "CreateExclusion" ] }, - "CreateSink": { - "methods": [ + "CreateSink": { + "methods": [ "CreateSink" ] }, - "CreateView": { - "methods": [ + "CreateView": { + "methods": [ "CreateView" ] }, - "DeleteBucket": { - "methods": [ + "DeleteBucket": { + "methods": [ "DeleteBucket" ] }, - "DeleteExclusion": { - "methods": [ + "DeleteExclusion": { + "methods": [ "DeleteExclusion" ] }, - "DeleteSink": { - "methods": [ + "DeleteSink": { + "methods": [ "DeleteSink" ] }, - "DeleteView": { - "methods": [ + "DeleteView": { + "methods": [ "DeleteView" ] }, - "GetBucket": { - "methods": [ + "GetBucket": { + "methods": [ "GetBucket" ] }, - "GetCmekSettings": { - "methods": [ + "GetCmekSettings": { + "methods": [ "GetCmekSettings" ] }, - "GetExclusion": { - "methods": [ + "GetExclusion": { + "methods": [ "GetExclusion" ] }, - "GetSink": { - "methods": [ + "GetSink": { + "methods": [ "GetSink" ] }, - "GetView": { - "methods": [ + "GetView": { + "methods": [ "GetView" ] }, - "ListBuckets": { - "methods": [ + "ListBuckets": { + "methods": [ "ListBuckets" ] }, - "ListExclusions": { - "methods": [ + "ListExclusions": { + "methods": [ "ListExclusions" ] }, - "ListSinks": { - "methods": [ + "ListSinks": { + "methods": [ "ListSinks" ] }, - "ListViews": { - "methods": [ + "ListViews": { + "methods": [ "ListViews" ] }, - "UndeleteBucket": { - "methods": [ + "UndeleteBucket": { + "methods": [ "UndeleteBucket" ] }, - "UpdateBucket": { - "methods": [ + "UpdateBucket": { + "methods": [ "UpdateBucket" ] }, - "UpdateCmekSettings": { - "methods": [ + "UpdateCmekSettings": { + "methods": [ "UpdateCmekSettings" ] }, - "UpdateExclusion": { - "methods": [ + "UpdateExclusion": { + "methods": [ "UpdateExclusion" ] }, - "UpdateSink": { - "methods": [ + "UpdateSink": { + "methods": [ "UpdateSink" ] }, - "UpdateView": { - "methods": [ + "UpdateView": { + "methods": [ "UpdateView" ] } @@ -129,38 +129,38 @@ } } }, - "LoggingServiceV2": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "DeleteLog": { - "methods": [ + "LoggingServiceV2": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "DeleteLog": { + "methods": [ "DeleteLog" ] }, - "ListLogEntries": { - "methods": [ + "ListLogEntries": { + "methods": [ "ListLogEntries" ] }, - "ListLogs": { - "methods": [ + "ListLogs": { + "methods": [ "ListLogs" ] }, - "ListMonitoredResourceDescriptors": { - "methods": [ + "ListMonitoredResourceDescriptors": { + "methods": [ "ListMonitoredResourceDescriptors" ] }, - "TailLogEntries": { - "methods": [ + "TailLogEntries": { + "methods": [ "TailLogEntries" ] }, - "WriteLogEntries": { - "methods": [ + "WriteLogEntries": { + "methods": [ "WriteLogEntries" ] } @@ -168,33 +168,33 @@ } } }, - "MetricsServiceV2": { - "clients": { - "grpc": { - "libraryClient": "MetricsClient", - "rpcs": { - "CreateLogMetric": { - "methods": [ + "MetricsServiceV2": { + "clients": { + "grpc": { + "libraryClient": "MetricsClient", + "rpcs": { + "CreateLogMetric": { + "methods": [ "CreateLogMetric" ] }, - "DeleteLogMetric": { - "methods": [ + "DeleteLogMetric": { + "methods": [ "DeleteLogMetric" ] }, - "GetLogMetric": { - "methods": [ + "GetLogMetric": { + "methods": [ "GetLogMetric" ] }, - "ListLogMetrics": { - "methods": [ + "ListLogMetrics": { + "methods": [ "ListLogMetrics" ] }, - "UpdateLogMetric": { - "methods": [ + "UpdateLogMetric": { + "methods": [ "UpdateLogMetric" ] } diff --git a/logging/go.mod b/logging/go.mod index 5842c20700ef..b0f7fe80ff62 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -11,7 +11,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/logging/go.sum b/logging/go.sum index ccd16df4d1b7..41ab982999f4 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -455,8 +455,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index 7aee7d39003e..33bf0f3db74a 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/longrunning/autogen/gapic_metadata.json b/longrunning/autogen/gapic_metadata.json index 8489336a675e..eff1271b207c 100644 --- a/longrunning/autogen/gapic_metadata.json +++ b/longrunning/autogen/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.longrunning", - "libraryPackage": "cloud.google.com/go/longrunning/autogen", - "services": { - "Operations": { - "clients": { - "grpc": { - "libraryClient": "OperationsClient", - "rpcs": { - "CancelOperation": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.longrunning", + "libraryPackage": "cloud.google.com/go/longrunning/autogen", + "services": { + "Operations": { + "clients": { + "grpc": { + "libraryClient": "OperationsClient", + "rpcs": { + "CancelOperation": { + "methods": [ "CancelOperation" ] }, - "DeleteOperation": { - "methods": [ + "DeleteOperation": { + "methods": [ "DeleteOperation" ] }, - "GetOperation": { - "methods": [ + "GetOperation": { + "methods": [ "GetOperation" ] }, - "ListOperations": { - "methods": [ + "ListOperations": { + "methods": [ "ListOperations" ] }, - "WaitOperation": { - "methods": [ + "WaitOperation": { + "methods": [ "WaitOperation" ] } diff --git a/managedidentities/apiv1/doc.go b/managedidentities/apiv1/doc.go index 6225a551cdd2..e9b404958368 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/managedidentities/apiv1/gapic_metadata.json b/managedidentities/apiv1/gapic_metadata.json index d1c3eaa88990..4277b2fe80f1 100644 --- a/managedidentities/apiv1/gapic_metadata.json +++ b/managedidentities/apiv1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.managedidentities.v1", - "libraryPackage": "cloud.google.com/go/managedidentities/apiv1", - "services": { - "ManagedIdentitiesService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AttachTrust": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.managedidentities.v1", + "libraryPackage": "cloud.google.com/go/managedidentities/apiv1", + "services": { + "ManagedIdentitiesService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AttachTrust": { + "methods": [ "AttachTrust" ] }, - "CreateMicrosoftAdDomain": { - "methods": [ + "CreateMicrosoftAdDomain": { + "methods": [ "CreateMicrosoftAdDomain" ] }, - "DeleteDomain": { - "methods": [ + "DeleteDomain": { + "methods": [ "DeleteDomain" ] }, - "DetachTrust": { - "methods": [ + "DetachTrust": { + "methods": [ "DetachTrust" ] }, - "GetDomain": { - "methods": [ + "GetDomain": { + "methods": [ "GetDomain" ] }, - "ListDomains": { - "methods": [ + "ListDomains": { + "methods": [ "ListDomains" ] }, - "ReconfigureTrust": { - "methods": [ + "ReconfigureTrust": { + "methods": [ "ReconfigureTrust" ] }, - "ResetAdminPassword": { - "methods": [ + "ResetAdminPassword": { + "methods": [ "ResetAdminPassword" ] }, - "UpdateDomain": { - "methods": [ + "UpdateDomain": { + "methods": [ "UpdateDomain" ] }, - "ValidateTrust": { - "methods": [ + "ValidateTrust": { + "methods": [ "ValidateTrust" ] } diff --git a/mediatranslation/apiv1beta1/doc.go b/mediatranslation/apiv1beta1/doc.go index 8b6811bef261..80c2dfc4ec5b 100644 --- a/mediatranslation/apiv1beta1/doc.go +++ b/mediatranslation/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/mediatranslation/apiv1beta1/gapic_metadata.json b/mediatranslation/apiv1beta1/gapic_metadata.json index 720f4cab3791..8ce9729bf44f 100644 --- a/mediatranslation/apiv1beta1/gapic_metadata.json +++ b/mediatranslation/apiv1beta1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.mediatranslation.v1beta1", - "libraryPackage": "cloud.google.com/go/mediatranslation/apiv1beta1", - "services": { - "SpeechTranslationService": { - "clients": { - "grpc": { - "libraryClient": "SpeechTranslationClient", - "rpcs": { - "StreamingTranslateSpeech": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.mediatranslation.v1beta1", + "libraryPackage": "cloud.google.com/go/mediatranslation/apiv1beta1", + "services": { + "SpeechTranslationService": { + "clients": { + "grpc": { + "libraryClient": "SpeechTranslationClient", + "rpcs": { + "StreamingTranslateSpeech": { + "methods": [ "StreamingTranslateSpeech" ] } diff --git a/memcache/apiv1/doc.go b/memcache/apiv1/doc.go index 53c4fa8bf595..f891f3f3dd09 100644 --- a/memcache/apiv1/doc.go +++ b/memcache/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1/gapic_metadata.json b/memcache/apiv1/gapic_metadata.json index 3d1d457865dc..5ceb74dbd7fe 100644 --- a/memcache/apiv1/gapic_metadata.json +++ b/memcache/apiv1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.memcache.v1", - "libraryPackage": "cloud.google.com/go/memcache/apiv1", - "services": { - "CloudMemcache": { - "clients": { - "grpc": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "ApplyParameters": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.memcache.v1", + "libraryPackage": "cloud.google.com/go/memcache/apiv1", + "services": { + "CloudMemcache": { + "clients": { + "grpc": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "ApplyParameters": { + "methods": [ "ApplyParameters" ] }, - "CreateInstance": { - "methods": [ + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "UpdateInstance": { - "methods": [ + "UpdateInstance": { + "methods": [ "UpdateInstance" ] }, - "UpdateParameters": { - "methods": [ + "UpdateParameters": { + "methods": [ "UpdateParameters" ] } diff --git a/memcache/apiv1beta2/doc.go b/memcache/apiv1beta2/doc.go index f4fcbf8e7af2..da5a42411922 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/memcache/apiv1beta2/gapic_metadata.json b/memcache/apiv1beta2/gapic_metadata.json index 5e76a0182712..6efa801fe86b 100644 --- a/memcache/apiv1beta2/gapic_metadata.json +++ b/memcache/apiv1beta2/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.memcache.v1beta2", - "libraryPackage": "cloud.google.com/go/memcache/apiv1beta2", - "services": { - "CloudMemcache": { - "clients": { - "grpc": { - "libraryClient": "CloudMemcacheClient", - "rpcs": { - "ApplyParameters": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.memcache.v1beta2", + "libraryPackage": "cloud.google.com/go/memcache/apiv1beta2", + "services": { + "CloudMemcache": { + "clients": { + "grpc": { + "libraryClient": "CloudMemcacheClient", + "rpcs": { + "ApplyParameters": { + "methods": [ "ApplyParameters" ] }, - "ApplySoftwareUpdate": { - "methods": [ + "ApplySoftwareUpdate": { + "methods": [ "ApplySoftwareUpdate" ] }, - "CreateInstance": { - "methods": [ + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "UpdateInstance": { - "methods": [ + "UpdateInstance": { + "methods": [ "UpdateInstance" ] }, - "UpdateParameters": { - "methods": [ + "UpdateParameters": { + "methods": [ "UpdateParameters" ] } diff --git a/metastore/apiv1/doc.go b/metastore/apiv1/doc.go index 30a894666f87..cc4984a4ec61 100644 --- a/metastore/apiv1/doc.go +++ b/metastore/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1/gapic_metadata.json b/metastore/apiv1/gapic_metadata.json index e5ec3bd4e15a..373a5e1dcb44 100644 --- a/metastore/apiv1/gapic_metadata.json +++ b/metastore/apiv1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.metastore.v1", - "libraryPackage": "cloud.google.com/go/metastore/apiv1", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "CreateMetadataImport": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.metastore.v1", + "libraryPackage": "cloud.google.com/go/metastore/apiv1", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "CreateMetadataImport": { + "methods": [ "CreateMetadataImport" ] }, - "CreateService": { - "methods": [ + "CreateService": { + "methods": [ "CreateService" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "ExportMetadata": { - "methods": [ + "ExportMetadata": { + "methods": [ "ExportMetadata" ] }, - "GetMetadataImport": { - "methods": [ + "GetMetadataImport": { + "methods": [ "GetMetadataImport" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListMetadataImports": { - "methods": [ + "ListMetadataImports": { + "methods": [ "ListMetadataImports" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "UpdateMetadataImport": { - "methods": [ + "UpdateMetadataImport": { + "methods": [ "UpdateMetadataImport" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } diff --git a/metastore/apiv1alpha/doc.go b/metastore/apiv1alpha/doc.go index 157b3d777239..c7abcb3c484e 100644 --- a/metastore/apiv1alpha/doc.go +++ b/metastore/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1alpha/gapic_metadata.json b/metastore/apiv1alpha/gapic_metadata.json index 682ed11bb1d8..868989b84060 100644 --- a/metastore/apiv1alpha/gapic_metadata.json +++ b/metastore/apiv1alpha/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.metastore.v1alpha", - "libraryPackage": "cloud.google.com/go/metastore/apiv1alpha", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "CreateBackup": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.metastore.v1alpha", + "libraryPackage": "cloud.google.com/go/metastore/apiv1alpha", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "CreateBackup": { + "methods": [ "CreateBackup" ] }, - "CreateMetadataImport": { - "methods": [ + "CreateMetadataImport": { + "methods": [ "CreateMetadataImport" ] }, - "CreateService": { - "methods": [ + "CreateService": { + "methods": [ "CreateService" ] }, - "DeleteBackup": { - "methods": [ + "DeleteBackup": { + "methods": [ "DeleteBackup" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "ExportMetadata": { - "methods": [ + "ExportMetadata": { + "methods": [ "ExportMetadata" ] }, - "GetBackup": { - "methods": [ + "GetBackup": { + "methods": [ "GetBackup" ] }, - "GetMetadataImport": { - "methods": [ + "GetMetadataImport": { + "methods": [ "GetMetadataImport" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListBackups": { - "methods": [ + "ListBackups": { + "methods": [ "ListBackups" ] }, - "ListMetadataImports": { - "methods": [ + "ListMetadataImports": { + "methods": [ "ListMetadataImports" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "RestoreService": { - "methods": [ + "RestoreService": { + "methods": [ "RestoreService" ] }, - "UpdateMetadataImport": { - "methods": [ + "UpdateMetadataImport": { + "methods": [ "UpdateMetadataImport" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } diff --git a/metastore/apiv1beta/doc.go b/metastore/apiv1beta/doc.go index 22c07e96de8c..2f95d1c0f45f 100644 --- a/metastore/apiv1beta/doc.go +++ b/metastore/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/metastore/apiv1beta/gapic_metadata.json b/metastore/apiv1beta/gapic_metadata.json index fb3f0a82e739..187c53166785 100644 --- a/metastore/apiv1beta/gapic_metadata.json +++ b/metastore/apiv1beta/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.metastore.v1beta", - "libraryPackage": "cloud.google.com/go/metastore/apiv1beta", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "CreateBackup": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.metastore.v1beta", + "libraryPackage": "cloud.google.com/go/metastore/apiv1beta", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "CreateBackup": { + "methods": [ "CreateBackup" ] }, - "CreateMetadataImport": { - "methods": [ + "CreateMetadataImport": { + "methods": [ "CreateMetadataImport" ] }, - "CreateService": { - "methods": [ + "CreateService": { + "methods": [ "CreateService" ] }, - "DeleteBackup": { - "methods": [ + "DeleteBackup": { + "methods": [ "DeleteBackup" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "ExportMetadata": { - "methods": [ + "ExportMetadata": { + "methods": [ "ExportMetadata" ] }, - "GetBackup": { - "methods": [ + "GetBackup": { + "methods": [ "GetBackup" ] }, - "GetMetadataImport": { - "methods": [ + "GetMetadataImport": { + "methods": [ "GetMetadataImport" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListBackups": { - "methods": [ + "ListBackups": { + "methods": [ "ListBackups" ] }, - "ListMetadataImports": { - "methods": [ + "ListMetadataImports": { + "methods": [ "ListMetadataImports" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "RestoreService": { - "methods": [ + "RestoreService": { + "methods": [ "RestoreService" ] }, - "UpdateMetadataImport": { - "methods": [ + "UpdateMetadataImport": { + "methods": [ "UpdateMetadataImport" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index 27fe565031fd..e8f1d363d8d9 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/apiv3/v2/gapic_metadata.json b/monitoring/apiv3/v2/gapic_metadata.json index 8b42e15d29b2..c522dbe13591 100644 --- a/monitoring/apiv3/v2/gapic_metadata.json +++ b/monitoring/apiv3/v2/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.monitoring.v3", - "libraryPackage": "cloud.google.com/go/monitoring/apiv3/v2", - "services": { - "AlertPolicyService": { - "clients": { - "grpc": { - "libraryClient": "AlertPolicyClient", - "rpcs": { - "CreateAlertPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.monitoring.v3", + "libraryPackage": "cloud.google.com/go/monitoring/apiv3/v2", + "services": { + "AlertPolicyService": { + "clients": { + "grpc": { + "libraryClient": "AlertPolicyClient", + "rpcs": { + "CreateAlertPolicy": { + "methods": [ "CreateAlertPolicy" ] }, - "DeleteAlertPolicy": { - "methods": [ + "DeleteAlertPolicy": { + "methods": [ "DeleteAlertPolicy" ] }, - "GetAlertPolicy": { - "methods": [ + "GetAlertPolicy": { + "methods": [ "GetAlertPolicy" ] }, - "ListAlertPolicies": { - "methods": [ + "ListAlertPolicies": { + "methods": [ "ListAlertPolicies" ] }, - "UpdateAlertPolicy": { - "methods": [ + "UpdateAlertPolicy": { + "methods": [ "UpdateAlertPolicy" ] } @@ -39,38 +39,38 @@ } } }, - "GroupService": { - "clients": { - "grpc": { - "libraryClient": "GroupClient", - "rpcs": { - "CreateGroup": { - "methods": [ + "GroupService": { + "clients": { + "grpc": { + "libraryClient": "GroupClient", + "rpcs": { + "CreateGroup": { + "methods": [ "CreateGroup" ] }, - "DeleteGroup": { - "methods": [ + "DeleteGroup": { + "methods": [ "DeleteGroup" ] }, - "GetGroup": { - "methods": [ + "GetGroup": { + "methods": [ "GetGroup" ] }, - "ListGroupMembers": { - "methods": [ + "ListGroupMembers": { + "methods": [ "ListGroupMembers" ] }, - "ListGroups": { - "methods": [ + "ListGroups": { + "methods": [ "ListGroups" ] }, - "UpdateGroup": { - "methods": [ + "UpdateGroup": { + "methods": [ "UpdateGroup" ] } @@ -78,48 +78,48 @@ } } }, - "MetricService": { - "clients": { - "grpc": { - "libraryClient": "MetricClient", - "rpcs": { - "CreateMetricDescriptor": { - "methods": [ + "MetricService": { + "clients": { + "grpc": { + "libraryClient": "MetricClient", + "rpcs": { + "CreateMetricDescriptor": { + "methods": [ "CreateMetricDescriptor" ] }, - "CreateTimeSeries": { - "methods": [ + "CreateTimeSeries": { + "methods": [ "CreateTimeSeries" ] }, - "DeleteMetricDescriptor": { - "methods": [ + "DeleteMetricDescriptor": { + "methods": [ "DeleteMetricDescriptor" ] }, - "GetMetricDescriptor": { - "methods": [ + "GetMetricDescriptor": { + "methods": [ "GetMetricDescriptor" ] }, - "GetMonitoredResourceDescriptor": { - "methods": [ + "GetMonitoredResourceDescriptor": { + "methods": [ "GetMonitoredResourceDescriptor" ] }, - "ListMetricDescriptors": { - "methods": [ + "ListMetricDescriptors": { + "methods": [ "ListMetricDescriptors" ] }, - "ListMonitoredResourceDescriptors": { - "methods": [ + "ListMonitoredResourceDescriptors": { + "methods": [ "ListMonitoredResourceDescriptors" ] }, - "ListTimeSeries": { - "methods": [ + "ListTimeSeries": { + "methods": [ "ListTimeSeries" ] } @@ -127,58 +127,58 @@ } } }, - "NotificationChannelService": { - "clients": { - "grpc": { - "libraryClient": "NotificationChannelClient", - "rpcs": { - "CreateNotificationChannel": { - "methods": [ + "NotificationChannelService": { + "clients": { + "grpc": { + "libraryClient": "NotificationChannelClient", + "rpcs": { + "CreateNotificationChannel": { + "methods": [ "CreateNotificationChannel" ] }, - "DeleteNotificationChannel": { - "methods": [ + "DeleteNotificationChannel": { + "methods": [ "DeleteNotificationChannel" ] }, - "GetNotificationChannel": { - "methods": [ + "GetNotificationChannel": { + "methods": [ "GetNotificationChannel" ] }, - "GetNotificationChannelDescriptor": { - "methods": [ + "GetNotificationChannelDescriptor": { + "methods": [ "GetNotificationChannelDescriptor" ] }, - "GetNotificationChannelVerificationCode": { - "methods": [ + "GetNotificationChannelVerificationCode": { + "methods": [ "GetNotificationChannelVerificationCode" ] }, - "ListNotificationChannelDescriptors": { - "methods": [ + "ListNotificationChannelDescriptors": { + "methods": [ "ListNotificationChannelDescriptors" ] }, - "ListNotificationChannels": { - "methods": [ + "ListNotificationChannels": { + "methods": [ "ListNotificationChannels" ] }, - "SendNotificationChannelVerificationCode": { - "methods": [ + "SendNotificationChannelVerificationCode": { + "methods": [ "SendNotificationChannelVerificationCode" ] }, - "UpdateNotificationChannel": { - "methods": [ + "UpdateNotificationChannel": { + "methods": [ "UpdateNotificationChannel" ] }, - "VerifyNotificationChannel": { - "methods": [ + "VerifyNotificationChannel": { + "methods": [ "VerifyNotificationChannel" ] } @@ -186,13 +186,13 @@ } } }, - "QueryService": { - "clients": { - "grpc": { - "libraryClient": "QueryClient", - "rpcs": { - "QueryTimeSeries": { - "methods": [ + "QueryService": { + "clients": { + "grpc": { + "libraryClient": "QueryClient", + "rpcs": { + "QueryTimeSeries": { + "methods": [ "QueryTimeSeries" ] } @@ -200,58 +200,58 @@ } } }, - "ServiceMonitoringService": { - "clients": { - "grpc": { - "libraryClient": "ServiceMonitoringClient", - "rpcs": { - "CreateService": { - "methods": [ + "ServiceMonitoringService": { + "clients": { + "grpc": { + "libraryClient": "ServiceMonitoringClient", + "rpcs": { + "CreateService": { + "methods": [ "CreateService" ] }, - "CreateServiceLevelObjective": { - "methods": [ + "CreateServiceLevelObjective": { + "methods": [ "CreateServiceLevelObjective" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "DeleteServiceLevelObjective": { - "methods": [ + "DeleteServiceLevelObjective": { + "methods": [ "DeleteServiceLevelObjective" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "GetServiceLevelObjective": { - "methods": [ + "GetServiceLevelObjective": { + "methods": [ "GetServiceLevelObjective" ] }, - "ListServiceLevelObjectives": { - "methods": [ + "ListServiceLevelObjectives": { + "methods": [ "ListServiceLevelObjectives" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] }, - "UpdateServiceLevelObjective": { - "methods": [ + "UpdateServiceLevelObjective": { + "methods": [ "UpdateServiceLevelObjective" ] } @@ -259,38 +259,38 @@ } } }, - "UptimeCheckService": { - "clients": { - "grpc": { - "libraryClient": "UptimeCheckClient", - "rpcs": { - "CreateUptimeCheckConfig": { - "methods": [ + "UptimeCheckService": { + "clients": { + "grpc": { + "libraryClient": "UptimeCheckClient", + "rpcs": { + "CreateUptimeCheckConfig": { + "methods": [ "CreateUptimeCheckConfig" ] }, - "DeleteUptimeCheckConfig": { - "methods": [ + "DeleteUptimeCheckConfig": { + "methods": [ "DeleteUptimeCheckConfig" ] }, - "GetUptimeCheckConfig": { - "methods": [ + "GetUptimeCheckConfig": { + "methods": [ "GetUptimeCheckConfig" ] }, - "ListUptimeCheckConfigs": { - "methods": [ + "ListUptimeCheckConfigs": { + "methods": [ "ListUptimeCheckConfigs" ] }, - "ListUptimeCheckIps": { - "methods": [ + "ListUptimeCheckIps": { + "methods": [ "ListUptimeCheckIps" ] }, - "UpdateUptimeCheckConfig": { - "methods": [ + "UpdateUptimeCheckConfig": { + "methods": [ "UpdateUptimeCheckConfig" ] } diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index 729b4640d952..271cc826068d 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -53,7 +53,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/dashboard/apiv1/gapic_metadata.json b/monitoring/dashboard/apiv1/gapic_metadata.json index 09b473804cec..28ca5eb4c1ce 100644 --- a/monitoring/dashboard/apiv1/gapic_metadata.json +++ b/monitoring/dashboard/apiv1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.monitoring.dashboard.v1", - "libraryPackage": "cloud.google.com/go/monitoring/dashboard/apiv1", - "services": { - "DashboardsService": { - "clients": { - "grpc": { - "libraryClient": "DashboardsClient", - "rpcs": { - "CreateDashboard": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.monitoring.dashboard.v1", + "libraryPackage": "cloud.google.com/go/monitoring/dashboard/apiv1", + "services": { + "DashboardsService": { + "clients": { + "grpc": { + "libraryClient": "DashboardsClient", + "rpcs": { + "CreateDashboard": { + "methods": [ "CreateDashboard" ] }, - "DeleteDashboard": { - "methods": [ + "DeleteDashboard": { + "methods": [ "DeleteDashboard" ] }, - "GetDashboard": { - "methods": [ + "GetDashboard": { + "methods": [ "GetDashboard" ] }, - "ListDashboards": { - "methods": [ + "ListDashboards": { + "methods": [ "ListDashboards" ] }, - "UpdateDashboard": { - "methods": [ + "UpdateDashboard": { + "methods": [ "UpdateDashboard" ] } diff --git a/networkconnectivity/apiv1alpha1/doc.go b/networkconnectivity/apiv1alpha1/doc.go index e60114823606..f93d846129a1 100644 --- a/networkconnectivity/apiv1alpha1/doc.go +++ b/networkconnectivity/apiv1alpha1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/networkconnectivity/apiv1alpha1/gapic_metadata.json b/networkconnectivity/apiv1alpha1/gapic_metadata.json index 350849dea786..500541cde0f5 100644 --- a/networkconnectivity/apiv1alpha1/gapic_metadata.json +++ b/networkconnectivity/apiv1alpha1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.networkconnectivity.v1alpha1", - "libraryPackage": "cloud.google.com/go/networkconnectivity/apiv1alpha1", - "services": { - "HubService": { - "clients": { - "grpc": { - "libraryClient": "HubClient", - "rpcs": { - "CreateHub": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.networkconnectivity.v1alpha1", + "libraryPackage": "cloud.google.com/go/networkconnectivity/apiv1alpha1", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubClient", + "rpcs": { + "CreateHub": { + "methods": [ "CreateHub" ] }, - "CreateSpoke": { - "methods": [ + "CreateSpoke": { + "methods": [ "CreateSpoke" ] }, - "DeleteHub": { - "methods": [ + "DeleteHub": { + "methods": [ "DeleteHub" ] }, - "DeleteSpoke": { - "methods": [ + "DeleteSpoke": { + "methods": [ "DeleteSpoke" ] }, - "GetHub": { - "methods": [ + "GetHub": { + "methods": [ "GetHub" ] }, - "GetSpoke": { - "methods": [ + "GetSpoke": { + "methods": [ "GetSpoke" ] }, - "ListHubs": { - "methods": [ + "ListHubs": { + "methods": [ "ListHubs" ] }, - "ListSpokes": { - "methods": [ + "ListSpokes": { + "methods": [ "ListSpokes" ] }, - "UpdateHub": { - "methods": [ + "UpdateHub": { + "methods": [ "UpdateHub" ] }, - "UpdateSpoke": { - "methods": [ + "UpdateSpoke": { + "methods": [ "UpdateSpoke" ] } diff --git a/notebooks/apiv1beta1/doc.go b/notebooks/apiv1beta1/doc.go index 0c93c0dcf6c7..2402a2cc4698 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/notebooks/apiv1beta1/gapic_metadata.json b/notebooks/apiv1beta1/gapic_metadata.json index e3e3dce499bc..a344cd6d96b3 100644 --- a/notebooks/apiv1beta1/gapic_metadata.json +++ b/notebooks/apiv1beta1/gapic_metadata.json @@ -1,107 +1,107 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.notebooks.v1beta1", - "libraryPackage": "cloud.google.com/go/notebooks/apiv1beta1", - "services": { - "NotebookService": { - "clients": { - "grpc": { - "libraryClient": "NotebookClient", - "rpcs": { - "CreateEnvironment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.notebooks.v1beta1", + "libraryPackage": "cloud.google.com/go/notebooks/apiv1beta1", + "services": { + "NotebookService": { + "clients": { + "grpc": { + "libraryClient": "NotebookClient", + "rpcs": { + "CreateEnvironment": { + "methods": [ "CreateEnvironment" ] }, - "CreateInstance": { - "methods": [ + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteEnvironment": { - "methods": [ + "DeleteEnvironment": { + "methods": [ "DeleteEnvironment" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "GetEnvironment": { - "methods": [ + "GetEnvironment": { + "methods": [ "GetEnvironment" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "IsInstanceUpgradeable": { - "methods": [ + "IsInstanceUpgradeable": { + "methods": [ "IsInstanceUpgradeable" ] }, - "ListEnvironments": { - "methods": [ + "ListEnvironments": { + "methods": [ "ListEnvironments" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "RegisterInstance": { - "methods": [ + "RegisterInstance": { + "methods": [ "RegisterInstance" ] }, - "ReportInstanceInfo": { - "methods": [ + "ReportInstanceInfo": { + "methods": [ "ReportInstanceInfo" ] }, - "ResetInstance": { - "methods": [ + "ResetInstance": { + "methods": [ "ResetInstance" ] }, - "SetInstanceAccelerator": { - "methods": [ + "SetInstanceAccelerator": { + "methods": [ "SetInstanceAccelerator" ] }, - "SetInstanceLabels": { - "methods": [ + "SetInstanceLabels": { + "methods": [ "SetInstanceLabels" ] }, - "SetInstanceMachineType": { - "methods": [ + "SetInstanceMachineType": { + "methods": [ "SetInstanceMachineType" ] }, - "StartInstance": { - "methods": [ + "StartInstance": { + "methods": [ "StartInstance" ] }, - "StopInstance": { - "methods": [ + "StopInstance": { + "methods": [ "StopInstance" ] }, - "UpgradeInstance": { - "methods": [ + "UpgradeInstance": { + "methods": [ "UpgradeInstance" ] }, - "UpgradeInstanceInternal": { - "methods": [ + "UpgradeInstanceInternal": { + "methods": [ "UpgradeInstanceInternal" ] } diff --git a/orgpolicy/apiv2/doc.go b/orgpolicy/apiv2/doc.go index d55489e4dec6..1bfd1d41b86b 100644 --- a/orgpolicy/apiv2/doc.go +++ b/orgpolicy/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/orgpolicy/apiv2/gapic_metadata.json b/orgpolicy/apiv2/gapic_metadata.json index c9c26e4e516b..c07306a370e5 100644 --- a/orgpolicy/apiv2/gapic_metadata.json +++ b/orgpolicy/apiv2/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.orgpolicy.v2", - "libraryPackage": "cloud.google.com/go/orgpolicy/apiv2", - "services": { - "OrgPolicy": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreatePolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.orgpolicy.v2", + "libraryPackage": "cloud.google.com/go/orgpolicy/apiv2", + "services": { + "OrgPolicy": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreatePolicy": { + "methods": [ "CreatePolicy" ] }, - "DeletePolicy": { - "methods": [ + "DeletePolicy": { + "methods": [ "DeletePolicy" ] }, - "GetEffectivePolicy": { - "methods": [ + "GetEffectivePolicy": { + "methods": [ "GetEffectivePolicy" ] }, - "GetPolicy": { - "methods": [ + "GetPolicy": { + "methods": [ "GetPolicy" ] }, - "ListConstraints": { - "methods": [ + "ListConstraints": { + "methods": [ "ListConstraints" ] }, - "ListPolicies": { - "methods": [ + "ListPolicies": { + "methods": [ "ListPolicies" ] }, - "UpdatePolicy": { - "methods": [ + "UpdatePolicy": { + "methods": [ "UpdatePolicy" ] } diff --git a/osconfig/agentendpoint/apiv1/doc.go b/osconfig/agentendpoint/apiv1/doc.go index 89b757f3fa24..685cb443fdcb 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1/gapic_metadata.json b/osconfig/agentendpoint/apiv1/gapic_metadata.json index 10311f0ebc98..a1becd796201 100644 --- a/osconfig/agentendpoint/apiv1/gapic_metadata.json +++ b/osconfig/agentendpoint/apiv1/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.osconfig.agentendpoint.v1", - "libraryPackage": "cloud.google.com/go/osconfig/agentendpoint/apiv1", - "services": { - "AgentEndpointService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ReceiveTaskNotification": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.osconfig.agentendpoint.v1", + "libraryPackage": "cloud.google.com/go/osconfig/agentendpoint/apiv1", + "services": { + "AgentEndpointService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ReceiveTaskNotification": { + "methods": [ "ReceiveTaskNotification" ] }, - "RegisterAgent": { - "methods": [ + "RegisterAgent": { + "methods": [ "RegisterAgent" ] }, - "ReportInventory": { - "methods": [ + "ReportInventory": { + "methods": [ "ReportInventory" ] }, - "ReportTaskComplete": { - "methods": [ + "ReportTaskComplete": { + "methods": [ "ReportTaskComplete" ] }, - "ReportTaskProgress": { - "methods": [ + "ReportTaskProgress": { + "methods": [ "ReportTaskProgress" ] }, - "StartNextTask": { - "methods": [ + "StartNextTask": { + "methods": [ "StartNextTask" ] } diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go index 10b866c4d9e4..1a76b52d9ada 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/agentendpoint/apiv1beta/gapic_metadata.json b/osconfig/agentendpoint/apiv1beta/gapic_metadata.json index 31ec346d10d6..3d302165c762 100644 --- a/osconfig/agentendpoint/apiv1beta/gapic_metadata.json +++ b/osconfig/agentendpoint/apiv1beta/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.osconfig.agentendpoint.v1beta", - "libraryPackage": "cloud.google.com/go/osconfig/agentendpoint/apiv1beta", - "services": { - "AgentEndpointService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "LookupEffectiveGuestPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.osconfig.agentendpoint.v1beta", + "libraryPackage": "cloud.google.com/go/osconfig/agentendpoint/apiv1beta", + "services": { + "AgentEndpointService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "LookupEffectiveGuestPolicy": { + "methods": [ "LookupEffectiveGuestPolicy" ] }, - "ReceiveTaskNotification": { - "methods": [ + "ReceiveTaskNotification": { + "methods": [ "ReceiveTaskNotification" ] }, - "RegisterAgent": { - "methods": [ + "RegisterAgent": { + "methods": [ "RegisterAgent" ] }, - "ReportTaskComplete": { - "methods": [ + "ReportTaskComplete": { + "methods": [ "ReportTaskComplete" ] }, - "ReportTaskProgress": { - "methods": [ + "ReportTaskProgress": { + "methods": [ "ReportTaskProgress" ] }, - "StartNextTask": { - "methods": [ + "StartNextTask": { + "methods": [ "StartNextTask" ] } diff --git a/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index 7f30e0d4f362..11d02031618d 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1/gapic_metadata.json b/osconfig/apiv1/gapic_metadata.json index eb5c0df8398f..1b0d0f460a22 100644 --- a/osconfig/apiv1/gapic_metadata.json +++ b/osconfig/apiv1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.osconfig.v1", - "libraryPackage": "cloud.google.com/go/osconfig/apiv1", - "services": { - "OsConfigService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CancelPatchJob": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.osconfig.v1", + "libraryPackage": "cloud.google.com/go/osconfig/apiv1", + "services": { + "OsConfigService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelPatchJob": { + "methods": [ "CancelPatchJob" ] }, - "CreatePatchDeployment": { - "methods": [ + "CreatePatchDeployment": { + "methods": [ "CreatePatchDeployment" ] }, - "DeletePatchDeployment": { - "methods": [ + "DeletePatchDeployment": { + "methods": [ "DeletePatchDeployment" ] }, - "ExecutePatchJob": { - "methods": [ + "ExecutePatchJob": { + "methods": [ "ExecutePatchJob" ] }, - "GetPatchDeployment": { - "methods": [ + "GetPatchDeployment": { + "methods": [ "GetPatchDeployment" ] }, - "GetPatchJob": { - "methods": [ + "GetPatchJob": { + "methods": [ "GetPatchJob" ] }, - "ListPatchDeployments": { - "methods": [ + "ListPatchDeployments": { + "methods": [ "ListPatchDeployments" ] }, - "ListPatchJobInstanceDetails": { - "methods": [ + "ListPatchJobInstanceDetails": { + "methods": [ "ListPatchJobInstanceDetails" ] }, - "ListPatchJobs": { - "methods": [ + "ListPatchJobs": { + "methods": [ "ListPatchJobs" ] } diff --git a/osconfig/apiv1alpha/doc.go b/osconfig/apiv1alpha/doc.go index f536fe15e1b9..4712c64c2324 100644 --- a/osconfig/apiv1alpha/doc.go +++ b/osconfig/apiv1alpha/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1alpha/gapic_metadata.json b/osconfig/apiv1alpha/gapic_metadata.json index 7a423634f9b5..68645256d0c3 100644 --- a/osconfig/apiv1alpha/gapic_metadata.json +++ b/osconfig/apiv1alpha/gapic_metadata.json @@ -1,72 +1,72 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.osconfig.v1alpha", - "libraryPackage": "cloud.google.com/go/osconfig/apiv1alpha", - "services": { - "OsConfigZonalService": { - "clients": { - "grpc": { - "libraryClient": "OsConfigZonalClient", - "rpcs": { - "CreateOSPolicyAssignment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.osconfig.v1alpha", + "libraryPackage": "cloud.google.com/go/osconfig/apiv1alpha", + "services": { + "OsConfigZonalService": { + "clients": { + "grpc": { + "libraryClient": "OsConfigZonalClient", + "rpcs": { + "CreateOSPolicyAssignment": { + "methods": [ "CreateOSPolicyAssignment" ] }, - "DeleteOSPolicyAssignment": { - "methods": [ + "DeleteOSPolicyAssignment": { + "methods": [ "DeleteOSPolicyAssignment" ] }, - "GetInstanceOSPoliciesCompliance": { - "methods": [ + "GetInstanceOSPoliciesCompliance": { + "methods": [ "GetInstanceOSPoliciesCompliance" ] }, - "GetInventory": { - "methods": [ + "GetInventory": { + "methods": [ "GetInventory" ] }, - "GetOSPolicyAssignment": { - "methods": [ + "GetOSPolicyAssignment": { + "methods": [ "GetOSPolicyAssignment" ] }, - "GetVulnerabilityReport": { - "methods": [ + "GetVulnerabilityReport": { + "methods": [ "GetVulnerabilityReport" ] }, - "ListInstanceOSPoliciesCompliances": { - "methods": [ + "ListInstanceOSPoliciesCompliances": { + "methods": [ "ListInstanceOSPoliciesCompliances" ] }, - "ListInventories": { - "methods": [ + "ListInventories": { + "methods": [ "ListInventories" ] }, - "ListOSPolicyAssignmentRevisions": { - "methods": [ + "ListOSPolicyAssignmentRevisions": { + "methods": [ "ListOSPolicyAssignmentRevisions" ] }, - "ListOSPolicyAssignments": { - "methods": [ + "ListOSPolicyAssignments": { + "methods": [ "ListOSPolicyAssignments" ] }, - "ListVulnerabilityReports": { - "methods": [ + "ListVulnerabilityReports": { + "methods": [ "ListVulnerabilityReports" ] }, - "UpdateOSPolicyAssignment": { - "methods": [ + "UpdateOSPolicyAssignment": { + "methods": [ "UpdateOSPolicyAssignment" ] } diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go index 28a1bacd5f9b..2d0e46f10034 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/osconfig/apiv1beta/gapic_metadata.json b/osconfig/apiv1beta/gapic_metadata.json index 74a643af24a3..08c5c3128d3b 100644 --- a/osconfig/apiv1beta/gapic_metadata.json +++ b/osconfig/apiv1beta/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.osconfig.v1beta", - "libraryPackage": "cloud.google.com/go/osconfig/apiv1beta", - "services": { - "OsConfigService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CancelPatchJob": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.osconfig.v1beta", + "libraryPackage": "cloud.google.com/go/osconfig/apiv1beta", + "services": { + "OsConfigService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelPatchJob": { + "methods": [ "CancelPatchJob" ] }, - "CreateGuestPolicy": { - "methods": [ + "CreateGuestPolicy": { + "methods": [ "CreateGuestPolicy" ] }, - "CreatePatchDeployment": { - "methods": [ + "CreatePatchDeployment": { + "methods": [ "CreatePatchDeployment" ] }, - "DeleteGuestPolicy": { - "methods": [ + "DeleteGuestPolicy": { + "methods": [ "DeleteGuestPolicy" ] }, - "DeletePatchDeployment": { - "methods": [ + "DeletePatchDeployment": { + "methods": [ "DeletePatchDeployment" ] }, - "ExecutePatchJob": { - "methods": [ + "ExecutePatchJob": { + "methods": [ "ExecutePatchJob" ] }, - "GetGuestPolicy": { - "methods": [ + "GetGuestPolicy": { + "methods": [ "GetGuestPolicy" ] }, - "GetPatchDeployment": { - "methods": [ + "GetPatchDeployment": { + "methods": [ "GetPatchDeployment" ] }, - "GetPatchJob": { - "methods": [ + "GetPatchJob": { + "methods": [ "GetPatchJob" ] }, - "ListGuestPolicies": { - "methods": [ + "ListGuestPolicies": { + "methods": [ "ListGuestPolicies" ] }, - "ListPatchDeployments": { - "methods": [ + "ListPatchDeployments": { + "methods": [ "ListPatchDeployments" ] }, - "ListPatchJobInstanceDetails": { - "methods": [ + "ListPatchJobInstanceDetails": { + "methods": [ "ListPatchJobInstanceDetails" ] }, - "ListPatchJobs": { - "methods": [ + "ListPatchJobs": { + "methods": [ "ListPatchJobs" ] }, - "LookupEffectiveGuestPolicy": { - "methods": [ + "LookupEffectiveGuestPolicy": { + "methods": [ "LookupEffectiveGuestPolicy" ] }, - "UpdateGuestPolicy": { - "methods": [ + "UpdateGuestPolicy": { + "methods": [ "UpdateGuestPolicy" ] } diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index 29cd8bc06dda..b238bbcfc96a 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1/gapic_metadata.json b/oslogin/apiv1/gapic_metadata.json index 209474126313..36ddc426625a 100644 --- a/oslogin/apiv1/gapic_metadata.json +++ b/oslogin/apiv1/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.oslogin.v1", - "libraryPackage": "cloud.google.com/go/oslogin/apiv1", - "services": { - "OsLoginService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "DeletePosixAccount": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.oslogin.v1", + "libraryPackage": "cloud.google.com/go/oslogin/apiv1", + "services": { + "OsLoginService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "DeletePosixAccount": { + "methods": [ "DeletePosixAccount" ] }, - "DeleteSshPublicKey": { - "methods": [ + "DeleteSshPublicKey": { + "methods": [ "DeleteSshPublicKey" ] }, - "GetLoginProfile": { - "methods": [ + "GetLoginProfile": { + "methods": [ "GetLoginProfile" ] }, - "GetSshPublicKey": { - "methods": [ + "GetSshPublicKey": { + "methods": [ "GetSshPublicKey" ] }, - "ImportSshPublicKey": { - "methods": [ + "ImportSshPublicKey": { + "methods": [ "ImportSshPublicKey" ] }, - "UpdateSshPublicKey": { - "methods": [ + "UpdateSshPublicKey": { + "methods": [ "UpdateSshPublicKey" ] } diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 513a6d8f8315..8d1df6e50737 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/oslogin/apiv1beta/gapic_metadata.json b/oslogin/apiv1beta/gapic_metadata.json index d517bb07a29f..ddd46bd05909 100644 --- a/oslogin/apiv1beta/gapic_metadata.json +++ b/oslogin/apiv1beta/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.oslogin.v1beta", - "libraryPackage": "cloud.google.com/go/oslogin/apiv1beta", - "services": { - "OsLoginService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "DeletePosixAccount": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.oslogin.v1beta", + "libraryPackage": "cloud.google.com/go/oslogin/apiv1beta", + "services": { + "OsLoginService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "DeletePosixAccount": { + "methods": [ "DeletePosixAccount" ] }, - "DeleteSshPublicKey": { - "methods": [ + "DeleteSshPublicKey": { + "methods": [ "DeleteSshPublicKey" ] }, - "GetLoginProfile": { - "methods": [ + "GetLoginProfile": { + "methods": [ "GetLoginProfile" ] }, - "GetSshPublicKey": { - "methods": [ + "GetSshPublicKey": { + "methods": [ "GetSshPublicKey" ] }, - "ImportSshPublicKey": { - "methods": [ + "ImportSshPublicKey": { + "methods": [ "ImportSshPublicKey" ] }, - "UpdateSshPublicKey": { - "methods": [ + "UpdateSshPublicKey": { + "methods": [ "UpdateSshPublicKey" ] } diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index f8d1981beb4f..9de824a3ff45 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/phishingprotection/apiv1beta1/gapic_metadata.json b/phishingprotection/apiv1beta1/gapic_metadata.json index aa808a1c3195..fafe97d9d874 100644 --- a/phishingprotection/apiv1beta1/gapic_metadata.json +++ b/phishingprotection/apiv1beta1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.phishingprotection.v1beta1", - "libraryPackage": "cloud.google.com/go/phishingprotection/apiv1beta1", - "services": { - "PhishingProtectionServiceV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "PhishingProtectionServiceV1Beta1Client", - "rpcs": { - "ReportPhishing": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.phishingprotection.v1beta1", + "libraryPackage": "cloud.google.com/go/phishingprotection/apiv1beta1", + "services": { + "PhishingProtectionServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "PhishingProtectionServiceV1Beta1Client", + "rpcs": { + "ReportPhishing": { + "methods": [ "ReportPhishing" ] } diff --git a/policytroubleshooter/apiv1/doc.go b/policytroubleshooter/apiv1/doc.go index 98329ea8d120..41b2bbaf26f7 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/policytroubleshooter/apiv1/gapic_metadata.json b/policytroubleshooter/apiv1/gapic_metadata.json index 225f08d3e540..d2e85d113643 100644 --- a/policytroubleshooter/apiv1/gapic_metadata.json +++ b/policytroubleshooter/apiv1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.policytroubleshooter.v1", - "libraryPackage": "cloud.google.com/go/policytroubleshooter/apiv1", - "services": { - "IamChecker": { - "clients": { - "grpc": { - "libraryClient": "IamCheckerClient", - "rpcs": { - "TroubleshootIamPolicy": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.policytroubleshooter.v1", + "libraryPackage": "cloud.google.com/go/policytroubleshooter/apiv1", + "services": { + "IamChecker": { + "clients": { + "grpc": { + "libraryClient": "IamCheckerClient", + "rpcs": { + "TroubleshootIamPolicy": { + "methods": [ "TroubleshootIamPolicy" ] } diff --git a/privatecatalog/apiv1beta1/doc.go b/privatecatalog/apiv1beta1/doc.go index fc9e625eebb4..59b32641b767 100644 --- a/privatecatalog/apiv1beta1/doc.go +++ b/privatecatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/privatecatalog/apiv1beta1/gapic_metadata.json b/privatecatalog/apiv1beta1/gapic_metadata.json index 768bec963904..a549a3afcb23 100644 --- a/privatecatalog/apiv1beta1/gapic_metadata.json +++ b/privatecatalog/apiv1beta1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.privatecatalog.v1beta1", - "libraryPackage": "cloud.google.com/go/privatecatalog/apiv1beta1", - "services": { - "PrivateCatalog": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "SearchCatalogs": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.privatecatalog.v1beta1", + "libraryPackage": "cloud.google.com/go/privatecatalog/apiv1beta1", + "services": { + "PrivateCatalog": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "SearchCatalogs": { + "methods": [ "SearchCatalogs" ] }, - "SearchProducts": { - "methods": [ + "SearchProducts": { + "methods": [ "SearchProducts" ] }, - "SearchVersions": { - "methods": [ + "SearchVersions": { + "methods": [ "SearchVersions" ] } diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index 4f7c31c86b38..d415a1724dff 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/gapic_metadata.json b/pubsub/apiv1/gapic_metadata.json index 0923be3c70da..64b2999668a6 100644 --- a/pubsub/apiv1/gapic_metadata.json +++ b/pubsub/apiv1/gapic_metadata.json @@ -1,72 +1,72 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.pubsub.v1", - "libraryPackage": "cloud.google.com/go/pubsub/apiv1", - "services": { - "Publisher": { - "clients": { - "grpc": { - "libraryClient": "PublisherClient", - "rpcs": { - "CreateTopic": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.pubsub.v1", + "libraryPackage": "cloud.google.com/go/pubsub/apiv1", + "services": { + "Publisher": { + "clients": { + "grpc": { + "libraryClient": "PublisherClient", + "rpcs": { + "CreateTopic": { + "methods": [ "CreateTopic" ] }, - "DeleteTopic": { - "methods": [ + "DeleteTopic": { + "methods": [ "DeleteTopic" ] }, - "DetachSubscription": { - "methods": [ + "DetachSubscription": { + "methods": [ "DetachSubscription" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetTopic": { - "methods": [ + "GetTopic": { + "methods": [ "GetTopic" ] }, - "ListTopicSnapshots": { - "methods": [ + "ListTopicSnapshots": { + "methods": [ "ListTopicSnapshots" ] }, - "ListTopicSubscriptions": { - "methods": [ + "ListTopicSubscriptions": { + "methods": [ "ListTopicSubscriptions" ] }, - "ListTopics": { - "methods": [ + "ListTopics": { + "methods": [ "ListTopics" ] }, - "Publish": { - "methods": [ + "Publish": { + "methods": [ "Publish" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateTopic": { - "methods": [ + "UpdateTopic": { + "methods": [ "UpdateTopic" ] } @@ -74,53 +74,53 @@ } } }, - "SchemaService": { - "clients": { - "grpc": { - "libraryClient": "SchemaClient", - "rpcs": { - "CreateSchema": { - "methods": [ + "SchemaService": { + "clients": { + "grpc": { + "libraryClient": "SchemaClient", + "rpcs": { + "CreateSchema": { + "methods": [ "CreateSchema" ] }, - "DeleteSchema": { - "methods": [ + "DeleteSchema": { + "methods": [ "DeleteSchema" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetSchema": { - "methods": [ + "GetSchema": { + "methods": [ "GetSchema" ] }, - "ListSchemas": { - "methods": [ + "ListSchemas": { + "methods": [ "ListSchemas" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "ValidateMessage": { - "methods": [ + "ValidateMessage": { + "methods": [ "ValidateMessage" ] }, - "ValidateSchema": { - "methods": [ + "ValidateSchema": { + "methods": [ "ValidateSchema" ] } @@ -128,103 +128,103 @@ } } }, - "Subscriber": { - "clients": { - "grpc": { - "libraryClient": "SubscriberClient", - "rpcs": { - "Acknowledge": { - "methods": [ + "Subscriber": { + "clients": { + "grpc": { + "libraryClient": "SubscriberClient", + "rpcs": { + "Acknowledge": { + "methods": [ "Acknowledge" ] }, - "CreateSnapshot": { - "methods": [ + "CreateSnapshot": { + "methods": [ "CreateSnapshot" ] }, - "CreateSubscription": { - "methods": [ + "CreateSubscription": { + "methods": [ "CreateSubscription" ] }, - "DeleteSnapshot": { - "methods": [ + "DeleteSnapshot": { + "methods": [ "DeleteSnapshot" ] }, - "DeleteSubscription": { - "methods": [ + "DeleteSubscription": { + "methods": [ "DeleteSubscription" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetSnapshot": { - "methods": [ + "GetSnapshot": { + "methods": [ "GetSnapshot" ] }, - "GetSubscription": { - "methods": [ + "GetSubscription": { + "methods": [ "GetSubscription" ] }, - "ListSnapshots": { - "methods": [ + "ListSnapshots": { + "methods": [ "ListSnapshots" ] }, - "ListSubscriptions": { - "methods": [ + "ListSubscriptions": { + "methods": [ "ListSubscriptions" ] }, - "ModifyAckDeadline": { - "methods": [ + "ModifyAckDeadline": { + "methods": [ "ModifyAckDeadline" ] }, - "ModifyPushConfig": { - "methods": [ + "ModifyPushConfig": { + "methods": [ "ModifyPushConfig" ] }, - "Pull": { - "methods": [ + "Pull": { + "methods": [ "Pull" ] }, - "Seek": { - "methods": [ + "Seek": { + "methods": [ "Seek" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "StreamingPull": { - "methods": [ + "StreamingPull": { + "methods": [ "StreamingPull" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateSnapshot": { - "methods": [ + "UpdateSnapshot": { + "methods": [ "UpdateSnapshot" ] }, - "UpdateSubscription": { - "methods": [ + "UpdateSubscription": { + "methods": [ "UpdateSubscription" ] } diff --git a/pubsub/go.mod b/pubsub/go.mod index 3b84c79b4a7d..c9853a19eaef 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index abf3e80d5431..424a7ba55509 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -453,8 +453,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index facfd16cabce..24882873059d 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsublite/apiv1/gapic_metadata.json b/pubsublite/apiv1/gapic_metadata.json index 1714ec611faa..4d82bdaf696f 100644 --- a/pubsublite/apiv1/gapic_metadata.json +++ b/pubsublite/apiv1/gapic_metadata.json @@ -1,107 +1,107 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.pubsublite.v1", - "libraryPackage": "cloud.google.com/go/pubsublite/apiv1", - "services": { - "AdminService": { - "clients": { - "grpc": { - "libraryClient": "AdminClient", - "rpcs": { - "CreateReservation": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.pubsublite.v1", + "libraryPackage": "cloud.google.com/go/pubsublite/apiv1", + "services": { + "AdminService": { + "clients": { + "grpc": { + "libraryClient": "AdminClient", + "rpcs": { + "CreateReservation": { + "methods": [ "CreateReservation" ] }, - "CreateSubscription": { - "methods": [ + "CreateSubscription": { + "methods": [ "CreateSubscription" ] }, - "CreateTopic": { - "methods": [ + "CreateTopic": { + "methods": [ "CreateTopic" ] }, - "DeleteReservation": { - "methods": [ + "DeleteReservation": { + "methods": [ "DeleteReservation" ] }, - "DeleteSubscription": { - "methods": [ + "DeleteSubscription": { + "methods": [ "DeleteSubscription" ] }, - "DeleteTopic": { - "methods": [ + "DeleteTopic": { + "methods": [ "DeleteTopic" ] }, - "GetReservation": { - "methods": [ + "GetReservation": { + "methods": [ "GetReservation" ] }, - "GetSubscription": { - "methods": [ + "GetSubscription": { + "methods": [ "GetSubscription" ] }, - "GetTopic": { - "methods": [ + "GetTopic": { + "methods": [ "GetTopic" ] }, - "GetTopicPartitions": { - "methods": [ + "GetTopicPartitions": { + "methods": [ "GetTopicPartitions" ] }, - "ListReservationTopics": { - "methods": [ + "ListReservationTopics": { + "methods": [ "ListReservationTopics" ] }, - "ListReservations": { - "methods": [ + "ListReservations": { + "methods": [ "ListReservations" ] }, - "ListSubscriptions": { - "methods": [ + "ListSubscriptions": { + "methods": [ "ListSubscriptions" ] }, - "ListTopicSubscriptions": { - "methods": [ + "ListTopicSubscriptions": { + "methods": [ "ListTopicSubscriptions" ] }, - "ListTopics": { - "methods": [ + "ListTopics": { + "methods": [ "ListTopics" ] }, - "SeekSubscription": { - "methods": [ + "SeekSubscription": { + "methods": [ "SeekSubscription" ] }, - "UpdateReservation": { - "methods": [ + "UpdateReservation": { + "methods": [ "UpdateReservation" ] }, - "UpdateSubscription": { - "methods": [ + "UpdateSubscription": { + "methods": [ "UpdateSubscription" ] }, - "UpdateTopic": { - "methods": [ + "UpdateTopic": { + "methods": [ "UpdateTopic" ] } @@ -109,23 +109,23 @@ } } }, - "CursorService": { - "clients": { - "grpc": { - "libraryClient": "CursorClient", - "rpcs": { - "CommitCursor": { - "methods": [ + "CursorService": { + "clients": { + "grpc": { + "libraryClient": "CursorClient", + "rpcs": { + "CommitCursor": { + "methods": [ "CommitCursor" ] }, - "ListPartitionCursors": { - "methods": [ + "ListPartitionCursors": { + "methods": [ "ListPartitionCursors" ] }, - "StreamingCommitCursor": { - "methods": [ + "StreamingCommitCursor": { + "methods": [ "StreamingCommitCursor" ] } @@ -133,13 +133,13 @@ } } }, - "PartitionAssignmentService": { - "clients": { - "grpc": { - "libraryClient": "PartitionAssignmentClient", - "rpcs": { - "AssignPartitions": { - "methods": [ + "PartitionAssignmentService": { + "clients": { + "grpc": { + "libraryClient": "PartitionAssignmentClient", + "rpcs": { + "AssignPartitions": { + "methods": [ "AssignPartitions" ] } @@ -147,13 +147,13 @@ } } }, - "PublisherService": { - "clients": { - "grpc": { - "libraryClient": "PublisherClient", - "rpcs": { - "Publish": { - "methods": [ + "PublisherService": { + "clients": { + "grpc": { + "libraryClient": "PublisherClient", + "rpcs": { + "Publish": { + "methods": [ "Publish" ] } @@ -161,13 +161,13 @@ } } }, - "SubscriberService": { - "clients": { - "grpc": { - "libraryClient": "SubscriberClient", - "rpcs": { - "Subscribe": { - "methods": [ + "SubscriberService": { + "clients": { + "grpc": { + "libraryClient": "SubscriberClient", + "rpcs": { + "Subscribe": { + "methods": [ "Subscribe" ] } @@ -175,23 +175,23 @@ } } }, - "TopicStatsService": { - "clients": { - "grpc": { - "libraryClient": "TopicStatsClient", - "rpcs": { - "ComputeHeadCursor": { - "methods": [ + "TopicStatsService": { + "clients": { + "grpc": { + "libraryClient": "TopicStatsClient", + "rpcs": { + "ComputeHeadCursor": { + "methods": [ "ComputeHeadCursor" ] }, - "ComputeMessageStats": { - "methods": [ + "ComputeMessageStats": { + "methods": [ "ComputeMessageStats" ] }, - "ComputeTimeCursor": { - "methods": [ + "ComputeTimeCursor": { + "methods": [ "ComputeTimeCursor" ] } diff --git a/pubsublite/go.mod b/pubsublite/go.mod index 16fc15756cf0..6329bc5686a6 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index 9c7faf2ef99a..0e3eacfcd534 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -461,8 +461,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index f71d43aa545f..25f7abce78e0 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1/gapic_metadata.json b/recaptchaenterprise/apiv1/gapic_metadata.json index 0db6a363aa70..3b6837f105d4 100644 --- a/recaptchaenterprise/apiv1/gapic_metadata.json +++ b/recaptchaenterprise/apiv1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.recaptchaenterprise.v1", - "libraryPackage": "cloud.google.com/go/recaptchaenterprise/apiv1", - "services": { - "RecaptchaEnterpriseService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnnotateAssessment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.recaptchaenterprise.v1", + "libraryPackage": "cloud.google.com/go/recaptchaenterprise/apiv1", + "services": { + "RecaptchaEnterpriseService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnnotateAssessment": { + "methods": [ "AnnotateAssessment" ] }, - "CreateAssessment": { - "methods": [ + "CreateAssessment": { + "methods": [ "CreateAssessment" ] }, - "CreateKey": { - "methods": [ + "CreateKey": { + "methods": [ "CreateKey" ] }, - "DeleteKey": { - "methods": [ + "DeleteKey": { + "methods": [ "DeleteKey" ] }, - "GetKey": { - "methods": [ + "GetKey": { + "methods": [ "GetKey" ] }, - "ListKeys": { - "methods": [ + "ListKeys": { + "methods": [ "ListKeys" ] }, - "UpdateKey": { - "methods": [ + "UpdateKey": { + "methods": [ "UpdateKey" ] } diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index f4a33838174b..d0a1985401a4 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recaptchaenterprise/apiv1beta1/gapic_metadata.json b/recaptchaenterprise/apiv1beta1/gapic_metadata.json index 65354db9612c..18538c3a3a17 100644 --- a/recaptchaenterprise/apiv1beta1/gapic_metadata.json +++ b/recaptchaenterprise/apiv1beta1/gapic_metadata.json @@ -1,47 +1,47 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.recaptchaenterprise.v1beta1", - "libraryPackage": "cloud.google.com/go/recaptchaenterprise/apiv1beta1", - "services": { - "RecaptchaEnterpriseServiceV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "RecaptchaEnterpriseServiceV1Beta1Client", - "rpcs": { - "AnnotateAssessment": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.recaptchaenterprise.v1beta1", + "libraryPackage": "cloud.google.com/go/recaptchaenterprise/apiv1beta1", + "services": { + "RecaptchaEnterpriseServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "RecaptchaEnterpriseServiceV1Beta1Client", + "rpcs": { + "AnnotateAssessment": { + "methods": [ "AnnotateAssessment" ] }, - "CreateAssessment": { - "methods": [ + "CreateAssessment": { + "methods": [ "CreateAssessment" ] }, - "CreateKey": { - "methods": [ + "CreateKey": { + "methods": [ "CreateKey" ] }, - "DeleteKey": { - "methods": [ + "DeleteKey": { + "methods": [ "DeleteKey" ] }, - "GetKey": { - "methods": [ + "GetKey": { + "methods": [ "GetKey" ] }, - "ListKeys": { - "methods": [ + "ListKeys": { + "methods": [ "ListKeys" ] }, - "UpdateKey": { - "methods": [ + "UpdateKey": { + "methods": [ "UpdateKey" ] } diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go index f487bf7ac7c2..34e45a5412d4 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1/gapic_metadata.json b/recommender/apiv1/gapic_metadata.json index 3f5463513fa0..2a268577a488 100644 --- a/recommender/apiv1/gapic_metadata.json +++ b/recommender/apiv1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.recommender.v1", - "libraryPackage": "cloud.google.com/go/recommender/apiv1", - "services": { - "Recommender": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "GetInsight": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.recommender.v1", + "libraryPackage": "cloud.google.com/go/recommender/apiv1", + "services": { + "Recommender": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "GetInsight": { + "methods": [ "GetInsight" ] }, - "GetRecommendation": { - "methods": [ + "GetRecommendation": { + "methods": [ "GetRecommendation" ] }, - "ListInsights": { - "methods": [ + "ListInsights": { + "methods": [ "ListInsights" ] }, - "ListRecommendations": { - "methods": [ + "ListRecommendations": { + "methods": [ "ListRecommendations" ] }, - "MarkInsightAccepted": { - "methods": [ + "MarkInsightAccepted": { + "methods": [ "MarkInsightAccepted" ] }, - "MarkRecommendationClaimed": { - "methods": [ + "MarkRecommendationClaimed": { + "methods": [ "MarkRecommendationClaimed" ] }, - "MarkRecommendationFailed": { - "methods": [ + "MarkRecommendationFailed": { + "methods": [ "MarkRecommendationFailed" ] }, - "MarkRecommendationSucceeded": { - "methods": [ + "MarkRecommendationSucceeded": { + "methods": [ "MarkRecommendationSucceeded" ] } diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index 439ea9ae9420..e688e486a374 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/recommender/apiv1beta1/gapic_metadata.json b/recommender/apiv1beta1/gapic_metadata.json index b5feebfdba38..23bf63068e4d 100644 --- a/recommender/apiv1beta1/gapic_metadata.json +++ b/recommender/apiv1beta1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.recommender.v1beta1", - "libraryPackage": "cloud.google.com/go/recommender/apiv1beta1", - "services": { - "Recommender": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "GetInsight": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.recommender.v1beta1", + "libraryPackage": "cloud.google.com/go/recommender/apiv1beta1", + "services": { + "Recommender": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "GetInsight": { + "methods": [ "GetInsight" ] }, - "GetRecommendation": { - "methods": [ + "GetRecommendation": { + "methods": [ "GetRecommendation" ] }, - "ListInsights": { - "methods": [ + "ListInsights": { + "methods": [ "ListInsights" ] }, - "ListRecommendations": { - "methods": [ + "ListRecommendations": { + "methods": [ "ListRecommendations" ] }, - "MarkInsightAccepted": { - "methods": [ + "MarkInsightAccepted": { + "methods": [ "MarkInsightAccepted" ] }, - "MarkRecommendationClaimed": { - "methods": [ + "MarkRecommendationClaimed": { + "methods": [ "MarkRecommendationClaimed" ] }, - "MarkRecommendationFailed": { - "methods": [ + "MarkRecommendationFailed": { + "methods": [ "MarkRecommendationFailed" ] }, - "MarkRecommendationSucceeded": { - "methods": [ + "MarkRecommendationSucceeded": { + "methods": [ "MarkRecommendationSucceeded" ] } diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index 309eb9c97e9c..88c276f4a1c8 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1/gapic_metadata.json b/redis/apiv1/gapic_metadata.json index b50e74d5d198..3898343a3c48 100644 --- a/redis/apiv1/gapic_metadata.json +++ b/redis/apiv1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.redis.v1", - "libraryPackage": "cloud.google.com/go/redis/apiv1", - "services": { - "CloudRedis": { - "clients": { - "grpc": { - "libraryClient": "CloudRedisClient", - "rpcs": { - "CreateInstance": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.redis.v1", + "libraryPackage": "cloud.google.com/go/redis/apiv1", + "services": { + "CloudRedis": { + "clients": { + "grpc": { + "libraryClient": "CloudRedisClient", + "rpcs": { + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "ExportInstance": { - "methods": [ + "ExportInstance": { + "methods": [ "ExportInstance" ] }, - "FailoverInstance": { - "methods": [ + "FailoverInstance": { + "methods": [ "FailoverInstance" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "ImportInstance": { - "methods": [ + "ImportInstance": { + "methods": [ "ImportInstance" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "UpdateInstance": { - "methods": [ + "UpdateInstance": { + "methods": [ "UpdateInstance" ] }, - "UpgradeInstance": { - "methods": [ + "UpgradeInstance": { + "methods": [ "UpgradeInstance" ] } diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index c11875d34c1d..2db6db9eb5e6 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/redis/apiv1beta1/gapic_metadata.json b/redis/apiv1beta1/gapic_metadata.json index 928126e482aa..a7d95307cec0 100644 --- a/redis/apiv1beta1/gapic_metadata.json +++ b/redis/apiv1beta1/gapic_metadata.json @@ -1,57 +1,57 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.redis.v1beta1", - "libraryPackage": "cloud.google.com/go/redis/apiv1beta1", - "services": { - "CloudRedis": { - "clients": { - "grpc": { - "libraryClient": "CloudRedisClient", - "rpcs": { - "CreateInstance": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.redis.v1beta1", + "libraryPackage": "cloud.google.com/go/redis/apiv1beta1", + "services": { + "CloudRedis": { + "clients": { + "grpc": { + "libraryClient": "CloudRedisClient", + "rpcs": { + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "ExportInstance": { - "methods": [ + "ExportInstance": { + "methods": [ "ExportInstance" ] }, - "FailoverInstance": { - "methods": [ + "FailoverInstance": { + "methods": [ "FailoverInstance" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "ImportInstance": { - "methods": [ + "ImportInstance": { + "methods": [ "ImportInstance" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "UpdateInstance": { - "methods": [ + "UpdateInstance": { + "methods": [ "UpdateInstance" ] }, - "UpgradeInstance": { - "methods": [ + "UpgradeInstance": { + "methods": [ "UpgradeInstance" ] } diff --git a/resourcemanager/apiv2/doc.go b/resourcemanager/apiv2/doc.go index 323ca943a43f..64f94499fea2 100644 --- a/resourcemanager/apiv2/doc.go +++ b/resourcemanager/apiv2/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcemanager/apiv2/gapic_metadata.json b/resourcemanager/apiv2/gapic_metadata.json index f34cfab5b5a5..6f709286f1f4 100644 --- a/resourcemanager/apiv2/gapic_metadata.json +++ b/resourcemanager/apiv2/gapic_metadata.json @@ -1,67 +1,67 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.resourcemanager.v2", - "libraryPackage": "cloud.google.com/go/resourcemanager/apiv2", - "services": { - "Folders": { - "clients": { - "grpc": { - "libraryClient": "FoldersClient", - "rpcs": { - "CreateFolder": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.resourcemanager.v2", + "libraryPackage": "cloud.google.com/go/resourcemanager/apiv2", + "services": { + "Folders": { + "clients": { + "grpc": { + "libraryClient": "FoldersClient", + "rpcs": { + "CreateFolder": { + "methods": [ "CreateFolder" ] }, - "DeleteFolder": { - "methods": [ + "DeleteFolder": { + "methods": [ "DeleteFolder" ] }, - "GetFolder": { - "methods": [ + "GetFolder": { + "methods": [ "GetFolder" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListFolders": { - "methods": [ + "ListFolders": { + "methods": [ "ListFolders" ] }, - "MoveFolder": { - "methods": [ + "MoveFolder": { + "methods": [ "MoveFolder" ] }, - "SearchFolders": { - "methods": [ + "SearchFolders": { + "methods": [ "SearchFolders" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UndeleteFolder": { - "methods": [ + "UndeleteFolder": { + "methods": [ "UndeleteFolder" ] }, - "UpdateFolder": { - "methods": [ + "UpdateFolder": { + "methods": [ "UpdateFolder" ] } diff --git a/resourcesettings/apiv1/doc.go b/resourcesettings/apiv1/doc.go index 74794a8b9a5d..0a8ab6112d98 100644 --- a/resourcesettings/apiv1/doc.go +++ b/resourcesettings/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/resourcesettings/apiv1/gapic_metadata.json b/resourcesettings/apiv1/gapic_metadata.json index d31e8b223ff6..a07edb31e640 100644 --- a/resourcesettings/apiv1/gapic_metadata.json +++ b/resourcesettings/apiv1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.resourcesettings.v1", - "libraryPackage": "cloud.google.com/go/resourcesettings/apiv1", - "services": { - "ResourceSettingsService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "GetSetting": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.resourcesettings.v1", + "libraryPackage": "cloud.google.com/go/resourcesettings/apiv1", + "services": { + "ResourceSettingsService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "GetSetting": { + "methods": [ "GetSetting" ] }, - "ListSettings": { - "methods": [ + "ListSettings": { + "methods": [ "ListSettings" ] }, - "UpdateSetting": { - "methods": [ + "UpdateSetting": { + "methods": [ "UpdateSetting" ] } diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go index 06b272ce5b1b..e11dd65c9d19 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/retail/apiv2/gapic_metadata.json b/retail/apiv2/gapic_metadata.json index 7318b6367c26..946693b2fc64 100644 --- a/retail/apiv2/gapic_metadata.json +++ b/retail/apiv2/gapic_metadata.json @@ -1,22 +1,22 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.retail.v2", - "libraryPackage": "cloud.google.com/go/retail/apiv2", - "services": { - "CatalogService": { - "clients": { - "grpc": { - "libraryClient": "CatalogClient", - "rpcs": { - "ListCatalogs": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.retail.v2", + "libraryPackage": "cloud.google.com/go/retail/apiv2", + "services": { + "CatalogService": { + "clients": { + "grpc": { + "libraryClient": "CatalogClient", + "rpcs": { + "ListCatalogs": { + "methods": [ "ListCatalogs" ] }, - "UpdateCatalog": { - "methods": [ + "UpdateCatalog": { + "methods": [ "UpdateCatalog" ] } @@ -24,13 +24,13 @@ } } }, - "PredictionService": { - "clients": { - "grpc": { - "libraryClient": "PredictionClient", - "rpcs": { - "Predict": { - "methods": [ + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "PredictionClient", + "rpcs": { + "Predict": { + "methods": [ "Predict" ] } @@ -38,33 +38,33 @@ } } }, - "ProductService": { - "clients": { - "grpc": { - "libraryClient": "ProductClient", - "rpcs": { - "CreateProduct": { - "methods": [ + "ProductService": { + "clients": { + "grpc": { + "libraryClient": "ProductClient", + "rpcs": { + "CreateProduct": { + "methods": [ "CreateProduct" ] }, - "DeleteProduct": { - "methods": [ + "DeleteProduct": { + "methods": [ "DeleteProduct" ] }, - "GetProduct": { - "methods": [ + "GetProduct": { + "methods": [ "GetProduct" ] }, - "ImportProducts": { - "methods": [ + "ImportProducts": { + "methods": [ "ImportProducts" ] }, - "UpdateProduct": { - "methods": [ + "UpdateProduct": { + "methods": [ "UpdateProduct" ] } @@ -72,33 +72,33 @@ } } }, - "UserEventService": { - "clients": { - "grpc": { - "libraryClient": "UserEventClient", - "rpcs": { - "CollectUserEvent": { - "methods": [ + "UserEventService": { + "clients": { + "grpc": { + "libraryClient": "UserEventClient", + "rpcs": { + "CollectUserEvent": { + "methods": [ "CollectUserEvent" ] }, - "ImportUserEvents": { - "methods": [ + "ImportUserEvents": { + "methods": [ "ImportUserEvents" ] }, - "PurgeUserEvents": { - "methods": [ + "PurgeUserEvents": { + "methods": [ "PurgeUserEvents" ] }, - "RejoinUserEvents": { - "methods": [ + "RejoinUserEvents": { + "methods": [ "RejoinUserEvents" ] }, - "WriteUserEvent": { - "methods": [ + "WriteUserEvent": { + "methods": [ "WriteUserEvent" ] } diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index b4576410e7a8..2ee425905fe5 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1/gapic_metadata.json b/scheduler/apiv1/gapic_metadata.json index 406680902028..d0dd864d7eed 100644 --- a/scheduler/apiv1/gapic_metadata.json +++ b/scheduler/apiv1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.scheduler.v1", - "libraryPackage": "cloud.google.com/go/scheduler/apiv1", - "services": { - "CloudScheduler": { - "clients": { - "grpc": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "CreateJob": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.scheduler.v1", + "libraryPackage": "cloud.google.com/go/scheduler/apiv1", + "services": { + "CloudScheduler": { + "clients": { + "grpc": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "CreateJob": { + "methods": [ "CreateJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "PauseJob": { - "methods": [ + "PauseJob": { + "methods": [ "PauseJob" ] }, - "ResumeJob": { - "methods": [ + "ResumeJob": { + "methods": [ "ResumeJob" ] }, - "RunJob": { - "methods": [ + "RunJob": { + "methods": [ "RunJob" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index 6751ab7c0533..4814fa38d3af 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/scheduler/apiv1beta1/gapic_metadata.json b/scheduler/apiv1beta1/gapic_metadata.json index 7d4c4f943bec..0af02b964f97 100644 --- a/scheduler/apiv1beta1/gapic_metadata.json +++ b/scheduler/apiv1beta1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.scheduler.v1beta1", - "libraryPackage": "cloud.google.com/go/scheduler/apiv1beta1", - "services": { - "CloudScheduler": { - "clients": { - "grpc": { - "libraryClient": "CloudSchedulerClient", - "rpcs": { - "CreateJob": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.scheduler.v1beta1", + "libraryPackage": "cloud.google.com/go/scheduler/apiv1beta1", + "services": { + "CloudScheduler": { + "clients": { + "grpc": { + "libraryClient": "CloudSchedulerClient", + "rpcs": { + "CreateJob": { + "methods": [ "CreateJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "PauseJob": { - "methods": [ + "PauseJob": { + "methods": [ "PauseJob" ] }, - "ResumeJob": { - "methods": [ + "ResumeJob": { + "methods": [ "ResumeJob" ] }, - "RunJob": { - "methods": [ + "RunJob": { + "methods": [ "RunJob" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } diff --git a/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index 1c0eb0450b70..80bb5b816a7d 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1/gapic_metadata.json b/secretmanager/apiv1/gapic_metadata.json index 0b7c538e1fe7..a5049c72dadf 100644 --- a/secretmanager/apiv1/gapic_metadata.json +++ b/secretmanager/apiv1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.secretmanager.v1", - "libraryPackage": "cloud.google.com/go/secretmanager/apiv1", - "services": { - "SecretManagerService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AccessSecretVersion": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.secretmanager.v1", + "libraryPackage": "cloud.google.com/go/secretmanager/apiv1", + "services": { + "SecretManagerService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AccessSecretVersion": { + "methods": [ "AccessSecretVersion" ] }, - "AddSecretVersion": { - "methods": [ + "AddSecretVersion": { + "methods": [ "AddSecretVersion" ] }, - "CreateSecret": { - "methods": [ + "CreateSecret": { + "methods": [ "CreateSecret" ] }, - "DeleteSecret": { - "methods": [ + "DeleteSecret": { + "methods": [ "DeleteSecret" ] }, - "DestroySecretVersion": { - "methods": [ + "DestroySecretVersion": { + "methods": [ "DestroySecretVersion" ] }, - "DisableSecretVersion": { - "methods": [ + "DisableSecretVersion": { + "methods": [ "DisableSecretVersion" ] }, - "EnableSecretVersion": { - "methods": [ + "EnableSecretVersion": { + "methods": [ "EnableSecretVersion" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetSecret": { - "methods": [ + "GetSecret": { + "methods": [ "GetSecret" ] }, - "GetSecretVersion": { - "methods": [ + "GetSecretVersion": { + "methods": [ "GetSecretVersion" ] }, - "ListSecretVersions": { - "methods": [ + "ListSecretVersions": { + "methods": [ "ListSecretVersions" ] }, - "ListSecrets": { - "methods": [ + "ListSecrets": { + "methods": [ "ListSecrets" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateSecret": { - "methods": [ + "UpdateSecret": { + "methods": [ "UpdateSecret" ] } diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go index 14e5b7cefdf9..b0a58a1ed992 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/secretmanager/apiv1beta1/gapic_metadata.json b/secretmanager/apiv1beta1/gapic_metadata.json index 0b85afa83a47..31f38b730d9a 100644 --- a/secretmanager/apiv1beta1/gapic_metadata.json +++ b/secretmanager/apiv1beta1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.secrets.v1beta1", - "libraryPackage": "cloud.google.com/go/secretmanager/apiv1beta1", - "services": { - "SecretManagerService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AccessSecretVersion": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.secrets.v1beta1", + "libraryPackage": "cloud.google.com/go/secretmanager/apiv1beta1", + "services": { + "SecretManagerService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AccessSecretVersion": { + "methods": [ "AccessSecretVersion" ] }, - "AddSecretVersion": { - "methods": [ + "AddSecretVersion": { + "methods": [ "AddSecretVersion" ] }, - "CreateSecret": { - "methods": [ + "CreateSecret": { + "methods": [ "CreateSecret" ] }, - "DeleteSecret": { - "methods": [ + "DeleteSecret": { + "methods": [ "DeleteSecret" ] }, - "DestroySecretVersion": { - "methods": [ + "DestroySecretVersion": { + "methods": [ "DestroySecretVersion" ] }, - "DisableSecretVersion": { - "methods": [ + "DisableSecretVersion": { + "methods": [ "DisableSecretVersion" ] }, - "EnableSecretVersion": { - "methods": [ + "EnableSecretVersion": { + "methods": [ "EnableSecretVersion" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetSecret": { - "methods": [ + "GetSecret": { + "methods": [ "GetSecret" ] }, - "GetSecretVersion": { - "methods": [ + "GetSecretVersion": { + "methods": [ "GetSecretVersion" ] }, - "ListSecretVersions": { - "methods": [ + "ListSecretVersions": { + "methods": [ "ListSecretVersions" ] }, - "ListSecrets": { - "methods": [ + "ListSecrets": { + "methods": [ "ListSecrets" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateSecret": { - "methods": [ + "UpdateSecret": { + "methods": [ "UpdateSecret" ] } diff --git a/security/privateca/apiv1/doc.go b/security/privateca/apiv1/doc.go index b905a6daf0fc..4b0d63a0d111 100644 --- a/security/privateca/apiv1/doc.go +++ b/security/privateca/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1/gapic_metadata.json b/security/privateca/apiv1/gapic_metadata.json index 8f5e39723a8a..c979b6d151bc 100644 --- a/security/privateca/apiv1/gapic_metadata.json +++ b/security/privateca/apiv1/gapic_metadata.json @@ -1,157 +1,157 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.security.privateca.v1", - "libraryPackage": "cloud.google.com/go/security/privateca/apiv1", - "services": { - "CertificateAuthorityService": { - "clients": { - "grpc": { - "libraryClient": "CertificateAuthorityClient", - "rpcs": { - "ActivateCertificateAuthority": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.security.privateca.v1", + "libraryPackage": "cloud.google.com/go/security/privateca/apiv1", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ "ActivateCertificateAuthority" ] }, - "CreateCaPool": { - "methods": [ + "CreateCaPool": { + "methods": [ "CreateCaPool" ] }, - "CreateCertificate": { - "methods": [ + "CreateCertificate": { + "methods": [ "CreateCertificate" ] }, - "CreateCertificateAuthority": { - "methods": [ + "CreateCertificateAuthority": { + "methods": [ "CreateCertificateAuthority" ] }, - "CreateCertificateTemplate": { - "methods": [ + "CreateCertificateTemplate": { + "methods": [ "CreateCertificateTemplate" ] }, - "DeleteCaPool": { - "methods": [ + "DeleteCaPool": { + "methods": [ "DeleteCaPool" ] }, - "DeleteCertificateAuthority": { - "methods": [ + "DeleteCertificateAuthority": { + "methods": [ "DeleteCertificateAuthority" ] }, - "DeleteCertificateTemplate": { - "methods": [ + "DeleteCertificateTemplate": { + "methods": [ "DeleteCertificateTemplate" ] }, - "DisableCertificateAuthority": { - "methods": [ + "DisableCertificateAuthority": { + "methods": [ "DisableCertificateAuthority" ] }, - "EnableCertificateAuthority": { - "methods": [ + "EnableCertificateAuthority": { + "methods": [ "EnableCertificateAuthority" ] }, - "FetchCaCerts": { - "methods": [ + "FetchCaCerts": { + "methods": [ "FetchCaCerts" ] }, - "FetchCertificateAuthorityCsr": { - "methods": [ + "FetchCertificateAuthorityCsr": { + "methods": [ "FetchCertificateAuthorityCsr" ] }, - "GetCaPool": { - "methods": [ + "GetCaPool": { + "methods": [ "GetCaPool" ] }, - "GetCertificate": { - "methods": [ + "GetCertificate": { + "methods": [ "GetCertificate" ] }, - "GetCertificateAuthority": { - "methods": [ + "GetCertificateAuthority": { + "methods": [ "GetCertificateAuthority" ] }, - "GetCertificateRevocationList": { - "methods": [ + "GetCertificateRevocationList": { + "methods": [ "GetCertificateRevocationList" ] }, - "GetCertificateTemplate": { - "methods": [ + "GetCertificateTemplate": { + "methods": [ "GetCertificateTemplate" ] }, - "ListCaPools": { - "methods": [ + "ListCaPools": { + "methods": [ "ListCaPools" ] }, - "ListCertificateAuthorities": { - "methods": [ + "ListCertificateAuthorities": { + "methods": [ "ListCertificateAuthorities" ] }, - "ListCertificateRevocationLists": { - "methods": [ + "ListCertificateRevocationLists": { + "methods": [ "ListCertificateRevocationLists" ] }, - "ListCertificateTemplates": { - "methods": [ + "ListCertificateTemplates": { + "methods": [ "ListCertificateTemplates" ] }, - "ListCertificates": { - "methods": [ + "ListCertificates": { + "methods": [ "ListCertificates" ] }, - "RevokeCertificate": { - "methods": [ + "RevokeCertificate": { + "methods": [ "RevokeCertificate" ] }, - "UndeleteCertificateAuthority": { - "methods": [ + "UndeleteCertificateAuthority": { + "methods": [ "UndeleteCertificateAuthority" ] }, - "UpdateCaPool": { - "methods": [ + "UpdateCaPool": { + "methods": [ "UpdateCaPool" ] }, - "UpdateCertificate": { - "methods": [ + "UpdateCertificate": { + "methods": [ "UpdateCertificate" ] }, - "UpdateCertificateAuthority": { - "methods": [ + "UpdateCertificateAuthority": { + "methods": [ "UpdateCertificateAuthority" ] }, - "UpdateCertificateRevocationList": { - "methods": [ + "UpdateCertificateRevocationList": { + "methods": [ "UpdateCertificateRevocationList" ] }, - "UpdateCertificateTemplate": { - "methods": [ + "UpdateCertificateTemplate": { + "methods": [ "UpdateCertificateTemplate" ] } diff --git a/security/privateca/apiv1beta1/doc.go b/security/privateca/apiv1beta1/doc.go index 008aaa9c967a..469b3288171c 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/security/privateca/apiv1beta1/gapic_metadata.json b/security/privateca/apiv1beta1/gapic_metadata.json index 3ea3f6113ae1..d6c24e8707a5 100644 --- a/security/privateca/apiv1beta1/gapic_metadata.json +++ b/security/privateca/apiv1beta1/gapic_metadata.json @@ -1,112 +1,112 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.security.privateca.v1beta1", - "libraryPackage": "cloud.google.com/go/security/privateca/apiv1beta1", - "services": { - "CertificateAuthorityService": { - "clients": { - "grpc": { - "libraryClient": "CertificateAuthorityClient", - "rpcs": { - "ActivateCertificateAuthority": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.security.privateca.v1beta1", + "libraryPackage": "cloud.google.com/go/security/privateca/apiv1beta1", + "services": { + "CertificateAuthorityService": { + "clients": { + "grpc": { + "libraryClient": "CertificateAuthorityClient", + "rpcs": { + "ActivateCertificateAuthority": { + "methods": [ "ActivateCertificateAuthority" ] }, - "CreateCertificate": { - "methods": [ + "CreateCertificate": { + "methods": [ "CreateCertificate" ] }, - "CreateCertificateAuthority": { - "methods": [ + "CreateCertificateAuthority": { + "methods": [ "CreateCertificateAuthority" ] }, - "DisableCertificateAuthority": { - "methods": [ + "DisableCertificateAuthority": { + "methods": [ "DisableCertificateAuthority" ] }, - "EnableCertificateAuthority": { - "methods": [ + "EnableCertificateAuthority": { + "methods": [ "EnableCertificateAuthority" ] }, - "FetchCertificateAuthorityCsr": { - "methods": [ + "FetchCertificateAuthorityCsr": { + "methods": [ "FetchCertificateAuthorityCsr" ] }, - "GetCertificate": { - "methods": [ + "GetCertificate": { + "methods": [ "GetCertificate" ] }, - "GetCertificateAuthority": { - "methods": [ + "GetCertificateAuthority": { + "methods": [ "GetCertificateAuthority" ] }, - "GetCertificateRevocationList": { - "methods": [ + "GetCertificateRevocationList": { + "methods": [ "GetCertificateRevocationList" ] }, - "GetReusableConfig": { - "methods": [ + "GetReusableConfig": { + "methods": [ "GetReusableConfig" ] }, - "ListCertificateAuthorities": { - "methods": [ + "ListCertificateAuthorities": { + "methods": [ "ListCertificateAuthorities" ] }, - "ListCertificateRevocationLists": { - "methods": [ + "ListCertificateRevocationLists": { + "methods": [ "ListCertificateRevocationLists" ] }, - "ListCertificates": { - "methods": [ + "ListCertificates": { + "methods": [ "ListCertificates" ] }, - "ListReusableConfigs": { - "methods": [ + "ListReusableConfigs": { + "methods": [ "ListReusableConfigs" ] }, - "RestoreCertificateAuthority": { - "methods": [ + "RestoreCertificateAuthority": { + "methods": [ "RestoreCertificateAuthority" ] }, - "RevokeCertificate": { - "methods": [ + "RevokeCertificate": { + "methods": [ "RevokeCertificate" ] }, - "ScheduleDeleteCertificateAuthority": { - "methods": [ + "ScheduleDeleteCertificateAuthority": { + "methods": [ "ScheduleDeleteCertificateAuthority" ] }, - "UpdateCertificate": { - "methods": [ + "UpdateCertificate": { + "methods": [ "UpdateCertificate" ] }, - "UpdateCertificateAuthority": { - "methods": [ + "UpdateCertificateAuthority": { + "methods": [ "UpdateCertificateAuthority" ] }, - "UpdateCertificateRevocationList": { - "methods": [ + "UpdateCertificateRevocationList": { + "methods": [ "UpdateCertificateRevocationList" ] } diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index bcd3fc0248be..5a1c5e3d4bfe 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/gapic_metadata.json b/securitycenter/apiv1/gapic_metadata.json index ce8878f4e078..9c8c2592c226 100644 --- a/securitycenter/apiv1/gapic_metadata.json +++ b/securitycenter/apiv1/gapic_metadata.json @@ -1,127 +1,127 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.securitycenter.v1", - "libraryPackage": "cloud.google.com/go/securitycenter/apiv1", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateFinding": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.securitycenter.v1", + "libraryPackage": "cloud.google.com/go/securitycenter/apiv1", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateFinding": { + "methods": [ "CreateFinding" ] }, - "CreateNotificationConfig": { - "methods": [ + "CreateNotificationConfig": { + "methods": [ "CreateNotificationConfig" ] }, - "CreateSource": { - "methods": [ + "CreateSource": { + "methods": [ "CreateSource" ] }, - "DeleteNotificationConfig": { - "methods": [ + "DeleteNotificationConfig": { + "methods": [ "DeleteNotificationConfig" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetNotificationConfig": { - "methods": [ + "GetNotificationConfig": { + "methods": [ "GetNotificationConfig" ] }, - "GetOrganizationSettings": { - "methods": [ + "GetOrganizationSettings": { + "methods": [ "GetOrganizationSettings" ] }, - "GetSource": { - "methods": [ + "GetSource": { + "methods": [ "GetSource" ] }, - "GroupAssets": { - "methods": [ + "GroupAssets": { + "methods": [ "GroupAssets" ] }, - "GroupFindings": { - "methods": [ + "GroupFindings": { + "methods": [ "GroupFindings" ] }, - "ListAssets": { - "methods": [ + "ListAssets": { + "methods": [ "ListAssets" ] }, - "ListFindings": { - "methods": [ + "ListFindings": { + "methods": [ "ListFindings" ] }, - "ListNotificationConfigs": { - "methods": [ + "ListNotificationConfigs": { + "methods": [ "ListNotificationConfigs" ] }, - "ListSources": { - "methods": [ + "ListSources": { + "methods": [ "ListSources" ] }, - "RunAssetDiscovery": { - "methods": [ + "RunAssetDiscovery": { + "methods": [ "RunAssetDiscovery" ] }, - "SetFindingState": { - "methods": [ + "SetFindingState": { + "methods": [ "SetFindingState" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateFinding": { - "methods": [ + "UpdateFinding": { + "methods": [ "UpdateFinding" ] }, - "UpdateNotificationConfig": { - "methods": [ + "UpdateNotificationConfig": { + "methods": [ "UpdateNotificationConfig" ] }, - "UpdateOrganizationSettings": { - "methods": [ + "UpdateOrganizationSettings": { + "methods": [ "UpdateOrganizationSettings" ] }, - "UpdateSecurityMarks": { - "methods": [ + "UpdateSecurityMarks": { + "methods": [ "UpdateSecurityMarks" ] }, - "UpdateSource": { - "methods": [ + "UpdateSource": { + "methods": [ "UpdateSource" ] } diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index 63d23ba9a0a6..2d9d312d1993 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1beta1/gapic_metadata.json b/securitycenter/apiv1beta1/gapic_metadata.json index c5c1ac806361..0bafa06cf3c9 100644 --- a/securitycenter/apiv1beta1/gapic_metadata.json +++ b/securitycenter/apiv1beta1/gapic_metadata.json @@ -1,102 +1,102 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.securitycenter.v1beta1", - "libraryPackage": "cloud.google.com/go/securitycenter/apiv1beta1", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateFinding": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.securitycenter.v1beta1", + "libraryPackage": "cloud.google.com/go/securitycenter/apiv1beta1", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateFinding": { + "methods": [ "CreateFinding" ] }, - "CreateSource": { - "methods": [ + "CreateSource": { + "methods": [ "CreateSource" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetOrganizationSettings": { - "methods": [ + "GetOrganizationSettings": { + "methods": [ "GetOrganizationSettings" ] }, - "GetSource": { - "methods": [ + "GetSource": { + "methods": [ "GetSource" ] }, - "GroupAssets": { - "methods": [ + "GroupAssets": { + "methods": [ "GroupAssets" ] }, - "GroupFindings": { - "methods": [ + "GroupFindings": { + "methods": [ "GroupFindings" ] }, - "ListAssets": { - "methods": [ + "ListAssets": { + "methods": [ "ListAssets" ] }, - "ListFindings": { - "methods": [ + "ListFindings": { + "methods": [ "ListFindings" ] }, - "ListSources": { - "methods": [ + "ListSources": { + "methods": [ "ListSources" ] }, - "RunAssetDiscovery": { - "methods": [ + "RunAssetDiscovery": { + "methods": [ "RunAssetDiscovery" ] }, - "SetFindingState": { - "methods": [ + "SetFindingState": { + "methods": [ "SetFindingState" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateFinding": { - "methods": [ + "UpdateFinding": { + "methods": [ "UpdateFinding" ] }, - "UpdateOrganizationSettings": { - "methods": [ + "UpdateOrganizationSettings": { + "methods": [ "UpdateOrganizationSettings" ] }, - "UpdateSecurityMarks": { - "methods": [ + "UpdateSecurityMarks": { + "methods": [ "UpdateSecurityMarks" ] }, - "UpdateSource": { - "methods": [ + "UpdateSource": { + "methods": [ "UpdateSource" ] } diff --git a/securitycenter/apiv1p1beta1/doc.go b/securitycenter/apiv1p1beta1/doc.go index f49364ff423b..e84de24b5747 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1p1beta1/gapic_metadata.json b/securitycenter/apiv1p1beta1/gapic_metadata.json index bf1f551d0aeb..57386d58d3e2 100644 --- a/securitycenter/apiv1p1beta1/gapic_metadata.json +++ b/securitycenter/apiv1p1beta1/gapic_metadata.json @@ -1,127 +1,127 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.securitycenter.v1p1beta1", - "libraryPackage": "cloud.google.com/go/securitycenter/apiv1p1beta1", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateFinding": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.securitycenter.v1p1beta1", + "libraryPackage": "cloud.google.com/go/securitycenter/apiv1p1beta1", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateFinding": { + "methods": [ "CreateFinding" ] }, - "CreateNotificationConfig": { - "methods": [ + "CreateNotificationConfig": { + "methods": [ "CreateNotificationConfig" ] }, - "CreateSource": { - "methods": [ + "CreateSource": { + "methods": [ "CreateSource" ] }, - "DeleteNotificationConfig": { - "methods": [ + "DeleteNotificationConfig": { + "methods": [ "DeleteNotificationConfig" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetNotificationConfig": { - "methods": [ + "GetNotificationConfig": { + "methods": [ "GetNotificationConfig" ] }, - "GetOrganizationSettings": { - "methods": [ + "GetOrganizationSettings": { + "methods": [ "GetOrganizationSettings" ] }, - "GetSource": { - "methods": [ + "GetSource": { + "methods": [ "GetSource" ] }, - "GroupAssets": { - "methods": [ + "GroupAssets": { + "methods": [ "GroupAssets" ] }, - "GroupFindings": { - "methods": [ + "GroupFindings": { + "methods": [ "GroupFindings" ] }, - "ListAssets": { - "methods": [ + "ListAssets": { + "methods": [ "ListAssets" ] }, - "ListFindings": { - "methods": [ + "ListFindings": { + "methods": [ "ListFindings" ] }, - "ListNotificationConfigs": { - "methods": [ + "ListNotificationConfigs": { + "methods": [ "ListNotificationConfigs" ] }, - "ListSources": { - "methods": [ + "ListSources": { + "methods": [ "ListSources" ] }, - "RunAssetDiscovery": { - "methods": [ + "RunAssetDiscovery": { + "methods": [ "RunAssetDiscovery" ] }, - "SetFindingState": { - "methods": [ + "SetFindingState": { + "methods": [ "SetFindingState" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateFinding": { - "methods": [ + "UpdateFinding": { + "methods": [ "UpdateFinding" ] }, - "UpdateNotificationConfig": { - "methods": [ + "UpdateNotificationConfig": { + "methods": [ "UpdateNotificationConfig" ] }, - "UpdateOrganizationSettings": { - "methods": [ + "UpdateOrganizationSettings": { + "methods": [ "UpdateOrganizationSettings" ] }, - "UpdateSecurityMarks": { - "methods": [ + "UpdateSecurityMarks": { + "methods": [ "UpdateSecurityMarks" ] }, - "UpdateSource": { - "methods": [ + "UpdateSource": { + "methods": [ "UpdateSource" ] } diff --git a/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index 9043c6fdb9d2..dc35f507e48a 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/settings/apiv1beta1/gapic_metadata.json b/securitycenter/settings/apiv1beta1/gapic_metadata.json index 8cc28a604b19..ef3a6db6dc74 100644 --- a/securitycenter/settings/apiv1beta1/gapic_metadata.json +++ b/securitycenter/settings/apiv1beta1/gapic_metadata.json @@ -1,77 +1,77 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.securitycenter.settings.v1beta1", - "libraryPackage": "cloud.google.com/go/securitycenter/settings/apiv1beta1", - "services": { - "SecurityCenterSettingsService": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterSettingsClient", - "rpcs": { - "BatchCalculateEffectiveSettings": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.securitycenter.settings.v1beta1", + "libraryPackage": "cloud.google.com/go/securitycenter/settings/apiv1beta1", + "services": { + "SecurityCenterSettingsService": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterSettingsClient", + "rpcs": { + "BatchCalculateEffectiveSettings": { + "methods": [ "BatchCalculateEffectiveSettings" ] }, - "BatchGetSettings": { - "methods": [ + "BatchGetSettings": { + "methods": [ "BatchGetSettings" ] }, - "CalculateEffectiveComponentSettings": { - "methods": [ + "CalculateEffectiveComponentSettings": { + "methods": [ "CalculateEffectiveComponentSettings" ] }, - "CalculateEffectiveSettings": { - "methods": [ + "CalculateEffectiveSettings": { + "methods": [ "CalculateEffectiveSettings" ] }, - "GetComponentSettings": { - "methods": [ + "GetComponentSettings": { + "methods": [ "GetComponentSettings" ] }, - "GetServiceAccount": { - "methods": [ + "GetServiceAccount": { + "methods": [ "GetServiceAccount" ] }, - "GetSettings": { - "methods": [ + "GetSettings": { + "methods": [ "GetSettings" ] }, - "ListComponents": { - "methods": [ + "ListComponents": { + "methods": [ "ListComponents" ] }, - "ListDetectors": { - "methods": [ + "ListDetectors": { + "methods": [ "ListDetectors" ] }, - "ResetComponentSettings": { - "methods": [ + "ResetComponentSettings": { + "methods": [ "ResetComponentSettings" ] }, - "ResetSettings": { - "methods": [ + "ResetSettings": { + "methods": [ "ResetSettings" ] }, - "UpdateComponentSettings": { - "methods": [ + "UpdateComponentSettings": { + "methods": [ "UpdateComponentSettings" ] }, - "UpdateSettings": { - "methods": [ + "UpdateSettings": { + "methods": [ "UpdateSettings" ] } diff --git a/servicecontrol/apiv1/doc.go b/servicecontrol/apiv1/doc.go index 790142cb65ae..5995fa3623c3 100644 --- a/servicecontrol/apiv1/doc.go +++ b/servicecontrol/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicecontrol/apiv1/gapic_metadata.json b/servicecontrol/apiv1/gapic_metadata.json index 6e2938974f1f..6ae772250050 100644 --- a/servicecontrol/apiv1/gapic_metadata.json +++ b/servicecontrol/apiv1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.api.servicecontrol.v1", - "libraryPackage": "cloud.google.com/go/servicecontrol/apiv1", - "services": { - "QuotaController": { - "clients": { - "grpc": { - "libraryClient": "QuotaControllerClient", - "rpcs": { - "AllocateQuota": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.api.servicecontrol.v1", + "libraryPackage": "cloud.google.com/go/servicecontrol/apiv1", + "services": { + "QuotaController": { + "clients": { + "grpc": { + "libraryClient": "QuotaControllerClient", + "rpcs": { + "AllocateQuota": { + "methods": [ "AllocateQuota" ] } @@ -19,18 +19,18 @@ } } }, - "ServiceController": { - "clients": { - "grpc": { - "libraryClient": "ServiceControllerClient", - "rpcs": { - "Check": { - "methods": [ + "ServiceController": { + "clients": { + "grpc": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": [ "Check" ] }, - "Report": { - "methods": [ + "Report": { + "methods": [ "Report" ] } diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go index 991a0be48e2a..2f164c581b00 100644 --- a/servicedirectory/apiv1/doc.go +++ b/servicedirectory/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1/gapic_metadata.json b/servicedirectory/apiv1/gapic_metadata.json index a3b82c3fc738..0cfd6fd3345d 100644 --- a/servicedirectory/apiv1/gapic_metadata.json +++ b/servicedirectory/apiv1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.servicedirectory.v1", - "libraryPackage": "cloud.google.com/go/servicedirectory/apiv1", - "services": { - "LookupService": { - "clients": { - "grpc": { - "libraryClient": "LookupClient", - "rpcs": { - "ResolveService": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.servicedirectory.v1", + "libraryPackage": "cloud.google.com/go/servicedirectory/apiv1", + "services": { + "LookupService": { + "clients": { + "grpc": { + "libraryClient": "LookupClient", + "rpcs": { + "ResolveService": { + "methods": [ "ResolveService" ] } @@ -19,98 +19,98 @@ } } }, - "RegistrationService": { - "clients": { - "grpc": { - "libraryClient": "RegistrationClient", - "rpcs": { - "CreateEndpoint": { - "methods": [ + "RegistrationService": { + "clients": { + "grpc": { + "libraryClient": "RegistrationClient", + "rpcs": { + "CreateEndpoint": { + "methods": [ "CreateEndpoint" ] }, - "CreateNamespace": { - "methods": [ + "CreateNamespace": { + "methods": [ "CreateNamespace" ] }, - "CreateService": { - "methods": [ + "CreateService": { + "methods": [ "CreateService" ] }, - "DeleteEndpoint": { - "methods": [ + "DeleteEndpoint": { + "methods": [ "DeleteEndpoint" ] }, - "DeleteNamespace": { - "methods": [ + "DeleteNamespace": { + "methods": [ "DeleteNamespace" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "GetEndpoint": { - "methods": [ + "GetEndpoint": { + "methods": [ "GetEndpoint" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetNamespace": { - "methods": [ + "GetNamespace": { + "methods": [ "GetNamespace" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListEndpoints": { - "methods": [ + "ListEndpoints": { + "methods": [ "ListEndpoints" ] }, - "ListNamespaces": { - "methods": [ + "ListNamespaces": { + "methods": [ "ListNamespaces" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateEndpoint": { - "methods": [ + "UpdateEndpoint": { + "methods": [ "UpdateEndpoint" ] }, - "UpdateNamespace": { - "methods": [ + "UpdateNamespace": { + "methods": [ "UpdateNamespace" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } diff --git a/servicedirectory/apiv1beta1/doc.go b/servicedirectory/apiv1beta1/doc.go index b63b25ff36d2..fa7b8e51b9f5 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicedirectory/apiv1beta1/gapic_metadata.json b/servicedirectory/apiv1beta1/gapic_metadata.json index da14be6c39b1..13f4d2fec391 100644 --- a/servicedirectory/apiv1beta1/gapic_metadata.json +++ b/servicedirectory/apiv1beta1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.servicedirectory.v1beta1", - "libraryPackage": "cloud.google.com/go/servicedirectory/apiv1beta1", - "services": { - "LookupService": { - "clients": { - "grpc": { - "libraryClient": "LookupClient", - "rpcs": { - "ResolveService": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.servicedirectory.v1beta1", + "libraryPackage": "cloud.google.com/go/servicedirectory/apiv1beta1", + "services": { + "LookupService": { + "clients": { + "grpc": { + "libraryClient": "LookupClient", + "rpcs": { + "ResolveService": { + "methods": [ "ResolveService" ] } @@ -19,98 +19,98 @@ } } }, - "RegistrationService": { - "clients": { - "grpc": { - "libraryClient": "RegistrationClient", - "rpcs": { - "CreateEndpoint": { - "methods": [ + "RegistrationService": { + "clients": { + "grpc": { + "libraryClient": "RegistrationClient", + "rpcs": { + "CreateEndpoint": { + "methods": [ "CreateEndpoint" ] }, - "CreateNamespace": { - "methods": [ + "CreateNamespace": { + "methods": [ "CreateNamespace" ] }, - "CreateService": { - "methods": [ + "CreateService": { + "methods": [ "CreateService" ] }, - "DeleteEndpoint": { - "methods": [ + "DeleteEndpoint": { + "methods": [ "DeleteEndpoint" ] }, - "DeleteNamespace": { - "methods": [ + "DeleteNamespace": { + "methods": [ "DeleteNamespace" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "GetEndpoint": { - "methods": [ + "GetEndpoint": { + "methods": [ "GetEndpoint" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetNamespace": { - "methods": [ + "GetNamespace": { + "methods": [ "GetNamespace" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListEndpoints": { - "methods": [ + "ListEndpoints": { + "methods": [ "ListEndpoints" ] }, - "ListNamespaces": { - "methods": [ + "ListNamespaces": { + "methods": [ "ListNamespaces" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateEndpoint": { - "methods": [ + "UpdateEndpoint": { + "methods": [ "UpdateEndpoint" ] }, - "UpdateNamespace": { - "methods": [ + "UpdateNamespace": { + "methods": [ "UpdateNamespace" ] }, - "UpdateService": { - "methods": [ + "UpdateService": { + "methods": [ "UpdateService" ] } diff --git a/servicemanagement/apiv1/doc.go b/servicemanagement/apiv1/doc.go index a9a150052eb5..7b126a8d0d40 100644 --- a/servicemanagement/apiv1/doc.go +++ b/servicemanagement/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/servicemanagement/apiv1/gapic_metadata.json b/servicemanagement/apiv1/gapic_metadata.json index d494f0192d08..76ab2fcdbc3f 100644 --- a/servicemanagement/apiv1/gapic_metadata.json +++ b/servicemanagement/apiv1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.api.servicemanagement.v1", - "libraryPackage": "cloud.google.com/go/servicemanagement/apiv1", - "services": { - "ServiceManager": { - "clients": { - "grpc": { - "libraryClient": "ServiceManagerClient", - "rpcs": { - "CreateService": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.api.servicemanagement.v1", + "libraryPackage": "cloud.google.com/go/servicemanagement/apiv1", + "services": { + "ServiceManager": { + "clients": { + "grpc": { + "libraryClient": "ServiceManagerClient", + "rpcs": { + "CreateService": { + "methods": [ "CreateService" ] }, - "CreateServiceConfig": { - "methods": [ + "CreateServiceConfig": { + "methods": [ "CreateServiceConfig" ] }, - "CreateServiceRollout": { - "methods": [ + "CreateServiceRollout": { + "methods": [ "CreateServiceRollout" ] }, - "DeleteService": { - "methods": [ + "DeleteService": { + "methods": [ "DeleteService" ] }, - "DisableService": { - "methods": [ + "DisableService": { + "methods": [ "DisableService" ] }, - "EnableService": { - "methods": [ + "EnableService": { + "methods": [ "EnableService" ] }, - "GenerateConfigReport": { - "methods": [ + "GenerateConfigReport": { + "methods": [ "GenerateConfigReport" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "GetServiceConfig": { - "methods": [ + "GetServiceConfig": { + "methods": [ "GetServiceConfig" ] }, - "GetServiceRollout": { - "methods": [ + "GetServiceRollout": { + "methods": [ "GetServiceRollout" ] }, - "ListServiceConfigs": { - "methods": [ + "ListServiceConfigs": { + "methods": [ "ListServiceConfigs" ] }, - "ListServiceRollouts": { - "methods": [ + "ListServiceRollouts": { + "methods": [ "ListServiceRollouts" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] }, - "SubmitConfigSource": { - "methods": [ + "SubmitConfigSource": { + "methods": [ "SubmitConfigSource" ] }, - "UndeleteService": { - "methods": [ + "UndeleteService": { + "methods": [ "UndeleteService" ] } diff --git a/serviceusage/apiv1/doc.go b/serviceusage/apiv1/doc.go index e3e2054b1f73..85c71b37b559 100644 --- a/serviceusage/apiv1/doc.go +++ b/serviceusage/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/serviceusage/apiv1/gapic_metadata.json b/serviceusage/apiv1/gapic_metadata.json index 5df488bbece9..9c9213fb2f51 100644 --- a/serviceusage/apiv1/gapic_metadata.json +++ b/serviceusage/apiv1/gapic_metadata.json @@ -1,42 +1,42 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.api.serviceusage.v1", - "libraryPackage": "cloud.google.com/go/serviceusage/apiv1", - "services": { - "ServiceUsage": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "BatchEnableServices": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.api.serviceusage.v1", + "libraryPackage": "cloud.google.com/go/serviceusage/apiv1", + "services": { + "ServiceUsage": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "BatchEnableServices": { + "methods": [ "BatchEnableServices" ] }, - "BatchGetServices": { - "methods": [ + "BatchGetServices": { + "methods": [ "BatchGetServices" ] }, - "DisableService": { - "methods": [ + "DisableService": { + "methods": [ "DisableService" ] }, - "EnableService": { - "methods": [ + "EnableService": { + "methods": [ "EnableService" ] }, - "GetService": { - "methods": [ + "GetService": { + "methods": [ "GetService" ] }, - "ListServices": { - "methods": [ + "ListServices": { + "methods": [ "ListServices" ] } diff --git a/shell/apiv1/doc.go b/shell/apiv1/doc.go index 1f9641739593..519481b1aaf7 100644 --- a/shell/apiv1/doc.go +++ b/shell/apiv1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/shell/apiv1/gapic_metadata.json b/shell/apiv1/gapic_metadata.json index 9ed4b9782feb..9f2bef8962e2 100644 --- a/shell/apiv1/gapic_metadata.json +++ b/shell/apiv1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.shell.v1", - "libraryPackage": "cloud.google.com/go/shell/apiv1", - "services": { - "CloudShellService": { - "clients": { - "grpc": { - "libraryClient": "CloudShellClient", - "rpcs": { - "AddPublicKey": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.shell.v1", + "libraryPackage": "cloud.google.com/go/shell/apiv1", + "services": { + "CloudShellService": { + "clients": { + "grpc": { + "libraryClient": "CloudShellClient", + "rpcs": { + "AddPublicKey": { + "methods": [ "AddPublicKey" ] }, - "AuthorizeEnvironment": { - "methods": [ + "AuthorizeEnvironment": { + "methods": [ "AuthorizeEnvironment" ] }, - "GetEnvironment": { - "methods": [ + "GetEnvironment": { + "methods": [ "GetEnvironment" ] }, - "RemovePublicKey": { - "methods": [ + "RemovePublicKey": { + "methods": [ "RemovePublicKey" ] }, - "StartEnvironment": { - "methods": [ + "StartEnvironment": { + "methods": [ "StartEnvironment" ] } diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index c31d02ef04eb..9830571ea075 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/database/apiv1/gapic_metadata.json b/spanner/admin/database/apiv1/gapic_metadata.json index 7d6e483909f9..e99be310982a 100644 --- a/spanner/admin/database/apiv1/gapic_metadata.json +++ b/spanner/admin/database/apiv1/gapic_metadata.json @@ -1,97 +1,97 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.spanner.admin.database.v1", - "libraryPackage": "cloud.google.com/go/spanner/admin/database/apiv1", - "services": { - "DatabaseAdmin": { - "clients": { - "grpc": { - "libraryClient": "DatabaseAdminClient", - "rpcs": { - "CreateBackup": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.spanner.admin.database.v1", + "libraryPackage": "cloud.google.com/go/spanner/admin/database/apiv1", + "services": { + "DatabaseAdmin": { + "clients": { + "grpc": { + "libraryClient": "DatabaseAdminClient", + "rpcs": { + "CreateBackup": { + "methods": [ "CreateBackup" ] }, - "CreateDatabase": { - "methods": [ + "CreateDatabase": { + "methods": [ "CreateDatabase" ] }, - "DeleteBackup": { - "methods": [ + "DeleteBackup": { + "methods": [ "DeleteBackup" ] }, - "DropDatabase": { - "methods": [ + "DropDatabase": { + "methods": [ "DropDatabase" ] }, - "GetBackup": { - "methods": [ + "GetBackup": { + "methods": [ "GetBackup" ] }, - "GetDatabase": { - "methods": [ + "GetDatabase": { + "methods": [ "GetDatabase" ] }, - "GetDatabaseDdl": { - "methods": [ + "GetDatabaseDdl": { + "methods": [ "GetDatabaseDdl" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "ListBackupOperations": { - "methods": [ + "ListBackupOperations": { + "methods": [ "ListBackupOperations" ] }, - "ListBackups": { - "methods": [ + "ListBackups": { + "methods": [ "ListBackups" ] }, - "ListDatabaseOperations": { - "methods": [ + "ListDatabaseOperations": { + "methods": [ "ListDatabaseOperations" ] }, - "ListDatabases": { - "methods": [ + "ListDatabases": { + "methods": [ "ListDatabases" ] }, - "RestoreDatabase": { - "methods": [ + "RestoreDatabase": { + "methods": [ "RestoreDatabase" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateBackup": { - "methods": [ + "UpdateBackup": { + "methods": [ "UpdateBackup" ] }, - "UpdateDatabaseDdl": { - "methods": [ + "UpdateDatabaseDdl": { + "methods": [ "UpdateDatabaseDdl" ] } diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index 9aa40e6eab9f..eb313b2c3c1c 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/admin/instance/apiv1/gapic_metadata.json b/spanner/admin/instance/apiv1/gapic_metadata.json index c3ff88742f9a..641de7334ae9 100644 --- a/spanner/admin/instance/apiv1/gapic_metadata.json +++ b/spanner/admin/instance/apiv1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.spanner.admin.instance.v1", - "libraryPackage": "cloud.google.com/go/spanner/admin/instance/apiv1", - "services": { - "InstanceAdmin": { - "clients": { - "grpc": { - "libraryClient": "InstanceAdminClient", - "rpcs": { - "CreateInstance": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.spanner.admin.instance.v1", + "libraryPackage": "cloud.google.com/go/spanner/admin/instance/apiv1", + "services": { + "InstanceAdmin": { + "clients": { + "grpc": { + "libraryClient": "InstanceAdminClient", + "rpcs": { + "CreateInstance": { + "methods": [ "CreateInstance" ] }, - "DeleteInstance": { - "methods": [ + "DeleteInstance": { + "methods": [ "DeleteInstance" ] }, - "GetIamPolicy": { - "methods": [ + "GetIamPolicy": { + "methods": [ "GetIamPolicy" ] }, - "GetInstance": { - "methods": [ + "GetInstance": { + "methods": [ "GetInstance" ] }, - "GetInstanceConfig": { - "methods": [ + "GetInstanceConfig": { + "methods": [ "GetInstanceConfig" ] }, - "ListInstanceConfigs": { - "methods": [ + "ListInstanceConfigs": { + "methods": [ "ListInstanceConfigs" ] }, - "ListInstances": { - "methods": [ + "ListInstances": { + "methods": [ "ListInstances" ] }, - "SetIamPolicy": { - "methods": [ + "SetIamPolicy": { + "methods": [ "SetIamPolicy" ] }, - "TestIamPermissions": { - "methods": [ + "TestIamPermissions": { + "methods": [ "TestIamPermissions" ] }, - "UpdateInstance": { - "methods": [ + "UpdateInstance": { + "methods": [ "UpdateInstance" ] } diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index 91c6e30ead7e..512f60f25f6d 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/apiv1/gapic_metadata.json b/spanner/apiv1/gapic_metadata.json index 1a3d63647299..7a47d3467843 100644 --- a/spanner/apiv1/gapic_metadata.json +++ b/spanner/apiv1/gapic_metadata.json @@ -1,87 +1,87 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.spanner.v1", - "libraryPackage": "cloud.google.com/go/spanner/apiv1", - "services": { - "Spanner": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "BatchCreateSessions": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.spanner.v1", + "libraryPackage": "cloud.google.com/go/spanner/apiv1", + "services": { + "Spanner": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "BatchCreateSessions": { + "methods": [ "BatchCreateSessions" ] }, - "BeginTransaction": { - "methods": [ + "BeginTransaction": { + "methods": [ "BeginTransaction" ] }, - "Commit": { - "methods": [ + "Commit": { + "methods": [ "Commit" ] }, - "CreateSession": { - "methods": [ + "CreateSession": { + "methods": [ "CreateSession" ] }, - "DeleteSession": { - "methods": [ + "DeleteSession": { + "methods": [ "DeleteSession" ] }, - "ExecuteBatchDml": { - "methods": [ + "ExecuteBatchDml": { + "methods": [ "ExecuteBatchDml" ] }, - "ExecuteSql": { - "methods": [ + "ExecuteSql": { + "methods": [ "ExecuteSql" ] }, - "ExecuteStreamingSql": { - "methods": [ + "ExecuteStreamingSql": { + "methods": [ "ExecuteStreamingSql" ] }, - "GetSession": { - "methods": [ + "GetSession": { + "methods": [ "GetSession" ] }, - "ListSessions": { - "methods": [ + "ListSessions": { + "methods": [ "ListSessions" ] }, - "PartitionQuery": { - "methods": [ + "PartitionQuery": { + "methods": [ "PartitionQuery" ] }, - "PartitionRead": { - "methods": [ + "PartitionRead": { + "methods": [ "PartitionRead" ] }, - "Read": { - "methods": [ + "Read": { + "methods": [ "Read" ] }, - "Rollback": { - "methods": [ + "Rollback": { + "methods": [ "Rollback" ] }, - "StreamingRead": { - "methods": [ + "StreamingRead": { + "methods": [ "StreamingRead" ] } diff --git a/spanner/go.mod b/spanner/go.mod index 36160c00fc56..457a68aea499 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -10,7 +10,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.27.1 ) diff --git a/spanner/go.sum b/spanner/go.sum index 9e44f7fc0b63..aa8fd5de0a26 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -450,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index 9457d7d7a5a0..37405d8bb7b1 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1/gapic_metadata.json b/speech/apiv1/gapic_metadata.json index cdc96357a36d..299da42f5ed3 100644 --- a/speech/apiv1/gapic_metadata.json +++ b/speech/apiv1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.speech.v1", - "libraryPackage": "cloud.google.com/go/speech/apiv1", - "services": { - "Speech": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "LongRunningRecognize": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.speech.v1", + "libraryPackage": "cloud.google.com/go/speech/apiv1", + "services": { + "Speech": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "LongRunningRecognize": { + "methods": [ "LongRunningRecognize" ] }, - "Recognize": { - "methods": [ + "Recognize": { + "methods": [ "Recognize" ] }, - "StreamingRecognize": { - "methods": [ + "StreamingRecognize": { + "methods": [ "StreamingRecognize" ] } diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 3da928467c2b..3b2a00d5ec1b 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1p1beta1/gapic_metadata.json b/speech/apiv1p1beta1/gapic_metadata.json index 99d872caa8fd..37520a28aee8 100644 --- a/speech/apiv1p1beta1/gapic_metadata.json +++ b/speech/apiv1p1beta1/gapic_metadata.json @@ -1,62 +1,62 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.speech.v1p1beta1", - "libraryPackage": "cloud.google.com/go/speech/apiv1p1beta1", - "services": { - "Adaptation": { - "clients": { - "grpc": { - "libraryClient": "AdaptationClient", - "rpcs": { - "CreateCustomClass": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.speech.v1p1beta1", + "libraryPackage": "cloud.google.com/go/speech/apiv1p1beta1", + "services": { + "Adaptation": { + "clients": { + "grpc": { + "libraryClient": "AdaptationClient", + "rpcs": { + "CreateCustomClass": { + "methods": [ "CreateCustomClass" ] }, - "CreatePhraseSet": { - "methods": [ + "CreatePhraseSet": { + "methods": [ "CreatePhraseSet" ] }, - "DeleteCustomClass": { - "methods": [ + "DeleteCustomClass": { + "methods": [ "DeleteCustomClass" ] }, - "DeletePhraseSet": { - "methods": [ + "DeletePhraseSet": { + "methods": [ "DeletePhraseSet" ] }, - "GetCustomClass": { - "methods": [ + "GetCustomClass": { + "methods": [ "GetCustomClass" ] }, - "GetPhraseSet": { - "methods": [ + "GetPhraseSet": { + "methods": [ "GetPhraseSet" ] }, - "ListCustomClasses": { - "methods": [ + "ListCustomClasses": { + "methods": [ "ListCustomClasses" ] }, - "ListPhraseSet": { - "methods": [ + "ListPhraseSet": { + "methods": [ "ListPhraseSet" ] }, - "UpdateCustomClass": { - "methods": [ + "UpdateCustomClass": { + "methods": [ "UpdateCustomClass" ] }, - "UpdatePhraseSet": { - "methods": [ + "UpdatePhraseSet": { + "methods": [ "UpdatePhraseSet" ] } @@ -64,23 +64,23 @@ } } }, - "Speech": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "LongRunningRecognize": { - "methods": [ + "Speech": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "LongRunningRecognize": { + "methods": [ "LongRunningRecognize" ] }, - "Recognize": { - "methods": [ + "Recognize": { + "methods": [ "Recognize" ] }, - "StreamingRecognize": { - "methods": [ + "StreamingRecognize": { + "methods": [ "StreamingRecognize" ] } diff --git a/storage/go.mod b/storage/go.mod index 9bc831475036..5651bf0eee37 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 + google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 google.golang.org/grpc v1.38.0 ) diff --git a/storage/go.sum b/storage/go.sum index 936f162bac73..0d994fb54e3c 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -453,8 +453,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 h1:s1jFTXJryg4a1mew7xv03VZD8N9XjxFhk1o4Js4WvPQ= -google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95 h1:xyRjacsGcaSoZ2fTcaLCSzh2JEceLLOT4X8k32Q0xAQ= +google.golang.org/genproto v0.0.0-20210701133433-6b8dcf568a95/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/storage/internal/apiv1/doc.go b/storage/internal/apiv1/doc.go index 3a6b9595fde1..f99c1727c55b 100644 --- a/storage/internal/apiv1/doc.go +++ b/storage/internal/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/storage/internal/apiv1/gapic_metadata.json b/storage/internal/apiv1/gapic_metadata.json index b3a8f901993c..d7b93b754dec 100644 --- a/storage/internal/apiv1/gapic_metadata.json +++ b/storage/internal/apiv1/gapic_metadata.json @@ -1,292 +1,292 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.storage.v1", - "libraryPackage": "cloud.google.com/go/storage/internal/apiv1", - "services": { - "Storage": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ComposeObject": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.storage.v1", + "libraryPackage": "cloud.google.com/go/storage/internal/apiv1", + "services": { + "Storage": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ComposeObject": { + "methods": [ "ComposeObject" ] }, - "CopyObject": { - "methods": [ + "CopyObject": { + "methods": [ "CopyObject" ] }, - "CreateHmacKey": { - "methods": [ + "CreateHmacKey": { + "methods": [ "CreateHmacKey" ] }, - "DeleteBucket": { - "methods": [ + "DeleteBucket": { + "methods": [ "DeleteBucket" ] }, - "DeleteBucketAccessControl": { - "methods": [ + "DeleteBucketAccessControl": { + "methods": [ "DeleteBucketAccessControl" ] }, - "DeleteDefaultObjectAccessControl": { - "methods": [ + "DeleteDefaultObjectAccessControl": { + "methods": [ "DeleteDefaultObjectAccessControl" ] }, - "DeleteHmacKey": { - "methods": [ + "DeleteHmacKey": { + "methods": [ "DeleteHmacKey" ] }, - "DeleteNotification": { - "methods": [ + "DeleteNotification": { + "methods": [ "DeleteNotification" ] }, - "DeleteObject": { - "methods": [ + "DeleteObject": { + "methods": [ "DeleteObject" ] }, - "DeleteObjectAccessControl": { - "methods": [ + "DeleteObjectAccessControl": { + "methods": [ "DeleteObjectAccessControl" ] }, - "GetBucket": { - "methods": [ + "GetBucket": { + "methods": [ "GetBucket" ] }, - "GetBucketAccessControl": { - "methods": [ + "GetBucketAccessControl": { + "methods": [ "GetBucketAccessControl" ] }, - "GetBucketIamPolicy": { - "methods": [ + "GetBucketIamPolicy": { + "methods": [ "GetBucketIamPolicy" ] }, - "GetDefaultObjectAccessControl": { - "methods": [ + "GetDefaultObjectAccessControl": { + "methods": [ "GetDefaultObjectAccessControl" ] }, - "GetHmacKey": { - "methods": [ + "GetHmacKey": { + "methods": [ "GetHmacKey" ] }, - "GetNotification": { - "methods": [ + "GetNotification": { + "methods": [ "GetNotification" ] }, - "GetObject": { - "methods": [ + "GetObject": { + "methods": [ "GetObject" ] }, - "GetObjectAccessControl": { - "methods": [ + "GetObjectAccessControl": { + "methods": [ "GetObjectAccessControl" ] }, - "GetObjectIamPolicy": { - "methods": [ + "GetObjectIamPolicy": { + "methods": [ "GetObjectIamPolicy" ] }, - "GetObjectMedia": { - "methods": [ + "GetObjectMedia": { + "methods": [ "GetObjectMedia" ] }, - "GetServiceAccount": { - "methods": [ + "GetServiceAccount": { + "methods": [ "GetServiceAccount" ] }, - "InsertBucket": { - "methods": [ + "InsertBucket": { + "methods": [ "InsertBucket" ] }, - "InsertBucketAccessControl": { - "methods": [ + "InsertBucketAccessControl": { + "methods": [ "InsertBucketAccessControl" ] }, - "InsertDefaultObjectAccessControl": { - "methods": [ + "InsertDefaultObjectAccessControl": { + "methods": [ "InsertDefaultObjectAccessControl" ] }, - "InsertNotification": { - "methods": [ + "InsertNotification": { + "methods": [ "InsertNotification" ] }, - "InsertObject": { - "methods": [ + "InsertObject": { + "methods": [ "InsertObject" ] }, - "InsertObjectAccessControl": { - "methods": [ + "InsertObjectAccessControl": { + "methods": [ "InsertObjectAccessControl" ] }, - "ListBucketAccessControls": { - "methods": [ + "ListBucketAccessControls": { + "methods": [ "ListBucketAccessControls" ] }, - "ListBuckets": { - "methods": [ + "ListBuckets": { + "methods": [ "ListBuckets" ] }, - "ListChannels": { - "methods": [ + "ListChannels": { + "methods": [ "ListChannels" ] }, - "ListDefaultObjectAccessControls": { - "methods": [ + "ListDefaultObjectAccessControls": { + "methods": [ "ListDefaultObjectAccessControls" ] }, - "ListHmacKeys": { - "methods": [ + "ListHmacKeys": { + "methods": [ "ListHmacKeys" ] }, - "ListNotifications": { - "methods": [ + "ListNotifications": { + "methods": [ "ListNotifications" ] }, - "ListObjectAccessControls": { - "methods": [ + "ListObjectAccessControls": { + "methods": [ "ListObjectAccessControls" ] }, - "ListObjects": { - "methods": [ + "ListObjects": { + "methods": [ "ListObjects" ] }, - "LockBucketRetentionPolicy": { - "methods": [ + "LockBucketRetentionPolicy": { + "methods": [ "LockBucketRetentionPolicy" ] }, - "PatchBucket": { - "methods": [ + "PatchBucket": { + "methods": [ "PatchBucket" ] }, - "PatchBucketAccessControl": { - "methods": [ + "PatchBucketAccessControl": { + "methods": [ "PatchBucketAccessControl" ] }, - "PatchDefaultObjectAccessControl": { - "methods": [ + "PatchDefaultObjectAccessControl": { + "methods": [ "PatchDefaultObjectAccessControl" ] }, - "PatchObject": { - "methods": [ + "PatchObject": { + "methods": [ "PatchObject" ] }, - "PatchObjectAccessControl": { - "methods": [ + "PatchObjectAccessControl": { + "methods": [ "PatchObjectAccessControl" ] }, - "QueryWriteStatus": { - "methods": [ + "QueryWriteStatus": { + "methods": [ "QueryWriteStatus" ] }, - "RewriteObject": { - "methods": [ + "RewriteObject": { + "methods": [ "RewriteObject" ] }, - "SetBucketIamPolicy": { - "methods": [ + "SetBucketIamPolicy": { + "methods": [ "SetBucketIamPolicy" ] }, - "SetObjectIamPolicy": { - "methods": [ + "SetObjectIamPolicy": { + "methods": [ "SetObjectIamPolicy" ] }, - "StartResumableWrite": { - "methods": [ + "StartResumableWrite": { + "methods": [ "StartResumableWrite" ] }, - "StopChannel": { - "methods": [ + "StopChannel": { + "methods": [ "StopChannel" ] }, - "TestBucketIamPermissions": { - "methods": [ + "TestBucketIamPermissions": { + "methods": [ "TestBucketIamPermissions" ] }, - "TestObjectIamPermissions": { - "methods": [ + "TestObjectIamPermissions": { + "methods": [ "TestObjectIamPermissions" ] }, - "UpdateBucket": { - "methods": [ + "UpdateBucket": { + "methods": [ "UpdateBucket" ] }, - "UpdateBucketAccessControl": { - "methods": [ + "UpdateBucketAccessControl": { + "methods": [ "UpdateBucketAccessControl" ] }, - "UpdateDefaultObjectAccessControl": { - "methods": [ + "UpdateDefaultObjectAccessControl": { + "methods": [ "UpdateDefaultObjectAccessControl" ] }, - "UpdateHmacKey": { - "methods": [ + "UpdateHmacKey": { + "methods": [ "UpdateHmacKey" ] }, - "UpdateObject": { - "methods": [ + "UpdateObject": { + "methods": [ "UpdateObject" ] }, - "UpdateObjectAccessControl": { - "methods": [ + "UpdateObjectAccessControl": { + "methods": [ "UpdateObjectAccessControl" ] }, - "WatchAllObjects": { - "methods": [ + "WatchAllObjects": { + "methods": [ "WatchAllObjects" ] } diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index 80d229064f90..d516d2ccb0f7 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4/gapic_metadata.json b/talent/apiv4/gapic_metadata.json index d61c4881dc07..864dcdd90bdd 100644 --- a/talent/apiv4/gapic_metadata.json +++ b/talent/apiv4/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.talent.v4", - "libraryPackage": "cloud.google.com/go/talent/apiv4", - "services": { - "CompanyService": { - "clients": { - "grpc": { - "libraryClient": "CompanyClient", - "rpcs": { - "CreateCompany": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.talent.v4", + "libraryPackage": "cloud.google.com/go/talent/apiv4", + "services": { + "CompanyService": { + "clients": { + "grpc": { + "libraryClient": "CompanyClient", + "rpcs": { + "CreateCompany": { + "methods": [ "CreateCompany" ] }, - "DeleteCompany": { - "methods": [ + "DeleteCompany": { + "methods": [ "DeleteCompany" ] }, - "GetCompany": { - "methods": [ + "GetCompany": { + "methods": [ "GetCompany" ] }, - "ListCompanies": { - "methods": [ + "ListCompanies": { + "methods": [ "ListCompanies" ] }, - "UpdateCompany": { - "methods": [ + "UpdateCompany": { + "methods": [ "UpdateCompany" ] } @@ -39,13 +39,13 @@ } } }, - "Completion": { - "clients": { - "grpc": { - "libraryClient": "CompletionClient", - "rpcs": { - "CompleteQuery": { - "methods": [ + "Completion": { + "clients": { + "grpc": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ "CompleteQuery" ] } @@ -53,13 +53,13 @@ } } }, - "EventService": { - "clients": { - "grpc": { - "libraryClient": "EventClient", - "rpcs": { - "CreateClientEvent": { - "methods": [ + "EventService": { + "clients": { + "grpc": { + "libraryClient": "EventClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ "CreateClientEvent" ] } @@ -67,58 +67,58 @@ } } }, - "JobService": { - "clients": { - "grpc": { - "libraryClient": "JobClient", - "rpcs": { - "BatchCreateJobs": { - "methods": [ + "JobService": { + "clients": { + "grpc": { + "libraryClient": "JobClient", + "rpcs": { + "BatchCreateJobs": { + "methods": [ "BatchCreateJobs" ] }, - "BatchDeleteJobs": { - "methods": [ + "BatchDeleteJobs": { + "methods": [ "BatchDeleteJobs" ] }, - "BatchUpdateJobs": { - "methods": [ + "BatchUpdateJobs": { + "methods": [ "BatchUpdateJobs" ] }, - "CreateJob": { - "methods": [ + "CreateJob": { + "methods": [ "CreateJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "SearchJobs": { - "methods": [ + "SearchJobs": { + "methods": [ "SearchJobs" ] }, - "SearchJobsForAlert": { - "methods": [ + "SearchJobsForAlert": { + "methods": [ "SearchJobsForAlert" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } @@ -126,33 +126,33 @@ } } }, - "TenantService": { - "clients": { - "grpc": { - "libraryClient": "TenantClient", - "rpcs": { - "CreateTenant": { - "methods": [ + "TenantService": { + "clients": { + "grpc": { + "libraryClient": "TenantClient", + "rpcs": { + "CreateTenant": { + "methods": [ "CreateTenant" ] }, - "DeleteTenant": { - "methods": [ + "DeleteTenant": { + "methods": [ "DeleteTenant" ] }, - "GetTenant": { - "methods": [ + "GetTenant": { + "methods": [ "GetTenant" ] }, - "ListTenants": { - "methods": [ + "ListTenants": { + "methods": [ "ListTenants" ] }, - "UpdateTenant": { - "methods": [ + "UpdateTenant": { + "methods": [ "UpdateTenant" ] } diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index 1d595b4bfa4c..42177b8b532f 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/talent/apiv4beta1/gapic_metadata.json b/talent/apiv4beta1/gapic_metadata.json index f51c8de5b4dc..5bfc350233b6 100644 --- a/talent/apiv4beta1/gapic_metadata.json +++ b/talent/apiv4beta1/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.talent.v4beta1", - "libraryPackage": "cloud.google.com/go/talent/apiv4beta1", - "services": { - "ApplicationService": { - "clients": { - "grpc": { - "libraryClient": "ApplicationClient", - "rpcs": { - "CreateApplication": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.talent.v4beta1", + "libraryPackage": "cloud.google.com/go/talent/apiv4beta1", + "services": { + "ApplicationService": { + "clients": { + "grpc": { + "libraryClient": "ApplicationClient", + "rpcs": { + "CreateApplication": { + "methods": [ "CreateApplication" ] }, - "DeleteApplication": { - "methods": [ + "DeleteApplication": { + "methods": [ "DeleteApplication" ] }, - "GetApplication": { - "methods": [ + "GetApplication": { + "methods": [ "GetApplication" ] }, - "ListApplications": { - "methods": [ + "ListApplications": { + "methods": [ "ListApplications" ] }, - "UpdateApplication": { - "methods": [ + "UpdateApplication": { + "methods": [ "UpdateApplication" ] } @@ -39,33 +39,33 @@ } } }, - "CompanyService": { - "clients": { - "grpc": { - "libraryClient": "CompanyClient", - "rpcs": { - "CreateCompany": { - "methods": [ + "CompanyService": { + "clients": { + "grpc": { + "libraryClient": "CompanyClient", + "rpcs": { + "CreateCompany": { + "methods": [ "CreateCompany" ] }, - "DeleteCompany": { - "methods": [ + "DeleteCompany": { + "methods": [ "DeleteCompany" ] }, - "GetCompany": { - "methods": [ + "GetCompany": { + "methods": [ "GetCompany" ] }, - "ListCompanies": { - "methods": [ + "ListCompanies": { + "methods": [ "ListCompanies" ] }, - "UpdateCompany": { - "methods": [ + "UpdateCompany": { + "methods": [ "UpdateCompany" ] } @@ -73,13 +73,13 @@ } } }, - "Completion": { - "clients": { - "grpc": { - "libraryClient": "CompletionClient", - "rpcs": { - "CompleteQuery": { - "methods": [ + "Completion": { + "clients": { + "grpc": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ "CompleteQuery" ] } @@ -87,13 +87,13 @@ } } }, - "EventService": { - "clients": { - "grpc": { - "libraryClient": "EventClient", - "rpcs": { - "CreateClientEvent": { - "methods": [ + "EventService": { + "clients": { + "grpc": { + "libraryClient": "EventClient", + "rpcs": { + "CreateClientEvent": { + "methods": [ "CreateClientEvent" ] } @@ -101,58 +101,58 @@ } } }, - "JobService": { - "clients": { - "grpc": { - "libraryClient": "JobClient", - "rpcs": { - "BatchCreateJobs": { - "methods": [ + "JobService": { + "clients": { + "grpc": { + "libraryClient": "JobClient", + "rpcs": { + "BatchCreateJobs": { + "methods": [ "BatchCreateJobs" ] }, - "BatchDeleteJobs": { - "methods": [ + "BatchDeleteJobs": { + "methods": [ "BatchDeleteJobs" ] }, - "BatchUpdateJobs": { - "methods": [ + "BatchUpdateJobs": { + "methods": [ "BatchUpdateJobs" ] }, - "CreateJob": { - "methods": [ + "CreateJob": { + "methods": [ "CreateJob" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] }, - "SearchJobs": { - "methods": [ + "SearchJobs": { + "methods": [ "SearchJobs" ] }, - "SearchJobsForAlert": { - "methods": [ + "SearchJobsForAlert": { + "methods": [ "SearchJobsForAlert" ] }, - "UpdateJob": { - "methods": [ + "UpdateJob": { + "methods": [ "UpdateJob" ] } @@ -160,38 +160,38 @@ } } }, - "ProfileService": { - "clients": { - "grpc": { - "libraryClient": "ProfileClient", - "rpcs": { - "CreateProfile": { - "methods": [ + "ProfileService": { + "clients": { + "grpc": { + "libraryClient": "ProfileClient", + "rpcs": { + "CreateProfile": { + "methods": [ "CreateProfile" ] }, - "DeleteProfile": { - "methods": [ + "DeleteProfile": { + "methods": [ "DeleteProfile" ] }, - "GetProfile": { - "methods": [ + "GetProfile": { + "methods": [ "GetProfile" ] }, - "ListProfiles": { - "methods": [ + "ListProfiles": { + "methods": [ "ListProfiles" ] }, - "SearchProfiles": { - "methods": [ + "SearchProfiles": { + "methods": [ "SearchProfiles" ] }, - "UpdateProfile": { - "methods": [ + "UpdateProfile": { + "methods": [ "UpdateProfile" ] } @@ -199,33 +199,33 @@ } } }, - "TenantService": { - "clients": { - "grpc": { - "libraryClient": "TenantClient", - "rpcs": { - "CreateTenant": { - "methods": [ + "TenantService": { + "clients": { + "grpc": { + "libraryClient": "TenantClient", + "rpcs": { + "CreateTenant": { + "methods": [ "CreateTenant" ] }, - "DeleteTenant": { - "methods": [ + "DeleteTenant": { + "methods": [ "DeleteTenant" ] }, - "GetTenant": { - "methods": [ + "GetTenant": { + "methods": [ "GetTenant" ] }, - "ListTenants": { - "methods": [ + "ListTenants": { + "methods": [ "ListTenants" ] }, - "UpdateTenant": { - "methods": [ + "UpdateTenant": { + "methods": [ "UpdateTenant" ] } diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index 97ce4c977a51..24ba20cf8ea3 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/texttospeech/apiv1/gapic_metadata.json b/texttospeech/apiv1/gapic_metadata.json index db921930a9ec..111b0361dca8 100644 --- a/texttospeech/apiv1/gapic_metadata.json +++ b/texttospeech/apiv1/gapic_metadata.json @@ -1,22 +1,22 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.texttospeech.v1", - "libraryPackage": "cloud.google.com/go/texttospeech/apiv1", - "services": { - "TextToSpeech": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ListVoices": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.texttospeech.v1", + "libraryPackage": "cloud.google.com/go/texttospeech/apiv1", + "services": { + "TextToSpeech": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ListVoices": { + "methods": [ "ListVoices" ] }, - "SynthesizeSpeech": { - "methods": [ + "SynthesizeSpeech": { + "methods": [ "SynthesizeSpeech" ] } diff --git a/tpu/apiv1/doc.go b/tpu/apiv1/doc.go index 5b6b64837151..dad0e41b400f 100644 --- a/tpu/apiv1/doc.go +++ b/tpu/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/tpu/apiv1/gapic_metadata.json b/tpu/apiv1/gapic_metadata.json index 78db6c59e592..3144ece1f5df 100644 --- a/tpu/apiv1/gapic_metadata.json +++ b/tpu/apiv1/gapic_metadata.json @@ -1,67 +1,67 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.tpu.v1", - "libraryPackage": "cloud.google.com/go/tpu/apiv1", - "services": { - "Tpu": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateNode": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.tpu.v1", + "libraryPackage": "cloud.google.com/go/tpu/apiv1", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateNode": { + "methods": [ "CreateNode" ] }, - "DeleteNode": { - "methods": [ + "DeleteNode": { + "methods": [ "DeleteNode" ] }, - "GetAcceleratorType": { - "methods": [ + "GetAcceleratorType": { + "methods": [ "GetAcceleratorType" ] }, - "GetNode": { - "methods": [ + "GetNode": { + "methods": [ "GetNode" ] }, - "GetTensorFlowVersion": { - "methods": [ + "GetTensorFlowVersion": { + "methods": [ "GetTensorFlowVersion" ] }, - "ListAcceleratorTypes": { - "methods": [ + "ListAcceleratorTypes": { + "methods": [ "ListAcceleratorTypes" ] }, - "ListNodes": { - "methods": [ + "ListNodes": { + "methods": [ "ListNodes" ] }, - "ListTensorFlowVersions": { - "methods": [ + "ListTensorFlowVersions": { + "methods": [ "ListTensorFlowVersions" ] }, - "ReimageNode": { - "methods": [ + "ReimageNode": { + "methods": [ "ReimageNode" ] }, - "StartNode": { - "methods": [ + "StartNode": { + "methods": [ "StartNode" ] }, - "StopNode": { - "methods": [ + "StopNode": { + "methods": [ "StopNode" ] } diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index 90f7779e41d2..e0a78f4aa7f8 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv1/gapic_metadata.json b/trace/apiv1/gapic_metadata.json index 8e90e9704266..173594929e90 100644 --- a/trace/apiv1/gapic_metadata.json +++ b/trace/apiv1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.cloudtrace.v1", - "libraryPackage": "cloud.google.com/go/trace/apiv1", - "services": { - "TraceService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "GetTrace": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.cloudtrace.v1", + "libraryPackage": "cloud.google.com/go/trace/apiv1", + "services": { + "TraceService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "GetTrace": { + "methods": [ "GetTrace" ] }, - "ListTraces": { - "methods": [ + "ListTraces": { + "methods": [ "ListTraces" ] }, - "PatchTraces": { - "methods": [ + "PatchTraces": { + "methods": [ "PatchTraces" ] } diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index c24cb4af159a..d0c58d965322 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/trace/apiv2/gapic_metadata.json b/trace/apiv2/gapic_metadata.json index 30874dcba3d4..ef3c8d6d0456 100644 --- a/trace/apiv2/gapic_metadata.json +++ b/trace/apiv2/gapic_metadata.json @@ -1,22 +1,22 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.devtools.cloudtrace.v2", - "libraryPackage": "cloud.google.com/go/trace/apiv2", - "services": { - "TraceService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "BatchWriteSpans": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.devtools.cloudtrace.v2", + "libraryPackage": "cloud.google.com/go/trace/apiv2", + "services": { + "TraceService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "BatchWriteSpans": { + "methods": [ "BatchWriteSpans" ] }, - "CreateSpan": { - "methods": [ + "CreateSpan": { + "methods": [ "CreateSpan" ] } diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index 04cb0f9e719e..8fec30345a26 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/translate/apiv3/gapic_metadata.json b/translate/apiv3/gapic_metadata.json index 674769576bfc..cc792ac4728c 100644 --- a/translate/apiv3/gapic_metadata.json +++ b/translate/apiv3/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.translation.v3", - "libraryPackage": "cloud.google.com/go/translate/apiv3", - "services": { - "TranslationService": { - "clients": { - "grpc": { - "libraryClient": "TranslationClient", - "rpcs": { - "BatchTranslateText": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.translation.v3", + "libraryPackage": "cloud.google.com/go/translate/apiv3", + "services": { + "TranslationService": { + "clients": { + "grpc": { + "libraryClient": "TranslationClient", + "rpcs": { + "BatchTranslateText": { + "methods": [ "BatchTranslateText" ] }, - "CreateGlossary": { - "methods": [ + "CreateGlossary": { + "methods": [ "CreateGlossary" ] }, - "DeleteGlossary": { - "methods": [ + "DeleteGlossary": { + "methods": [ "DeleteGlossary" ] }, - "DetectLanguage": { - "methods": [ + "DetectLanguage": { + "methods": [ "DetectLanguage" ] }, - "GetGlossary": { - "methods": [ + "GetGlossary": { + "methods": [ "GetGlossary" ] }, - "GetSupportedLanguages": { - "methods": [ + "GetSupportedLanguages": { + "methods": [ "GetSupportedLanguages" ] }, - "ListGlossaries": { - "methods": [ + "ListGlossaries": { + "methods": [ "ListGlossaries" ] }, - "TranslateText": { - "methods": [ + "TranslateText": { + "methods": [ "TranslateText" ] } diff --git a/video/transcoder/apiv1beta1/doc.go b/video/transcoder/apiv1beta1/doc.go index 0bd836c86096..f6b78a3a542f 100644 --- a/video/transcoder/apiv1beta1/doc.go +++ b/video/transcoder/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/video/transcoder/apiv1beta1/gapic_metadata.json b/video/transcoder/apiv1beta1/gapic_metadata.json index 84e3d7d1ab5b..4a92159ad674 100644 --- a/video/transcoder/apiv1beta1/gapic_metadata.json +++ b/video/transcoder/apiv1beta1/gapic_metadata.json @@ -1,52 +1,52 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.video.transcoder.v1beta1", - "libraryPackage": "cloud.google.com/go/video/transcoder/apiv1beta1", - "services": { - "TranscoderService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateJob": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.video.transcoder.v1beta1", + "libraryPackage": "cloud.google.com/go/video/transcoder/apiv1beta1", + "services": { + "TranscoderService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateJob": { + "methods": [ "CreateJob" ] }, - "CreateJobTemplate": { - "methods": [ + "CreateJobTemplate": { + "methods": [ "CreateJobTemplate" ] }, - "DeleteJob": { - "methods": [ + "DeleteJob": { + "methods": [ "DeleteJob" ] }, - "DeleteJobTemplate": { - "methods": [ + "DeleteJobTemplate": { + "methods": [ "DeleteJobTemplate" ] }, - "GetJob": { - "methods": [ + "GetJob": { + "methods": [ "GetJob" ] }, - "GetJobTemplate": { - "methods": [ + "GetJobTemplate": { + "methods": [ "GetJobTemplate" ] }, - "ListJobTemplates": { - "methods": [ + "ListJobTemplates": { + "methods": [ "ListJobTemplates" ] }, - "ListJobs": { - "methods": [ + "ListJobs": { + "methods": [ "ListJobs" ] } diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index 830d968e4a2d..54494b31bf2e 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1/gapic_metadata.json b/videointelligence/apiv1/gapic_metadata.json index a2525d443026..ff747ce5951f 100644 --- a/videointelligence/apiv1/gapic_metadata.json +++ b/videointelligence/apiv1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.videointelligence.v1", - "libraryPackage": "cloud.google.com/go/videointelligence/apiv1", - "services": { - "VideoIntelligenceService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnnotateVideo": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.videointelligence.v1", + "libraryPackage": "cloud.google.com/go/videointelligence/apiv1", + "services": { + "VideoIntelligenceService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnnotateVideo": { + "methods": [ "AnnotateVideo" ] } diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index 65d81c707343..3ca9b3f113bd 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/videointelligence/apiv1beta2/gapic_metadata.json b/videointelligence/apiv1beta2/gapic_metadata.json index 922cd9bc58d8..48b64ef04a39 100644 --- a/videointelligence/apiv1beta2/gapic_metadata.json +++ b/videointelligence/apiv1beta2/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.videointelligence.v1beta2", - "libraryPackage": "cloud.google.com/go/videointelligence/apiv1beta2", - "services": { - "VideoIntelligenceService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "AnnotateVideo": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.videointelligence.v1beta2", + "libraryPackage": "cloud.google.com/go/videointelligence/apiv1beta2", + "services": { + "VideoIntelligenceService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "AnnotateVideo": { + "methods": [ "AnnotateVideo" ] } diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index 74aa0a134b6c..d8eb6e748706 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1/gapic_metadata.json b/vision/apiv1/gapic_metadata.json index 52725dbf9d21..98867fffb093 100644 --- a/vision/apiv1/gapic_metadata.json +++ b/vision/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.vision.v1", - "libraryPackage": "cloud.google.com/go/vision/apiv1", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "AsyncBatchAnnotateFiles": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.vision.v1", + "libraryPackage": "cloud.google.com/go/vision/apiv1", + "services": { + "ImageAnnotator": { + "clients": { + "grpc": { + "libraryClient": "ImageAnnotatorClient", + "rpcs": { + "AsyncBatchAnnotateFiles": { + "methods": [ "AsyncBatchAnnotateFiles" ] }, - "AsyncBatchAnnotateImages": { - "methods": [ + "AsyncBatchAnnotateImages": { + "methods": [ "AsyncBatchAnnotateImages" ] }, - "BatchAnnotateFiles": { - "methods": [ + "BatchAnnotateFiles": { + "methods": [ "BatchAnnotateFiles" ] }, - "BatchAnnotateImages": { - "methods": [ + "BatchAnnotateImages": { + "methods": [ "BatchAnnotateImages" ] } @@ -34,103 +34,103 @@ } } }, - "ProductSearch": { - "clients": { - "grpc": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "AddProductToProductSet": { - "methods": [ + "ProductSearch": { + "clients": { + "grpc": { + "libraryClient": "ProductSearchClient", + "rpcs": { + "AddProductToProductSet": { + "methods": [ "AddProductToProductSet" ] }, - "CreateProduct": { - "methods": [ + "CreateProduct": { + "methods": [ "CreateProduct" ] }, - "CreateProductSet": { - "methods": [ + "CreateProductSet": { + "methods": [ "CreateProductSet" ] }, - "CreateReferenceImage": { - "methods": [ + "CreateReferenceImage": { + "methods": [ "CreateReferenceImage" ] }, - "DeleteProduct": { - "methods": [ + "DeleteProduct": { + "methods": [ "DeleteProduct" ] }, - "DeleteProductSet": { - "methods": [ + "DeleteProductSet": { + "methods": [ "DeleteProductSet" ] }, - "DeleteReferenceImage": { - "methods": [ + "DeleteReferenceImage": { + "methods": [ "DeleteReferenceImage" ] }, - "GetProduct": { - "methods": [ + "GetProduct": { + "methods": [ "GetProduct" ] }, - "GetProductSet": { - "methods": [ + "GetProductSet": { + "methods": [ "GetProductSet" ] }, - "GetReferenceImage": { - "methods": [ + "GetReferenceImage": { + "methods": [ "GetReferenceImage" ] }, - "ImportProductSets": { - "methods": [ + "ImportProductSets": { + "methods": [ "ImportProductSets" ] }, - "ListProductSets": { - "methods": [ + "ListProductSets": { + "methods": [ "ListProductSets" ] }, - "ListProducts": { - "methods": [ + "ListProducts": { + "methods": [ "ListProducts" ] }, - "ListProductsInProductSet": { - "methods": [ + "ListProductsInProductSet": { + "methods": [ "ListProductsInProductSet" ] }, - "ListReferenceImages": { - "methods": [ + "ListReferenceImages": { + "methods": [ "ListReferenceImages" ] }, - "PurgeProducts": { - "methods": [ + "PurgeProducts": { + "methods": [ "PurgeProducts" ] }, - "RemoveProductFromProductSet": { - "methods": [ + "RemoveProductFromProductSet": { + "methods": [ "RemoveProductFromProductSet" ] }, - "UpdateProduct": { - "methods": [ + "UpdateProduct": { + "methods": [ "UpdateProduct" ] }, - "UpdateProductSet": { - "methods": [ + "UpdateProductSet": { + "methods": [ "UpdateProductSet" ] } diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index 806c795fda5c..780ad088ca69 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vision/apiv1p1beta1/gapic_metadata.json b/vision/apiv1p1beta1/gapic_metadata.json index 1d1f4da4420d..04778b0b3e36 100644 --- a/vision/apiv1p1beta1/gapic_metadata.json +++ b/vision/apiv1p1beta1/gapic_metadata.json @@ -1,17 +1,17 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.vision.v1p1beta1", - "libraryPackage": "cloud.google.com/go/vision/apiv1p1beta1", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.vision.v1p1beta1", + "libraryPackage": "cloud.google.com/go/vision/apiv1p1beta1", + "services": { + "ImageAnnotator": { + "clients": { + "grpc": { + "libraryClient": "ImageAnnotatorClient", + "rpcs": { + "BatchAnnotateImages": { + "methods": [ "BatchAnnotateImages" ] } diff --git a/vpcaccess/apiv1/doc.go b/vpcaccess/apiv1/doc.go index 3cc5efa3233b..cc9820231b8e 100644 --- a/vpcaccess/apiv1/doc.go +++ b/vpcaccess/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/vpcaccess/apiv1/gapic_metadata.json b/vpcaccess/apiv1/gapic_metadata.json index 619b6dce04d9..bc096e30bbda 100644 --- a/vpcaccess/apiv1/gapic_metadata.json +++ b/vpcaccess/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.vpcaccess.v1", - "libraryPackage": "cloud.google.com/go/vpcaccess/apiv1", - "services": { - "VpcAccessService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateConnector": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.vpcaccess.v1", + "libraryPackage": "cloud.google.com/go/vpcaccess/apiv1", + "services": { + "VpcAccessService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateConnector": { + "methods": [ "CreateConnector" ] }, - "DeleteConnector": { - "methods": [ + "DeleteConnector": { + "methods": [ "DeleteConnector" ] }, - "GetConnector": { - "methods": [ + "GetConnector": { + "methods": [ "GetConnector" ] }, - "ListConnectors": { - "methods": [ + "ListConnectors": { + "methods": [ "ListConnectors" ] } diff --git a/webrisk/apiv1/doc.go b/webrisk/apiv1/doc.go index 05153fe95905..cf39af86ed71 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1/gapic_metadata.json b/webrisk/apiv1/gapic_metadata.json index fed41bc485d0..f8d27fd70289 100644 --- a/webrisk/apiv1/gapic_metadata.json +++ b/webrisk/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.webrisk.v1", - "libraryPackage": "cloud.google.com/go/webrisk/apiv1", - "services": { - "WebRiskService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.webrisk.v1", + "libraryPackage": "cloud.google.com/go/webrisk/apiv1", + "services": { + "WebRiskService": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ "ComputeThreatListDiff" ] }, - "CreateSubmission": { - "methods": [ + "CreateSubmission": { + "methods": [ "CreateSubmission" ] }, - "SearchHashes": { - "methods": [ + "SearchHashes": { + "methods": [ "SearchHashes" ] }, - "SearchUris": { - "methods": [ + "SearchUris": { + "methods": [ "SearchUris" ] } diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index 9eead0d77c49..d6278cbfffe2 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/webrisk/apiv1beta1/gapic_metadata.json b/webrisk/apiv1beta1/gapic_metadata.json index 7da7ea74a1cc..75941f478c87 100644 --- a/webrisk/apiv1beta1/gapic_metadata.json +++ b/webrisk/apiv1beta1/gapic_metadata.json @@ -1,27 +1,27 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.webrisk.v1beta1", - "libraryPackage": "cloud.google.com/go/webrisk/apiv1beta1", - "services": { - "WebRiskServiceV1Beta1": { - "clients": { - "grpc": { - "libraryClient": "WebRiskServiceV1Beta1Client", - "rpcs": { - "ComputeThreatListDiff": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.webrisk.v1beta1", + "libraryPackage": "cloud.google.com/go/webrisk/apiv1beta1", + "services": { + "WebRiskServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "WebRiskServiceV1Beta1Client", + "rpcs": { + "ComputeThreatListDiff": { + "methods": [ "ComputeThreatListDiff" ] }, - "SearchHashes": { - "methods": [ + "SearchHashes": { + "methods": [ "SearchHashes" ] }, - "SearchUris": { - "methods": [ + "SearchUris": { + "methods": [ "SearchUris" ] } diff --git a/websecurityscanner/apiv1/doc.go b/websecurityscanner/apiv1/doc.go index ce6539a3d194..7065fdfd3580 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/websecurityscanner/apiv1/gapic_metadata.json b/websecurityscanner/apiv1/gapic_metadata.json index 26bb0feab789..9fc5f875602a 100644 --- a/websecurityscanner/apiv1/gapic_metadata.json +++ b/websecurityscanner/apiv1/gapic_metadata.json @@ -1,77 +1,77 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.websecurityscanner.v1", - "libraryPackage": "cloud.google.com/go/websecurityscanner/apiv1", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateScanConfig": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.websecurityscanner.v1", + "libraryPackage": "cloud.google.com/go/websecurityscanner/apiv1", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateScanConfig": { + "methods": [ "CreateScanConfig" ] }, - "DeleteScanConfig": { - "methods": [ + "DeleteScanConfig": { + "methods": [ "DeleteScanConfig" ] }, - "GetFinding": { - "methods": [ + "GetFinding": { + "methods": [ "GetFinding" ] }, - "GetScanConfig": { - "methods": [ + "GetScanConfig": { + "methods": [ "GetScanConfig" ] }, - "GetScanRun": { - "methods": [ + "GetScanRun": { + "methods": [ "GetScanRun" ] }, - "ListCrawledUrls": { - "methods": [ + "ListCrawledUrls": { + "methods": [ "ListCrawledUrls" ] }, - "ListFindingTypeStats": { - "methods": [ + "ListFindingTypeStats": { + "methods": [ "ListFindingTypeStats" ] }, - "ListFindings": { - "methods": [ + "ListFindings": { + "methods": [ "ListFindings" ] }, - "ListScanConfigs": { - "methods": [ + "ListScanConfigs": { + "methods": [ "ListScanConfigs" ] }, - "ListScanRuns": { - "methods": [ + "ListScanRuns": { + "methods": [ "ListScanRuns" ] }, - "StartScanRun": { - "methods": [ + "StartScanRun": { + "methods": [ "StartScanRun" ] }, - "StopScanRun": { - "methods": [ + "StopScanRun": { + "methods": [ "StopScanRun" ] }, - "UpdateScanConfig": { - "methods": [ + "UpdateScanConfig": { + "methods": [ "UpdateScanConfig" ] } diff --git a/workflows/apiv1beta/doc.go b/workflows/apiv1beta/doc.go index 54b8d3320174..d2eaf1752890 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/apiv1beta/gapic_metadata.json b/workflows/apiv1beta/gapic_metadata.json index 4b57d1c91999..78b97d5169f2 100644 --- a/workflows/apiv1beta/gapic_metadata.json +++ b/workflows/apiv1beta/gapic_metadata.json @@ -1,37 +1,37 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.workflows.v1beta", - "libraryPackage": "cloud.google.com/go/workflows/apiv1beta", - "services": { - "Workflows": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateWorkflow": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.workflows.v1beta", + "libraryPackage": "cloud.google.com/go/workflows/apiv1beta", + "services": { + "Workflows": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CreateWorkflow": { + "methods": [ "CreateWorkflow" ] }, - "DeleteWorkflow": { - "methods": [ + "DeleteWorkflow": { + "methods": [ "DeleteWorkflow" ] }, - "GetWorkflow": { - "methods": [ + "GetWorkflow": { + "methods": [ "GetWorkflow" ] }, - "ListWorkflows": { - "methods": [ + "ListWorkflows": { + "methods": [ "ListWorkflows" ] }, - "UpdateWorkflow": { - "methods": [ + "UpdateWorkflow": { + "methods": [ "UpdateWorkflow" ] } diff --git a/workflows/executions/apiv1/doc.go b/workflows/executions/apiv1/doc.go index ace2c66faf23..302fe9c08fc1 100644 --- a/workflows/executions/apiv1/doc.go +++ b/workflows/executions/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "UNKNOWN" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/executions/apiv1/gapic_metadata.json b/workflows/executions/apiv1/gapic_metadata.json index bd49590ca4b4..cade633f7da4 100644 --- a/workflows/executions/apiv1/gapic_metadata.json +++ b/workflows/executions/apiv1/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.workflows.executions.v1", - "libraryPackage": "cloud.google.com/go/workflows/executions/apiv1", - "services": { - "Executions": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CancelExecution": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.workflows.executions.v1", + "libraryPackage": "cloud.google.com/go/workflows/executions/apiv1", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelExecution": { + "methods": [ "CancelExecution" ] }, - "CreateExecution": { - "methods": [ + "CreateExecution": { + "methods": [ "CreateExecution" ] }, - "GetExecution": { - "methods": [ + "GetExecution": { + "methods": [ "GetExecution" ] }, - "ListExecutions": { - "methods": [ + "ListExecutions": { + "methods": [ "ListExecutions" ] } diff --git a/workflows/executions/apiv1beta/doc.go b/workflows/executions/apiv1beta/doc.go index c358413800a5..25969c4bed23 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210630" +const versionClient = "20210701" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/workflows/executions/apiv1beta/gapic_metadata.json b/workflows/executions/apiv1beta/gapic_metadata.json index f9d5dca3cbf3..df3144a708a3 100644 --- a/workflows/executions/apiv1beta/gapic_metadata.json +++ b/workflows/executions/apiv1beta/gapic_metadata.json @@ -1,32 +1,32 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.workflows.executions.v1beta", - "libraryPackage": "cloud.google.com/go/workflows/executions/apiv1beta", - "services": { - "Executions": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CancelExecution": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.workflows.executions.v1beta", + "libraryPackage": "cloud.google.com/go/workflows/executions/apiv1beta", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "CancelExecution": { + "methods": [ "CancelExecution" ] }, - "CreateExecution": { - "methods": [ + "CreateExecution": { + "methods": [ "CreateExecution" ] }, - "GetExecution": { - "methods": [ + "GetExecution": { + "methods": [ "GetExecution" ] }, - "ListExecutions": { - "methods": [ + "ListExecutions": { + "methods": [ "ListExecutions" ] } From 58d4055eae44ced04177be6b78eb74b13353a16e Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Thu, 1 Jul 2021 12:42:23 -0400 Subject: [PATCH 11/18] test(storage): unflake PublicAccessPrevention test (#4352) This needs a retry to account for propagation time for bucket ACLs. Fixes #4351 --- storage/integration_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/storage/integration_test.go b/storage/integration_test.go index 043cc5a8bd53..7ea61e3c47e7 100644 --- a/storage/integration_test.go +++ b/storage/integration_test.go @@ -627,9 +627,14 @@ func TestIntegration_PublicAccessPrevention(t *testing.T) { t.Error("updating PublicAccessPrevention changed UBLA setting") } - // Now, making object public or making bucket public should succeed. - a = o.ACL() - if err := a.Set(ctx, AllUsers, RoleReader); err != nil { + // Now, making object public or making bucket public should succeed. Run with + // retry because ACL settings may take time to propagate. + if err := retry(ctx, + func() error { + a = o.ACL() + return a.Set(ctx, AllUsers, RoleReader) + }, + nil); err != nil { t.Errorf("ACL.Set: making object public failed: %v", err) } policy, err = bkt.IAM().V3().Policy(ctx) From f2b20f493e2ed5a883ce42fa65695c03c574feb5 Mon Sep 17 00:00:00 2001 From: shollyman Date: Thu, 1 Jul 2021 10:14:23 -0700 Subject: [PATCH 12/18] feat(bigquery managedwriter): schema conversion support (#4357) This is the first of multiple PRs to build up the functionality of a new thick client over the new BigQuery Storage API's write mechanism. This PR exposes schema conversion between the main bigquery package and the bigquery storage API. Towards: https://github.com/googleapis/google-cloud-go/issues/4366 --- bigquery/storage/managedwriter/adapt/doc.go | 19 ++ .../managedwriter/adapt/schemaconversion.go | 140 ++++++++++++ .../adapt/schemaconversion_test.go | 203 ++++++++++++++++++ bigquery/storage/managedwriter/doc.go | 22 ++ 4 files changed, 384 insertions(+) create mode 100644 bigquery/storage/managedwriter/adapt/doc.go create mode 100644 bigquery/storage/managedwriter/adapt/schemaconversion.go create mode 100644 bigquery/storage/managedwriter/adapt/schemaconversion_test.go create mode 100644 bigquery/storage/managedwriter/doc.go diff --git a/bigquery/storage/managedwriter/adapt/doc.go b/bigquery/storage/managedwriter/adapt/doc.go new file mode 100644 index 000000000000..c06d30392007 --- /dev/null +++ b/bigquery/storage/managedwriter/adapt/doc.go @@ -0,0 +1,19 @@ +// Copyright 2021 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. + +// Package adapt adds functionality related to converting bigquery representations +// like schema and data type representations. +// +// It is EXPERIMENTAL and subject to change or removal without notice. +package adapt diff --git a/bigquery/storage/managedwriter/adapt/schemaconversion.go b/bigquery/storage/managedwriter/adapt/schemaconversion.go new file mode 100644 index 000000000000..8de22575db6f --- /dev/null +++ b/bigquery/storage/managedwriter/adapt/schemaconversion.go @@ -0,0 +1,140 @@ +// Copyright 2021 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. + +package adapt + +import ( + "fmt" + + "cloud.google.com/go/bigquery" + storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2" +) + +var fieldTypeMap = map[bigquery.FieldType]storagepb.TableFieldSchema_Type{ + bigquery.StringFieldType: storagepb.TableFieldSchema_STRING, + bigquery.BytesFieldType: storagepb.TableFieldSchema_BYTES, + bigquery.IntegerFieldType: storagepb.TableFieldSchema_INT64, + bigquery.FloatFieldType: storagepb.TableFieldSchema_DOUBLE, + bigquery.BooleanFieldType: storagepb.TableFieldSchema_BOOL, + bigquery.TimestampFieldType: storagepb.TableFieldSchema_TIMESTAMP, + bigquery.RecordFieldType: storagepb.TableFieldSchema_STRUCT, + bigquery.DateFieldType: storagepb.TableFieldSchema_DATE, + bigquery.TimeFieldType: storagepb.TableFieldSchema_TIME, + bigquery.DateTimeFieldType: storagepb.TableFieldSchema_DATETIME, + bigquery.NumericFieldType: storagepb.TableFieldSchema_NUMERIC, + bigquery.BigNumericFieldType: storagepb.TableFieldSchema_BIGNUMERIC, + bigquery.GeographyFieldType: storagepb.TableFieldSchema_GEOGRAPHY, +} + +func bqFieldToProto(in *bigquery.FieldSchema) (*storagepb.TableFieldSchema, error) { + if in == nil { + return nil, nil + } + out := &storagepb.TableFieldSchema{ + Name: in.Name, + Description: in.Description, + } + + // Type conversion. + typ, ok := fieldTypeMap[in.Type] + if !ok { + return nil, fmt.Errorf("could not convert field (%s) due to unknown type value: %s", in.Name, in.Type) + } + out.Type = typ + + // Mode conversion. Repeated trumps required. + out.Mode = storagepb.TableFieldSchema_NULLABLE + if in.Repeated { + out.Mode = storagepb.TableFieldSchema_REPEATED + } + if !in.Repeated && in.Required { + out.Mode = storagepb.TableFieldSchema_REQUIRED + } + + for _, s := range in.Schema { + subField, err := bqFieldToProto(s) + if err != nil { + return nil, err + } + out.Fields = append(out.Fields, subField) + } + return out, nil +} + +func protoToBQField(in *storagepb.TableFieldSchema) (*bigquery.FieldSchema, error) { + if in == nil { + return nil, nil + } + out := &bigquery.FieldSchema{ + Name: in.GetName(), + Description: in.GetDescription(), + Repeated: in.GetMode() == storagepb.TableFieldSchema_REPEATED, + Required: in.GetMode() == storagepb.TableFieldSchema_REQUIRED, + } + + typeResolved := false + for k, v := range fieldTypeMap { + if v == in.GetType() { + out.Type = k + typeResolved = true + break + } + } + if !typeResolved { + return nil, fmt.Errorf("could not convert proto type to bigquery type: %v", in.GetType().String()) + } + + for _, s := range in.Fields { + subField, err := protoToBQField(s) + if err != nil { + return nil, err + } + out.Schema = append(out.Schema, subField) + } + return out, nil +} + +// BQSchemaToStorageTableSchema converts a bigquery Schema into the protobuf-based TableSchema used +// by the BigQuery Storage WriteClient. +func BQSchemaToStorageTableSchema(in bigquery.Schema) (*storagepb.TableSchema, error) { + if in == nil { + return nil, nil + } + out := &storagepb.TableSchema{} + for _, s := range in { + converted, err := bqFieldToProto(s) + if err != nil { + return nil, err + } + out.Fields = append(out.Fields, converted) + } + return out, nil +} + +// StorageTableSchemaToBQSchema converts a TableSchema from the BigQuery Storage WriteClient +// into the equivalent BigQuery Schema. +func StorageTableSchemaToBQSchema(in *storagepb.TableSchema) (bigquery.Schema, error) { + if in == nil { + return nil, nil + } + var out bigquery.Schema + for _, s := range in.Fields { + converted, err := protoToBQField(s) + if err != nil { + return nil, err + } + out = append(out, converted) + } + return out, nil +} diff --git a/bigquery/storage/managedwriter/adapt/schemaconversion_test.go b/bigquery/storage/managedwriter/adapt/schemaconversion_test.go new file mode 100644 index 000000000000..aab85fa90724 --- /dev/null +++ b/bigquery/storage/managedwriter/adapt/schemaconversion_test.go @@ -0,0 +1,203 @@ +// Copyright 2021 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. + +package adapt + +import ( + "testing" + + "cloud.google.com/go/bigquery" + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2" + "google.golang.org/protobuf/testing/protocmp" +) + +func TestFieldConversions(t *testing.T) { + testCases := []struct { + desc string + bq *bigquery.FieldSchema + proto *storagepb.TableFieldSchema + }{ + { + desc: "nil", + bq: nil, + proto: nil, + }, + { + desc: "string field", + bq: &bigquery.FieldSchema{ + Name: "name", + Type: bigquery.StringFieldType, + Description: "description", + }, + proto: &storagepb.TableFieldSchema{ + Name: "name", + Type: storagepb.TableFieldSchema_STRING, + Description: "description", + Mode: storagepb.TableFieldSchema_NULLABLE, + }, + }, + { + desc: "required integer field", + bq: &bigquery.FieldSchema{ + Name: "name", + Type: bigquery.IntegerFieldType, + Description: "description", + Required: true, + }, + proto: &storagepb.TableFieldSchema{ + Name: "name", + Type: storagepb.TableFieldSchema_INT64, + Description: "description", + Mode: storagepb.TableFieldSchema_REQUIRED, + }, + }, + { + desc: "struct with repeated bytes subfield", + bq: &bigquery.FieldSchema{ + Name: "name", + Type: bigquery.RecordFieldType, + Description: "description", + Required: true, + Schema: bigquery.Schema{ + &bigquery.FieldSchema{ + Name: "inner1", + Repeated: true, + Description: "repeat", + Type: bigquery.BytesFieldType, + }, + }, + }, + proto: &storagepb.TableFieldSchema{ + Name: "name", + Type: storagepb.TableFieldSchema_STRUCT, + Description: "description", + Mode: storagepb.TableFieldSchema_REQUIRED, + Fields: []*storagepb.TableFieldSchema{ + { + Name: "inner1", + Mode: storagepb.TableFieldSchema_REPEATED, + Description: "repeat", + Type: storagepb.TableFieldSchema_BYTES, + }, + }, + }, + }, + } + + for _, tc := range testCases { + // first, bq to proto + converted, err := bqFieldToProto(tc.bq) + if err != nil { + t.Errorf("case (%s) failed conversion from bq: %v", tc.desc, err) + } + if diff := cmp.Diff(converted, tc.proto, protocmp.Transform()); diff != "" { + t.Errorf("conversion to proto diff (%s):\n%v", tc.desc, diff) + } + // reverse conversion, proto to bq + reverse, err := protoToBQField(tc.proto) + if err != nil { + t.Errorf("case (%s) failed conversion from proto: %v", tc.desc, err) + } + if diff := cmp.Diff(reverse, tc.bq); diff != "" { + t.Errorf("conversion to BQ diff (%s):\n%v", tc.desc, diff) + } + } +} + +func TestSchemaConversion(t *testing.T) { + + testCases := []struct { + description string + bqSchema bigquery.Schema + storageSchema *storagepb.TableSchema + }{ + { + description: "nil", + bqSchema: nil, + storageSchema: nil, + }, + { + description: "scalars", + bqSchema: bigquery.Schema{ + {Name: "f1", Type: bigquery.StringFieldType}, + {Name: "f2", Type: bigquery.IntegerFieldType}, + {Name: "f3", Type: bigquery.BooleanFieldType}, + }, + storageSchema: &storagepb.TableSchema{ + Fields: []*storagepb.TableFieldSchema{ + {Name: "f1", Type: storagepb.TableFieldSchema_STRING, Mode: storagepb.TableFieldSchema_NULLABLE}, + {Name: "f2", Type: storagepb.TableFieldSchema_INT64, Mode: storagepb.TableFieldSchema_NULLABLE}, + {Name: "f3", Type: storagepb.TableFieldSchema_BOOL, Mode: storagepb.TableFieldSchema_NULLABLE}, + }, + }, + }, + { + description: "array", + bqSchema: bigquery.Schema{ + {Name: "arr", Type: bigquery.NumericFieldType, Repeated: true}, + {Name: "big", Type: bigquery.BigNumericFieldType, Required: true}, + }, + storageSchema: &storagepb.TableSchema{ + Fields: []*storagepb.TableFieldSchema{ + {Name: "arr", Type: storagepb.TableFieldSchema_NUMERIC, Mode: storagepb.TableFieldSchema_REPEATED}, + {Name: "big", Type: storagepb.TableFieldSchema_BIGNUMERIC, Mode: storagepb.TableFieldSchema_REQUIRED}, + }, + }, + }, + { + description: "nested", + bqSchema: bigquery.Schema{ + {Name: "struct1", Type: bigquery.RecordFieldType, Schema: []*bigquery.FieldSchema{ + {Name: "leaf1", Type: bigquery.DateFieldType}, + {Name: "leaf2", Type: bigquery.DateTimeFieldType}, + }}, + {Name: "field2", Type: bigquery.StringFieldType}, + }, + storageSchema: &storagepb.TableSchema{ + Fields: []*storagepb.TableFieldSchema{ + {Name: "struct1", + Type: storagepb.TableFieldSchema_STRUCT, + Mode: storagepb.TableFieldSchema_NULLABLE, + Fields: []*storagepb.TableFieldSchema{ + {Name: "leaf1", Type: storagepb.TableFieldSchema_DATE, Mode: storagepb.TableFieldSchema_NULLABLE}, + {Name: "leaf2", Type: storagepb.TableFieldSchema_DATETIME, Mode: storagepb.TableFieldSchema_NULLABLE}, + }}, + {Name: "field2", Type: storagepb.TableFieldSchema_STRING, Mode: storagepb.TableFieldSchema_NULLABLE}, + }, + }, + }, + } + for _, tc := range testCases { + + // BQ -> Storage + storageS, err := BQSchemaToStorageTableSchema(tc.bqSchema) + if err != nil { + t.Errorf("BQSchemaToStorageTableSchema(%s): %v", tc.description, err) + } + if diff := testutil.Diff(storageS, tc.storageSchema); diff != "" { + t.Fatalf("BQSchemaToStorageTableSchema(%s): -got, +want:\n%s", tc.description, diff) + } + + // Storage -> BQ + bqS, err := StorageTableSchemaToBQSchema(tc.storageSchema) + if err != nil { + t.Errorf("StorageTableSchemaToBQSchema(%s): %v", tc.description, err) + } + if diff := testutil.Diff(bqS, tc.bqSchema); diff != "" { + t.Fatalf("StorageTableSchemaToBQSchema(%s): -got, +want:\n%s", tc.description, diff) + } + } +} diff --git a/bigquery/storage/managedwriter/doc.go b/bigquery/storage/managedwriter/doc.go new file mode 100644 index 000000000000..a8e580bd90cf --- /dev/null +++ b/bigquery/storage/managedwriter/doc.go @@ -0,0 +1,22 @@ +// Copyright 2021 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. + +// Package managedwriter will be a thick client around the storage API's BigQueryWriteClient. +// +// It is EXPERIMENTAL and subject to change or removal without notice. +// +// Currently, the BigQueryWriteClient this library targets is exposed in the storage v1beta2 endpoint, and is +// a successor to the streaming interface. API method tabledata.insertAll is the primary backend method, and +// the Inserter abstraction is the equivalent to this in the cloud.google.com/go/bigquery package. +package managedwriter From 729a517b16d93584b56ca0864de60f25f2a6a35a Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Thu, 1 Jul 2021 10:42:58 -0700 Subject: [PATCH 13/18] chore(internal): update microgen to v0.21.5 (#4368) --- internal/gapicgen/cmd/genbot/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/gapicgen/cmd/genbot/Dockerfile b/internal/gapicgen/cmd/genbot/Dockerfile index a63fd58728fd..faeffdd1d4a6 100644 --- a/internal/gapicgen/cmd/genbot/Dockerfile +++ b/internal/gapicgen/cmd/genbot/Dockerfile @@ -28,7 +28,7 @@ RUN GO111MODULE=on go get \ golang.org/x/lint/golint@latest \ golang.org/x/tools/cmd/goimports@latest \ honnef.co/go/tools/cmd/staticcheck@latest \ - github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic@v0.21.3 + github.com/googleapis/gapic-generator-go/cmd/protoc-gen-go_gapic@v0.21.5 ENV PATH="${PATH}:/root/go/bin" # Source: http://debuggable.com/posts/disable-strict-host-checking-for-git-clone:49896ff3-0ac0-4263-9703-1eae4834cda3 From 75e3d64018f31b85f31658e2be7fcbac01c63495 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Thu, 1 Jul 2021 14:46:06 -0500 Subject: [PATCH 14/18] chore(all): auto-regenerate gapics (#4369) This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/630 Changes: chore(datastream): Add package/namespace options for C#, Ruby and PHP. This is a breaking change *only* for those languages, and packages for those languages have not been published yet. PiperOrigin-RevId: 382509175 Source-Link: https://github.com/googleapis/googleapis/commit/0c62f63ad7ca987f1c22f524d6378cff29da8a33 --- compute/apiv1/accelerator_types_client.go | 341 ++ .../accelerator_types_client_example_test.go | 93 + compute/apiv1/addresses_client.go | 452 +++ .../apiv1/addresses_client_example_test.go | 131 + compute/apiv1/autoscalers_client.go | 580 +++ .../apiv1/autoscalers_client_example_test.go | 169 + compute/apiv1/backend_buckets_client.go | 620 +++ .../backend_buckets_client_example_test.go | 188 + compute/apiv1/backend_services_client.go | 809 ++++ .../backend_services_client_example_test.go | 245 ++ compute/apiv1/disk_types_client.go | 337 ++ .../apiv1/disk_types_client_example_test.go | 93 + compute/apiv1/disks_client.go | 907 +++++ compute/apiv1/disks_client_example_test.go | 283 ++ compute/apiv1/doc.go | 118 + compute/apiv1/external_vpn_gateways_client.go | 482 +++ ...ternal_vpn_gateways_client_example_test.go | 150 + compute/apiv1/firewall_policies_client.go | 1194 ++++++ .../firewall_policies_client_example_test.go | 378 ++ compute/apiv1/firewalls_client.go | 502 +++ .../apiv1/firewalls_client_example_test.go | 150 + compute/apiv1/forwarding_rules_client.go | 626 +++ .../forwarding_rules_client_example_test.go | 188 + compute/apiv1/gapic_metadata.json | 3581 +++++++++++++++++ compute/apiv1/global_addresses_client.go | 380 ++ .../global_addresses_client_example_test.go | 112 + .../apiv1/global_forwarding_rules_client.go | 547 +++ ...al_forwarding_rules_client_example_test.go | 169 + .../global_network_endpoint_groups_client.go | 565 +++ ...ork_endpoint_groups_client_example_test.go | 169 + compute/apiv1/global_operations_client.go | 449 +++ .../global_operations_client_example_test.go | 131 + .../global_organization_operations_client.go | 332 ++ ...nization_operations_client_example_test.go | 93 + ...global_public_delegated_prefixes_client.go | 438 ++ ..._delegated_prefixes_client_example_test.go | 131 + compute/apiv1/health_checks_client.go | 574 +++ .../health_checks_client_example_test.go | 169 + compute/apiv1/images_client.go | 763 ++++ compute/apiv1/images_client_example_test.go | 245 ++ .../apiv1/instance_group_managers_client.go | 1387 +++++++ ...ance_group_managers_client_example_test.go | 416 ++ compute/apiv1/instance_groups_client.go | 708 ++++ .../instance_groups_client_example_test.go | 207 + compute/apiv1/instance_templates_client.go | 539 +++ .../instance_templates_client_example_test.go | 169 + compute/apiv1/instances_client.go | 2614 ++++++++++++ .../apiv1/instances_client_example_test.go | 834 ++++ .../apiv1/interconnect_attachments_client.go | 513 +++ ...connect_attachments_client_example_test.go | 150 + .../apiv1/interconnect_locations_client.go | 265 ++ ...erconnect_locations_client_example_test.go | 74 + compute/apiv1/interconnects_client.go | 488 +++ .../interconnects_client_example_test.go | 150 + compute/apiv1/license_codes_client.go | 247 ++ .../license_codes_client_example_test.go | 74 + compute/apiv1/licenses_client.go | 539 +++ compute/apiv1/licenses_client_example_test.go | 169 + compute/apiv1/machine_types_client.go | 337 ++ .../machine_types_client_example_test.go | 93 + .../apiv1/network_endpoint_groups_client.go | 689 ++++ ...ork_endpoint_groups_client_example_test.go | 207 + compute/apiv1/networks_client.go | 797 ++++ compute/apiv1/networks_client_example_test.go | 245 ++ compute/apiv1/node_groups_client.go | 915 +++++ .../apiv1/node_groups_client_example_test.go | 283 ++ compute/apiv1/node_templates_client.go | 611 +++ .../node_templates_client_example_test.go | 188 + compute/apiv1/node_types_client.go | 337 ++ .../apiv1/node_types_client_example_test.go | 93 + compute/apiv1/packet_mirrorings_client.go | 561 +++ .../packet_mirrorings_client_example_test.go | 169 + compute/apiv1/projects_client.go | 905 +++++ compute/apiv1/projects_client_example_test.go | 283 ++ .../public_advertised_prefixes_client.go | 438 ++ ...advertised_prefixes_client_example_test.go | 131 + .../apiv1/public_delegated_prefixes_client.go | 510 +++ ..._delegated_prefixes_client_example_test.go | 150 + compute/apiv1/region_autoscalers_client.go | 508 +++ .../region_autoscalers_client_example_test.go | 150 + .../apiv1/region_backend_services_client.go | 556 +++ ...on_backend_services_client_example_test.go | 169 + compute/apiv1/region_commitments_client.go | 395 ++ .../region_commitments_client_example_test.go | 112 + compute/apiv1/region_disk_types_client.go | 265 ++ .../region_disk_types_client_example_test.go | 74 + compute/apiv1/region_disks_client.go | 832 ++++ .../apiv1/region_disks_client_example_test.go | 264 ++ .../region_health_check_services_client.go | 438 ++ ...alth_check_services_client_example_test.go | 131 + compute/apiv1/region_health_checks_client.go | 505 +++ ...egion_health_checks_client_example_test.go | 150 + .../region_instance_group_managers_client.go | 1307 ++++++ ...ance_group_managers_client_example_test.go | 397 ++ .../apiv1/region_instance_groups_client.go | 393 ++ ...ion_instance_groups_client_example_test.go | 112 + compute/apiv1/region_instances_client.go | 204 + .../region_instances_client_example_test.go | 55 + .../region_network_endpoint_groups_client.go | 380 ++ ...ork_endpoint_groups_client_example_test.go | 112 + .../region_notification_endpoints_client.go | 380 ++ ...ification_endpoints_client_example_test.go | 112 + compute/apiv1/region_operations_client.go | 377 ++ .../region_operations_client_example_test.go | 112 + .../apiv1/region_ssl_certificates_client.go | 380 ++ ...on_ssl_certificates_client_example_test.go | 112 + .../region_target_http_proxies_client.go | 438 ++ ...target_http_proxies_client_example_test.go | 131 + .../region_target_https_proxies_client.go | 496 +++ ...arget_https_proxies_client_example_test.go | 150 + compute/apiv1/region_url_maps_client.go | 556 +++ .../region_url_maps_client_example_test.go | 169 + compute/apiv1/regions_client.go | 265 ++ compute/apiv1/regions_client_example_test.go | 74 + compute/apiv1/reservations_client.go | 669 +++ .../apiv1/reservations_client_example_test.go | 207 + compute/apiv1/resource_policies_client.go | 611 +++ .../resource_policies_client_example_test.go | 188 + compute/apiv1/routers_client.go | 747 ++++ compute/apiv1/routers_client_example_test.go | 226 ++ compute/apiv1/routes_client.go | 380 ++ compute/apiv1/routes_client_example_test.go | 112 + compute/apiv1/security_policies_client.go | 730 ++++ .../security_policies_client_example_test.go | 226 ++ compute/apiv1/snapshots_client.go | 536 +++ .../apiv1/snapshots_client_example_test.go | 169 + compute/apiv1/ssl_certificates_client.go | 452 +++ .../ssl_certificates_client_example_test.go | 131 + compute/apiv1/ssl_policies_client.go | 507 +++ .../apiv1/ssl_policies_client_example_test.go | 150 + compute/apiv1/subnetworks_client.go | 857 ++++ .../apiv1/subnetworks_client_example_test.go | 264 ++ compute/apiv1/target_grpc_proxies_client.go | 438 ++ ...target_grpc_proxies_client_example_test.go | 131 + compute/apiv1/target_http_proxies_client.go | 568 +++ ...target_http_proxies_client_example_test.go | 169 + compute/apiv1/target_https_proxies_client.go | 742 ++++ ...arget_https_proxies_client_example_test.go | 226 ++ compute/apiv1/target_instances_client.go | 452 +++ .../target_instances_client_example_test.go | 131 + compute/apiv1/target_pools_client.go | 796 ++++ .../apiv1/target_pools_client_example_test.go | 245 ++ compute/apiv1/target_ssl_proxies_client.go | 612 +++ .../target_ssl_proxies_client_example_test.go | 188 + compute/apiv1/target_tcp_proxies_client.go | 496 +++ .../target_tcp_proxies_client_example_test.go | 150 + compute/apiv1/target_vpn_gateways_client.go | 452 +++ ...target_vpn_gateways_client_example_test.go | 131 + compute/apiv1/url_maps_client.go | 687 ++++ compute/apiv1/url_maps_client_example_test.go | 207 + compute/apiv1/vpn_gateways_client.go | 611 +++ .../apiv1/vpn_gateways_client_example_test.go | 188 + compute/apiv1/vpn_tunnels_client.go | 452 +++ .../apiv1/vpn_tunnels_client_example_test.go | 131 + compute/apiv1/zone_operations_client.go | 377 ++ .../zone_operations_client_example_test.go | 112 + compute/apiv1/zones_client.go | 265 ++ compute/apiv1/zones_client_example_test.go | 74 + internal/.repo-metadata-full.json | 9 + 159 files changed, 62832 insertions(+) create mode 100644 compute/apiv1/accelerator_types_client.go create mode 100644 compute/apiv1/accelerator_types_client_example_test.go create mode 100644 compute/apiv1/addresses_client.go create mode 100644 compute/apiv1/addresses_client_example_test.go create mode 100644 compute/apiv1/autoscalers_client.go create mode 100644 compute/apiv1/autoscalers_client_example_test.go create mode 100644 compute/apiv1/backend_buckets_client.go create mode 100644 compute/apiv1/backend_buckets_client_example_test.go create mode 100644 compute/apiv1/backend_services_client.go create mode 100644 compute/apiv1/backend_services_client_example_test.go create mode 100644 compute/apiv1/disk_types_client.go create mode 100644 compute/apiv1/disk_types_client_example_test.go create mode 100644 compute/apiv1/disks_client.go create mode 100644 compute/apiv1/disks_client_example_test.go create mode 100644 compute/apiv1/doc.go create mode 100644 compute/apiv1/external_vpn_gateways_client.go create mode 100644 compute/apiv1/external_vpn_gateways_client_example_test.go create mode 100644 compute/apiv1/firewall_policies_client.go create mode 100644 compute/apiv1/firewall_policies_client_example_test.go create mode 100644 compute/apiv1/firewalls_client.go create mode 100644 compute/apiv1/firewalls_client_example_test.go create mode 100644 compute/apiv1/forwarding_rules_client.go create mode 100644 compute/apiv1/forwarding_rules_client_example_test.go create mode 100644 compute/apiv1/gapic_metadata.json create mode 100644 compute/apiv1/global_addresses_client.go create mode 100644 compute/apiv1/global_addresses_client_example_test.go create mode 100644 compute/apiv1/global_forwarding_rules_client.go create mode 100644 compute/apiv1/global_forwarding_rules_client_example_test.go create mode 100644 compute/apiv1/global_network_endpoint_groups_client.go create mode 100644 compute/apiv1/global_network_endpoint_groups_client_example_test.go create mode 100644 compute/apiv1/global_operations_client.go create mode 100644 compute/apiv1/global_operations_client_example_test.go create mode 100644 compute/apiv1/global_organization_operations_client.go create mode 100644 compute/apiv1/global_organization_operations_client_example_test.go create mode 100644 compute/apiv1/global_public_delegated_prefixes_client.go create mode 100644 compute/apiv1/global_public_delegated_prefixes_client_example_test.go create mode 100644 compute/apiv1/health_checks_client.go create mode 100644 compute/apiv1/health_checks_client_example_test.go create mode 100644 compute/apiv1/images_client.go create mode 100644 compute/apiv1/images_client_example_test.go create mode 100644 compute/apiv1/instance_group_managers_client.go create mode 100644 compute/apiv1/instance_group_managers_client_example_test.go create mode 100644 compute/apiv1/instance_groups_client.go create mode 100644 compute/apiv1/instance_groups_client_example_test.go create mode 100644 compute/apiv1/instance_templates_client.go create mode 100644 compute/apiv1/instance_templates_client_example_test.go create mode 100644 compute/apiv1/instances_client.go create mode 100644 compute/apiv1/instances_client_example_test.go create mode 100644 compute/apiv1/interconnect_attachments_client.go create mode 100644 compute/apiv1/interconnect_attachments_client_example_test.go create mode 100644 compute/apiv1/interconnect_locations_client.go create mode 100644 compute/apiv1/interconnect_locations_client_example_test.go create mode 100644 compute/apiv1/interconnects_client.go create mode 100644 compute/apiv1/interconnects_client_example_test.go create mode 100644 compute/apiv1/license_codes_client.go create mode 100644 compute/apiv1/license_codes_client_example_test.go create mode 100644 compute/apiv1/licenses_client.go create mode 100644 compute/apiv1/licenses_client_example_test.go create mode 100644 compute/apiv1/machine_types_client.go create mode 100644 compute/apiv1/machine_types_client_example_test.go create mode 100644 compute/apiv1/network_endpoint_groups_client.go create mode 100644 compute/apiv1/network_endpoint_groups_client_example_test.go create mode 100644 compute/apiv1/networks_client.go create mode 100644 compute/apiv1/networks_client_example_test.go create mode 100644 compute/apiv1/node_groups_client.go create mode 100644 compute/apiv1/node_groups_client_example_test.go create mode 100644 compute/apiv1/node_templates_client.go create mode 100644 compute/apiv1/node_templates_client_example_test.go create mode 100644 compute/apiv1/node_types_client.go create mode 100644 compute/apiv1/node_types_client_example_test.go create mode 100644 compute/apiv1/packet_mirrorings_client.go create mode 100644 compute/apiv1/packet_mirrorings_client_example_test.go create mode 100644 compute/apiv1/projects_client.go create mode 100644 compute/apiv1/projects_client_example_test.go create mode 100644 compute/apiv1/public_advertised_prefixes_client.go create mode 100644 compute/apiv1/public_advertised_prefixes_client_example_test.go create mode 100644 compute/apiv1/public_delegated_prefixes_client.go create mode 100644 compute/apiv1/public_delegated_prefixes_client_example_test.go create mode 100644 compute/apiv1/region_autoscalers_client.go create mode 100644 compute/apiv1/region_autoscalers_client_example_test.go create mode 100644 compute/apiv1/region_backend_services_client.go create mode 100644 compute/apiv1/region_backend_services_client_example_test.go create mode 100644 compute/apiv1/region_commitments_client.go create mode 100644 compute/apiv1/region_commitments_client_example_test.go create mode 100644 compute/apiv1/region_disk_types_client.go create mode 100644 compute/apiv1/region_disk_types_client_example_test.go create mode 100644 compute/apiv1/region_disks_client.go create mode 100644 compute/apiv1/region_disks_client_example_test.go create mode 100644 compute/apiv1/region_health_check_services_client.go create mode 100644 compute/apiv1/region_health_check_services_client_example_test.go create mode 100644 compute/apiv1/region_health_checks_client.go create mode 100644 compute/apiv1/region_health_checks_client_example_test.go create mode 100644 compute/apiv1/region_instance_group_managers_client.go create mode 100644 compute/apiv1/region_instance_group_managers_client_example_test.go create mode 100644 compute/apiv1/region_instance_groups_client.go create mode 100644 compute/apiv1/region_instance_groups_client_example_test.go create mode 100644 compute/apiv1/region_instances_client.go create mode 100644 compute/apiv1/region_instances_client_example_test.go create mode 100644 compute/apiv1/region_network_endpoint_groups_client.go create mode 100644 compute/apiv1/region_network_endpoint_groups_client_example_test.go create mode 100644 compute/apiv1/region_notification_endpoints_client.go create mode 100644 compute/apiv1/region_notification_endpoints_client_example_test.go create mode 100644 compute/apiv1/region_operations_client.go create mode 100644 compute/apiv1/region_operations_client_example_test.go create mode 100644 compute/apiv1/region_ssl_certificates_client.go create mode 100644 compute/apiv1/region_ssl_certificates_client_example_test.go create mode 100644 compute/apiv1/region_target_http_proxies_client.go create mode 100644 compute/apiv1/region_target_http_proxies_client_example_test.go create mode 100644 compute/apiv1/region_target_https_proxies_client.go create mode 100644 compute/apiv1/region_target_https_proxies_client_example_test.go create mode 100644 compute/apiv1/region_url_maps_client.go create mode 100644 compute/apiv1/region_url_maps_client_example_test.go create mode 100644 compute/apiv1/regions_client.go create mode 100644 compute/apiv1/regions_client_example_test.go create mode 100644 compute/apiv1/reservations_client.go create mode 100644 compute/apiv1/reservations_client_example_test.go create mode 100644 compute/apiv1/resource_policies_client.go create mode 100644 compute/apiv1/resource_policies_client_example_test.go create mode 100644 compute/apiv1/routers_client.go create mode 100644 compute/apiv1/routers_client_example_test.go create mode 100644 compute/apiv1/routes_client.go create mode 100644 compute/apiv1/routes_client_example_test.go create mode 100644 compute/apiv1/security_policies_client.go create mode 100644 compute/apiv1/security_policies_client_example_test.go create mode 100644 compute/apiv1/snapshots_client.go create mode 100644 compute/apiv1/snapshots_client_example_test.go create mode 100644 compute/apiv1/ssl_certificates_client.go create mode 100644 compute/apiv1/ssl_certificates_client_example_test.go create mode 100644 compute/apiv1/ssl_policies_client.go create mode 100644 compute/apiv1/ssl_policies_client_example_test.go create mode 100644 compute/apiv1/subnetworks_client.go create mode 100644 compute/apiv1/subnetworks_client_example_test.go create mode 100644 compute/apiv1/target_grpc_proxies_client.go create mode 100644 compute/apiv1/target_grpc_proxies_client_example_test.go create mode 100644 compute/apiv1/target_http_proxies_client.go create mode 100644 compute/apiv1/target_http_proxies_client_example_test.go create mode 100644 compute/apiv1/target_https_proxies_client.go create mode 100644 compute/apiv1/target_https_proxies_client_example_test.go create mode 100644 compute/apiv1/target_instances_client.go create mode 100644 compute/apiv1/target_instances_client_example_test.go create mode 100644 compute/apiv1/target_pools_client.go create mode 100644 compute/apiv1/target_pools_client_example_test.go create mode 100644 compute/apiv1/target_ssl_proxies_client.go create mode 100644 compute/apiv1/target_ssl_proxies_client_example_test.go create mode 100644 compute/apiv1/target_tcp_proxies_client.go create mode 100644 compute/apiv1/target_tcp_proxies_client_example_test.go create mode 100644 compute/apiv1/target_vpn_gateways_client.go create mode 100644 compute/apiv1/target_vpn_gateways_client_example_test.go create mode 100644 compute/apiv1/url_maps_client.go create mode 100644 compute/apiv1/url_maps_client_example_test.go create mode 100644 compute/apiv1/vpn_gateways_client.go create mode 100644 compute/apiv1/vpn_gateways_client_example_test.go create mode 100644 compute/apiv1/vpn_tunnels_client.go create mode 100644 compute/apiv1/vpn_tunnels_client_example_test.go create mode 100644 compute/apiv1/zone_operations_client.go create mode 100644 compute/apiv1/zone_operations_client_example_test.go create mode 100644 compute/apiv1/zones_client.go create mode 100644 compute/apiv1/zones_client_example_test.go diff --git a/compute/apiv1/accelerator_types_client.go b/compute/apiv1/accelerator_types_client.go new file mode 100644 index 000000000000..ebb96df0ed2c --- /dev/null +++ b/compute/apiv1/accelerator_types_client.go @@ -0,0 +1,341 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newAcceleratorTypesClientHook clientHook + +// AcceleratorTypesCallOptions contains the retry settings for each method of AcceleratorTypesClient. +type AcceleratorTypesCallOptions struct { + AggregatedList []gax.CallOption + Get []gax.CallOption + List []gax.CallOption +} + +// internalAcceleratorTypesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalAcceleratorTypesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListAcceleratorTypesRequest, ...gax.CallOption) (*computepb.AcceleratorTypeAggregatedList, error) + Get(context.Context, *computepb.GetAcceleratorTypeRequest, ...gax.CallOption) (*computepb.AcceleratorType, error) + List(context.Context, *computepb.ListAcceleratorTypesRequest, ...gax.CallOption) (*computepb.AcceleratorTypeList, error) +} + +// AcceleratorTypesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Services +// +// The AcceleratorTypes API. +type AcceleratorTypesClient struct { + // The internal transport-dependent client. + internalClient internalAcceleratorTypesClient + + // The call options for this service. + CallOptions *AcceleratorTypesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AcceleratorTypesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *AcceleratorTypesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *AcceleratorTypesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of accelerator types. +func (c *AcceleratorTypesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Get returns the specified accelerator type. +func (c *AcceleratorTypesClient) Get(ctx context.Context, req *computepb.GetAcceleratorTypeRequest, opts ...gax.CallOption) (*computepb.AcceleratorType, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of accelerator types that are available to the specified project. +func (c *AcceleratorTypesClient) List(ctx context.Context, req *computepb.ListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type acceleratorTypesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAcceleratorTypesRESTClient creates a new accelerator types rest client. +// +// Services +// +// The AcceleratorTypes API. +func NewAcceleratorTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*AcceleratorTypesClient, error) { + clientOpts := append(defaultAcceleratorTypesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &acceleratorTypesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &AcceleratorTypesClient{internalClient: c, CallOptions: &AcceleratorTypesCallOptions{}}, nil +} + +func defaultAcceleratorTypesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *acceleratorTypesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *acceleratorTypesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *acceleratorTypesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of accelerator types. +func (c *acceleratorTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/acceleratorTypes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AcceleratorTypeAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified accelerator type. +func (c *acceleratorTypesRESTClient) Get(ctx context.Context, req *computepb.GetAcceleratorTypeRequest, opts ...gax.CallOption) (*computepb.AcceleratorType, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/acceleratorTypes/%v", req.GetProject(), req.GetZone(), req.GetAcceleratorType()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AcceleratorType{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of accelerator types that are available to the specified project. +func (c *acceleratorTypesRESTClient) List(ctx context.Context, req *computepb.ListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/acceleratorTypes", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AcceleratorTypeList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/accelerator_types_client_example_test.go b/compute/apiv1/accelerator_types_client_example_test.go new file mode 100644 index 000000000000..ddb62c81c7ca --- /dev/null +++ b/compute/apiv1/accelerator_types_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewAcceleratorTypesRESTClient() { + ctx := context.Background() + c, err := compute.NewAcceleratorTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleAcceleratorTypesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewAcceleratorTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListAcceleratorTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAcceleratorTypesClient_Get() { + ctx := context.Background() + c, err := compute.NewAcceleratorTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetAcceleratorTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAcceleratorTypesClient_List() { + ctx := context.Background() + c, err := compute.NewAcceleratorTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListAcceleratorTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/addresses_client.go b/compute/apiv1/addresses_client.go new file mode 100644 index 000000000000..023436436bde --- /dev/null +++ b/compute/apiv1/addresses_client.go @@ -0,0 +1,452 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newAddressesClientHook clientHook + +// AddressesCallOptions contains the retry settings for each method of AddressesClient. +type AddressesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalAddressesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalAddressesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListAddressesRequest, ...gax.CallOption) (*computepb.AddressAggregatedList, error) + Delete(context.Context, *computepb.DeleteAddressRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetAddressRequest, ...gax.CallOption) (*computepb.Address, error) + Insert(context.Context, *computepb.InsertAddressRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListAddressesRequest, ...gax.CallOption) (*computepb.AddressList, error) +} + +// AddressesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Addresses API. +type AddressesClient struct { + // The internal transport-dependent client. + internalClient internalAddressesClient + + // The call options for this service. + CallOptions *AddressesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AddressesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *AddressesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *AddressesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of addresses. +func (c *AddressesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified address resource. +func (c *AddressesClient) Delete(ctx context.Context, req *computepb.DeleteAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified address resource. +func (c *AddressesClient) Get(ctx context.Context, req *computepb.GetAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an address resource in the specified project by using the data included in the request. +func (c *AddressesClient) Insert(ctx context.Context, req *computepb.InsertAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of addresses contained within the specified region. +func (c *AddressesClient) List(ctx context.Context, req *computepb.ListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type addressesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAddressesRESTClient creates a new addresses rest client. +// +// The Addresses API. +func NewAddressesRESTClient(ctx context.Context, opts ...option.ClientOption) (*AddressesClient, error) { + clientOpts := append(defaultAddressesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &addressesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &AddressesClient{internalClient: c, CallOptions: &AddressesCallOptions{}}, nil +} + +func defaultAddressesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *addressesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *addressesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *addressesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of addresses. +func (c *addressesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/addresses", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AddressAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified address resource. +func (c *addressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses/%v", req.GetProject(), req.GetRegion(), req.GetAddress()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified address resource. +func (c *addressesRESTClient) Get(ctx context.Context, req *computepb.GetAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses/%v", req.GetProject(), req.GetRegion(), req.GetAddress()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Address{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an address resource in the specified project by using the data included in the request. +func (c *addressesRESTClient) Insert(ctx context.Context, req *computepb.InsertAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAddressResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of addresses contained within the specified region. +func (c *addressesRESTClient) List(ctx context.Context, req *computepb.ListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AddressList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/addresses_client_example_test.go b/compute/apiv1/addresses_client_example_test.go new file mode 100644 index 000000000000..8349df07d7b3 --- /dev/null +++ b/compute/apiv1/addresses_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewAddressesRESTClient() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleAddressesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListAddressesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAddressesClient_Delete() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAddressesClient_Get() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAddressesClient_Insert() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAddressesClient_List() { + ctx := context.Background() + c, err := compute.NewAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListAddressesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/autoscalers_client.go b/compute/apiv1/autoscalers_client.go new file mode 100644 index 000000000000..771438a92849 --- /dev/null +++ b/compute/apiv1/autoscalers_client.go @@ -0,0 +1,580 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newAutoscalersClientHook clientHook + +// AutoscalersCallOptions contains the retry settings for each method of AutoscalersClient. +type AutoscalersCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalAutoscalersClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalAutoscalersClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListAutoscalersRequest, ...gax.CallOption) (*computepb.AutoscalerAggregatedList, error) + Delete(context.Context, *computepb.DeleteAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetAutoscalerRequest, ...gax.CallOption) (*computepb.Autoscaler, error) + Insert(context.Context, *computepb.InsertAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListAutoscalersRequest, ...gax.CallOption) (*computepb.AutoscalerList, error) + Patch(context.Context, *computepb.PatchAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// AutoscalersClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Autoscalers API. +type AutoscalersClient struct { + // The internal transport-dependent client. + internalClient internalAutoscalersClient + + // The call options for this service. + CallOptions *AutoscalersCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AutoscalersClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *AutoscalersClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *AutoscalersClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of autoscalers. +func (c *AutoscalersClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified autoscaler. +func (c *AutoscalersClient) Delete(ctx context.Context, req *computepb.DeleteAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified autoscaler resource. Gets a list of available autoscalers by making a list() request. +func (c *AutoscalersClient) Get(ctx context.Context, req *computepb.GetAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an autoscaler in the specified project using the data included in the request. +func (c *AutoscalersClient) Insert(ctx context.Context, req *computepb.InsertAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of autoscalers contained within the specified zone. +func (c *AutoscalersClient) List(ctx context.Context, req *computepb.ListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *AutoscalersClient) Patch(ctx context.Context, req *computepb.PatchAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates an autoscaler in the specified project using the data included in the request. +func (c *AutoscalersClient) Update(ctx context.Context, req *computepb.UpdateAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type autoscalersRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAutoscalersRESTClient creates a new autoscalers rest client. +// +// The Autoscalers API. +func NewAutoscalersRESTClient(ctx context.Context, opts ...option.ClientOption) (*AutoscalersClient, error) { + clientOpts := append(defaultAutoscalersRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &autoscalersRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &AutoscalersClient{internalClient: c, CallOptions: &AutoscalersCallOptions{}}, nil +} + +func defaultAutoscalersRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *autoscalersRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *autoscalersRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *autoscalersRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of autoscalers. +func (c *autoscalersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/autoscalers", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AutoscalerAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified autoscaler. +func (c *autoscalersRESTClient) Delete(ctx context.Context, req *computepb.DeleteAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers/%v", req.GetProject(), req.GetZone(), req.GetAutoscaler()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified autoscaler resource. Gets a list of available autoscalers by making a list() request. +func (c *autoscalersRESTClient) Get(ctx context.Context, req *computepb.GetAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers/%v", req.GetProject(), req.GetZone(), req.GetAutoscaler()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Autoscaler{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an autoscaler in the specified project using the data included in the request. +func (c *autoscalersRESTClient) Insert(ctx context.Context, req *computepb.InsertAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of autoscalers contained within the specified zone. +func (c *autoscalersRESTClient) List(ctx context.Context, req *computepb.ListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AutoscalerList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *autoscalersRESTClient) Patch(ctx context.Context, req *computepb.PatchAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Autoscaler != nil { + params.Add("autoscaler", fmt.Sprintf("%v", req.GetAutoscaler())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates an autoscaler in the specified project using the data included in the request. +func (c *autoscalersRESTClient) Update(ctx context.Context, req *computepb.UpdateAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req != nil && req.Autoscaler != nil { + params.Add("autoscaler", fmt.Sprintf("%v", req.GetAutoscaler())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetZone() != "" { + params.Add("zone", fmt.Sprintf("%v", req.GetZone())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/autoscalers_client_example_test.go b/compute/apiv1/autoscalers_client_example_test.go new file mode 100644 index 000000000000..48fa08ea6595 --- /dev/null +++ b/compute/apiv1/autoscalers_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewAutoscalersRESTClient() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleAutoscalersClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListAutoscalersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_Delete() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_Get() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_Insert() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_List() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListAutoscalersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_Patch() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAutoscalersClient_Update() { + ctx := context.Background() + c, err := compute.NewAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/backend_buckets_client.go b/compute/apiv1/backend_buckets_client.go new file mode 100644 index 000000000000..89286c9d461f --- /dev/null +++ b/compute/apiv1/backend_buckets_client.go @@ -0,0 +1,620 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newBackendBucketsClientHook clientHook + +// BackendBucketsCallOptions contains the retry settings for each method of BackendBucketsClient. +type BackendBucketsCallOptions struct { + AddSignedUrlKey []gax.CallOption + Delete []gax.CallOption + DeleteSignedUrlKey []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalBackendBucketsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalBackendBucketsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddSignedUrlKey(context.Context, *computepb.AddSignedUrlKeyBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteSignedUrlKey(context.Context, *computepb.DeleteSignedUrlKeyBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetBackendBucketRequest, ...gax.CallOption) (*computepb.BackendBucket, error) + Insert(context.Context, *computepb.InsertBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListBackendBucketsRequest, ...gax.CallOption) (*computepb.BackendBucketList, error) + Patch(context.Context, *computepb.PatchBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateBackendBucketRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// BackendBucketsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The BackendBuckets API. +type BackendBucketsClient struct { + // The internal transport-dependent client. + internalClient internalBackendBucketsClient + + // The call options for this service. + CallOptions *BackendBucketsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *BackendBucketsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *BackendBucketsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *BackendBucketsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddSignedUrlKey adds a key for validating requests with signed URLs for this backend bucket. +func (c *BackendBucketsClient) AddSignedUrlKey(ctx context.Context, req *computepb.AddSignedUrlKeyBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddSignedUrlKey(ctx, req, opts...) +} + +// Delete deletes the specified BackendBucket resource. +func (c *BackendBucketsClient) Delete(ctx context.Context, req *computepb.DeleteBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend bucket. +func (c *BackendBucketsClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteSignedUrlKey(ctx, req, opts...) +} + +// Get returns the specified BackendBucket resource. Gets a list of available backend buckets by making a list() request. +func (c *BackendBucketsClient) Get(ctx context.Context, req *computepb.GetBackendBucketRequest, opts ...gax.CallOption) (*computepb.BackendBucket, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a BackendBucket resource in the specified project using the data included in the request. +func (c *BackendBucketsClient) Insert(ctx context.Context, req *computepb.InsertBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of BackendBucket resources available to the specified project. +func (c *BackendBucketsClient) List(ctx context.Context, req *computepb.ListBackendBucketsRequest, opts ...gax.CallOption) (*computepb.BackendBucketList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *BackendBucketsClient) Patch(ctx context.Context, req *computepb.PatchBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates the specified BackendBucket resource with the data included in the request. +func (c *BackendBucketsClient) Update(ctx context.Context, req *computepb.UpdateBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type backendBucketsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewBackendBucketsRESTClient creates a new backend buckets rest client. +// +// The BackendBuckets API. +func NewBackendBucketsRESTClient(ctx context.Context, opts ...option.ClientOption) (*BackendBucketsClient, error) { + clientOpts := append(defaultBackendBucketsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &backendBucketsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &BackendBucketsClient{internalClient: c, CallOptions: &BackendBucketsCallOptions{}}, nil +} + +func defaultBackendBucketsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *backendBucketsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *backendBucketsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *backendBucketsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddSignedUrlKey adds a key for validating requests with signed URLs for this backend bucket. +func (c *backendBucketsRESTClient) AddSignedUrlKey(ctx context.Context, req *computepb.AddSignedUrlKeyBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSignedUrlKeyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v/addSignedUrlKey", req.GetProject(), req.GetBackendBucket()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified BackendBucket resource. +func (c *backendBucketsRESTClient) Delete(ctx context.Context, req *computepb.DeleteBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v", req.GetProject(), req.GetBackendBucket()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend bucket. +func (c *backendBucketsRESTClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v/deleteSignedUrlKey", req.GetProject(), req.GetBackendBucket()) + + params := url.Values{} + if req.GetKeyName() != "" { + params.Add("keyName", fmt.Sprintf("%v", req.GetKeyName())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified BackendBucket resource. Gets a list of available backend buckets by making a list() request. +func (c *backendBucketsRESTClient) Get(ctx context.Context, req *computepb.GetBackendBucketRequest, opts ...gax.CallOption) (*computepb.BackendBucket, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v", req.GetProject(), req.GetBackendBucket()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendBucket{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a BackendBucket resource in the specified project using the data included in the request. +func (c *backendBucketsRESTClient) Insert(ctx context.Context, req *computepb.InsertBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendBucketResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of BackendBucket resources available to the specified project. +func (c *backendBucketsRESTClient) List(ctx context.Context, req *computepb.ListBackendBucketsRequest, opts ...gax.CallOption) (*computepb.BackendBucketList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendBucketList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *backendBucketsRESTClient) Patch(ctx context.Context, req *computepb.PatchBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendBucketResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v", req.GetProject(), req.GetBackendBucket()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified BackendBucket resource with the data included in the request. +func (c *backendBucketsRESTClient) Update(ctx context.Context, req *computepb.UpdateBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendBucketResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetBackendBucket() != "" { + params.Add("backendBucket", fmt.Sprintf("%v", req.GetBackendBucket())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/backend_buckets_client_example_test.go b/compute/apiv1/backend_buckets_client_example_test.go new file mode 100644 index 000000000000..1a7f35265062 --- /dev/null +++ b/compute/apiv1/backend_buckets_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewBackendBucketsRESTClient() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleBackendBucketsClient_AddSignedUrlKey() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddSignedUrlKeyBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddSignedUrlKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_Delete() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_DeleteSignedUrlKey() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSignedUrlKeyBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteSignedUrlKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_Get() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_Insert() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_List() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListBackendBucketsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_Patch() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendBucketsClient_Update() { + ctx := context.Background() + c, err := compute.NewBackendBucketsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateBackendBucketRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/backend_services_client.go b/compute/apiv1/backend_services_client.go new file mode 100644 index 000000000000..b6dc5e585b49 --- /dev/null +++ b/compute/apiv1/backend_services_client.go @@ -0,0 +1,809 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newBackendServicesClientHook clientHook + +// BackendServicesCallOptions contains the retry settings for each method of BackendServicesClient. +type BackendServicesCallOptions struct { + AddSignedUrlKey []gax.CallOption + AggregatedList []gax.CallOption + Delete []gax.CallOption + DeleteSignedUrlKey []gax.CallOption + Get []gax.CallOption + GetHealth []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetSecurityPolicy []gax.CallOption + Update []gax.CallOption +} + +// internalBackendServicesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalBackendServicesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddSignedUrlKey(context.Context, *computepb.AddSignedUrlKeyBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListBackendServicesRequest, ...gax.CallOption) (*computepb.BackendServiceAggregatedList, error) + Delete(context.Context, *computepb.DeleteBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteSignedUrlKey(context.Context, *computepb.DeleteSignedUrlKeyBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetBackendServiceRequest, ...gax.CallOption) (*computepb.BackendService, error) + GetHealth(context.Context, *computepb.GetHealthBackendServiceRequest, ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) + Insert(context.Context, *computepb.InsertBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListBackendServicesRequest, ...gax.CallOption) (*computepb.BackendServiceList, error) + Patch(context.Context, *computepb.PatchBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetSecurityPolicy(context.Context, *computepb.SetSecurityPolicyBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// BackendServicesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The BackendServices API. +type BackendServicesClient struct { + // The internal transport-dependent client. + internalClient internalBackendServicesClient + + // The call options for this service. + CallOptions *BackendServicesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *BackendServicesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *BackendServicesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *BackendServicesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddSignedUrlKey adds a key for validating requests with signed URLs for this backend service. +func (c *BackendServicesClient) AddSignedUrlKey(ctx context.Context, req *computepb.AddSignedUrlKeyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddSignedUrlKey(ctx, req, opts...) +} + +// AggregatedList retrieves the list of all BackendService resources, regional and global, available to the specified project. +func (c *BackendServicesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified BackendService resource. +func (c *BackendServicesClient) Delete(ctx context.Context, req *computepb.DeleteBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend service. +func (c *BackendServicesClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteSignedUrlKey(ctx, req, opts...) +} + +// Get returns the specified BackendService resource. Gets a list of available backend services. +func (c *BackendServicesClient) Get(ctx context.Context, req *computepb.GetBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetHealth gets the most recent health check results for this BackendService. +// +// Example request body: +// +// { “group”: “/zones/us-east1-b/instanceGroups/lb-backend-example” } +func (c *BackendServicesClient) GetHealth(ctx context.Context, req *computepb.GetHealthBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) { + return c.internalClient.GetHealth(ctx, req, opts...) +} + +// Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +func (c *BackendServicesClient) Insert(ctx context.Context, req *computepb.InsertBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of BackendService resources available to the specified project. +func (c *BackendServicesClient) List(ctx context.Context, req *computepb.ListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified BackendService resource with the data included in the request. For more information, see Backend services overview. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *BackendServicesClient) Patch(ctx context.Context, req *computepb.PatchBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview +func (c *BackendServicesClient) SetSecurityPolicy(ctx context.Context, req *computepb.SetSecurityPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSecurityPolicy(ctx, req, opts...) +} + +// Update updates the specified BackendService resource with the data included in the request. For more information, see Backend services overview. +func (c *BackendServicesClient) Update(ctx context.Context, req *computepb.UpdateBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type backendServicesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewBackendServicesRESTClient creates a new backend services rest client. +// +// The BackendServices API. +func NewBackendServicesRESTClient(ctx context.Context, opts ...option.ClientOption) (*BackendServicesClient, error) { + clientOpts := append(defaultBackendServicesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &backendServicesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &BackendServicesClient{internalClient: c, CallOptions: &BackendServicesCallOptions{}}, nil +} + +func defaultBackendServicesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *backendServicesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *backendServicesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *backendServicesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddSignedUrlKey adds a key for validating requests with signed URLs for this backend service. +func (c *backendServicesRESTClient) AddSignedUrlKey(ctx context.Context, req *computepb.AddSignedUrlKeyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSignedUrlKeyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/addSignedUrlKey", req.GetProject(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves the list of all BackendService resources, regional and global, available to the specified project. +func (c *backendServicesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/backendServices", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendServiceAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified BackendService resource. +func (c *backendServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v", req.GetProject(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend service. +func (c *backendServicesRESTClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/deleteSignedUrlKey", req.GetProject(), req.GetBackendService()) + + params := url.Values{} + if req.GetKeyName() != "" { + params.Add("keyName", fmt.Sprintf("%v", req.GetKeyName())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified BackendService resource. Gets a list of available backend services. +func (c *backendServicesRESTClient) Get(ctx context.Context, req *computepb.GetBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v", req.GetProject(), req.GetBackendService()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendService{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetHealth gets the most recent health check results for this BackendService. +// +// Example request body: +// +// { “group”: “/zones/us-east1-b/instanceGroups/lb-backend-example” } +func (c *backendServicesRESTClient) GetHealth(ctx context.Context, req *computepb.GetHealthBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetResourceGroupReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/getHealth", req.GetProject(), req.GetBackendService()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendServiceGroupHealth{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +func (c *backendServicesRESTClient) Insert(ctx context.Context, req *computepb.InsertBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of BackendService resources available to the specified project. +func (c *backendServicesRESTClient) List(ctx context.Context, req *computepb.ListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendServiceList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified BackendService resource with the data included in the request. For more information, see Backend services overview. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *backendServicesRESTClient) Patch(ctx context.Context, req *computepb.PatchBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v", req.GetProject(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview +func (c *backendServicesRESTClient) SetSecurityPolicy(ctx context.Context, req *computepb.SetSecurityPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSecurityPolicyReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/setSecurityPolicy", req.GetProject(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified BackendService resource with the data included in the request. For more information, see Backend services overview. +func (c *backendServicesRESTClient) Update(ctx context.Context, req *computepb.UpdateBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetBackendService() != "" { + params.Add("backendService", fmt.Sprintf("%v", req.GetBackendService())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/backend_services_client_example_test.go b/compute/apiv1/backend_services_client_example_test.go new file mode 100644 index 000000000000..6bdbd1e68e1c --- /dev/null +++ b/compute/apiv1/backend_services_client_example_test.go @@ -0,0 +1,245 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewBackendServicesRESTClient() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleBackendServicesClient_AddSignedUrlKey() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddSignedUrlKeyBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddSignedUrlKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListBackendServicesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_Delete() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_DeleteSignedUrlKey() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSignedUrlKeyBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteSignedUrlKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_Get() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_GetHealth() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetHealthBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetHealth(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_Insert() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_List() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListBackendServicesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_Patch() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_SetSecurityPolicy() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSecurityPolicyBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSecurityPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBackendServicesClient_Update() { + ctx := context.Background() + c, err := compute.NewBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/disk_types_client.go b/compute/apiv1/disk_types_client.go new file mode 100644 index 000000000000..aeb5487e614d --- /dev/null +++ b/compute/apiv1/disk_types_client.go @@ -0,0 +1,337 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newDiskTypesClientHook clientHook + +// DiskTypesCallOptions contains the retry settings for each method of DiskTypesClient. +type DiskTypesCallOptions struct { + AggregatedList []gax.CallOption + Get []gax.CallOption + List []gax.CallOption +} + +// internalDiskTypesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalDiskTypesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListDiskTypesRequest, ...gax.CallOption) (*computepb.DiskTypeAggregatedList, error) + Get(context.Context, *computepb.GetDiskTypeRequest, ...gax.CallOption) (*computepb.DiskType, error) + List(context.Context, *computepb.ListDiskTypesRequest, ...gax.CallOption) (*computepb.DiskTypeList, error) +} + +// DiskTypesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The DiskTypes API. +type DiskTypesClient struct { + // The internal transport-dependent client. + internalClient internalDiskTypesClient + + // The call options for this service. + CallOptions *DiskTypesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *DiskTypesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *DiskTypesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *DiskTypesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of disk types. +func (c *DiskTypesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Get returns the specified disk type. Gets a list of available disk types by making a list() request. +func (c *DiskTypesClient) Get(ctx context.Context, req *computepb.GetDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of disk types available to the specified project. +func (c *DiskTypesClient) List(ctx context.Context, req *computepb.ListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type diskTypesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewDiskTypesRESTClient creates a new disk types rest client. +// +// The DiskTypes API. +func NewDiskTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*DiskTypesClient, error) { + clientOpts := append(defaultDiskTypesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &diskTypesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &DiskTypesClient{internalClient: c, CallOptions: &DiskTypesCallOptions{}}, nil +} + +func defaultDiskTypesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *diskTypesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *diskTypesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *diskTypesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of disk types. +func (c *diskTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/diskTypes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskTypeAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified disk type. Gets a list of available disk types by making a list() request. +func (c *diskTypesRESTClient) Get(ctx context.Context, req *computepb.GetDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/diskTypes/%v", req.GetProject(), req.GetZone(), req.GetDiskType()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskType{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of disk types available to the specified project. +func (c *diskTypesRESTClient) List(ctx context.Context, req *computepb.ListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/diskTypes", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskTypeList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/disk_types_client_example_test.go b/compute/apiv1/disk_types_client_example_test.go new file mode 100644 index 000000000000..db2c18bb93e3 --- /dev/null +++ b/compute/apiv1/disk_types_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewDiskTypesRESTClient() { + ctx := context.Background() + c, err := compute.NewDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleDiskTypesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListDiskTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDiskTypesClient_Get() { + ctx := context.Background() + c, err := compute.NewDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetDiskTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDiskTypesClient_List() { + ctx := context.Background() + c, err := compute.NewDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListDiskTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/disks_client.go b/compute/apiv1/disks_client.go new file mode 100644 index 000000000000..60e3f5e44dc4 --- /dev/null +++ b/compute/apiv1/disks_client.go @@ -0,0 +1,907 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newDisksClientHook clientHook + +// DisksCallOptions contains the retry settings for each method of DisksClient. +type DisksCallOptions struct { + AddResourcePolicies []gax.CallOption + AggregatedList []gax.CallOption + CreateSnapshot []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + RemoveResourcePolicies []gax.CallOption + Resize []gax.CallOption + SetIamPolicy []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalDisksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalDisksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddResourcePolicies(context.Context, *computepb.AddResourcePoliciesDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListDisksRequest, ...gax.CallOption) (*computepb.DiskAggregatedList, error) + CreateSnapshot(context.Context, *computepb.CreateSnapshotDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetDiskRequest, ...gax.CallOption) (*computepb.Disk, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyDiskRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListDisksRequest, ...gax.CallOption) (*computepb.DiskList, error) + RemoveResourcePolicies(context.Context, *computepb.RemoveResourcePoliciesDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Resize(context.Context, *computepb.ResizeDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyDiskRequest, ...gax.CallOption) (*computepb.Policy, error) + SetLabels(context.Context, *computepb.SetLabelsDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsDiskRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// DisksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Disks API. +type DisksClient struct { + // The internal transport-dependent client. + internalClient internalDisksClient + + // The call options for this service. + CallOptions *DisksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *DisksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *DisksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *DisksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddResourcePolicies adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. +func (c *DisksClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddResourcePolicies(ctx, req, opts...) +} + +// AggregatedList retrieves an aggregated list of persistent disks. +func (c *DisksClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDisksRequest, opts ...gax.CallOption) (*computepb.DiskAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// CreateSnapshot creates a snapshot of a specified persistent disk. +func (c *DisksClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.CreateSnapshot(ctx, req, opts...) +} + +// Delete deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. +func (c *DisksClient) Delete(ctx context.Context, req *computepb.DeleteDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns a specified persistent disk. Gets a list of available persistent disks by making a list() request. +func (c *DisksClient) Get(ctx context.Context, req *computepb.GetDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *DisksClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property. +func (c *DisksClient) Insert(ctx context.Context, req *computepb.InsertDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of persistent disks contained within the specified zone. +func (c *DisksClient) List(ctx context.Context, req *computepb.ListDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// RemoveResourcePolicies removes resource policies from a disk. +func (c *DisksClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveResourcePolicies(ctx, req, opts...) +} + +// Resize resizes the specified persistent disk. You can only increase the size of the disk. +func (c *DisksClient) Resize(ctx context.Context, req *computepb.ResizeDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Resize(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *DisksClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetLabels sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation. +func (c *DisksClient) SetLabels(ctx context.Context, req *computepb.SetLabelsDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *DisksClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsDiskRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type disksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewDisksRESTClient creates a new disks rest client. +// +// The Disks API. +func NewDisksRESTClient(ctx context.Context, opts ...option.ClientOption) (*DisksClient, error) { + clientOpts := append(defaultDisksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &disksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &DisksClient{internalClient: c, CallOptions: &DisksCallOptions{}}, nil +} + +func defaultDisksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *disksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *disksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *disksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddResourcePolicies adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. +func (c *disksRESTClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDisksAddResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/addResourcePolicies", req.GetProject(), req.GetZone(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves an aggregated list of persistent disks. +func (c *disksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDisksRequest, opts ...gax.CallOption) (*computepb.DiskAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/disks", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// CreateSnapshot creates a snapshot of a specified persistent disk. +func (c *disksRESTClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSnapshotResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/createSnapshot", req.GetProject(), req.GetZone(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.GuestFlush != nil { + params.Add("guestFlush", fmt.Sprintf("%v", req.GetGuestFlush())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. +func (c *disksRESTClient) Delete(ctx context.Context, req *computepb.DeleteDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v", req.GetProject(), req.GetZone(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns a specified persistent disk. Gets a list of available persistent disks by making a list() request. +func (c *disksRESTClient) Get(ctx context.Context, req *computepb.GetDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v", req.GetProject(), req.GetZone(), req.GetDisk()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Disk{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *disksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property. +func (c *disksRESTClient) Insert(ctx context.Context, req *computepb.InsertDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDiskResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req != nil && req.SourceImage != nil { + params.Add("sourceImage", fmt.Sprintf("%v", req.GetSourceImage())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of persistent disks contained within the specified zone. +func (c *disksRESTClient) List(ctx context.Context, req *computepb.ListDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveResourcePolicies removes resource policies from a disk. +func (c *disksRESTClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDisksRemoveResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/removeResourcePolicies", req.GetProject(), req.GetZone(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Resize resizes the specified persistent disk. You can only increase the size of the disk. +func (c *disksRESTClient) Resize(ctx context.Context, req *computepb.ResizeDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDisksResizeRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/resize", req.GetProject(), req.GetZone(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *disksRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetZoneSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/setIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation. +func (c *disksRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetZoneSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/setLabels", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *disksRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsDiskRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/testIamPermissions", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/disks_client_example_test.go b/compute/apiv1/disks_client_example_test.go new file mode 100644 index 000000000000..cbdcd918b754 --- /dev/null +++ b/compute/apiv1/disks_client_example_test.go @@ -0,0 +1,283 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewDisksRESTClient() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleDisksClient_AddResourcePolicies() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddResourcePoliciesDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListDisksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_CreateSnapshot() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.CreateSnapshotDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_Delete() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_Get() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_Insert() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_List() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListDisksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_RemoveResourcePolicies() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveResourcePoliciesDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_Resize() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResizeDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Resize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDisksClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/doc.go b/compute/apiv1/doc.go new file mode 100644 index 000000000000..4b6efeb2d7e7 --- /dev/null +++ b/compute/apiv1/doc.go @@ -0,0 +1,118 @@ +// Copyright 2021 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 compute is an auto-generated package for the +// Google Compute Engine API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit https://pkg.go.dev/cloud.google.com/go. +package compute // import "cloud.google.com/go/compute/apiv1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "20210701" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/compute/apiv1/external_vpn_gateways_client.go b/compute/apiv1/external_vpn_gateways_client.go new file mode 100644 index 000000000000..00311af90540 --- /dev/null +++ b/compute/apiv1/external_vpn_gateways_client.go @@ -0,0 +1,482 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newExternalVpnGatewaysClientHook clientHook + +// ExternalVpnGatewaysCallOptions contains the retry settings for each method of ExternalVpnGatewaysClient. +type ExternalVpnGatewaysCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalExternalVpnGatewaysClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalExternalVpnGatewaysClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteExternalVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetExternalVpnGatewayRequest, ...gax.CallOption) (*computepb.ExternalVpnGateway, error) + Insert(context.Context, *computepb.InsertExternalVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListExternalVpnGatewaysRequest, ...gax.CallOption) (*computepb.ExternalVpnGatewayList, error) + SetLabels(context.Context, *computepb.SetLabelsExternalVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsExternalVpnGatewayRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// ExternalVpnGatewaysClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The ExternalVpnGateways API. +type ExternalVpnGatewaysClient struct { + // The internal transport-dependent client. + internalClient internalExternalVpnGatewaysClient + + // The call options for this service. + CallOptions *ExternalVpnGatewaysCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ExternalVpnGatewaysClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ExternalVpnGatewaysClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ExternalVpnGatewaysClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified externalVpnGateway. +func (c *ExternalVpnGatewaysClient) Delete(ctx context.Context, req *computepb.DeleteExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified externalVpnGateway. Get a list of available externalVpnGateways by making a list() request. +func (c *ExternalVpnGatewaysClient) Get(ctx context.Context, req *computepb.GetExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGateway, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a ExternalVpnGateway in the specified project using the data included in the request. +func (c *ExternalVpnGatewaysClient) Insert(ctx context.Context, req *computepb.InsertExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of ExternalVpnGateway available to the specified project. +func (c *ExternalVpnGatewaysClient) List(ctx context.Context, req *computepb.ListExternalVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGatewayList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetLabels sets the labels on an ExternalVpnGateway. To learn more about labels, read the Labeling Resources documentation. +func (c *ExternalVpnGatewaysClient) SetLabels(ctx context.Context, req *computepb.SetLabelsExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *ExternalVpnGatewaysClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type externalVpnGatewaysRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewExternalVpnGatewaysRESTClient creates a new external vpn gateways rest client. +// +// The ExternalVpnGateways API. +func NewExternalVpnGatewaysRESTClient(ctx context.Context, opts ...option.ClientOption) (*ExternalVpnGatewaysClient, error) { + clientOpts := append(defaultExternalVpnGatewaysRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &externalVpnGatewaysRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ExternalVpnGatewaysClient{internalClient: c, CallOptions: &ExternalVpnGatewaysCallOptions{}}, nil +} + +func defaultExternalVpnGatewaysRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *externalVpnGatewaysRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *externalVpnGatewaysRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *externalVpnGatewaysRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified externalVpnGateway. +func (c *externalVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v", req.GetProject(), req.GetExternalVpnGateway()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified externalVpnGateway. Get a list of available externalVpnGateways by making a list() request. +func (c *externalVpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGateway, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v", req.GetProject(), req.GetExternalVpnGateway()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ExternalVpnGateway{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a ExternalVpnGateway in the specified project using the data included in the request. +func (c *externalVpnGatewaysRESTClient) Insert(ctx context.Context, req *computepb.InsertExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetExternalVpnGatewayResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of ExternalVpnGateway available to the specified project. +func (c *externalVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListExternalVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGatewayList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ExternalVpnGatewayList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on an ExternalVpnGateway. To learn more about labels, read the Labeling Resources documentation. +func (c *externalVpnGatewaysRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v/setLabels", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *externalVpnGatewaysRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/external_vpn_gateways_client_example_test.go b/compute/apiv1/external_vpn_gateways_client_example_test.go new file mode 100644 index 000000000000..820c2c0a3fbc --- /dev/null +++ b/compute/apiv1/external_vpn_gateways_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewExternalVpnGatewaysRESTClient() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleExternalVpnGatewaysClient_Delete() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteExternalVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleExternalVpnGatewaysClient_Get() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetExternalVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleExternalVpnGatewaysClient_Insert() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertExternalVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleExternalVpnGatewaysClient_List() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListExternalVpnGatewaysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleExternalVpnGatewaysClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsExternalVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleExternalVpnGatewaysClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewExternalVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsExternalVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/firewall_policies_client.go b/compute/apiv1/firewall_policies_client.go new file mode 100644 index 000000000000..4b224a975c37 --- /dev/null +++ b/compute/apiv1/firewall_policies_client.go @@ -0,0 +1,1194 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newFirewallPoliciesClientHook clientHook + +// FirewallPoliciesCallOptions contains the retry settings for each method of FirewallPoliciesClient. +type FirewallPoliciesCallOptions struct { + AddAssociation []gax.CallOption + AddRule []gax.CallOption + CloneRules []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetAssociation []gax.CallOption + GetIamPolicy []gax.CallOption + GetRule []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListAssociations []gax.CallOption + Move []gax.CallOption + Patch []gax.CallOption + PatchRule []gax.CallOption + RemoveAssociation []gax.CallOption + RemoveRule []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalFirewallPoliciesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalFirewallPoliciesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddAssociation(context.Context, *computepb.AddAssociationFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + AddRule(context.Context, *computepb.AddRuleFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + CloneRules(context.Context, *computepb.CloneRulesFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetFirewallPolicyRequest, ...gax.CallOption) (*computepb.FirewallPolicy, error) + GetAssociation(context.Context, *computepb.GetAssociationFirewallPolicyRequest, ...gax.CallOption) (*computepb.FirewallPolicyAssociation, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyFirewallPolicyRequest, ...gax.CallOption) (*computepb.Policy, error) + GetRule(context.Context, *computepb.GetRuleFirewallPolicyRequest, ...gax.CallOption) (*computepb.FirewallPolicyRule, error) + Insert(context.Context, *computepb.InsertFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListFirewallPoliciesRequest, ...gax.CallOption) (*computepb.FirewallPolicyList, error) + ListAssociations(context.Context, *computepb.ListAssociationsFirewallPolicyRequest, ...gax.CallOption) (*computepb.FirewallPoliciesListAssociationsResponse, error) + Move(context.Context, *computepb.MoveFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Patch(context.Context, *computepb.PatchFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + PatchRule(context.Context, *computepb.PatchRuleFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + RemoveAssociation(context.Context, *computepb.RemoveAssociationFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + RemoveRule(context.Context, *computepb.RemoveRuleFirewallPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyFirewallPolicyRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsFirewallPolicyRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// FirewallPoliciesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The FirewallPolicies API. +type FirewallPoliciesClient struct { + // The internal transport-dependent client. + internalClient internalFirewallPoliciesClient + + // The call options for this service. + CallOptions *FirewallPoliciesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *FirewallPoliciesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *FirewallPoliciesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FirewallPoliciesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddAssociation inserts an association for the specified firewall policy. +func (c *FirewallPoliciesClient) AddAssociation(ctx context.Context, req *computepb.AddAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddAssociation(ctx, req, opts...) +} + +// AddRule inserts a rule into a firewall policy. +func (c *FirewallPoliciesClient) AddRule(ctx context.Context, req *computepb.AddRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddRule(ctx, req, opts...) +} + +// CloneRules copies rules to the specified firewall policy. +func (c *FirewallPoliciesClient) CloneRules(ctx context.Context, req *computepb.CloneRulesFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.CloneRules(ctx, req, opts...) +} + +// Delete deletes the specified policy. +func (c *FirewallPoliciesClient) Delete(ctx context.Context, req *computepb.DeleteFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified firewall policy. +func (c *FirewallPoliciesClient) Get(ctx context.Context, req *computepb.GetFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetAssociation gets an association with the specified name. +func (c *FirewallPoliciesClient) GetAssociation(ctx context.Context, req *computepb.GetAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyAssociation, error) { + return c.internalClient.GetAssociation(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *FirewallPoliciesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// GetRule gets a rule of the specified priority. +func (c *FirewallPoliciesClient) GetRule(ctx context.Context, req *computepb.GetRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyRule, error) { + return c.internalClient.GetRule(ctx, req, opts...) +} + +// Insert creates a new policy in the specified project using the data included in the request. +func (c *FirewallPoliciesClient) Insert(ctx context.Context, req *computepb.InsertFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists all the policies that have been configured for the specified project. +func (c *FirewallPoliciesClient) List(ctx context.Context, req *computepb.ListFirewallPoliciesRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListAssociations lists associations of a specified target, i.e., organization or folder. +func (c *FirewallPoliciesClient) ListAssociations(ctx context.Context, req *computepb.ListAssociationsFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPoliciesListAssociationsResponse, error) { + return c.internalClient.ListAssociations(ctx, req, opts...) +} + +// Move moves the specified firewall policy. +func (c *FirewallPoliciesClient) Move(ctx context.Context, req *computepb.MoveFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Move(ctx, req, opts...) +} + +// Patch patches the specified policy with the data included in the request. +func (c *FirewallPoliciesClient) Patch(ctx context.Context, req *computepb.PatchFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// PatchRule patches a rule of the specified priority. +func (c *FirewallPoliciesClient) PatchRule(ctx context.Context, req *computepb.PatchRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.PatchRule(ctx, req, opts...) +} + +// RemoveAssociation removes an association for the specified firewall policy. +func (c *FirewallPoliciesClient) RemoveAssociation(ctx context.Context, req *computepb.RemoveAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveAssociation(ctx, req, opts...) +} + +// RemoveRule deletes a rule of the specified priority. +func (c *FirewallPoliciesClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveRule(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *FirewallPoliciesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *FirewallPoliciesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type firewallPoliciesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewFirewallPoliciesRESTClient creates a new firewall policies rest client. +// +// The FirewallPolicies API. +func NewFirewallPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*FirewallPoliciesClient, error) { + clientOpts := append(defaultFirewallPoliciesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &firewallPoliciesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &FirewallPoliciesClient{internalClient: c, CallOptions: &FirewallPoliciesCallOptions{}}, nil +} + +func defaultFirewallPoliciesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *firewallPoliciesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *firewallPoliciesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *firewallPoliciesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddAssociation inserts an association for the specified firewall policy. +func (c *firewallPoliciesRESTClient) AddAssociation(ctx context.Context, req *computepb.AddAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallPolicyAssociationResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/addAssociation", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.ReplaceExistingAssociation != nil { + params.Add("replaceExistingAssociation", fmt.Sprintf("%v", req.GetReplaceExistingAssociation())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AddRule inserts a rule into a firewall policy. +func (c *firewallPoliciesRESTClient) AddRule(ctx context.Context, req *computepb.AddRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallPolicyRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/addRule", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// CloneRules copies rules to the specified firewall policy. +func (c *firewallPoliciesRESTClient) CloneRules(ctx context.Context, req *computepb.CloneRulesFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/cloneRules", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req != nil && req.SourceFirewallPolicy != nil { + params.Add("sourceFirewallPolicy", fmt.Sprintf("%v", req.GetSourceFirewallPolicy())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified policy. +func (c *firewallPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified firewall policy. +func (c *firewallPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v", req.GetFirewallPolicy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallPolicy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetAssociation gets an association with the specified name. +func (c *firewallPoliciesRESTClient) GetAssociation(ctx context.Context, req *computepb.GetAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyAssociation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getAssociation", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.Name != nil { + params.Add("name", fmt.Sprintf("%v", req.GetName())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallPolicyAssociation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *firewallPoliciesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getIamPolicy", req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetRule gets a rule of the specified priority. +func (c *firewallPoliciesRESTClient) GetRule(ctx context.Context, req *computepb.GetRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyRule, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getRule", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallPolicyRule{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a new policy in the specified project using the data included in the request. +func (c *firewallPoliciesRESTClient) Insert(ctx context.Context, req *computepb.InsertFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies") + + params := url.Values{} + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists all the policies that have been configured for the specified project. +func (c *firewallPoliciesRESTClient) List(ctx context.Context, req *computepb.ListFirewallPoliciesRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies") + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallPolicyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListAssociations lists associations of a specified target, i.e., organization or folder. +func (c *firewallPoliciesRESTClient) ListAssociations(ctx context.Context, req *computepb.ListAssociationsFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPoliciesListAssociationsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/listAssociations") + + params := url.Values{} + if req != nil && req.TargetResource != nil { + params.Add("targetResource", fmt.Sprintf("%v", req.GetTargetResource())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallPoliciesListAssociationsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Move moves the specified firewall policy. +func (c *firewallPoliciesRESTClient) Move(ctx context.Context, req *computepb.MoveFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/move", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified policy with the data included in the request. +func (c *firewallPoliciesRESTClient) Patch(ctx context.Context, req *computepb.PatchFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// PatchRule patches a rule of the specified priority. +func (c *firewallPoliciesRESTClient) PatchRule(ctx context.Context, req *computepb.PatchRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallPolicyRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/patchRule", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveAssociation removes an association for the specified firewall policy. +func (c *firewallPoliciesRESTClient) RemoveAssociation(ctx context.Context, req *computepb.RemoveAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/removeAssociation", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.Name != nil { + params.Add("name", fmt.Sprintf("%v", req.GetName())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveRule deletes a rule of the specified priority. +func (c *firewallPoliciesRESTClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/removeRule", req.GetFirewallPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *firewallPoliciesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalOrganizationSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/setIamPolicy", req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *firewallPoliciesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/testIamPermissions", req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/firewall_policies_client_example_test.go b/compute/apiv1/firewall_policies_client_example_test.go new file mode 100644 index 000000000000..787e486ebd1a --- /dev/null +++ b/compute/apiv1/firewall_policies_client_example_test.go @@ -0,0 +1,378 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewFirewallPoliciesRESTClient() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleFirewallPoliciesClient_AddAssociation() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddAssociationFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddAssociation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_AddRule() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddRuleFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_CloneRules() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.CloneRulesFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CloneRules(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_Delete() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_Get() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_GetAssociation() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetAssociationFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetAssociation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_GetRule() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRuleFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_Insert() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_List() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListFirewallPoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_ListAssociations() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListAssociationsFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListAssociations(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_Move() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.MoveFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Move(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_Patch() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_PatchRule() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRuleFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PatchRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_RemoveAssociation() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveAssociationFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveAssociation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_RemoveRule() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveRuleFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallPoliciesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewFirewallPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsFirewallPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/firewalls_client.go b/compute/apiv1/firewalls_client.go new file mode 100644 index 000000000000..2d764796b192 --- /dev/null +++ b/compute/apiv1/firewalls_client.go @@ -0,0 +1,502 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newFirewallsClientHook clientHook + +// FirewallsCallOptions contains the retry settings for each method of FirewallsClient. +type FirewallsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalFirewallsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalFirewallsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteFirewallRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetFirewallRequest, ...gax.CallOption) (*computepb.Firewall, error) + Insert(context.Context, *computepb.InsertFirewallRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListFirewallsRequest, ...gax.CallOption) (*computepb.FirewallList, error) + Patch(context.Context, *computepb.PatchFirewallRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateFirewallRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// FirewallsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Firewalls API. +type FirewallsClient struct { + // The internal transport-dependent client. + internalClient internalFirewallsClient + + // The call options for this service. + CallOptions *FirewallsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *FirewallsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *FirewallsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FirewallsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified firewall. +func (c *FirewallsClient) Delete(ctx context.Context, req *computepb.DeleteFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified firewall. +func (c *FirewallsClient) Get(ctx context.Context, req *computepb.GetFirewallRequest, opts ...gax.CallOption) (*computepb.Firewall, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a firewall rule in the specified project using the data included in the request. +func (c *FirewallsClient) Insert(ctx context.Context, req *computepb.InsertFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of firewall rules available to the specified project. +func (c *FirewallsClient) List(ctx context.Context, req *computepb.ListFirewallsRequest, opts ...gax.CallOption) (*computepb.FirewallList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified firewall rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *FirewallsClient) Patch(ctx context.Context, req *computepb.PatchFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates the specified firewall rule with the data included in the request. Note that all fields will be updated if using PUT, even fields that are not specified. To update individual fields, please use PATCH instead. +func (c *FirewallsClient) Update(ctx context.Context, req *computepb.UpdateFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type firewallsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewFirewallsRESTClient creates a new firewalls rest client. +// +// The Firewalls API. +func NewFirewallsRESTClient(ctx context.Context, opts ...option.ClientOption) (*FirewallsClient, error) { + clientOpts := append(defaultFirewallsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &firewallsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &FirewallsClient{internalClient: c, CallOptions: &FirewallsCallOptions{}}, nil +} + +func defaultFirewallsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *firewallsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *firewallsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *firewallsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified firewall. +func (c *firewallsRESTClient) Delete(ctx context.Context, req *computepb.DeleteFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls/%v", req.GetProject(), req.GetFirewall()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified firewall. +func (c *firewallsRESTClient) Get(ctx context.Context, req *computepb.GetFirewallRequest, opts ...gax.CallOption) (*computepb.Firewall, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls/%v", req.GetProject(), req.GetFirewall()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Firewall{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a firewall rule in the specified project using the data included in the request. +func (c *firewallsRESTClient) Insert(ctx context.Context, req *computepb.InsertFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of firewall rules available to the specified project. +func (c *firewallsRESTClient) List(ctx context.Context, req *computepb.ListFirewallsRequest, opts ...gax.CallOption) (*computepb.FirewallList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.FirewallList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified firewall rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *firewallsRESTClient) Patch(ctx context.Context, req *computepb.PatchFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls/%v", req.GetProject(), req.GetFirewall()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified firewall rule with the data included in the request. Note that all fields will be updated if using PUT, even fields that are not specified. To update individual fields, please use PATCH instead. +func (c *firewallsRESTClient) Update(ctx context.Context, req *computepb.UpdateFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetFirewallResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetFirewall() != "" { + params.Add("firewall", fmt.Sprintf("%v", req.GetFirewall())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/firewalls_client_example_test.go b/compute/apiv1/firewalls_client_example_test.go new file mode 100644 index 000000000000..e1db038fb2ed --- /dev/null +++ b/compute/apiv1/firewalls_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewFirewallsRESTClient() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleFirewallsClient_Delete() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteFirewallRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallsClient_Get() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetFirewallRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallsClient_Insert() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertFirewallRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallsClient_List() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListFirewallsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallsClient_Patch() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchFirewallRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFirewallsClient_Update() { + ctx := context.Background() + c, err := compute.NewFirewallsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateFirewallRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/forwarding_rules_client.go b/compute/apiv1/forwarding_rules_client.go new file mode 100644 index 000000000000..de0011546a57 --- /dev/null +++ b/compute/apiv1/forwarding_rules_client.go @@ -0,0 +1,626 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newForwardingRulesClientHook clientHook + +// ForwardingRulesCallOptions contains the retry settings for each method of ForwardingRulesClient. +type ForwardingRulesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetLabels []gax.CallOption + SetTarget []gax.CallOption +} + +// internalForwardingRulesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalForwardingRulesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListForwardingRulesRequest, ...gax.CallOption) (*computepb.ForwardingRuleAggregatedList, error) + Delete(context.Context, *computepb.DeleteForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetForwardingRuleRequest, ...gax.CallOption) (*computepb.ForwardingRule, error) + Insert(context.Context, *computepb.InsertForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListForwardingRulesRequest, ...gax.CallOption) (*computepb.ForwardingRuleList, error) + Patch(context.Context, *computepb.PatchForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + SetLabels(context.Context, *computepb.SetLabelsForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + SetTarget(context.Context, *computepb.SetTargetForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// ForwardingRulesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The ForwardingRules API. +type ForwardingRulesClient struct { + // The internal transport-dependent client. + internalClient internalForwardingRulesClient + + // The call options for this service. + CallOptions *ForwardingRulesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ForwardingRulesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ForwardingRulesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ForwardingRulesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of forwarding rules. +func (c *ForwardingRulesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified ForwardingRule resource. +func (c *ForwardingRulesClient) Delete(ctx context.Context, req *computepb.DeleteForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified ForwardingRule resource. +func (c *ForwardingRulesClient) Get(ctx context.Context, req *computepb.GetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a ForwardingRule resource in the specified project and region using the data included in the request. +func (c *ForwardingRulesClient) Insert(ctx context.Context, req *computepb.InsertForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of ForwardingRule resources available to the specified project and region. +func (c *ForwardingRulesClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. +func (c *ForwardingRulesClient) Patch(ctx context.Context, req *computepb.PatchForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. +func (c *ForwardingRulesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// SetTarget changes target URL for forwarding rule. The new target should be of the same type as the old target. +func (c *ForwardingRulesClient) SetTarget(ctx context.Context, req *computepb.SetTargetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetTarget(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type forwardingRulesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewForwardingRulesRESTClient creates a new forwarding rules rest client. +// +// The ForwardingRules API. +func NewForwardingRulesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ForwardingRulesClient, error) { + clientOpts := append(defaultForwardingRulesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &forwardingRulesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ForwardingRulesClient{internalClient: c, CallOptions: &ForwardingRulesCallOptions{}}, nil +} + +func defaultForwardingRulesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *forwardingRulesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *forwardingRulesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *forwardingRulesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of forwarding rules. +func (c *forwardingRulesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/forwardingRules", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ForwardingRuleAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified ForwardingRule resource. +func (c *forwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.DeleteForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified ForwardingRule resource. +func (c *forwardingRulesRESTClient) Get(ctx context.Context, req *computepb.GetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ForwardingRule{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a ForwardingRule resource in the specified project and region using the data included in the request. +func (c *forwardingRulesRESTClient) Insert(ctx context.Context, req *computepb.InsertForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetForwardingRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of ForwardingRule resources available to the specified project and region. +func (c *forwardingRulesRESTClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ForwardingRuleList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. +func (c *forwardingRulesRESTClient) Patch(ctx context.Context, req *computepb.PatchForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetForwardingRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. +func (c *forwardingRulesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetTarget changes target URL for forwarding rule. The new target should be of the same type as the old target. +func (c *forwardingRulesRESTClient) SetTarget(ctx context.Context, req *computepb.SetTargetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v/setTarget", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/forwarding_rules_client_example_test.go b/compute/apiv1/forwarding_rules_client_example_test.go new file mode 100644 index 000000000000..1a2a9a5495f9 --- /dev/null +++ b/compute/apiv1/forwarding_rules_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewForwardingRulesRESTClient() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleForwardingRulesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListForwardingRulesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_Delete() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_Get() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_Insert() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_List() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListForwardingRulesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_Patch() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleForwardingRulesClient_SetTarget() { + ctx := context.Background() + c, err := compute.NewForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetTargetForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetTarget(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/gapic_metadata.json b/compute/apiv1/gapic_metadata.json new file mode 100644 index 000000000000..6474e15ecd95 --- /dev/null +++ b/compute/apiv1/gapic_metadata.json @@ -0,0 +1,3581 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.cloud.compute.v1", + "libraryPackage": "cloud.google.com/go/compute/apiv1", + "services": { + "AcceleratorTypes": { + "clients": { + "rest": { + "libraryClient": "AcceleratorTypesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "Addresses": { + "clients": { + "rest": { + "libraryClient": "AddressesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "Autoscalers": { + "clients": { + "rest": { + "libraryClient": "AutoscalersClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "BackendBuckets": { + "clients": { + "rest": { + "libraryClient": "BackendBucketsClient", + "rpcs": { + "AddSignedUrlKey": { + "methods": [ + "AddSignedUrlKey" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteSignedUrlKey": { + "methods": [ + "DeleteSignedUrlKey" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "BackendServices": { + "clients": { + "rest": { + "libraryClient": "BackendServicesClient", + "rpcs": { + "AddSignedUrlKey": { + "methods": [ + "AddSignedUrlKey" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteSignedUrlKey": { + "methods": [ + "DeleteSignedUrlKey" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetHealth": { + "methods": [ + "GetHealth" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetSecurityPolicy": { + "methods": [ + "SetSecurityPolicy" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "DiskTypes": { + "clients": { + "rest": { + "libraryClient": "DiskTypesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "Disks": { + "clients": { + "rest": { + "libraryClient": "DisksClient", + "rpcs": { + "AddResourcePolicies": { + "methods": [ + "AddResourcePolicies" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "CreateSnapshot": { + "methods": [ + "CreateSnapshot" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "RemoveResourcePolicies": { + "methods": [ + "RemoveResourcePolicies" + ] + }, + "Resize": { + "methods": [ + "Resize" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "ExternalVpnGateways": { + "clients": { + "rest": { + "libraryClient": "ExternalVpnGatewaysClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "FirewallPolicies": { + "clients": { + "rest": { + "libraryClient": "FirewallPoliciesClient", + "rpcs": { + "AddAssociation": { + "methods": [ + "AddAssociation" + ] + }, + "AddRule": { + "methods": [ + "AddRule" + ] + }, + "CloneRules": { + "methods": [ + "CloneRules" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetAssociation": { + "methods": [ + "GetAssociation" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "GetRule": { + "methods": [ + "GetRule" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListAssociations": { + "methods": [ + "ListAssociations" + ] + }, + "Move": { + "methods": [ + "Move" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "PatchRule": { + "methods": [ + "PatchRule" + ] + }, + "RemoveAssociation": { + "methods": [ + "RemoveAssociation" + ] + }, + "RemoveRule": { + "methods": [ + "RemoveRule" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Firewalls": { + "clients": { + "rest": { + "libraryClient": "FirewallsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "ForwardingRules": { + "clients": { + "rest": { + "libraryClient": "ForwardingRulesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "SetTarget": { + "methods": [ + "SetTarget" + ] + } + } + } + } + }, + "GlobalAddresses": { + "clients": { + "rest": { + "libraryClient": "GlobalAddressesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "GlobalForwardingRules": { + "clients": { + "rest": { + "libraryClient": "GlobalForwardingRulesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "SetTarget": { + "methods": [ + "SetTarget" + ] + } + } + } + } + }, + "GlobalNetworkEndpointGroups": { + "clients": { + "rest": { + "libraryClient": "GlobalNetworkEndpointGroupsClient", + "rpcs": { + "AttachNetworkEndpoints": { + "methods": [ + "AttachNetworkEndpoints" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DetachNetworkEndpoints": { + "methods": [ + "DetachNetworkEndpoints" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListNetworkEndpoints": { + "methods": [ + "ListNetworkEndpoints" + ] + } + } + } + } + }, + "GlobalOperations": { + "clients": { + "rest": { + "libraryClient": "GlobalOperationsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Wait": { + "methods": [ + "Wait" + ] + } + } + } + } + }, + "GlobalOrganizationOperations": { + "clients": { + "rest": { + "libraryClient": "GlobalOrganizationOperationsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "GlobalPublicDelegatedPrefixes": { + "clients": { + "rest": { + "libraryClient": "GlobalPublicDelegatedPrefixesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "HealthChecks": { + "clients": { + "rest": { + "libraryClient": "HealthChecksClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "Images": { + "clients": { + "rest": { + "libraryClient": "ImagesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Deprecate": { + "methods": [ + "Deprecate" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetFromFamily": { + "methods": [ + "GetFromFamily" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "InstanceGroupManagers": { + "clients": { + "rest": { + "libraryClient": "InstanceGroupManagersClient", + "rpcs": { + "AbandonInstances": { + "methods": [ + "AbandonInstances" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "ApplyUpdatesToInstances": { + "methods": [ + "ApplyUpdatesToInstances" + ] + }, + "CreateInstances": { + "methods": [ + "CreateInstances" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteInstances": { + "methods": [ + "DeleteInstances" + ] + }, + "DeletePerInstanceConfigs": { + "methods": [ + "DeletePerInstanceConfigs" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListErrors": { + "methods": [ + "ListErrors" + ] + }, + "ListManagedInstances": { + "methods": [ + "ListManagedInstances" + ] + }, + "ListPerInstanceConfigs": { + "methods": [ + "ListPerInstanceConfigs" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "PatchPerInstanceConfigs": { + "methods": [ + "PatchPerInstanceConfigs" + ] + }, + "RecreateInstances": { + "methods": [ + "RecreateInstances" + ] + }, + "Resize": { + "methods": [ + "Resize" + ] + }, + "SetInstanceTemplate": { + "methods": [ + "SetInstanceTemplate" + ] + }, + "SetTargetPools": { + "methods": [ + "SetTargetPools" + ] + }, + "UpdatePerInstanceConfigs": { + "methods": [ + "UpdatePerInstanceConfigs" + ] + } + } + } + } + }, + "InstanceGroups": { + "clients": { + "rest": { + "libraryClient": "InstanceGroupsClient", + "rpcs": { + "AddInstances": { + "methods": [ + "AddInstances" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListInstances": { + "methods": [ + "ListInstances" + ] + }, + "RemoveInstances": { + "methods": [ + "RemoveInstances" + ] + }, + "SetNamedPorts": { + "methods": [ + "SetNamedPorts" + ] + } + } + } + } + }, + "InstanceTemplates": { + "clients": { + "rest": { + "libraryClient": "InstanceTemplatesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Instances": { + "clients": { + "rest": { + "libraryClient": "InstancesClient", + "rpcs": { + "AddAccessConfig": { + "methods": [ + "AddAccessConfig" + ] + }, + "AddResourcePolicies": { + "methods": [ + "AddResourcePolicies" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "AttachDisk": { + "methods": [ + "AttachDisk" + ] + }, + "BulkInsert": { + "methods": [ + "BulkInsert" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteAccessConfig": { + "methods": [ + "DeleteAccessConfig" + ] + }, + "DetachDisk": { + "methods": [ + "DetachDisk" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetEffectiveFirewalls": { + "methods": [ + "GetEffectiveFirewalls" + ] + }, + "GetGuestAttributes": { + "methods": [ + "GetGuestAttributes" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "GetScreenshot": { + "methods": [ + "GetScreenshot" + ] + }, + "GetSerialPortOutput": { + "methods": [ + "GetSerialPortOutput" + ] + }, + "GetShieldedInstanceIdentity": { + "methods": [ + "GetShieldedInstanceIdentity" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListReferrers": { + "methods": [ + "ListReferrers" + ] + }, + "RemoveResourcePolicies": { + "methods": [ + "RemoveResourcePolicies" + ] + }, + "Reset": { + "methods": [ + "Reset" + ] + }, + "SetDeletionProtection": { + "methods": [ + "SetDeletionProtection" + ] + }, + "SetDiskAutoDelete": { + "methods": [ + "SetDiskAutoDelete" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "SetMachineResources": { + "methods": [ + "SetMachineResources" + ] + }, + "SetMachineType": { + "methods": [ + "SetMachineType" + ] + }, + "SetMetadata": { + "methods": [ + "SetMetadata" + ] + }, + "SetMinCpuPlatform": { + "methods": [ + "SetMinCpuPlatform" + ] + }, + "SetScheduling": { + "methods": [ + "SetScheduling" + ] + }, + "SetServiceAccount": { + "methods": [ + "SetServiceAccount" + ] + }, + "SetShieldedInstanceIntegrityPolicy": { + "methods": [ + "SetShieldedInstanceIntegrityPolicy" + ] + }, + "SetTags": { + "methods": [ + "SetTags" + ] + }, + "SimulateMaintenanceEvent": { + "methods": [ + "SimulateMaintenanceEvent" + ] + }, + "Start": { + "methods": [ + "Start" + ] + }, + "StartWithEncryptionKey": { + "methods": [ + "StartWithEncryptionKey" + ] + }, + "Stop": { + "methods": [ + "Stop" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, + "Update": { + "methods": [ + "Update" + ] + }, + "UpdateAccessConfig": { + "methods": [ + "UpdateAccessConfig" + ] + }, + "UpdateDisplayDevice": { + "methods": [ + "UpdateDisplayDevice" + ] + }, + "UpdateNetworkInterface": { + "methods": [ + "UpdateNetworkInterface" + ] + }, + "UpdateShieldedInstanceConfig": { + "methods": [ + "UpdateShieldedInstanceConfig" + ] + } + } + } + } + }, + "InterconnectAttachments": { + "clients": { + "rest": { + "libraryClient": "InterconnectAttachmentsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "InterconnectLocations": { + "clients": { + "rest": { + "libraryClient": "InterconnectLocationsClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "Interconnects": { + "clients": { + "rest": { + "libraryClient": "InterconnectsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetDiagnostics": { + "methods": [ + "GetDiagnostics" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "LicenseCodes": { + "clients": { + "rest": { + "libraryClient": "LicenseCodesClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Licenses": { + "clients": { + "rest": { + "libraryClient": "LicensesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "MachineTypes": { + "clients": { + "rest": { + "libraryClient": "MachineTypesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "NetworkEndpointGroups": { + "clients": { + "rest": { + "libraryClient": "NetworkEndpointGroupsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "AttachNetworkEndpoints": { + "methods": [ + "AttachNetworkEndpoints" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DetachNetworkEndpoints": { + "methods": [ + "DetachNetworkEndpoints" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListNetworkEndpoints": { + "methods": [ + "ListNetworkEndpoints" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Networks": { + "clients": { + "rest": { + "libraryClient": "NetworksClient", + "rpcs": { + "AddPeering": { + "methods": [ + "AddPeering" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetEffectiveFirewalls": { + "methods": [ + "GetEffectiveFirewalls" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListPeeringRoutes": { + "methods": [ + "ListPeeringRoutes" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "RemovePeering": { + "methods": [ + "RemovePeering" + ] + }, + "SwitchToCustomMode": { + "methods": [ + "SwitchToCustomMode" + ] + }, + "UpdatePeering": { + "methods": [ + "UpdatePeering" + ] + } + } + } + } + }, + "NodeGroups": { + "clients": { + "rest": { + "libraryClient": "NodeGroupsClient", + "rpcs": { + "AddNodes": { + "methods": [ + "AddNodes" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteNodes": { + "methods": [ + "DeleteNodes" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListNodes": { + "methods": [ + "ListNodes" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetNodeTemplate": { + "methods": [ + "SetNodeTemplate" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "NodeTemplates": { + "clients": { + "rest": { + "libraryClient": "NodeTemplatesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "NodeTypes": { + "clients": { + "rest": { + "libraryClient": "NodeTypesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "PacketMirrorings": { + "clients": { + "rest": { + "libraryClient": "PacketMirroringsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Projects": { + "clients": { + "rest": { + "libraryClient": "ProjectsClient", + "rpcs": { + "DisableXpnHost": { + "methods": [ + "DisableXpnHost" + ] + }, + "DisableXpnResource": { + "methods": [ + "DisableXpnResource" + ] + }, + "EnableXpnHost": { + "methods": [ + "EnableXpnHost" + ] + }, + "EnableXpnResource": { + "methods": [ + "EnableXpnResource" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetXpnHost": { + "methods": [ + "GetXpnHost" + ] + }, + "GetXpnResources": { + "methods": [ + "GetXpnResources" + ] + }, + "ListXpnHosts": { + "methods": [ + "ListXpnHosts" + ] + }, + "MoveDisk": { + "methods": [ + "MoveDisk" + ] + }, + "MoveInstance": { + "methods": [ + "MoveInstance" + ] + }, + "SetCommonInstanceMetadata": { + "methods": [ + "SetCommonInstanceMetadata" + ] + }, + "SetDefaultNetworkTier": { + "methods": [ + "SetDefaultNetworkTier" + ] + }, + "SetUsageExportBucket": { + "methods": [ + "SetUsageExportBucket" + ] + } + } + } + } + }, + "PublicAdvertisedPrefixes": { + "clients": { + "rest": { + "libraryClient": "PublicAdvertisedPrefixesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "PublicDelegatedPrefixes": { + "clients": { + "rest": { + "libraryClient": "PublicDelegatedPrefixesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "RegionAutoscalers": { + "clients": { + "rest": { + "libraryClient": "RegionAutoscalersClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "RegionBackendServices": { + "clients": { + "rest": { + "libraryClient": "RegionBackendServicesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetHealth": { + "methods": [ + "GetHealth" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "RegionCommitments": { + "clients": { + "rest": { + "libraryClient": "RegionCommitmentsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "RegionDiskTypes": { + "clients": { + "rest": { + "libraryClient": "RegionDiskTypesClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "RegionDisks": { + "clients": { + "rest": { + "libraryClient": "RegionDisksClient", + "rpcs": { + "AddResourcePolicies": { + "methods": [ + "AddResourcePolicies" + ] + }, + "CreateSnapshot": { + "methods": [ + "CreateSnapshot" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "RemoveResourcePolicies": { + "methods": [ + "RemoveResourcePolicies" + ] + }, + "Resize": { + "methods": [ + "Resize" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "RegionHealthCheckServices": { + "clients": { + "rest": { + "libraryClient": "RegionHealthCheckServicesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "RegionHealthChecks": { + "clients": { + "rest": { + "libraryClient": "RegionHealthChecksClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "RegionInstanceGroupManagers": { + "clients": { + "rest": { + "libraryClient": "RegionInstanceGroupManagersClient", + "rpcs": { + "AbandonInstances": { + "methods": [ + "AbandonInstances" + ] + }, + "ApplyUpdatesToInstances": { + "methods": [ + "ApplyUpdatesToInstances" + ] + }, + "CreateInstances": { + "methods": [ + "CreateInstances" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "DeleteInstances": { + "methods": [ + "DeleteInstances" + ] + }, + "DeletePerInstanceConfigs": { + "methods": [ + "DeletePerInstanceConfigs" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListErrors": { + "methods": [ + "ListErrors" + ] + }, + "ListManagedInstances": { + "methods": [ + "ListManagedInstances" + ] + }, + "ListPerInstanceConfigs": { + "methods": [ + "ListPerInstanceConfigs" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "PatchPerInstanceConfigs": { + "methods": [ + "PatchPerInstanceConfigs" + ] + }, + "RecreateInstances": { + "methods": [ + "RecreateInstances" + ] + }, + "Resize": { + "methods": [ + "Resize" + ] + }, + "SetInstanceTemplate": { + "methods": [ + "SetInstanceTemplate" + ] + }, + "SetTargetPools": { + "methods": [ + "SetTargetPools" + ] + }, + "UpdatePerInstanceConfigs": { + "methods": [ + "UpdatePerInstanceConfigs" + ] + } + } + } + } + }, + "RegionInstanceGroups": { + "clients": { + "rest": { + "libraryClient": "RegionInstanceGroupsClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListInstances": { + "methods": [ + "ListInstances" + ] + }, + "SetNamedPorts": { + "methods": [ + "SetNamedPorts" + ] + } + } + } + } + }, + "RegionInstances": { + "clients": { + "rest": { + "libraryClient": "RegionInstancesClient", + "rpcs": { + "BulkInsert": { + "methods": [ + "BulkInsert" + ] + } + } + } + } + }, + "RegionNetworkEndpointGroups": { + "clients": { + "rest": { + "libraryClient": "RegionNetworkEndpointGroupsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "RegionNotificationEndpoints": { + "clients": { + "rest": { + "libraryClient": "RegionNotificationEndpointsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "RegionOperations": { + "clients": { + "rest": { + "libraryClient": "RegionOperationsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Wait": { + "methods": [ + "Wait" + ] + } + } + } + } + }, + "RegionSslCertificates": { + "clients": { + "rest": { + "libraryClient": "RegionSslCertificatesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "RegionTargetHttpProxies": { + "clients": { + "rest": { + "libraryClient": "RegionTargetHttpProxiesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetUrlMap": { + "methods": [ + "SetUrlMap" + ] + } + } + } + } + }, + "RegionTargetHttpsProxies": { + "clients": { + "rest": { + "libraryClient": "RegionTargetHttpsProxiesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetSslCertificates": { + "methods": [ + "SetSslCertificates" + ] + }, + "SetUrlMap": { + "methods": [ + "SetUrlMap" + ] + } + } + } + } + }, + "RegionUrlMaps": { + "clients": { + "rest": { + "libraryClient": "RegionUrlMapsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + }, + "Validate": { + "methods": [ + "Validate" + ] + } + } + } + } + }, + "Regions": { + "clients": { + "rest": { + "libraryClient": "RegionsClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "Reservations": { + "clients": { + "rest": { + "libraryClient": "ReservationsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Resize": { + "methods": [ + "Resize" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "ResourcePolicies": { + "clients": { + "rest": { + "libraryClient": "ResourcePoliciesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "Routers": { + "clients": { + "rest": { + "libraryClient": "RoutersClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetNatMappingInfo": { + "methods": [ + "GetNatMappingInfo" + ] + }, + "GetRouterStatus": { + "methods": [ + "GetRouterStatus" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Preview": { + "methods": [ + "Preview" + ] + }, + "Update": { + "methods": [ + "Update" + ] + } + } + } + } + }, + "Routes": { + "clients": { + "rest": { + "libraryClient": "RoutesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "SecurityPolicies": { + "clients": { + "rest": { + "libraryClient": "SecurityPoliciesClient", + "rpcs": { + "AddRule": { + "methods": [ + "AddRule" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetRule": { + "methods": [ + "GetRule" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListPreconfiguredExpressionSets": { + "methods": [ + "ListPreconfiguredExpressionSets" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "PatchRule": { + "methods": [ + "PatchRule" + ] + }, + "RemoveRule": { + "methods": [ + "RemoveRule" + ] + } + } + } + } + }, + "Snapshots": { + "clients": { + "rest": { + "libraryClient": "SnapshotsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "SslCertificates": { + "clients": { + "rest": { + "libraryClient": "SslCertificatesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "SslPolicies": { + "clients": { + "rest": { + "libraryClient": "SslPoliciesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListAvailableFeatures": { + "methods": [ + "ListAvailableFeatures" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "Subnetworks": { + "clients": { + "rest": { + "libraryClient": "SubnetworksClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "ExpandIpCidrRange": { + "methods": [ + "ExpandIpCidrRange" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "ListUsable": { + "methods": [ + "ListUsable" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "SetPrivateIpGoogleAccess": { + "methods": [ + "SetPrivateIpGoogleAccess" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "TargetGrpcProxies": { + "clients": { + "rest": { + "libraryClient": "TargetGrpcProxiesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + } + } + } + } + }, + "TargetHttpProxies": { + "clients": { + "rest": { + "libraryClient": "TargetHttpProxiesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetUrlMap": { + "methods": [ + "SetUrlMap" + ] + } + } + } + } + }, + "TargetHttpsProxies": { + "clients": { + "rest": { + "libraryClient": "TargetHttpsProxiesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetQuicOverride": { + "methods": [ + "SetQuicOverride" + ] + }, + "SetSslCertificates": { + "methods": [ + "SetSslCertificates" + ] + }, + "SetSslPolicy": { + "methods": [ + "SetSslPolicy" + ] + }, + "SetUrlMap": { + "methods": [ + "SetUrlMap" + ] + } + } + } + } + }, + "TargetInstances": { + "clients": { + "rest": { + "libraryClient": "TargetInstancesClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "TargetPools": { + "clients": { + "rest": { + "libraryClient": "TargetPoolsClient", + "rpcs": { + "AddHealthCheck": { + "methods": [ + "AddHealthCheck" + ] + }, + "AddInstance": { + "methods": [ + "AddInstance" + ] + }, + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetHealth": { + "methods": [ + "GetHealth" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "RemoveHealthCheck": { + "methods": [ + "RemoveHealthCheck" + ] + }, + "RemoveInstance": { + "methods": [ + "RemoveInstance" + ] + }, + "SetBackup": { + "methods": [ + "SetBackup" + ] + } + } + } + } + }, + "TargetSslProxies": { + "clients": { + "rest": { + "libraryClient": "TargetSslProxiesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetBackendService": { + "methods": [ + "SetBackendService" + ] + }, + "SetProxyHeader": { + "methods": [ + "SetProxyHeader" + ] + }, + "SetSslCertificates": { + "methods": [ + "SetSslCertificates" + ] + }, + "SetSslPolicy": { + "methods": [ + "SetSslPolicy" + ] + } + } + } + } + }, + "TargetTcpProxies": { + "clients": { + "rest": { + "libraryClient": "TargetTcpProxiesClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetBackendService": { + "methods": [ + "SetBackendService" + ] + }, + "SetProxyHeader": { + "methods": [ + "SetProxyHeader" + ] + } + } + } + } + }, + "TargetVpnGateways": { + "clients": { + "rest": { + "libraryClient": "TargetVpnGatewaysClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "UrlMaps": { + "clients": { + "rest": { + "libraryClient": "UrlMapsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "InvalidateCache": { + "methods": [ + "InvalidateCache" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "Update": { + "methods": [ + "Update" + ] + }, + "Validate": { + "methods": [ + "Validate" + ] + } + } + } + } + }, + "VpnGateways": { + "clients": { + "rest": { + "libraryClient": "VpnGatewaysClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetStatus": { + "methods": [ + "GetStatus" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "SetLabels": { + "methods": [ + "SetLabels" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, + "VpnTunnels": { + "clients": { + "rest": { + "libraryClient": "VpnTunnelsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + }, + "ZoneOperations": { + "clients": { + "rest": { + "libraryClient": "ZoneOperationsClient", + "rpcs": { + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Wait": { + "methods": [ + "Wait" + ] + } + } + } + } + }, + "Zones": { + "clients": { + "rest": { + "libraryClient": "ZonesClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + }, + "List": { + "methods": [ + "List" + ] + } + } + } + } + } + } +} diff --git a/compute/apiv1/global_addresses_client.go b/compute/apiv1/global_addresses_client.go new file mode 100644 index 000000000000..cc8774653016 --- /dev/null +++ b/compute/apiv1/global_addresses_client.go @@ -0,0 +1,380 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalAddressesClientHook clientHook + +// GlobalAddressesCallOptions contains the retry settings for each method of GlobalAddressesClient. +type GlobalAddressesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalGlobalAddressesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalAddressesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteGlobalAddressRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetGlobalAddressRequest, ...gax.CallOption) (*computepb.Address, error) + Insert(context.Context, *computepb.InsertGlobalAddressRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalAddressesRequest, ...gax.CallOption) (*computepb.AddressList, error) +} + +// GlobalAddressesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalAddresses API. +type GlobalAddressesClient struct { + // The internal transport-dependent client. + internalClient internalGlobalAddressesClient + + // The call options for this service. + CallOptions *GlobalAddressesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalAddressesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalAddressesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalAddressesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified address resource. +func (c *GlobalAddressesClient) Delete(ctx context.Context, req *computepb.DeleteGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified address resource. Gets a list of available addresses by making a list() request. +func (c *GlobalAddressesClient) Get(ctx context.Context, req *computepb.GetGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an address resource in the specified project by using the data included in the request. +func (c *GlobalAddressesClient) Insert(ctx context.Context, req *computepb.InsertGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of global addresses. +func (c *GlobalAddressesClient) List(ctx context.Context, req *computepb.ListGlobalAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalAddressesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalAddressesRESTClient creates a new global addresses rest client. +// +// The GlobalAddresses API. +func NewGlobalAddressesRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalAddressesClient, error) { + clientOpts := append(defaultGlobalAddressesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalAddressesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalAddressesClient{internalClient: c, CallOptions: &GlobalAddressesCallOptions{}}, nil +} + +func defaultGlobalAddressesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalAddressesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalAddressesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalAddressesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified address resource. +func (c *globalAddressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses/%v", req.GetProject(), req.GetAddress()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified address resource. Gets a list of available addresses by making a list() request. +func (c *globalAddressesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses/%v", req.GetProject(), req.GetAddress()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Address{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an address resource in the specified project by using the data included in the request. +func (c *globalAddressesRESTClient) Insert(ctx context.Context, req *computepb.InsertGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAddressResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of global addresses. +func (c *globalAddressesRESTClient) List(ctx context.Context, req *computepb.ListGlobalAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.AddressList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_addresses_client_example_test.go b/compute/apiv1/global_addresses_client_example_test.go new file mode 100644 index 000000000000..a226879e9577 --- /dev/null +++ b/compute/apiv1/global_addresses_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalAddressesRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalAddressesClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalAddressesClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalAddressesClient_Insert() { + ctx := context.Background() + c, err := compute.NewGlobalAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertGlobalAddressRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalAddressesClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalAddressesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalAddressesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/global_forwarding_rules_client.go b/compute/apiv1/global_forwarding_rules_client.go new file mode 100644 index 000000000000..311265010410 --- /dev/null +++ b/compute/apiv1/global_forwarding_rules_client.go @@ -0,0 +1,547 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalForwardingRulesClientHook clientHook + +// GlobalForwardingRulesCallOptions contains the retry settings for each method of GlobalForwardingRulesClient. +type GlobalForwardingRulesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetLabels []gax.CallOption + SetTarget []gax.CallOption +} + +// internalGlobalForwardingRulesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalForwardingRulesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.ForwardingRule, error) + Insert(context.Context, *computepb.InsertGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalForwardingRulesRequest, ...gax.CallOption) (*computepb.ForwardingRuleList, error) + Patch(context.Context, *computepb.PatchGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + SetLabels(context.Context, *computepb.SetLabelsGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) + SetTarget(context.Context, *computepb.SetTargetGlobalForwardingRuleRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// GlobalForwardingRulesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalForwardingRules API. +type GlobalForwardingRulesClient struct { + // The internal transport-dependent client. + internalClient internalGlobalForwardingRulesClient + + // The call options for this service. + CallOptions *GlobalForwardingRulesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalForwardingRulesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalForwardingRulesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalForwardingRulesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified GlobalForwardingRule resource. +func (c *GlobalForwardingRulesClient) Delete(ctx context.Context, req *computepb.DeleteGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules by making a list() request. +func (c *GlobalForwardingRulesClient) Get(ctx context.Context, req *computepb.GetGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a GlobalForwardingRule resource in the specified project using the data included in the request. +func (c *GlobalForwardingRulesClient) Insert(ctx context.Context, req *computepb.InsertGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of GlobalForwardingRule resources available to the specified project. +func (c *GlobalForwardingRulesClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. +func (c *GlobalForwardingRulesClient) Patch(ctx context.Context, req *computepb.PatchGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. +func (c *GlobalForwardingRulesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// SetTarget changes target URL for the GlobalForwardingRule resource. The new target should be of the same type as the old target. +func (c *GlobalForwardingRulesClient) SetTarget(ctx context.Context, req *computepb.SetTargetGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetTarget(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalForwardingRulesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalForwardingRulesRESTClient creates a new global forwarding rules rest client. +// +// The GlobalForwardingRules API. +func NewGlobalForwardingRulesRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalForwardingRulesClient, error) { + clientOpts := append(defaultGlobalForwardingRulesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalForwardingRulesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalForwardingRulesClient{internalClient: c, CallOptions: &GlobalForwardingRulesCallOptions{}}, nil +} + +func defaultGlobalForwardingRulesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalForwardingRulesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalForwardingRulesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalForwardingRulesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified GlobalForwardingRule resource. +func (c *globalForwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v", req.GetProject(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules by making a list() request. +func (c *globalForwardingRulesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v", req.GetProject(), req.GetForwardingRule()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ForwardingRule{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a GlobalForwardingRule resource in the specified project using the data included in the request. +func (c *globalForwardingRulesRESTClient) Insert(ctx context.Context, req *computepb.InsertGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetForwardingRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of GlobalForwardingRule resources available to the specified project. +func (c *globalForwardingRulesRESTClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ForwardingRuleList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. +func (c *globalForwardingRulesRESTClient) Patch(ctx context.Context, req *computepb.PatchGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetForwardingRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v", req.GetProject(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. +func (c *globalForwardingRulesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v/setLabels", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetTarget changes target URL for the GlobalForwardingRule resource. The new target should be of the same type as the old target. +func (c *globalForwardingRulesRESTClient) SetTarget(ctx context.Context, req *computepb.SetTargetGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v/setTarget", req.GetProject(), req.GetForwardingRule()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_forwarding_rules_client_example_test.go b/compute/apiv1/global_forwarding_rules_client_example_test.go new file mode 100644 index 000000000000..13f8bce3d6b1 --- /dev/null +++ b/compute/apiv1/global_forwarding_rules_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalForwardingRulesRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalForwardingRulesClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_Insert() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalForwardingRulesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_Patch() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalForwardingRulesClient_SetTarget() { + ctx := context.Background() + c, err := compute.NewGlobalForwardingRulesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetTargetGlobalForwardingRuleRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetTarget(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/global_network_endpoint_groups_client.go b/compute/apiv1/global_network_endpoint_groups_client.go new file mode 100644 index 000000000000..54f22cccf5d8 --- /dev/null +++ b/compute/apiv1/global_network_endpoint_groups_client.go @@ -0,0 +1,565 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalNetworkEndpointGroupsClientHook clientHook + +// GlobalNetworkEndpointGroupsCallOptions contains the retry settings for each method of GlobalNetworkEndpointGroupsClient. +type GlobalNetworkEndpointGroupsCallOptions struct { + AttachNetworkEndpoints []gax.CallOption + Delete []gax.CallOption + DetachNetworkEndpoints []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListNetworkEndpoints []gax.CallOption +} + +// internalGlobalNetworkEndpointGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalNetworkEndpointGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AttachNetworkEndpoints(context.Context, *computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteGlobalNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + DetachNetworkEndpoints(context.Context, *computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetGlobalNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) + Insert(context.Context, *computepb.InsertGlobalNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) + ListNetworkEndpoints(context.Context, *computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) +} + +// GlobalNetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalNetworkEndpointGroups API. +type GlobalNetworkEndpointGroupsClient struct { + // The internal transport-dependent client. + internalClient internalGlobalNetworkEndpointGroupsClient + + // The call options for this service. + CallOptions *GlobalNetworkEndpointGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalNetworkEndpointGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalNetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalNetworkEndpointGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AttachNetworkEndpoints attach a network endpoint to the specified network endpoint group. +func (c *GlobalNetworkEndpointGroupsClient) AttachNetworkEndpoints(ctx context.Context, req *computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AttachNetworkEndpoints(ctx, req, opts...) +} + +// Delete deletes the specified network endpoint group.Note that the NEG cannot be deleted if there are backend services referencing it. +func (c *GlobalNetworkEndpointGroupsClient) Delete(ctx context.Context, req *computepb.DeleteGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DetachNetworkEndpoints detach the network endpoint from the specified network endpoint group. +func (c *GlobalNetworkEndpointGroupsClient) DetachNetworkEndpoints(ctx context.Context, req *computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DetachNetworkEndpoints(ctx, req, opts...) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *GlobalNetworkEndpointGroupsClient) Get(ctx context.Context, req *computepb.GetGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *GlobalNetworkEndpointGroupsClient) Insert(ctx context.Context, req *computepb.InsertGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of network endpoint groups that are located in the specified project. +func (c *GlobalNetworkEndpointGroupsClient) List(ctx context.Context, req *computepb.ListGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListNetworkEndpoints lists the network endpoints in the specified network endpoint group. +func (c *GlobalNetworkEndpointGroupsClient) ListNetworkEndpoints(ctx context.Context, req *computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) { + return c.internalClient.ListNetworkEndpoints(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalNetworkEndpointGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalNetworkEndpointGroupsRESTClient creates a new global network endpoint groups rest client. +// +// The GlobalNetworkEndpointGroups API. +func NewGlobalNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalNetworkEndpointGroupsClient, error) { + clientOpts := append(defaultGlobalNetworkEndpointGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalNetworkEndpointGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalNetworkEndpointGroupsClient{internalClient: c, CallOptions: &GlobalNetworkEndpointGroupsCallOptions{}}, nil +} + +func defaultGlobalNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalNetworkEndpointGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalNetworkEndpointGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalNetworkEndpointGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AttachNetworkEndpoints attach a network endpoint to the specified network endpoint group. +func (c *globalNetworkEndpointGroupsRESTClient) AttachNetworkEndpoints(ctx context.Context, req *computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalNetworkEndpointGroupsAttachEndpointsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v/attachNetworkEndpoints", req.GetProject(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified network endpoint group.Note that the NEG cannot be deleted if there are backend services referencing it. +func (c *globalNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v", req.GetProject(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DetachNetworkEndpoints detach the network endpoint from the specified network endpoint group. +func (c *globalNetworkEndpointGroupsRESTClient) DetachNetworkEndpoints(ctx context.Context, req *computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalNetworkEndpointGroupsDetachEndpointsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v/detachNetworkEndpoints", req.GetProject(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *globalNetworkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v", req.GetProject(), req.GetNetworkEndpointGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *globalNetworkEndpointGroupsRESTClient) Insert(ctx context.Context, req *computepb.InsertGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of network endpoint groups that are located in the specified project. +func (c *globalNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListNetworkEndpoints lists the network endpoints in the specified network endpoint group. +func (c *globalNetworkEndpointGroupsRESTClient) ListNetworkEndpoints(ctx context.Context, req *computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v/listNetworkEndpoints", req.GetProject(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupsListNetworkEndpoints{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_network_endpoint_groups_client_example_test.go b/compute/apiv1/global_network_endpoint_groups_client_example_test.go new file mode 100644 index 000000000000..80361d6d06e1 --- /dev/null +++ b/compute/apiv1/global_network_endpoint_groups_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalNetworkEndpointGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalNetworkEndpointGroupsClient_AttachNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AttachNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_DetachNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DetachNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_Insert() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertGlobalNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalNetworkEndpointGroupsClient_ListNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/global_operations_client.go b/compute/apiv1/global_operations_client.go new file mode 100644 index 000000000000..928eedface28 --- /dev/null +++ b/compute/apiv1/global_operations_client.go @@ -0,0 +1,449 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalOperationsClientHook clientHook + +// GlobalOperationsCallOptions contains the retry settings for each method of GlobalOperationsClient. +type GlobalOperationsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + List []gax.CallOption + Wait []gax.CallOption +} + +// internalGlobalOperationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalOperationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListGlobalOperationsRequest, ...gax.CallOption) (*computepb.OperationAggregatedList, error) + Delete(context.Context, *computepb.DeleteGlobalOperationRequest, ...gax.CallOption) (*computepb.DeleteGlobalOperationResponse, error) + Get(context.Context, *computepb.GetGlobalOperationRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalOperationsRequest, ...gax.CallOption) (*computepb.OperationList, error) + Wait(context.Context, *computepb.WaitGlobalOperationRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// GlobalOperationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalOperations API. +type GlobalOperationsClient struct { + // The internal transport-dependent client. + internalClient internalGlobalOperationsClient + + // The call options for this service. + CallOptions *GlobalOperationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalOperationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalOperationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalOperationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of all operations. +func (c *GlobalOperationsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified Operations resource. +func (c *GlobalOperationsClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOperationResponse, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +func (c *GlobalOperationsClient) Get(ctx context.Context, req *computepb.GetGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of Operation resources contained within the specified project. +func (c *GlobalOperationsClient) List(ctx context.Context, req *computepb.ListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *GlobalOperationsClient) Wait(ctx context.Context, req *computepb.WaitGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Wait(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalOperationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalOperationsRESTClient creates a new global operations rest client. +// +// The GlobalOperations API. +func NewGlobalOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalOperationsClient, error) { + clientOpts := append(defaultGlobalOperationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalOperationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalOperationsClient{internalClient: c, CallOptions: &GlobalOperationsCallOptions{}}, nil +} + +func defaultGlobalOperationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalOperationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalOperationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalOperationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of all operations. +func (c *globalOperationsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/operations", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.OperationAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified Operations resource. +func (c *globalOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOperationResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v", req.GetProject(), req.GetOperation()) + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DeleteGlobalOperationResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +func (c *globalOperationsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v", req.GetProject(), req.GetOperation()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of Operation resources contained within the specified project. +func (c *globalOperationsRESTClient) List(ctx context.Context, req *computepb.ListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.OperationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *globalOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v/wait", req.GetProject(), req.GetOperation()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_operations_client_example_test.go b/compute/apiv1/global_operations_client_example_test.go new file mode 100644 index 000000000000..4cb6a7867b3c --- /dev/null +++ b/compute/apiv1/global_operations_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalOperationsRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalOperationsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListGlobalOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOperationsClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOperationsClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOperationsClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOperationsClient_Wait() { + ctx := context.Background() + c, err := compute.NewGlobalOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.WaitGlobalOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Wait(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/global_organization_operations_client.go b/compute/apiv1/global_organization_operations_client.go new file mode 100644 index 000000000000..94cec22cbfc1 --- /dev/null +++ b/compute/apiv1/global_organization_operations_client.go @@ -0,0 +1,332 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalOrganizationOperationsClientHook clientHook + +// GlobalOrganizationOperationsCallOptions contains the retry settings for each method of GlobalOrganizationOperationsClient. +type GlobalOrganizationOperationsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + List []gax.CallOption +} + +// internalGlobalOrganizationOperationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalOrganizationOperationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteGlobalOrganizationOperationRequest, ...gax.CallOption) (*computepb.DeleteGlobalOrganizationOperationResponse, error) + Get(context.Context, *computepb.GetGlobalOrganizationOperationRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalOrganizationOperationsRequest, ...gax.CallOption) (*computepb.OperationList, error) +} + +// GlobalOrganizationOperationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalOrganizationOperations API. +type GlobalOrganizationOperationsClient struct { + // The internal transport-dependent client. + internalClient internalGlobalOrganizationOperationsClient + + // The call options for this service. + CallOptions *GlobalOrganizationOperationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalOrganizationOperationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalOrganizationOperationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalOrganizationOperationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified Operations resource. +func (c *GlobalOrganizationOperationsClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOrganizationOperationResponse, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +func (c *GlobalOrganizationOperationsClient) Get(ctx context.Context, req *computepb.GetGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of Operation resources contained within the specified organization. +func (c *GlobalOrganizationOperationsClient) List(ctx context.Context, req *computepb.ListGlobalOrganizationOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalOrganizationOperationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalOrganizationOperationsRESTClient creates a new global organization operations rest client. +// +// The GlobalOrganizationOperations API. +func NewGlobalOrganizationOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalOrganizationOperationsClient, error) { + clientOpts := append(defaultGlobalOrganizationOperationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalOrganizationOperationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalOrganizationOperationsClient{internalClient: c, CallOptions: &GlobalOrganizationOperationsCallOptions{}}, nil +} + +func defaultGlobalOrganizationOperationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalOrganizationOperationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalOrganizationOperationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalOrganizationOperationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified Operations resource. +func (c *globalOrganizationOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOrganizationOperationResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations/%v", req.GetOperation()) + + params := url.Values{} + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DeleteGlobalOrganizationOperationResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +func (c *globalOrganizationOperationsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations/%v", req.GetOperation()) + + params := url.Values{} + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of Operation resources contained within the specified organization. +func (c *globalOrganizationOperationsRESTClient) List(ctx context.Context, req *computepb.ListGlobalOrganizationOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations") + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ParentId != nil { + params.Add("parentId", fmt.Sprintf("%v", req.GetParentId())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.OperationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_organization_operations_client_example_test.go b/compute/apiv1/global_organization_operations_client_example_test.go new file mode 100644 index 000000000000..1018ba674335 --- /dev/null +++ b/compute/apiv1/global_organization_operations_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalOrganizationOperationsRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalOrganizationOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalOrganizationOperationsClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalOrganizationOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalOrganizationOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOrganizationOperationsClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalOrganizationOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalOrganizationOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalOrganizationOperationsClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalOrganizationOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalOrganizationOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/global_public_delegated_prefixes_client.go b/compute/apiv1/global_public_delegated_prefixes_client.go new file mode 100644 index 000000000000..b0e0fc7cc99b --- /dev/null +++ b/compute/apiv1/global_public_delegated_prefixes_client.go @@ -0,0 +1,438 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newGlobalPublicDelegatedPrefixesClientHook clientHook + +// GlobalPublicDelegatedPrefixesCallOptions contains the retry settings for each method of GlobalPublicDelegatedPrefixesClient. +type GlobalPublicDelegatedPrefixesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalGlobalPublicDelegatedPrefixesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalGlobalPublicDelegatedPrefixesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteGlobalPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetGlobalPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) + Insert(context.Context, *computepb.InsertGlobalPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListGlobalPublicDelegatedPrefixesRequest, ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) + Patch(context.Context, *computepb.PatchGlobalPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// GlobalPublicDelegatedPrefixesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The GlobalPublicDelegatedPrefixes API. +type GlobalPublicDelegatedPrefixesClient struct { + // The internal transport-dependent client. + internalClient internalGlobalPublicDelegatedPrefixesClient + + // The call options for this service. + CallOptions *GlobalPublicDelegatedPrefixesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GlobalPublicDelegatedPrefixesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GlobalPublicDelegatedPrefixesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *GlobalPublicDelegatedPrefixesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified global PublicDelegatedPrefix. +func (c *GlobalPublicDelegatedPrefixesClient) Delete(ctx context.Context, req *computepb.DeleteGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified global PublicDelegatedPrefix resource. +func (c *GlobalPublicDelegatedPrefixesClient) Get(ctx context.Context, req *computepb.GetGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a global PublicDelegatedPrefix in the specified project using the parameters that are included in the request. +func (c *GlobalPublicDelegatedPrefixesClient) Insert(ctx context.Context, req *computepb.InsertGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the global PublicDelegatedPrefixes for a project. +func (c *GlobalPublicDelegatedPrefixesClient) List(ctx context.Context, req *computepb.ListGlobalPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified global PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *GlobalPublicDelegatedPrefixesClient) Patch(ctx context.Context, req *computepb.PatchGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type globalPublicDelegatedPrefixesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGlobalPublicDelegatedPrefixesRESTClient creates a new global public delegated prefixes rest client. +// +// The GlobalPublicDelegatedPrefixes API. +func NewGlobalPublicDelegatedPrefixesRESTClient(ctx context.Context, opts ...option.ClientOption) (*GlobalPublicDelegatedPrefixesClient, error) { + clientOpts := append(defaultGlobalPublicDelegatedPrefixesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &globalPublicDelegatedPrefixesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &GlobalPublicDelegatedPrefixesClient{internalClient: c, CallOptions: &GlobalPublicDelegatedPrefixesCallOptions{}}, nil +} + +func defaultGlobalPublicDelegatedPrefixesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *globalPublicDelegatedPrefixesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *globalPublicDelegatedPrefixesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *globalPublicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified global PublicDelegatedPrefix. +func (c *globalPublicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes/%v", req.GetProject(), req.GetPublicDelegatedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified global PublicDelegatedPrefix resource. +func (c *globalPublicDelegatedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes/%v", req.GetProject(), req.GetPublicDelegatedPrefix()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicDelegatedPrefix{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a global PublicDelegatedPrefix in the specified project using the parameters that are included in the request. +func (c *globalPublicDelegatedPrefixesRESTClient) Insert(ctx context.Context, req *computepb.InsertGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicDelegatedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists the global PublicDelegatedPrefixes for a project. +func (c *globalPublicDelegatedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListGlobalPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicDelegatedPrefixList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified global PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *globalPublicDelegatedPrefixesRESTClient) Patch(ctx context.Context, req *computepb.PatchGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicDelegatedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes/%v", req.GetProject(), req.GetPublicDelegatedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/global_public_delegated_prefixes_client_example_test.go b/compute/apiv1/global_public_delegated_prefixes_client_example_test.go new file mode 100644 index 000000000000..dc9f1da0034b --- /dev/null +++ b/compute/apiv1/global_public_delegated_prefixes_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewGlobalPublicDelegatedPrefixesRESTClient() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleGlobalPublicDelegatedPrefixesClient_Delete() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteGlobalPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalPublicDelegatedPrefixesClient_Get() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGlobalPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalPublicDelegatedPrefixesClient_Insert() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertGlobalPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalPublicDelegatedPrefixesClient_List() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListGlobalPublicDelegatedPrefixesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGlobalPublicDelegatedPrefixesClient_Patch() { + ctx := context.Background() + c, err := compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchGlobalPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/health_checks_client.go b/compute/apiv1/health_checks_client.go new file mode 100644 index 000000000000..887b7c4a8535 --- /dev/null +++ b/compute/apiv1/health_checks_client.go @@ -0,0 +1,574 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newHealthChecksClientHook clientHook + +// HealthChecksCallOptions contains the retry settings for each method of HealthChecksClient. +type HealthChecksCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalHealthChecksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalHealthChecksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListHealthChecksRequest, ...gax.CallOption) (*computepb.HealthChecksAggregatedList, error) + Delete(context.Context, *computepb.DeleteHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetHealthCheckRequest, ...gax.CallOption) (*computepb.HealthCheck, error) + Insert(context.Context, *computepb.InsertHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListHealthChecksRequest, ...gax.CallOption) (*computepb.HealthCheckList, error) + Patch(context.Context, *computepb.PatchHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// HealthChecksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The HealthChecks API. +type HealthChecksClient struct { + // The internal transport-dependent client. + internalClient internalHealthChecksClient + + // The call options for this service. + CallOptions *HealthChecksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *HealthChecksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *HealthChecksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *HealthChecksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all HealthCheck resources, regional and global, available to the specified project. +func (c *HealthChecksClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthChecksAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified HealthCheck resource. +func (c *HealthChecksClient) Delete(ctx context.Context, req *computepb.DeleteHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. +func (c *HealthChecksClient) Get(ctx context.Context, req *computepb.GetHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a HealthCheck resource in the specified project using the data included in the request. +func (c *HealthChecksClient) Insert(ctx context.Context, req *computepb.InsertHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of HealthCheck resources available to the specified project. +func (c *HealthChecksClient) List(ctx context.Context, req *computepb.ListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *HealthChecksClient) Patch(ctx context.Context, req *computepb.PatchHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates a HealthCheck resource in the specified project using the data included in the request. +func (c *HealthChecksClient) Update(ctx context.Context, req *computepb.UpdateHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type healthChecksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewHealthChecksRESTClient creates a new health checks rest client. +// +// The HealthChecks API. +func NewHealthChecksRESTClient(ctx context.Context, opts ...option.ClientOption) (*HealthChecksClient, error) { + clientOpts := append(defaultHealthChecksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &healthChecksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &HealthChecksClient{internalClient: c, CallOptions: &HealthChecksCallOptions{}}, nil +} + +func defaultHealthChecksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *healthChecksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *healthChecksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *healthChecksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all HealthCheck resources, regional and global, available to the specified project. +func (c *healthChecksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthChecksAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/healthChecks", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthChecksAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified HealthCheck resource. +func (c *healthChecksRESTClient) Delete(ctx context.Context, req *computepb.DeleteHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks/%v", req.GetProject(), req.GetHealthCheck()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. +func (c *healthChecksRESTClient) Get(ctx context.Context, req *computepb.GetHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks/%v", req.GetProject(), req.GetHealthCheck()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheck{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a HealthCheck resource in the specified project using the data included in the request. +func (c *healthChecksRESTClient) Insert(ctx context.Context, req *computepb.InsertHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of HealthCheck resources available to the specified project. +func (c *healthChecksRESTClient) List(ctx context.Context, req *computepb.ListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheckList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *healthChecksRESTClient) Patch(ctx context.Context, req *computepb.PatchHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks/%v", req.GetProject(), req.GetHealthCheck()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates a HealthCheck resource in the specified project using the data included in the request. +func (c *healthChecksRESTClient) Update(ctx context.Context, req *computepb.UpdateHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetHealthCheck() != "" { + params.Add("healthCheck", fmt.Sprintf("%v", req.GetHealthCheck())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/health_checks_client_example_test.go b/compute/apiv1/health_checks_client_example_test.go new file mode 100644 index 000000000000..fe6aeb7fe687 --- /dev/null +++ b/compute/apiv1/health_checks_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewHealthChecksRESTClient() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleHealthChecksClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListHealthChecksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_Delete() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_Get() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_Insert() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_List() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListHealthChecksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_Patch() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleHealthChecksClient_Update() { + ctx := context.Background() + c, err := compute.NewHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/images_client.go b/compute/apiv1/images_client.go new file mode 100644 index 000000000000..8fbfa02a672a --- /dev/null +++ b/compute/apiv1/images_client.go @@ -0,0 +1,763 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newImagesClientHook clientHook + +// ImagesCallOptions contains the retry settings for each method of ImagesClient. +type ImagesCallOptions struct { + Delete []gax.CallOption + Deprecate []gax.CallOption + Get []gax.CallOption + GetFromFamily []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetIamPolicy []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalImagesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalImagesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteImageRequest, ...gax.CallOption) (*computepb.Operation, error) + Deprecate(context.Context, *computepb.DeprecateImageRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetImageRequest, ...gax.CallOption) (*computepb.Image, error) + GetFromFamily(context.Context, *computepb.GetFromFamilyImageRequest, ...gax.CallOption) (*computepb.Image, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyImageRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertImageRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListImagesRequest, ...gax.CallOption) (*computepb.ImageList, error) + Patch(context.Context, *computepb.PatchImageRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyImageRequest, ...gax.CallOption) (*computepb.Policy, error) + SetLabels(context.Context, *computepb.SetLabelsImageRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsImageRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// ImagesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Images API. +type ImagesClient struct { + // The internal transport-dependent client. + internalClient internalImagesClient + + // The call options for this service. + CallOptions *ImagesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ImagesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ImagesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ImagesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified image. +func (c *ImagesClient) Delete(ctx context.Context, req *computepb.DeleteImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Deprecate sets the deprecation status of an image. +// +// If an empty request body is given, clears the deprecation status instead. +func (c *ImagesClient) Deprecate(ctx context.Context, req *computepb.DeprecateImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Deprecate(ctx, req, opts...) +} + +// Get returns the specified image. Gets a list of available images by making a list() request. +func (c *ImagesClient) Get(ctx context.Context, req *computepb.GetImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetFromFamily returns the latest image that is part of an image family and is not deprecated. +func (c *ImagesClient) GetFromFamily(ctx context.Context, req *computepb.GetFromFamilyImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { + return c.internalClient.GetFromFamily(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *ImagesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyImageRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates an image in the specified project using the data included in the request. +func (c *ImagesClient) Insert(ctx context.Context, req *computepb.InsertImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. +func (c *ImagesClient) List(ctx context.Context, req *computepb.ListImagesRequest, opts ...gax.CallOption) (*computepb.ImageList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status. +func (c *ImagesClient) Patch(ctx context.Context, req *computepb.PatchImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *ImagesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyImageRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetLabels sets the labels on an image. To learn more about labels, read the Labeling Resources documentation. +func (c *ImagesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *ImagesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsImageRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type imagesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewImagesRESTClient creates a new images rest client. +// +// The Images API. +func NewImagesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ImagesClient, error) { + clientOpts := append(defaultImagesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &imagesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ImagesClient{internalClient: c, CallOptions: &ImagesCallOptions{}}, nil +} + +func defaultImagesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *imagesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *imagesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *imagesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified image. +func (c *imagesRESTClient) Delete(ctx context.Context, req *computepb.DeleteImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v", req.GetProject(), req.GetImage()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Deprecate sets the deprecation status of an image. +// +// If an empty request body is given, clears the deprecation status instead. +func (c *imagesRESTClient) Deprecate(ctx context.Context, req *computepb.DeprecateImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDeprecationStatusResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/deprecate", req.GetProject(), req.GetImage()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified image. Gets a list of available images by making a list() request. +func (c *imagesRESTClient) Get(ctx context.Context, req *computepb.GetImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v", req.GetProject(), req.GetImage()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Image{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetFromFamily returns the latest image that is part of an image family and is not deprecated. +func (c *imagesRESTClient) GetFromFamily(ctx context.Context, req *computepb.GetFromFamilyImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/family/%v", req.GetProject(), req.GetFamily()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Image{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *imagesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyImageRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/getIamPolicy", req.GetProject(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an image in the specified project using the data included in the request. +func (c *imagesRESTClient) Insert(ctx context.Context, req *computepb.InsertImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetImageResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images", req.GetProject()) + + params := url.Values{} + if req != nil && req.ForceCreate != nil { + params.Add("forceCreate", fmt.Sprintf("%v", req.GetForceCreate())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. +func (c *imagesRESTClient) List(ctx context.Context, req *computepb.ListImagesRequest, opts ...gax.CallOption) (*computepb.ImageList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ImageList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status. +func (c *imagesRESTClient) Patch(ctx context.Context, req *computepb.PatchImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetImageResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v", req.GetProject(), req.GetImage()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *imagesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyImageRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/setIamPolicy", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on an image. To learn more about labels, read the Labeling Resources documentation. +func (c *imagesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/setLabels", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *imagesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsImageRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/images_client_example_test.go b/compute/apiv1/images_client_example_test.go new file mode 100644 index 000000000000..30c381525445 --- /dev/null +++ b/compute/apiv1/images_client_example_test.go @@ -0,0 +1,245 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewImagesRESTClient() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleImagesClient_Delete() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_Deprecate() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeprecateImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Deprecate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_Get() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_GetFromFamily() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetFromFamilyImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetFromFamily(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_Insert() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_List() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListImagesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_Patch() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImagesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewImagesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/instance_group_managers_client.go b/compute/apiv1/instance_group_managers_client.go new file mode 100644 index 000000000000..630395260888 --- /dev/null +++ b/compute/apiv1/instance_group_managers_client.go @@ -0,0 +1,1387 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInstanceGroupManagersClientHook clientHook + +// InstanceGroupManagersCallOptions contains the retry settings for each method of InstanceGroupManagersClient. +type InstanceGroupManagersCallOptions struct { + AbandonInstances []gax.CallOption + AggregatedList []gax.CallOption + ApplyUpdatesToInstances []gax.CallOption + CreateInstances []gax.CallOption + Delete []gax.CallOption + DeleteInstances []gax.CallOption + DeletePerInstanceConfigs []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListErrors []gax.CallOption + ListManagedInstances []gax.CallOption + ListPerInstanceConfigs []gax.CallOption + Patch []gax.CallOption + PatchPerInstanceConfigs []gax.CallOption + RecreateInstances []gax.CallOption + Resize []gax.CallOption + SetInstanceTemplate []gax.CallOption + SetTargetPools []gax.CallOption + UpdatePerInstanceConfigs []gax.CallOption +} + +// internalInstanceGroupManagersClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInstanceGroupManagersClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AbandonInstances(context.Context, *computepb.AbandonInstancesInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.InstanceGroupManagerAggregatedList, error) + ApplyUpdatesToInstances(context.Context, *computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + CreateInstances(context.Context, *computepb.CreateInstancesInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteInstances(context.Context, *computepb.DeleteInstancesInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + DeletePerInstanceConfigs(context.Context, *computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.InstanceGroupManager, error) + Insert(context.Context, *computepb.InsertInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.InstanceGroupManagerList, error) + ListErrors(context.Context, *computepb.ListErrorsInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.InstanceGroupManagersListErrorsResponse, error) + ListManagedInstances(context.Context, *computepb.ListManagedInstancesInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.InstanceGroupManagersListManagedInstancesResponse, error) + ListPerInstanceConfigs(context.Context, *computepb.ListPerInstanceConfigsInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.InstanceGroupManagersListPerInstanceConfigsResp, error) + Patch(context.Context, *computepb.PatchInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + PatchPerInstanceConfigs(context.Context, *computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + RecreateInstances(context.Context, *computepb.RecreateInstancesInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Resize(context.Context, *computepb.ResizeInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + SetInstanceTemplate(context.Context, *computepb.SetInstanceTemplateInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + SetTargetPools(context.Context, *computepb.SetTargetPoolsInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdatePerInstanceConfigs(context.Context, *computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// InstanceGroupManagersClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The InstanceGroupManagers API. +type InstanceGroupManagersClient struct { + // The internal transport-dependent client. + internalClient internalInstanceGroupManagersClient + + // The call options for this service. + CallOptions *InstanceGroupManagersCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InstanceGroupManagersClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InstanceGroupManagersClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InstanceGroupManagersClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AbandonInstances flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *InstanceGroupManagersClient) AbandonInstances(ctx context.Context, req *computepb.AbandonInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AbandonInstances(ctx, req, opts...) +} + +// AggregatedList retrieves the list of managed instance groups and groups them by zone. +func (c *InstanceGroupManagersClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// ApplyUpdatesToInstances applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions. +func (c *InstanceGroupManagersClient) ApplyUpdatesToInstances(ctx context.Context, req *computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.ApplyUpdatesToInstances(ctx, req, opts...) +} + +// CreateInstances creates instances with per-instance configs in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. +func (c *InstanceGroupManagersClient) CreateInstances(ctx context.Context, req *computepb.CreateInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.CreateInstances(ctx, req, opts...) +} + +// Delete deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. +func (c *InstanceGroupManagersClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteInstances flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *InstanceGroupManagersClient) DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteInstances(ctx, req, opts...) +} + +// DeletePerInstanceConfigs deletes selected per-instance configs for the managed instance group. +func (c *InstanceGroupManagersClient) DeletePerInstanceConfigs(ctx context.Context, req *computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeletePerInstanceConfigs(ctx, req, opts...) +} + +// Get returns all of the details about the specified managed instance group. Gets a list of available managed instance groups by making a list() request. +func (c *InstanceGroupManagersClient) Get(ctx context.Context, req *computepb.GetInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +// +// A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. +func (c *InstanceGroupManagersClient) Insert(ctx context.Context, req *computepb.InsertInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of managed instance groups that are contained within the specified project and zone. +func (c *InstanceGroupManagersClient) List(ctx context.Context, req *computepb.ListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListErrors lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported. +func (c *InstanceGroupManagersClient) ListErrors(ctx context.Context, req *computepb.ListErrorsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListErrorsResponse, error) { + return c.internalClient.ListErrors(ctx, req, opts...) +} + +// ListManagedInstances lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. +func (c *InstanceGroupManagersClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListManagedInstancesResponse, error) { + return c.internalClient.ListManagedInstances(ctx, req, opts...) +} + +// ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. +func (c *InstanceGroupManagersClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListPerInstanceConfigsResp, error) { + return c.internalClient.ListPerInstanceConfigs(ctx, req, opts...) +} + +// Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InstanceGroupManagersClient) Patch(ctx context.Context, req *computepb.PatchInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// PatchPerInstanceConfigs inserts or patches per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *InstanceGroupManagersClient) PatchPerInstanceConfigs(ctx context.Context, req *computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.PatchPerInstanceConfigs(ctx, req, opts...) +} + +// RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *InstanceGroupManagersClient) RecreateInstances(ctx context.Context, req *computepb.RecreateInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RecreateInstances(ctx, req, opts...) +} + +// Resize resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. +// +// When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: +// +// The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. +// +// This list is subject to change. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +func (c *InstanceGroupManagersClient) Resize(ctx context.Context, req *computepb.ResizeInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Resize(ctx, req, opts...) +} + +// SetInstanceTemplate specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group’s updatePolicy.type to PROACTIVE. +func (c *InstanceGroupManagersClient) SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetInstanceTemplate(ctx, req, opts...) +} + +// SetTargetPools modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group. +func (c *InstanceGroupManagersClient) SetTargetPools(ctx context.Context, req *computepb.SetTargetPoolsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetTargetPools(ctx, req, opts...) +} + +// UpdatePerInstanceConfigs inserts or updates per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *InstanceGroupManagersClient) UpdatePerInstanceConfigs(ctx context.Context, req *computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdatePerInstanceConfigs(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type instanceGroupManagersRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInstanceGroupManagersRESTClient creates a new instance group managers rest client. +// +// The InstanceGroupManagers API. +func NewInstanceGroupManagersRESTClient(ctx context.Context, opts ...option.ClientOption) (*InstanceGroupManagersClient, error) { + clientOpts := append(defaultInstanceGroupManagersRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &instanceGroupManagersRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InstanceGroupManagersClient{internalClient: c, CallOptions: &InstanceGroupManagersCallOptions{}}, nil +} + +func defaultInstanceGroupManagersRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *instanceGroupManagersRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *instanceGroupManagersRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *instanceGroupManagersRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AbandonInstances flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *instanceGroupManagersRESTClient) AbandonInstances(ctx context.Context, req *computepb.AbandonInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersAbandonInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/abandonInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves the list of managed instance groups and groups them by zone. +func (c *instanceGroupManagersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instanceGroupManagers", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManagerAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ApplyUpdatesToInstances applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions. +func (c *instanceGroupManagersRESTClient) ApplyUpdatesToInstances(ctx context.Context, req *computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersApplyUpdatesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/applyUpdatesToInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// CreateInstances creates instances with per-instance configs in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. +func (c *instanceGroupManagersRESTClient) CreateInstances(ctx context.Context, req *computepb.CreateInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersCreateInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/createInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. +func (c *instanceGroupManagersRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteInstances flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *instanceGroupManagersRESTClient) DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersDeleteInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/deleteInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeletePerInstanceConfigs deletes selected per-instance configs for the managed instance group. +func (c *instanceGroupManagersRESTClient) DeletePerInstanceConfigs(ctx context.Context, req *computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersDeletePerInstanceConfigsReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/deletePerInstanceConfigs", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns all of the details about the specified managed instance group. Gets a list of available managed instance groups by making a list() request. +func (c *instanceGroupManagersRESTClient) Get(ctx context.Context, req *computepb.GetInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManager{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +// +// A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. +func (c *instanceGroupManagersRESTClient) Insert(ctx context.Context, req *computepb.InsertInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of managed instance groups that are contained within the specified project and zone. +func (c *instanceGroupManagersRESTClient) List(ctx context.Context, req *computepb.ListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManagerList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListErrors lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported. +func (c *instanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *computepb.ListErrorsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListErrorsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listErrors", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManagersListErrorsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListManagedInstances lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. +func (c *instanceGroupManagersRESTClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListManagedInstancesResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listManagedInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManagersListManagedInstancesResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. +func (c *instanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListPerInstanceConfigsResp, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listPerInstanceConfigs", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManagersListPerInstanceConfigsResp{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *instanceGroupManagersRESTClient) Patch(ctx context.Context, req *computepb.PatchInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// PatchPerInstanceConfigs inserts or patches per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *instanceGroupManagersRESTClient) PatchPerInstanceConfigs(ctx context.Context, req *computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersPatchPerInstanceConfigsReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/patchPerInstanceConfigs", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *instanceGroupManagersRESTClient) RecreateInstances(ctx context.Context, req *computepb.RecreateInstancesInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersRecreateInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/recreateInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Resize resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. +// +// When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: +// +// The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. +// +// This list is subject to change. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +func (c *instanceGroupManagersRESTClient) Resize(ctx context.Context, req *computepb.ResizeInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetSize() != 0 { + params.Add("size", fmt.Sprintf("%v", req.GetSize())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetInstanceTemplate specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group’s updatePolicy.type to PROACTIVE. +func (c *instanceGroupManagersRESTClient) SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersSetInstanceTemplateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/setInstanceTemplate", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetTargetPools modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group. +func (c *instanceGroupManagersRESTClient) SetTargetPools(ctx context.Context, req *computepb.SetTargetPoolsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersSetTargetPoolsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/setTargetPools", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdatePerInstanceConfigs inserts or updates per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *instanceGroupManagersRESTClient) UpdatePerInstanceConfigs(ctx context.Context, req *computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagersUpdatePerInstanceConfigsReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/updatePerInstanceConfigs", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/instance_group_managers_client_example_test.go b/compute/apiv1/instance_group_managers_client_example_test.go new file mode 100644 index 000000000000..d5602e701170 --- /dev/null +++ b/compute/apiv1/instance_group_managers_client_example_test.go @@ -0,0 +1,416 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInstanceGroupManagersRESTClient() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInstanceGroupManagersClient_AbandonInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AbandonInstancesInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AbandonInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_ApplyUpdatesToInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ApplyUpdatesToInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_CreateInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.CreateInstancesInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_Delete() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_DeleteInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstancesInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_DeletePerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeletePerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_Get() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_Insert() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_List() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_ListErrors() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListErrorsInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListErrors(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_ListManagedInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListManagedInstancesInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListManagedInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_ListPerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPerInstanceConfigsInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListPerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_Patch() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_PatchPerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PatchPerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_RecreateInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RecreateInstancesInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RecreateInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_Resize() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResizeInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Resize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_SetInstanceTemplate() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetInstanceTemplateInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetInstanceTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_SetTargetPools() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetTargetPoolsInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetTargetPools(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupManagersClient_UpdatePerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdatePerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/instance_groups_client.go b/compute/apiv1/instance_groups_client.go new file mode 100644 index 000000000000..0d57cd321516 --- /dev/null +++ b/compute/apiv1/instance_groups_client.go @@ -0,0 +1,708 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInstanceGroupsClientHook clientHook + +// InstanceGroupsCallOptions contains the retry settings for each method of InstanceGroupsClient. +type InstanceGroupsCallOptions struct { + AddInstances []gax.CallOption + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListInstances []gax.CallOption + RemoveInstances []gax.CallOption + SetNamedPorts []gax.CallOption +} + +// internalInstanceGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInstanceGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddInstances(context.Context, *computepb.AddInstancesInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListInstanceGroupsRequest, ...gax.CallOption) (*computepb.InstanceGroupAggregatedList, error) + Delete(context.Context, *computepb.DeleteInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInstanceGroupRequest, ...gax.CallOption) (*computepb.InstanceGroup, error) + Insert(context.Context, *computepb.InsertInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInstanceGroupsRequest, ...gax.CallOption) (*computepb.InstanceGroupList, error) + ListInstances(context.Context, *computepb.ListInstancesInstanceGroupsRequest, ...gax.CallOption) (*computepb.InstanceGroupsListInstances, error) + RemoveInstances(context.Context, *computepb.RemoveInstancesInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + SetNamedPorts(context.Context, *computepb.SetNamedPortsInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// InstanceGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The InstanceGroups API. +type InstanceGroupsClient struct { + // The internal transport-dependent client. + internalClient internalInstanceGroupsClient + + // The call options for this service. + CallOptions *InstanceGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InstanceGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InstanceGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InstanceGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddInstances adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information. +func (c *InstanceGroupsClient) AddInstances(ctx context.Context, req *computepb.AddInstancesInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddInstances(ctx, req, opts...) +} + +// AggregatedList retrieves the list of instance groups and sorts them by zone. +func (c *InstanceGroupsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. +func (c *InstanceGroupsClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. +// +// For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. +func (c *InstanceGroupsClient) Get(ctx context.Context, req *computepb.GetInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an instance group in the specified project using the parameters that are included in the request. +func (c *InstanceGroupsClient) Insert(ctx context.Context, req *computepb.InsertInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of zonal instance group resources contained within the specified zone. +// +// For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. +func (c *InstanceGroupsClient) List(ctx context.Context, req *computepb.ListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListInstances lists the instances in the specified instance group. The orderBy query parameter is not supported. +func (c *InstanceGroupsClient) ListInstances(ctx context.Context, req *computepb.ListInstancesInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupsListInstances, error) { + return c.internalClient.ListInstances(ctx, req, opts...) +} + +// RemoveInstances removes one or more instances from the specified instance group, but does not delete those instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted. +func (c *InstanceGroupsClient) RemoveInstances(ctx context.Context, req *computepb.RemoveInstancesInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveInstances(ctx, req, opts...) +} + +// SetNamedPorts sets the named ports for the specified instance group. +func (c *InstanceGroupsClient) SetNamedPorts(ctx context.Context, req *computepb.SetNamedPortsInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetNamedPorts(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type instanceGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInstanceGroupsRESTClient creates a new instance groups rest client. +// +// The InstanceGroups API. +func NewInstanceGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*InstanceGroupsClient, error) { + clientOpts := append(defaultInstanceGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &instanceGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InstanceGroupsClient{internalClient: c, CallOptions: &InstanceGroupsCallOptions{}}, nil +} + +func defaultInstanceGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *instanceGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *instanceGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *instanceGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddInstances adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information. +func (c *instanceGroupsRESTClient) AddInstances(ctx context.Context, req *computepb.AddInstancesInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupsAddInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v/addInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves the list of instance groups and sorts them by zone. +func (c *instanceGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instanceGroups", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. +func (c *instanceGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. +// +// For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. +func (c *instanceGroupsRESTClient) Get(ctx context.Context, req *computepb.GetInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an instance group in the specified project using the parameters that are included in the request. +func (c *instanceGroupsRESTClient) Insert(ctx context.Context, req *computepb.InsertInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of zonal instance group resources contained within the specified zone. +// +// For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. +func (c *instanceGroupsRESTClient) List(ctx context.Context, req *computepb.ListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListInstances lists the instances in the specified instance group. The orderBy query parameter is not supported. +func (c *instanceGroupsRESTClient) ListInstances(ctx context.Context, req *computepb.ListInstancesInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupsListInstances, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupsListInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v/listInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupsListInstances{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveInstances removes one or more instances from the specified instance group, but does not delete those instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted. +func (c *instanceGroupsRESTClient) RemoveInstances(ctx context.Context, req *computepb.RemoveInstancesInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupsRemoveInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v/removeInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetNamedPorts sets the named ports for the specified instance group. +func (c *instanceGroupsRESTClient) SetNamedPorts(ctx context.Context, req *computepb.SetNamedPortsInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupsSetNamedPortsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v/setNamedPorts", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/instance_groups_client_example_test.go b/compute/apiv1/instance_groups_client_example_test.go new file mode 100644 index 000000000000..8e646affefb4 --- /dev/null +++ b/compute/apiv1/instance_groups_client_example_test.go @@ -0,0 +1,207 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInstanceGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInstanceGroupsClient_AddInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddInstancesInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListInstanceGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_Delete() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_Insert() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstanceGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_ListInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstancesInstanceGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_RemoveInstances() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveInstancesInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceGroupsClient_SetNamedPorts() { + ctx := context.Background() + c, err := compute.NewInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetNamedPortsInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNamedPorts(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/instance_templates_client.go b/compute/apiv1/instance_templates_client.go new file mode 100644 index 000000000000..2003c355cf0d --- /dev/null +++ b/compute/apiv1/instance_templates_client.go @@ -0,0 +1,539 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInstanceTemplatesClientHook clientHook + +// InstanceTemplatesCallOptions contains the retry settings for each method of InstanceTemplatesClient. +type InstanceTemplatesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalInstanceTemplatesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInstanceTemplatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteInstanceTemplateRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInstanceTemplateRequest, ...gax.CallOption) (*computepb.InstanceTemplate, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyInstanceTemplateRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertInstanceTemplateRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInstanceTemplatesRequest, ...gax.CallOption) (*computepb.InstanceTemplateList, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyInstanceTemplateRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsInstanceTemplateRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// InstanceTemplatesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The InstanceTemplates API. +type InstanceTemplatesClient struct { + // The internal transport-dependent client. + internalClient internalInstanceTemplatesClient + + // The call options for this service. + CallOptions *InstanceTemplatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InstanceTemplatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InstanceTemplatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InstanceTemplatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. +func (c *InstanceTemplatesClient) Delete(ctx context.Context, req *computepb.DeleteInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified instance template. Gets a list of available instance templates by making a list() request. +func (c *InstanceTemplatesClient) Get(ctx context.Context, req *computepb.GetInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.InstanceTemplate, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *InstanceTemplatesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. +func (c *InstanceTemplatesClient) Insert(ctx context.Context, req *computepb.InsertInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of instance templates that are contained within the specified project. +func (c *InstanceTemplatesClient) List(ctx context.Context, req *computepb.ListInstanceTemplatesRequest, opts ...gax.CallOption) (*computepb.InstanceTemplateList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *InstanceTemplatesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *InstanceTemplatesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type instanceTemplatesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInstanceTemplatesRESTClient creates a new instance templates rest client. +// +// The InstanceTemplates API. +func NewInstanceTemplatesRESTClient(ctx context.Context, opts ...option.ClientOption) (*InstanceTemplatesClient, error) { + clientOpts := append(defaultInstanceTemplatesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &instanceTemplatesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InstanceTemplatesClient{internalClient: c, CallOptions: &InstanceTemplatesCallOptions{}}, nil +} + +func defaultInstanceTemplatesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *instanceTemplatesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *instanceTemplatesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *instanceTemplatesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. +func (c *instanceTemplatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v", req.GetProject(), req.GetInstanceTemplate()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified instance template. Gets a list of available instance templates by making a list() request. +func (c *instanceTemplatesRESTClient) Get(ctx context.Context, req *computepb.GetInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.InstanceTemplate, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v", req.GetProject(), req.GetInstanceTemplate()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceTemplate{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *instanceTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v/getIamPolicy", req.GetProject(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. +func (c *instanceTemplatesRESTClient) Insert(ctx context.Context, req *computepb.InsertInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceTemplateResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of instance templates that are contained within the specified project. +func (c *instanceTemplatesRESTClient) List(ctx context.Context, req *computepb.ListInstanceTemplatesRequest, opts ...gax.CallOption) (*computepb.InstanceTemplateList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceTemplateList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *instanceTemplatesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v/setIamPolicy", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *instanceTemplatesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/instance_templates_client_example_test.go b/compute/apiv1/instance_templates_client_example_test.go new file mode 100644 index 000000000000..3cdbbabf56db --- /dev/null +++ b/compute/apiv1/instance_templates_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInstanceTemplatesRESTClient() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInstanceTemplatesClient_Delete() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_Get() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_Insert() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_List() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstanceTemplatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceTemplatesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewInstanceTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsInstanceTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/instances_client.go b/compute/apiv1/instances_client.go new file mode 100644 index 000000000000..365b3efe4fcb --- /dev/null +++ b/compute/apiv1/instances_client.go @@ -0,0 +1,2614 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInstancesClientHook clientHook + +// InstancesCallOptions contains the retry settings for each method of InstancesClient. +type InstancesCallOptions struct { + AddAccessConfig []gax.CallOption + AddResourcePolicies []gax.CallOption + AggregatedList []gax.CallOption + AttachDisk []gax.CallOption + BulkInsert []gax.CallOption + Delete []gax.CallOption + DeleteAccessConfig []gax.CallOption + DetachDisk []gax.CallOption + Get []gax.CallOption + GetEffectiveFirewalls []gax.CallOption + GetGuestAttributes []gax.CallOption + GetIamPolicy []gax.CallOption + GetScreenshot []gax.CallOption + GetSerialPortOutput []gax.CallOption + GetShieldedInstanceIdentity []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListReferrers []gax.CallOption + RemoveResourcePolicies []gax.CallOption + Reset []gax.CallOption + SetDeletionProtection []gax.CallOption + SetDiskAutoDelete []gax.CallOption + SetIamPolicy []gax.CallOption + SetLabels []gax.CallOption + SetMachineResources []gax.CallOption + SetMachineType []gax.CallOption + SetMetadata []gax.CallOption + SetMinCpuPlatform []gax.CallOption + SetScheduling []gax.CallOption + SetServiceAccount []gax.CallOption + SetShieldedInstanceIntegrityPolicy []gax.CallOption + SetTags []gax.CallOption + SimulateMaintenanceEvent []gax.CallOption + Start []gax.CallOption + StartWithEncryptionKey []gax.CallOption + Stop []gax.CallOption + TestIamPermissions []gax.CallOption + Update []gax.CallOption + UpdateAccessConfig []gax.CallOption + UpdateDisplayDevice []gax.CallOption + UpdateNetworkInterface []gax.CallOption + UpdateShieldedInstanceConfig []gax.CallOption +} + +// internalInstancesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInstancesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddAccessConfig(context.Context, *computepb.AddAccessConfigInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + AddResourcePolicies(context.Context, *computepb.AddResourcePoliciesInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListInstancesRequest, ...gax.CallOption) (*computepb.InstanceAggregatedList, error) + AttachDisk(context.Context, *computepb.AttachDiskInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + BulkInsert(context.Context, *computepb.BulkInsertInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteAccessConfig(context.Context, *computepb.DeleteAccessConfigInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + DetachDisk(context.Context, *computepb.DetachDiskInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInstanceRequest, ...gax.CallOption) (*computepb.Instance, error) + GetEffectiveFirewalls(context.Context, *computepb.GetEffectiveFirewallsInstanceRequest, ...gax.CallOption) (*computepb.InstancesGetEffectiveFirewallsResponse, error) + GetGuestAttributes(context.Context, *computepb.GetGuestAttributesInstanceRequest, ...gax.CallOption) (*computepb.GuestAttributes, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyInstanceRequest, ...gax.CallOption) (*computepb.Policy, error) + GetScreenshot(context.Context, *computepb.GetScreenshotInstanceRequest, ...gax.CallOption) (*computepb.Screenshot, error) + GetSerialPortOutput(context.Context, *computepb.GetSerialPortOutputInstanceRequest, ...gax.CallOption) (*computepb.SerialPortOutput, error) + GetShieldedInstanceIdentity(context.Context, *computepb.GetShieldedInstanceIdentityInstanceRequest, ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) + Insert(context.Context, *computepb.InsertInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInstancesRequest, ...gax.CallOption) (*computepb.InstanceList, error) + ListReferrers(context.Context, *computepb.ListReferrersInstancesRequest, ...gax.CallOption) (*computepb.InstanceListReferrers, error) + RemoveResourcePolicies(context.Context, *computepb.RemoveResourcePoliciesInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Reset(context.Context, *computepb.ResetInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetDeletionProtection(context.Context, *computepb.SetDeletionProtectionInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetDiskAutoDelete(context.Context, *computepb.SetDiskAutoDeleteInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyInstanceRequest, ...gax.CallOption) (*computepb.Policy, error) + SetLabels(context.Context, *computepb.SetLabelsInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetMachineResources(context.Context, *computepb.SetMachineResourcesInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetMachineType(context.Context, *computepb.SetMachineTypeInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetMetadata(context.Context, *computepb.SetMetadataInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetMinCpuPlatform(context.Context, *computepb.SetMinCpuPlatformInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetScheduling(context.Context, *computepb.SetSchedulingInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetServiceAccount(context.Context, *computepb.SetServiceAccountInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetShieldedInstanceIntegrityPolicy(context.Context, *computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SetTags(context.Context, *computepb.SetTagsInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + SimulateMaintenanceEvent(context.Context, *computepb.SimulateMaintenanceEventInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Start(context.Context, *computepb.StartInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + StartWithEncryptionKey(context.Context, *computepb.StartWithEncryptionKeyInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Stop(context.Context, *computepb.StopInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsInstanceRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) + Update(context.Context, *computepb.UpdateInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdateAccessConfig(context.Context, *computepb.UpdateAccessConfigInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdateDisplayDevice(context.Context, *computepb.UpdateDisplayDeviceInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdateNetworkInterface(context.Context, *computepb.UpdateNetworkInterfaceInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdateShieldedInstanceConfig(context.Context, *computepb.UpdateShieldedInstanceConfigInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// InstancesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Instances API. +type InstancesClient struct { + // The internal transport-dependent client. + internalClient internalInstancesClient + + // The call options for this service. + CallOptions *InstancesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InstancesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InstancesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InstancesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddAccessConfig adds an access config to an instance’s network interface. +func (c *InstancesClient) AddAccessConfig(ctx context.Context, req *computepb.AddAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddAccessConfig(ctx, req, opts...) +} + +// AddResourcePolicies adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations. +func (c *InstancesClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddResourcePolicies(ctx, req, opts...) +} + +// AggregatedList retrieves aggregated list of all of the instances in your project across all regions and zones. +func (c *InstancesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// AttachDisk attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. +func (c *InstancesClient) AttachDisk(ctx context.Context, req *computepb.AttachDiskInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AttachDisk(ctx, req, opts...) +} + +// BulkInsert creates multiple instances. Count specifies the number of instances to create. +func (c *InstancesClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.BulkInsert(ctx, req, opts...) +} + +// Delete deletes the specified Instance resource. For more information, see Deleting an instance. +func (c *InstancesClient) Delete(ctx context.Context, req *computepb.DeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteAccessConfig deletes an access config from an instance’s network interface. +func (c *InstancesClient) DeleteAccessConfig(ctx context.Context, req *computepb.DeleteAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteAccessConfig(ctx, req, opts...) +} + +// DetachDisk detaches a disk from an instance. +func (c *InstancesClient) DetachDisk(ctx context.Context, req *computepb.DetachDiskInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DetachDisk(ctx, req, opts...) +} + +// Get returns the specified Instance resource. Gets a list of available instances by making a list() request. +func (c *InstancesClient) Get(ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption) (*computepb.Instance, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetEffectiveFirewalls returns effective firewalls applied to an interface of the instance. +func (c *InstancesClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsInstanceRequest, opts ...gax.CallOption) (*computepb.InstancesGetEffectiveFirewallsResponse, error) { + return c.internalClient.GetEffectiveFirewalls(ctx, req, opts...) +} + +// GetGuestAttributes returns the specified guest attributes entry. +func (c *InstancesClient) GetGuestAttributes(ctx context.Context, req *computepb.GetGuestAttributesInstanceRequest, opts ...gax.CallOption) (*computepb.GuestAttributes, error) { + return c.internalClient.GetGuestAttributes(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *InstancesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// GetScreenshot returns the screenshot from the specified instance. +func (c *InstancesClient) GetScreenshot(ctx context.Context, req *computepb.GetScreenshotInstanceRequest, opts ...gax.CallOption) (*computepb.Screenshot, error) { + return c.internalClient.GetScreenshot(ctx, req, opts...) +} + +// GetSerialPortOutput returns the last 1 MB of serial port output from the specified instance. +func (c *InstancesClient) GetSerialPortOutput(ctx context.Context, req *computepb.GetSerialPortOutputInstanceRequest, opts ...gax.CallOption) (*computepb.SerialPortOutput, error) { + return c.internalClient.GetSerialPortOutput(ctx, req, opts...) +} + +// GetShieldedInstanceIdentity returns the Shielded Instance Identity of an instance +func (c *InstancesClient) GetShieldedInstanceIdentity(ctx context.Context, req *computepb.GetShieldedInstanceIdentityInstanceRequest, opts ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) { + return c.internalClient.GetShieldedInstanceIdentity(ctx, req, opts...) +} + +// Insert creates an instance resource in the specified project using the data included in the request. +func (c *InstancesClient) Insert(ctx context.Context, req *computepb.InsertInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of instances contained within the specified zone. +func (c *InstancesClient) List(ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListReferrers retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances. +func (c *InstancesClient) ListReferrers(ctx context.Context, req *computepb.ListReferrersInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceListReferrers, error) { + return c.internalClient.ListReferrers(ctx, req, opts...) +} + +// RemoveResourcePolicies removes resource policies from an instance. +func (c *InstancesClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveResourcePolicies(ctx, req, opts...) +} + +// Reset performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance. +func (c *InstancesClient) Reset(ctx context.Context, req *computepb.ResetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Reset(ctx, req, opts...) +} + +// SetDeletionProtection sets deletion protection on the instance. +func (c *InstancesClient) SetDeletionProtection(ctx context.Context, req *computepb.SetDeletionProtectionInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetDeletionProtection(ctx, req, opts...) +} + +// SetDiskAutoDelete sets the auto-delete flag for a disk attached to an instance. +func (c *InstancesClient) SetDiskAutoDelete(ctx context.Context, req *computepb.SetDiskAutoDeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetDiskAutoDelete(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *InstancesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetLabels sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. +func (c *InstancesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// SetMachineResources changes the number and/or type of accelerator for a stopped instance to the values specified in the request. +func (c *InstancesClient) SetMachineResources(ctx context.Context, req *computepb.SetMachineResourcesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetMachineResources(ctx, req, opts...) +} + +// SetMachineType changes the machine type for a stopped instance to the machine type specified in the request. +func (c *InstancesClient) SetMachineType(ctx context.Context, req *computepb.SetMachineTypeInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetMachineType(ctx, req, opts...) +} + +// SetMetadata sets metadata for the specified instance to the data included in the request. +func (c *InstancesClient) SetMetadata(ctx context.Context, req *computepb.SetMetadataInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetMetadata(ctx, req, opts...) +} + +// SetMinCpuPlatform changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. +func (c *InstancesClient) SetMinCpuPlatform(ctx context.Context, req *computepb.SetMinCpuPlatformInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetMinCpuPlatform(ctx, req, opts...) +} + +// SetScheduling sets an instance’s scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. +func (c *InstancesClient) SetScheduling(ctx context.Context, req *computepb.SetSchedulingInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetScheduling(ctx, req, opts...) +} + +// SetServiceAccount sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance. +func (c *InstancesClient) SetServiceAccount(ctx context.Context, req *computepb.SetServiceAccountInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetServiceAccount(ctx, req, opts...) +} + +// SetShieldedInstanceIntegrityPolicy sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InstancesClient) SetShieldedInstanceIntegrityPolicy(ctx context.Context, req *computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetShieldedInstanceIntegrityPolicy(ctx, req, opts...) +} + +// SetTags sets network tags for the specified instance to the data included in the request. +func (c *InstancesClient) SetTags(ctx context.Context, req *computepb.SetTagsInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetTags(ctx, req, opts...) +} + +// SimulateMaintenanceEvent simulates a maintenance event on the instance. +func (c *InstancesClient) SimulateMaintenanceEvent(ctx context.Context, req *computepb.SimulateMaintenanceEventInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SimulateMaintenanceEvent(ctx, req, opts...) +} + +// Start starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. +func (c *InstancesClient) Start(ctx context.Context, req *computepb.StartInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Start(ctx, req, opts...) +} + +// StartWithEncryptionKey starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. +func (c *InstancesClient) StartWithEncryptionKey(ctx context.Context, req *computepb.StartWithEncryptionKeyInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.StartWithEncryptionKey(ctx, req, opts...) +} + +// Stop stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. +func (c *InstancesClient) Stop(ctx context.Context, req *computepb.StopInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Stop(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *InstancesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsInstanceRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Update updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties. +func (c *InstancesClient) Update(ctx context.Context, req *computepb.UpdateInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// UpdateAccessConfig updates the specified access config from an instance’s network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InstancesClient) UpdateAccessConfig(ctx context.Context, req *computepb.UpdateAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdateAccessConfig(ctx, req, opts...) +} + +// UpdateDisplayDevice updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InstancesClient) UpdateDisplayDevice(ctx context.Context, req *computepb.UpdateDisplayDeviceInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdateDisplayDevice(ctx, req, opts...) +} + +// UpdateNetworkInterface updates an instance’s network interface. This method can only update an interface’s alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics. +func (c *InstancesClient) UpdateNetworkInterface(ctx context.Context, req *computepb.UpdateNetworkInterfaceInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdateNetworkInterface(ctx, req, opts...) +} + +// UpdateShieldedInstanceConfig updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InstancesClient) UpdateShieldedInstanceConfig(ctx context.Context, req *computepb.UpdateShieldedInstanceConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdateShieldedInstanceConfig(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type instancesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInstancesRESTClient creates a new instances rest client. +// +// The Instances API. +func NewInstancesRESTClient(ctx context.Context, opts ...option.ClientOption) (*InstancesClient, error) { + clientOpts := append(defaultInstancesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &instancesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InstancesClient{internalClient: c, CallOptions: &InstancesCallOptions{}}, nil +} + +func defaultInstancesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *instancesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *instancesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *instancesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddAccessConfig adds an access config to an instance’s network interface. +func (c *instancesRESTClient) AddAccessConfig(ctx context.Context, req *computepb.AddAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAccessConfigResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/addAccessConfig", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetNetworkInterface() != "" { + params.Add("networkInterface", fmt.Sprintf("%v", req.GetNetworkInterface())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AddResourcePolicies adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations. +func (c *instancesRESTClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesAddResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/addResourcePolicies", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves aggregated list of all of the instances in your project across all regions and zones. +func (c *instancesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instances", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AttachDisk attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. +func (c *instancesRESTClient) AttachDisk(ctx context.Context, req *computepb.AttachDiskInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAttachedDiskResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/attachDisk", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.ForceAttach != nil { + params.Add("forceAttach", fmt.Sprintf("%v", req.GetForceAttach())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// BulkInsert creates multiple instances. Count specifies the number of instances to create. +func (c *instancesRESTClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBulkInsertInstanceResourceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/bulkInsert", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified Instance resource. For more information, see Deleting an instance. +func (c *instancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteAccessConfig deletes an access config from an instance’s network interface. +func (c *instancesRESTClient) DeleteAccessConfig(ctx context.Context, req *computepb.DeleteAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/deleteAccessConfig", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetAccessConfig() != "" { + params.Add("accessConfig", fmt.Sprintf("%v", req.GetAccessConfig())) + } + if req.GetNetworkInterface() != "" { + params.Add("networkInterface", fmt.Sprintf("%v", req.GetNetworkInterface())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DetachDisk detaches a disk from an instance. +func (c *instancesRESTClient) DetachDisk(ctx context.Context, req *computepb.DetachDiskInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/detachDisk", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetDeviceName() != "" { + params.Add("deviceName", fmt.Sprintf("%v", req.GetDeviceName())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified Instance resource. Gets a list of available instances by making a list() request. +func (c *instancesRESTClient) Get(ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption) (*computepb.Instance, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v", req.GetProject(), req.GetZone(), req.GetInstance()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Instance{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetEffectiveFirewalls returns effective firewalls applied to an interface of the instance. +func (c *instancesRESTClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsInstanceRequest, opts ...gax.CallOption) (*computepb.InstancesGetEffectiveFirewallsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getEffectiveFirewalls", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetNetworkInterface() != "" { + params.Add("networkInterface", fmt.Sprintf("%v", req.GetNetworkInterface())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstancesGetEffectiveFirewallsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetGuestAttributes returns the specified guest attributes entry. +func (c *instancesRESTClient) GetGuestAttributes(ctx context.Context, req *computepb.GetGuestAttributesInstanceRequest, opts ...gax.CallOption) (*computepb.GuestAttributes, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getGuestAttributes", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.QueryPath != nil { + params.Add("queryPath", fmt.Sprintf("%v", req.GetQueryPath())) + } + if req != nil && req.VariableKey != nil { + params.Add("variableKey", fmt.Sprintf("%v", req.GetVariableKey())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.GuestAttributes{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *instancesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetScreenshot returns the screenshot from the specified instance. +func (c *instancesRESTClient) GetScreenshot(ctx context.Context, req *computepb.GetScreenshotInstanceRequest, opts ...gax.CallOption) (*computepb.Screenshot, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/screenshot", req.GetProject(), req.GetZone(), req.GetInstance()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Screenshot{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetSerialPortOutput returns the last 1 MB of serial port output from the specified instance. +func (c *instancesRESTClient) GetSerialPortOutput(ctx context.Context, req *computepb.GetSerialPortOutputInstanceRequest, opts ...gax.CallOption) (*computepb.SerialPortOutput, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/serialPort", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.Port != nil { + params.Add("port", fmt.Sprintf("%v", req.GetPort())) + } + if req != nil && req.Start != nil { + params.Add("start", fmt.Sprintf("%v", req.GetStart())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SerialPortOutput{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetShieldedInstanceIdentity returns the Shielded Instance Identity of an instance +func (c *instancesRESTClient) GetShieldedInstanceIdentity(ctx context.Context, req *computepb.GetShieldedInstanceIdentityInstanceRequest, opts ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getShieldedInstanceIdentity", req.GetProject(), req.GetZone(), req.GetInstance()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ShieldedInstanceIdentity{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an instance resource in the specified project using the data included in the request. +func (c *instancesRESTClient) Insert(ctx context.Context, req *computepb.InsertInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req != nil && req.SourceInstanceTemplate != nil { + params.Add("sourceInstanceTemplate", fmt.Sprintf("%v", req.GetSourceInstanceTemplate())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of instances contained within the specified zone. +func (c *instancesRESTClient) List(ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListReferrers retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances. +func (c *instancesRESTClient) ListReferrers(ctx context.Context, req *computepb.ListReferrersInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceListReferrers, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/referrers", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceListReferrers{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveResourcePolicies removes resource policies from an instance. +func (c *instancesRESTClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesRemoveResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/removeResourcePolicies", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Reset performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance. +func (c *instancesRESTClient) Reset(ctx context.Context, req *computepb.ResetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/reset", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetDeletionProtection sets deletion protection on the instance. +func (c *instancesRESTClient) SetDeletionProtection(ctx context.Context, req *computepb.SetDeletionProtectionInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setDeletionProtection", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.DeletionProtection != nil { + params.Add("deletionProtection", fmt.Sprintf("%v", req.GetDeletionProtection())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetDiskAutoDelete sets the auto-delete flag for a disk attached to an instance. +func (c *instancesRESTClient) SetDiskAutoDelete(ctx context.Context, req *computepb.SetDiskAutoDeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setDiskAutoDelete", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetAutoDelete() { + params.Add("autoDelete", fmt.Sprintf("%v", req.GetAutoDelete())) + } + if req.GetDeviceName() != "" { + params.Add("deviceName", fmt.Sprintf("%v", req.GetDeviceName())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *instancesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetZoneSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. +func (c *instancesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setLabels", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetMachineResources changes the number and/or type of accelerator for a stopped instance to the values specified in the request. +func (c *instancesRESTClient) SetMachineResources(ctx context.Context, req *computepb.SetMachineResourcesInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesSetMachineResourcesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setMachineResources", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetMachineType changes the machine type for a stopped instance to the machine type specified in the request. +func (c *instancesRESTClient) SetMachineType(ctx context.Context, req *computepb.SetMachineTypeInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesSetMachineTypeRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setMachineType", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetMetadata sets metadata for the specified instance to the data included in the request. +func (c *instancesRESTClient) SetMetadata(ctx context.Context, req *computepb.SetMetadataInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetMetadataResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setMetadata", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetMinCpuPlatform changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. +func (c *instancesRESTClient) SetMinCpuPlatform(ctx context.Context, req *computepb.SetMinCpuPlatformInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesSetMinCpuPlatformRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setMinCpuPlatform", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetScheduling sets an instance’s scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. +func (c *instancesRESTClient) SetScheduling(ctx context.Context, req *computepb.SetSchedulingInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSchedulingResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setScheduling", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetServiceAccount sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance. +func (c *instancesRESTClient) SetServiceAccount(ctx context.Context, req *computepb.SetServiceAccountInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesSetServiceAccountRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setServiceAccount", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetShieldedInstanceIntegrityPolicy sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *instancesRESTClient) SetShieldedInstanceIntegrityPolicy(ctx context.Context, req *computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetShieldedInstanceIntegrityPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setShieldedInstanceIntegrityPolicy", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetTags sets network tags for the specified instance to the data included in the request. +func (c *instancesRESTClient) SetTags(ctx context.Context, req *computepb.SetTagsInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTagsResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setTags", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SimulateMaintenanceEvent simulates a maintenance event on the instance. +func (c *instancesRESTClient) SimulateMaintenanceEvent(ctx context.Context, req *computepb.SimulateMaintenanceEventInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/simulateMaintenanceEvent", req.GetProject(), req.GetZone(), req.GetInstance()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Start starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. +func (c *instancesRESTClient) Start(ctx context.Context, req *computepb.StartInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/start", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// StartWithEncryptionKey starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. +func (c *instancesRESTClient) StartWithEncryptionKey(ctx context.Context, req *computepb.StartWithEncryptionKeyInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstancesStartWithEncryptionKeyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/startWithEncryptionKey", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Stop stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. +func (c *instancesRESTClient) Stop(ctx context.Context, req *computepb.StopInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/stop", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *instancesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsInstanceRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/testIamPermissions", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties. +func (c *instancesRESTClient) Update(ctx context.Context, req *computepb.UpdateInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetInstance() != "" { + params.Add("instance", fmt.Sprintf("%v", req.GetInstance())) + } + if req != nil && req.MinimalAction != nil { + params.Add("minimalAction", fmt.Sprintf("%v", req.GetMinimalAction())) + } + if req != nil && req.MostDisruptiveAllowedAction != nil { + params.Add("mostDisruptiveAllowedAction", fmt.Sprintf("%v", req.GetMostDisruptiveAllowedAction())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetZone() != "" { + params.Add("zone", fmt.Sprintf("%v", req.GetZone())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdateAccessConfig updates the specified access config from an instance’s network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *instancesRESTClient) UpdateAccessConfig(ctx context.Context, req *computepb.UpdateAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAccessConfigResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/updateAccessConfig", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetNetworkInterface() != "" { + params.Add("networkInterface", fmt.Sprintf("%v", req.GetNetworkInterface())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdateDisplayDevice updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *instancesRESTClient) UpdateDisplayDevice(ctx context.Context, req *computepb.UpdateDisplayDeviceInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDisplayDeviceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/updateDisplayDevice", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdateNetworkInterface updates an instance’s network interface. This method can only update an interface’s alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics. +func (c *instancesRESTClient) UpdateNetworkInterface(ctx context.Context, req *computepb.UpdateNetworkInterfaceInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkInterfaceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/updateNetworkInterface", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req.GetNetworkInterface() != "" { + params.Add("networkInterface", fmt.Sprintf("%v", req.GetNetworkInterface())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdateShieldedInstanceConfig updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *instancesRESTClient) UpdateShieldedInstanceConfig(ctx context.Context, req *computepb.UpdateShieldedInstanceConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetShieldedInstanceConfigResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/updateShieldedInstanceConfig", req.GetProject(), req.GetZone(), req.GetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/instances_client_example_test.go b/compute/apiv1/instances_client_example_test.go new file mode 100644 index 000000000000..3728bb87319b --- /dev/null +++ b/compute/apiv1/instances_client_example_test.go @@ -0,0 +1,834 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInstancesRESTClient() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInstancesClient_AddAccessConfig() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddAccessConfigInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddAccessConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_AddResourcePolicies() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddResourcePoliciesInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListInstancesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_AttachDisk() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AttachDiskInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AttachDisk(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_BulkInsert() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.BulkInsertInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BulkInsert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Delete() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_DeleteAccessConfig() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteAccessConfigInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteAccessConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_DetachDisk() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DetachDiskInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DetachDisk(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Get() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetEffectiveFirewalls() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetEffectiveFirewallsInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetEffectiveFirewalls(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetGuestAttributes() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetGuestAttributesInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGuestAttributes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetScreenshot() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetScreenshotInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetScreenshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetSerialPortOutput() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSerialPortOutputInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSerialPortOutput(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_GetShieldedInstanceIdentity() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetShieldedInstanceIdentityInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetShieldedInstanceIdentity(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Insert() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_List() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstancesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_ListReferrers() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListReferrersInstancesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListReferrers(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_RemoveResourcePolicies() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveResourcePoliciesInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Reset() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Reset(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetDeletionProtection() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetDeletionProtectionInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetDeletionProtection(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetDiskAutoDelete() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetDiskAutoDeleteInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetDiskAutoDelete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetMachineResources() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetMachineResourcesInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMachineResources(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetMachineType() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetMachineTypeInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMachineType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetMetadata() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetMetadataInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMetadata(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetMinCpuPlatform() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetMinCpuPlatformInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMinCpuPlatform(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetScheduling() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSchedulingInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetScheduling(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetServiceAccount() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetServiceAccountInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetShieldedInstanceIntegrityPolicy() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetShieldedInstanceIntegrityPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SetTags() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetTagsInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetTags(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_SimulateMaintenanceEvent() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SimulateMaintenanceEventInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SimulateMaintenanceEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Start() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.StartInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Start(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_StartWithEncryptionKey() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.StartWithEncryptionKeyInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.StartWithEncryptionKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Stop() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.StopInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Stop(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_Update() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_UpdateAccessConfig() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateAccessConfigInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateAccessConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_UpdateDisplayDevice() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateDisplayDeviceInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateDisplayDevice(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_UpdateNetworkInterface() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateNetworkInterfaceInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateNetworkInterface(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstancesClient_UpdateShieldedInstanceConfig() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateShieldedInstanceConfigInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateShieldedInstanceConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/interconnect_attachments_client.go b/compute/apiv1/interconnect_attachments_client.go new file mode 100644 index 000000000000..017f933fde01 --- /dev/null +++ b/compute/apiv1/interconnect_attachments_client.go @@ -0,0 +1,513 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInterconnectAttachmentsClientHook clientHook + +// InterconnectAttachmentsCallOptions contains the retry settings for each method of InterconnectAttachmentsClient. +type InterconnectAttachmentsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalInterconnectAttachmentsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInterconnectAttachmentsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListInterconnectAttachmentsRequest, ...gax.CallOption) (*computepb.InterconnectAttachmentAggregatedList, error) + Delete(context.Context, *computepb.DeleteInterconnectAttachmentRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInterconnectAttachmentRequest, ...gax.CallOption) (*computepb.InterconnectAttachment, error) + Insert(context.Context, *computepb.InsertInterconnectAttachmentRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInterconnectAttachmentsRequest, ...gax.CallOption) (*computepb.InterconnectAttachmentList, error) + Patch(context.Context, *computepb.PatchInterconnectAttachmentRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// InterconnectAttachmentsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The InterconnectAttachments API. +type InterconnectAttachmentsClient struct { + // The internal transport-dependent client. + internalClient internalInterconnectAttachmentsClient + + // The call options for this service. + CallOptions *InterconnectAttachmentsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InterconnectAttachmentsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InterconnectAttachmentsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InterconnectAttachmentsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of interconnect attachments. +func (c *InterconnectAttachmentsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified interconnect attachment. +func (c *InterconnectAttachmentsClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified interconnect attachment. +func (c *InterconnectAttachmentsClient) Get(ctx context.Context, req *computepb.GetInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachment, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an InterconnectAttachment in the specified project using the data included in the request. +func (c *InterconnectAttachmentsClient) Insert(ctx context.Context, req *computepb.InsertInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of interconnect attachments contained within the specified region. +func (c *InterconnectAttachmentsClient) List(ctx context.Context, req *computepb.ListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified interconnect attachment with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InterconnectAttachmentsClient) Patch(ctx context.Context, req *computepb.PatchInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type interconnectAttachmentsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInterconnectAttachmentsRESTClient creates a new interconnect attachments rest client. +// +// The InterconnectAttachments API. +func NewInterconnectAttachmentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*InterconnectAttachmentsClient, error) { + clientOpts := append(defaultInterconnectAttachmentsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &interconnectAttachmentsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InterconnectAttachmentsClient{internalClient: c, CallOptions: &InterconnectAttachmentsCallOptions{}}, nil +} + +func defaultInterconnectAttachmentsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *interconnectAttachmentsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *interconnectAttachmentsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *interconnectAttachmentsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of interconnect attachments. +func (c *interconnectAttachmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/interconnectAttachments", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectAttachmentAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified interconnect attachment. +func (c *interconnectAttachmentsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v", req.GetProject(), req.GetRegion(), req.GetInterconnectAttachment()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified interconnect attachment. +func (c *interconnectAttachmentsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachment, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v", req.GetProject(), req.GetRegion(), req.GetInterconnectAttachment()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectAttachment{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an InterconnectAttachment in the specified project using the data included in the request. +func (c *interconnectAttachmentsRESTClient) Insert(ctx context.Context, req *computepb.InsertInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInterconnectAttachmentResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req != nil && req.ValidateOnly != nil { + params.Add("validateOnly", fmt.Sprintf("%v", req.GetValidateOnly())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of interconnect attachments contained within the specified region. +func (c *interconnectAttachmentsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectAttachmentList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified interconnect attachment with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *interconnectAttachmentsRESTClient) Patch(ctx context.Context, req *computepb.PatchInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInterconnectAttachmentResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v", req.GetProject(), req.GetRegion(), req.GetInterconnectAttachment()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/interconnect_attachments_client_example_test.go b/compute/apiv1/interconnect_attachments_client_example_test.go new file mode 100644 index 000000000000..0f480c1a58a8 --- /dev/null +++ b/compute/apiv1/interconnect_attachments_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInterconnectAttachmentsRESTClient() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInterconnectAttachmentsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListInterconnectAttachmentsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectAttachmentsClient_Delete() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInterconnectAttachmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectAttachmentsClient_Get() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInterconnectAttachmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectAttachmentsClient_Insert() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInterconnectAttachmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectAttachmentsClient_List() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInterconnectAttachmentsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectAttachmentsClient_Patch() { + ctx := context.Background() + c, err := compute.NewInterconnectAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchInterconnectAttachmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/interconnect_locations_client.go b/compute/apiv1/interconnect_locations_client.go new file mode 100644 index 000000000000..cf535f106e4a --- /dev/null +++ b/compute/apiv1/interconnect_locations_client.go @@ -0,0 +1,265 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInterconnectLocationsClientHook clientHook + +// InterconnectLocationsCallOptions contains the retry settings for each method of InterconnectLocationsClient. +type InterconnectLocationsCallOptions struct { + Get []gax.CallOption + List []gax.CallOption +} + +// internalInterconnectLocationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInterconnectLocationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetInterconnectLocationRequest, ...gax.CallOption) (*computepb.InterconnectLocation, error) + List(context.Context, *computepb.ListInterconnectLocationsRequest, ...gax.CallOption) (*computepb.InterconnectLocationList, error) +} + +// InterconnectLocationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The InterconnectLocations API. +type InterconnectLocationsClient struct { + // The internal transport-dependent client. + internalClient internalInterconnectLocationsClient + + // The call options for this service. + CallOptions *InterconnectLocationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InterconnectLocationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InterconnectLocationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InterconnectLocationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the details for the specified interconnect location. Gets a list of available interconnect locations by making a list() request. +func (c *InterconnectLocationsClient) Get(ctx context.Context, req *computepb.GetInterconnectLocationRequest, opts ...gax.CallOption) (*computepb.InterconnectLocation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves the list of interconnect locations available to the specified project. +func (c *InterconnectLocationsClient) List(ctx context.Context, req *computepb.ListInterconnectLocationsRequest, opts ...gax.CallOption) (*computepb.InterconnectLocationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type interconnectLocationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInterconnectLocationsRESTClient creates a new interconnect locations rest client. +// +// The InterconnectLocations API. +func NewInterconnectLocationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*InterconnectLocationsClient, error) { + clientOpts := append(defaultInterconnectLocationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &interconnectLocationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InterconnectLocationsClient{internalClient: c, CallOptions: &InterconnectLocationsCallOptions{}}, nil +} + +func defaultInterconnectLocationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *interconnectLocationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *interconnectLocationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *interconnectLocationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the details for the specified interconnect location. Gets a list of available interconnect locations by making a list() request. +func (c *interconnectLocationsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectLocationRequest, opts ...gax.CallOption) (*computepb.InterconnectLocation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnectLocations/%v", req.GetProject(), req.GetInterconnectLocation()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectLocation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of interconnect locations available to the specified project. +func (c *interconnectLocationsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectLocationsRequest, opts ...gax.CallOption) (*computepb.InterconnectLocationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnectLocations", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectLocationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/interconnect_locations_client_example_test.go b/compute/apiv1/interconnect_locations_client_example_test.go new file mode 100644 index 000000000000..2c48d43fbb84 --- /dev/null +++ b/compute/apiv1/interconnect_locations_client_example_test.go @@ -0,0 +1,74 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInterconnectLocationsRESTClient() { + ctx := context.Background() + c, err := compute.NewInterconnectLocationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInterconnectLocationsClient_Get() { + ctx := context.Background() + c, err := compute.NewInterconnectLocationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInterconnectLocationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectLocationsClient_List() { + ctx := context.Background() + c, err := compute.NewInterconnectLocationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInterconnectLocationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/interconnects_client.go b/compute/apiv1/interconnects_client.go new file mode 100644 index 000000000000..26fa2f16ccbc --- /dev/null +++ b/compute/apiv1/interconnects_client.go @@ -0,0 +1,488 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newInterconnectsClientHook clientHook + +// InterconnectsCallOptions contains the retry settings for each method of InterconnectsClient. +type InterconnectsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + GetDiagnostics []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalInterconnectsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalInterconnectsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteInterconnectRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetInterconnectRequest, ...gax.CallOption) (*computepb.Interconnect, error) + GetDiagnostics(context.Context, *computepb.GetDiagnosticsInterconnectRequest, ...gax.CallOption) (*computepb.InterconnectsGetDiagnosticsResponse, error) + Insert(context.Context, *computepb.InsertInterconnectRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListInterconnectsRequest, ...gax.CallOption) (*computepb.InterconnectList, error) + Patch(context.Context, *computepb.PatchInterconnectRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// InterconnectsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Interconnects API. +type InterconnectsClient struct { + // The internal transport-dependent client. + internalClient internalInterconnectsClient + + // The call options for this service. + CallOptions *InterconnectsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InterconnectsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InterconnectsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *InterconnectsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified interconnect. +func (c *InterconnectsClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified interconnect. Get a list of available interconnects by making a list() request. +func (c *InterconnectsClient) Get(ctx context.Context, req *computepb.GetInterconnectRequest, opts ...gax.CallOption) (*computepb.Interconnect, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetDiagnostics returns the interconnectDiagnostics for the specified interconnect. +func (c *InterconnectsClient) GetDiagnostics(ctx context.Context, req *computepb.GetDiagnosticsInterconnectRequest, opts ...gax.CallOption) (*computepb.InterconnectsGetDiagnosticsResponse, error) { + return c.internalClient.GetDiagnostics(ctx, req, opts...) +} + +// Insert creates a Interconnect in the specified project using the data included in the request. +func (c *InterconnectsClient) Insert(ctx context.Context, req *computepb.InsertInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of interconnect available to the specified project. +func (c *InterconnectsClient) List(ctx context.Context, req *computepb.ListInterconnectsRequest, opts ...gax.CallOption) (*computepb.InterconnectList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *InterconnectsClient) Patch(ctx context.Context, req *computepb.PatchInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type interconnectsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInterconnectsRESTClient creates a new interconnects rest client. +// +// The Interconnects API. +func NewInterconnectsRESTClient(ctx context.Context, opts ...option.ClientOption) (*InterconnectsClient, error) { + clientOpts := append(defaultInterconnectsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &interconnectsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &InterconnectsClient{internalClient: c, CallOptions: &InterconnectsCallOptions{}}, nil +} + +func defaultInterconnectsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *interconnectsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *interconnectsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *interconnectsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified interconnect. +func (c *interconnectsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v", req.GetProject(), req.GetInterconnect()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified interconnect. Get a list of available interconnects by making a list() request. +func (c *interconnectsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectRequest, opts ...gax.CallOption) (*computepb.Interconnect, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v", req.GetProject(), req.GetInterconnect()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Interconnect{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetDiagnostics returns the interconnectDiagnostics for the specified interconnect. +func (c *interconnectsRESTClient) GetDiagnostics(ctx context.Context, req *computepb.GetDiagnosticsInterconnectRequest, opts ...gax.CallOption) (*computepb.InterconnectsGetDiagnosticsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v/getDiagnostics", req.GetProject(), req.GetInterconnect()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectsGetDiagnosticsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a Interconnect in the specified project using the data included in the request. +func (c *interconnectsRESTClient) Insert(ctx context.Context, req *computepb.InsertInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInterconnectResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of interconnect available to the specified project. +func (c *interconnectsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectsRequest, opts ...gax.CallOption) (*computepb.InterconnectList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InterconnectList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *interconnectsRESTClient) Patch(ctx context.Context, req *computepb.PatchInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInterconnectResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v", req.GetProject(), req.GetInterconnect()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/interconnects_client_example_test.go b/compute/apiv1/interconnects_client_example_test.go new file mode 100644 index 000000000000..dca1482656bc --- /dev/null +++ b/compute/apiv1/interconnects_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewInterconnectsRESTClient() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleInterconnectsClient_Delete() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInterconnectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectsClient_Get() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetInterconnectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectsClient_GetDiagnostics() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetDiagnosticsInterconnectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDiagnostics(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectsClient_Insert() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertInterconnectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectsClient_List() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInterconnectsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInterconnectsClient_Patch() { + ctx := context.Background() + c, err := compute.NewInterconnectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchInterconnectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/license_codes_client.go b/compute/apiv1/license_codes_client.go new file mode 100644 index 000000000000..b87bb61e79e8 --- /dev/null +++ b/compute/apiv1/license_codes_client.go @@ -0,0 +1,247 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newLicenseCodesClientHook clientHook + +// LicenseCodesCallOptions contains the retry settings for each method of LicenseCodesClient. +type LicenseCodesCallOptions struct { + Get []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalLicenseCodesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalLicenseCodesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetLicenseCodeRequest, ...gax.CallOption) (*computepb.LicenseCode, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsLicenseCodeRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// LicenseCodesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The LicenseCodes API. +type LicenseCodesClient struct { + // The internal transport-dependent client. + internalClient internalLicenseCodesClient + + // The call options for this service. + CallOptions *LicenseCodesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *LicenseCodesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *LicenseCodesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *LicenseCodesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicenseCodesClient) Get(ctx context.Context, req *computepb.GetLicenseCodeRequest, opts ...gax.CallOption) (*computepb.LicenseCode, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicenseCodesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsLicenseCodeRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type licenseCodesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewLicenseCodesRESTClient creates a new license codes rest client. +// +// The LicenseCodes API. +func NewLicenseCodesRESTClient(ctx context.Context, opts ...option.ClientOption) (*LicenseCodesClient, error) { + clientOpts := append(defaultLicenseCodesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &licenseCodesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &LicenseCodesClient{internalClient: c, CallOptions: &LicenseCodesCallOptions{}}, nil +} + +func defaultLicenseCodesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *licenseCodesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *licenseCodesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *licenseCodesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licenseCodesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseCodeRequest, opts ...gax.CallOption) (*computepb.LicenseCode, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenseCodes/%v", req.GetProject(), req.GetLicenseCode()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.LicenseCode{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licenseCodesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsLicenseCodeRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenseCodes/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/license_codes_client_example_test.go b/compute/apiv1/license_codes_client_example_test.go new file mode 100644 index 000000000000..a0b54d391df1 --- /dev/null +++ b/compute/apiv1/license_codes_client_example_test.go @@ -0,0 +1,74 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewLicenseCodesRESTClient() { + ctx := context.Background() + c, err := compute.NewLicenseCodesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleLicenseCodesClient_Get() { + ctx := context.Background() + c, err := compute.NewLicenseCodesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetLicenseCodeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicenseCodesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewLicenseCodesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsLicenseCodeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/licenses_client.go b/compute/apiv1/licenses_client.go new file mode 100644 index 000000000000..f2f2ed9c2926 --- /dev/null +++ b/compute/apiv1/licenses_client.go @@ -0,0 +1,539 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newLicensesClientHook clientHook + +// LicensesCallOptions contains the retry settings for each method of LicensesClient. +type LicensesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalLicensesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalLicensesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteLicenseRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetLicenseRequest, ...gax.CallOption) (*computepb.License, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyLicenseRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertLicenseRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListLicensesRequest, ...gax.CallOption) (*computepb.LicensesListResponse, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyLicenseRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsLicenseRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// LicensesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Licenses API. +type LicensesClient struct { + // The internal transport-dependent client. + internalClient internalLicensesClient + + // The call options for this service. + CallOptions *LicensesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *LicensesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *LicensesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *LicensesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified license. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) Delete(ctx context.Context, req *computepb.DeleteLicenseRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified License resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) Get(ctx context.Context, req *computepb.GetLicenseRequest, opts ...gax.CallOption) (*computepb.License, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyLicenseRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert create a License resource in the specified project. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) Insert(ctx context.Context, req *computepb.InsertLicenseRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of licenses available in the specified project. This method does not get any licenses that belong to other projects, including licenses attached to publicly-available images, like Debian 9. If you want to get a list of publicly-available licenses, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) List(ctx context.Context, req *computepb.ListLicensesRequest, opts ...gax.CallOption) (*computepb.LicensesListResponse, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyLicenseRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *LicensesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsLicenseRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type licensesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewLicensesRESTClient creates a new licenses rest client. +// +// The Licenses API. +func NewLicensesRESTClient(ctx context.Context, opts ...option.ClientOption) (*LicensesClient, error) { + clientOpts := append(defaultLicensesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &licensesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &LicensesClient{internalClient: c, CallOptions: &LicensesCallOptions{}}, nil +} + +func defaultLicensesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *licensesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *licensesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *licensesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified license. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) Delete(ctx context.Context, req *computepb.DeleteLicenseRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified License resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseRequest, opts ...gax.CallOption) (*computepb.License, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.License{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyLicenseRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v/getIamPolicy", req.GetProject(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert create a License resource in the specified project. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) Insert(ctx context.Context, req *computepb.InsertLicenseRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetLicenseResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of licenses available in the specified project. This method does not get any licenses that belong to other projects, including licenses attached to publicly-available images, like Debian 9. If you want to get a list of publicly-available licenses, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) List(ctx context.Context, req *computepb.ListLicensesRequest, opts ...gax.CallOption) (*computepb.LicensesListResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.LicensesListResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyLicenseRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v/setIamPolicy", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +func (c *licensesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsLicenseRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/licenses_client_example_test.go b/compute/apiv1/licenses_client_example_test.go new file mode 100644 index 000000000000..82f80b1944f5 --- /dev/null +++ b/compute/apiv1/licenses_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewLicensesRESTClient() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleLicensesClient_Delete() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_Get() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_Insert() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_List() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListLicensesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleLicensesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewLicensesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsLicenseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/machine_types_client.go b/compute/apiv1/machine_types_client.go new file mode 100644 index 000000000000..b888cabec5b9 --- /dev/null +++ b/compute/apiv1/machine_types_client.go @@ -0,0 +1,337 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newMachineTypesClientHook clientHook + +// MachineTypesCallOptions contains the retry settings for each method of MachineTypesClient. +type MachineTypesCallOptions struct { + AggregatedList []gax.CallOption + Get []gax.CallOption + List []gax.CallOption +} + +// internalMachineTypesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalMachineTypesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListMachineTypesRequest, ...gax.CallOption) (*computepb.MachineTypeAggregatedList, error) + Get(context.Context, *computepb.GetMachineTypeRequest, ...gax.CallOption) (*computepb.MachineType, error) + List(context.Context, *computepb.ListMachineTypesRequest, ...gax.CallOption) (*computepb.MachineTypeList, error) +} + +// MachineTypesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The MachineTypes API. +type MachineTypesClient struct { + // The internal transport-dependent client. + internalClient internalMachineTypesClient + + // The call options for this service. + CallOptions *MachineTypesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *MachineTypesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *MachineTypesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *MachineTypesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of machine types. +func (c *MachineTypesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Get returns the specified machine type. Gets a list of available machine types by making a list() request. +func (c *MachineTypesClient) Get(ctx context.Context, req *computepb.GetMachineTypeRequest, opts ...gax.CallOption) (*computepb.MachineType, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of machine types available to the specified project. +func (c *MachineTypesClient) List(ctx context.Context, req *computepb.ListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type machineTypesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewMachineTypesRESTClient creates a new machine types rest client. +// +// The MachineTypes API. +func NewMachineTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*MachineTypesClient, error) { + clientOpts := append(defaultMachineTypesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &machineTypesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &MachineTypesClient{internalClient: c, CallOptions: &MachineTypesCallOptions{}}, nil +} + +func defaultMachineTypesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *machineTypesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *machineTypesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *machineTypesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of machine types. +func (c *machineTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/machineTypes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.MachineTypeAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified machine type. Gets a list of available machine types by making a list() request. +func (c *machineTypesRESTClient) Get(ctx context.Context, req *computepb.GetMachineTypeRequest, opts ...gax.CallOption) (*computepb.MachineType, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/machineTypes/%v", req.GetProject(), req.GetZone(), req.GetMachineType()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.MachineType{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of machine types available to the specified project. +func (c *machineTypesRESTClient) List(ctx context.Context, req *computepb.ListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/machineTypes", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.MachineTypeList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/machine_types_client_example_test.go b/compute/apiv1/machine_types_client_example_test.go new file mode 100644 index 000000000000..858b4032b5ca --- /dev/null +++ b/compute/apiv1/machine_types_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewMachineTypesRESTClient() { + ctx := context.Background() + c, err := compute.NewMachineTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleMachineTypesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewMachineTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListMachineTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMachineTypesClient_Get() { + ctx := context.Background() + c, err := compute.NewMachineTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetMachineTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMachineTypesClient_List() { + ctx := context.Background() + c, err := compute.NewMachineTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListMachineTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/network_endpoint_groups_client.go b/compute/apiv1/network_endpoint_groups_client.go new file mode 100644 index 000000000000..f9da210d93a3 --- /dev/null +++ b/compute/apiv1/network_endpoint_groups_client.go @@ -0,0 +1,689 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newNetworkEndpointGroupsClientHook clientHook + +// NetworkEndpointGroupsCallOptions contains the retry settings for each method of NetworkEndpointGroupsClient. +type NetworkEndpointGroupsCallOptions struct { + AggregatedList []gax.CallOption + AttachNetworkEndpoints []gax.CallOption + Delete []gax.CallOption + DetachNetworkEndpoints []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListNetworkEndpoints []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalNetworkEndpointGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalNetworkEndpointGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupAggregatedList, error) + AttachNetworkEndpoints(context.Context, *computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + DetachNetworkEndpoints(context.Context, *computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) + Insert(context.Context, *computepb.InsertNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) + ListNetworkEndpoints(context.Context, *computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// NetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The NetworkEndpointGroups API. +type NetworkEndpointGroupsClient struct { + // The internal transport-dependent client. + internalClient internalNetworkEndpointGroupsClient + + // The call options for this service. + CallOptions *NetworkEndpointGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NetworkEndpointGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *NetworkEndpointGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of network endpoint groups and sorts them by zone. +func (c *NetworkEndpointGroupsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// AttachNetworkEndpoints attach a list of network endpoints to the specified network endpoint group. +func (c *NetworkEndpointGroupsClient) AttachNetworkEndpoints(ctx context.Context, req *computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AttachNetworkEndpoints(ctx, req, opts...) +} + +// Delete deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it. +func (c *NetworkEndpointGroupsClient) Delete(ctx context.Context, req *computepb.DeleteNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DetachNetworkEndpoints detach a list of network endpoints from the specified network endpoint group. +func (c *NetworkEndpointGroupsClient) DetachNetworkEndpoints(ctx context.Context, req *computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DetachNetworkEndpoints(ctx, req, opts...) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *NetworkEndpointGroupsClient) Get(ctx context.Context, req *computepb.GetNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *NetworkEndpointGroupsClient) Insert(ctx context.Context, req *computepb.InsertNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of network endpoint groups that are located in the specified project and zone. +func (c *NetworkEndpointGroupsClient) List(ctx context.Context, req *computepb.ListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListNetworkEndpoints lists the network endpoints in the specified network endpoint group. +func (c *NetworkEndpointGroupsClient) ListNetworkEndpoints(ctx context.Context, req *computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) { + return c.internalClient.ListNetworkEndpoints(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *NetworkEndpointGroupsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type networkEndpointGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNetworkEndpointGroupsRESTClient creates a new network endpoint groups rest client. +// +// The NetworkEndpointGroups API. +func NewNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*NetworkEndpointGroupsClient, error) { + clientOpts := append(defaultNetworkEndpointGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &networkEndpointGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &NetworkEndpointGroupsClient{internalClient: c, CallOptions: &NetworkEndpointGroupsCallOptions{}}, nil +} + +func defaultNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *networkEndpointGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *networkEndpointGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *networkEndpointGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of network endpoint groups and sorts them by zone. +func (c *networkEndpointGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/networkEndpointGroups", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AttachNetworkEndpoints attach a list of network endpoints to the specified network endpoint group. +func (c *networkEndpointGroupsRESTClient) AttachNetworkEndpoints(ctx context.Context, req *computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupsAttachEndpointsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v/attachNetworkEndpoints", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it. +func (c *networkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DetachNetworkEndpoints detach a list of network endpoints from the specified network endpoint group. +func (c *networkEndpointGroupsRESTClient) DetachNetworkEndpoints(ctx context.Context, req *computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupsDetachEndpointsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v/detachNetworkEndpoints", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *networkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *networkEndpointGroupsRESTClient) Insert(ctx context.Context, req *computepb.InsertNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of network endpoint groups that are located in the specified project and zone. +func (c *networkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListNetworkEndpoints lists the network endpoints in the specified network endpoint group. +func (c *networkEndpointGroupsRESTClient) ListNetworkEndpoints(ctx context.Context, req *computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupsListEndpointsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v/listNetworkEndpoints", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupsListNetworkEndpoints{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *networkEndpointGroupsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v/testIamPermissions", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/network_endpoint_groups_client_example_test.go b/compute/apiv1/network_endpoint_groups_client_example_test.go new file mode 100644 index 000000000000..5c370298c7a5 --- /dev/null +++ b/compute/apiv1/network_endpoint_groups_client_example_test.go @@ -0,0 +1,207 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewNetworkEndpointGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleNetworkEndpointGroupsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_AttachNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AttachNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_Delete() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_DetachNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DetachNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_Insert() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_ListNetworkEndpoints() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListNetworkEndpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworkEndpointGroupsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/networks_client.go b/compute/apiv1/networks_client.go new file mode 100644 index 000000000000..432e0e8047fd --- /dev/null +++ b/compute/apiv1/networks_client.go @@ -0,0 +1,797 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newNetworksClientHook clientHook + +// NetworksCallOptions contains the retry settings for each method of NetworksClient. +type NetworksCallOptions struct { + AddPeering []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetEffectiveFirewalls []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListPeeringRoutes []gax.CallOption + Patch []gax.CallOption + RemovePeering []gax.CallOption + SwitchToCustomMode []gax.CallOption + UpdatePeering []gax.CallOption +} + +// internalNetworksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalNetworksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddPeering(context.Context, *computepb.AddPeeringNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetNetworkRequest, ...gax.CallOption) (*computepb.Network, error) + GetEffectiveFirewalls(context.Context, *computepb.GetEffectiveFirewallsNetworkRequest, ...gax.CallOption) (*computepb.NetworksGetEffectiveFirewallsResponse, error) + Insert(context.Context, *computepb.InsertNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListNetworksRequest, ...gax.CallOption) (*computepb.NetworkList, error) + ListPeeringRoutes(context.Context, *computepb.ListPeeringRoutesNetworksRequest, ...gax.CallOption) (*computepb.ExchangedPeeringRoutesList, error) + Patch(context.Context, *computepb.PatchNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + RemovePeering(context.Context, *computepb.RemovePeeringNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + SwitchToCustomMode(context.Context, *computepb.SwitchToCustomModeNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdatePeering(context.Context, *computepb.UpdatePeeringNetworkRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// NetworksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Networks API. +type NetworksClient struct { + // The internal transport-dependent client. + internalClient internalNetworksClient + + // The call options for this service. + CallOptions *NetworksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NetworksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NetworksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *NetworksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddPeering adds a peering to the specified network. +func (c *NetworksClient) AddPeering(ctx context.Context, req *computepb.AddPeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddPeering(ctx, req, opts...) +} + +// Delete deletes the specified network. +func (c *NetworksClient) Delete(ctx context.Context, req *computepb.DeleteNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified network. Gets a list of available networks by making a list() request. +func (c *NetworksClient) Get(ctx context.Context, req *computepb.GetNetworkRequest, opts ...gax.CallOption) (*computepb.Network, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetEffectiveFirewalls returns the effective firewalls on a given network. +func (c *NetworksClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsNetworkRequest, opts ...gax.CallOption) (*computepb.NetworksGetEffectiveFirewallsResponse, error) { + return c.internalClient.GetEffectiveFirewalls(ctx, req, opts...) +} + +// Insert creates a network in the specified project using the data included in the request. +func (c *NetworksClient) Insert(ctx context.Context, req *computepb.InsertNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of networks available to the specified project. +func (c *NetworksClient) List(ctx context.Context, req *computepb.ListNetworksRequest, opts ...gax.CallOption) (*computepb.NetworkList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListPeeringRoutes lists the peering routes exchanged over peering connection. +func (c *NetworksClient) ListPeeringRoutes(ctx context.Context, req *computepb.ListPeeringRoutesNetworksRequest, opts ...gax.CallOption) (*computepb.ExchangedPeeringRoutesList, error) { + return c.internalClient.ListPeeringRoutes(ctx, req, opts...) +} + +// Patch patches the specified network with the data included in the request. Only the following fields can be modified: routingConfig.routingMode. +func (c *NetworksClient) Patch(ctx context.Context, req *computepb.PatchNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// RemovePeering removes a peering from the specified network. +func (c *NetworksClient) RemovePeering(ctx context.Context, req *computepb.RemovePeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemovePeering(ctx, req, opts...) +} + +// SwitchToCustomMode switches the network mode from auto subnet mode to custom subnet mode. +func (c *NetworksClient) SwitchToCustomMode(ctx context.Context, req *computepb.SwitchToCustomModeNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SwitchToCustomMode(ctx, req, opts...) +} + +// UpdatePeering updates the specified network peering with the data included in the request Only the following fields can be modified: NetworkPeering.export_custom_routes, and NetworkPeering.import_custom_routes +func (c *NetworksClient) UpdatePeering(ctx context.Context, req *computepb.UpdatePeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdatePeering(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type networksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNetworksRESTClient creates a new networks rest client. +// +// The Networks API. +func NewNetworksRESTClient(ctx context.Context, opts ...option.ClientOption) (*NetworksClient, error) { + clientOpts := append(defaultNetworksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &networksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &NetworksClient{internalClient: c, CallOptions: &NetworksCallOptions{}}, nil +} + +func defaultNetworksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *networksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *networksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *networksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddPeering adds a peering to the specified network. +func (c *networksRESTClient) AddPeering(ctx context.Context, req *computepb.AddPeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworksAddPeeringRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/addPeering", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified network. +func (c *networksRESTClient) Delete(ctx context.Context, req *computepb.DeleteNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified network. Gets a list of available networks by making a list() request. +func (c *networksRESTClient) Get(ctx context.Context, req *computepb.GetNetworkRequest, opts ...gax.CallOption) (*computepb.Network, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v", req.GetProject(), req.GetNetwork()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Network{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetEffectiveFirewalls returns the effective firewalls on a given network. +func (c *networksRESTClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsNetworkRequest, opts ...gax.CallOption) (*computepb.NetworksGetEffectiveFirewallsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/getEffectiveFirewalls", req.GetProject(), req.GetNetwork()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworksGetEffectiveFirewallsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a network in the specified project using the data included in the request. +func (c *networksRESTClient) Insert(ctx context.Context, req *computepb.InsertNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of networks available to the specified project. +func (c *networksRESTClient) List(ctx context.Context, req *computepb.ListNetworksRequest, opts ...gax.CallOption) (*computepb.NetworkList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListPeeringRoutes lists the peering routes exchanged over peering connection. +func (c *networksRESTClient) ListPeeringRoutes(ctx context.Context, req *computepb.ListPeeringRoutesNetworksRequest, opts ...gax.CallOption) (*computepb.ExchangedPeeringRoutesList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/listPeeringRoutes", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.Direction != nil { + params.Add("direction", fmt.Sprintf("%v", req.GetDirection())) + } + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.PeeringName != nil { + params.Add("peeringName", fmt.Sprintf("%v", req.GetPeeringName())) + } + if req != nil && req.Region != nil { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ExchangedPeeringRoutesList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified network with the data included in the request. Only the following fields can be modified: routingConfig.routingMode. +func (c *networksRESTClient) Patch(ctx context.Context, req *computepb.PatchNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemovePeering removes a peering from the specified network. +func (c *networksRESTClient) RemovePeering(ctx context.Context, req *computepb.RemovePeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworksRemovePeeringRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/removePeering", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SwitchToCustomMode switches the network mode from auto subnet mode to custom subnet mode. +func (c *networksRESTClient) SwitchToCustomMode(ctx context.Context, req *computepb.SwitchToCustomModeNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/switchToCustomMode", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdatePeering updates the specified network peering with the data included in the request Only the following fields can be modified: NetworkPeering.export_custom_routes, and NetworkPeering.import_custom_routes +func (c *networksRESTClient) UpdatePeering(ctx context.Context, req *computepb.UpdatePeeringNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworksUpdatePeeringRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/updatePeering", req.GetProject(), req.GetNetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/networks_client_example_test.go b/compute/apiv1/networks_client_example_test.go new file mode 100644 index 000000000000..74578fdc389d --- /dev/null +++ b/compute/apiv1/networks_client_example_test.go @@ -0,0 +1,245 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewNetworksRESTClient() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleNetworksClient_AddPeering() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddPeeringNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddPeering(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_Delete() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_Get() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_GetEffectiveFirewalls() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetEffectiveFirewallsNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetEffectiveFirewalls(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_Insert() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_List() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNetworksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_ListPeeringRoutes() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPeeringRoutesNetworksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListPeeringRoutes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_Patch() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_RemovePeering() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemovePeeringNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemovePeering(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_SwitchToCustomMode() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SwitchToCustomModeNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SwitchToCustomMode(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNetworksClient_UpdatePeering() { + ctx := context.Background() + c, err := compute.NewNetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdatePeeringNetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdatePeering(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/node_groups_client.go b/compute/apiv1/node_groups_client.go new file mode 100644 index 000000000000..64563885daa8 --- /dev/null +++ b/compute/apiv1/node_groups_client.go @@ -0,0 +1,915 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newNodeGroupsClientHook clientHook + +// NodeGroupsCallOptions contains the retry settings for each method of NodeGroupsClient. +type NodeGroupsCallOptions struct { + AddNodes []gax.CallOption + AggregatedList []gax.CallOption + Delete []gax.CallOption + DeleteNodes []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListNodes []gax.CallOption + Patch []gax.CallOption + SetIamPolicy []gax.CallOption + SetNodeTemplate []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalNodeGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalNodeGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddNodes(context.Context, *computepb.AddNodesNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListNodeGroupsRequest, ...gax.CallOption) (*computepb.NodeGroupAggregatedList, error) + Delete(context.Context, *computepb.DeleteNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteNodes(context.Context, *computepb.DeleteNodesNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetNodeGroupRequest, ...gax.CallOption) (*computepb.NodeGroup, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyNodeGroupRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListNodeGroupsRequest, ...gax.CallOption) (*computepb.NodeGroupList, error) + ListNodes(context.Context, *computepb.ListNodesNodeGroupsRequest, ...gax.CallOption) (*computepb.NodeGroupsListNodes, error) + Patch(context.Context, *computepb.PatchNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyNodeGroupRequest, ...gax.CallOption) (*computepb.Policy, error) + SetNodeTemplate(context.Context, *computepb.SetNodeTemplateNodeGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsNodeGroupRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// NodeGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The NodeGroups API. +type NodeGroupsClient struct { + // The internal transport-dependent client. + internalClient internalNodeGroupsClient + + // The call options for this service. + CallOptions *NodeGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NodeGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NodeGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *NodeGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddNodes adds specified number of nodes to the node group. +func (c *NodeGroupsClient) AddNodes(ctx context.Context, req *computepb.AddNodesNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddNodes(ctx, req, opts...) +} + +// AggregatedList retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. +func (c *NodeGroupsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified NodeGroup resource. +func (c *NodeGroupsClient) Delete(ctx context.Context, req *computepb.DeleteNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteNodes deletes specified nodes from the node group. +func (c *NodeGroupsClient) DeleteNodes(ctx context.Context, req *computepb.DeleteNodesNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteNodes(ctx, req, opts...) +} + +// Get returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. Note: the “nodes” field should not be used. Use nodeGroups.listNodes instead. +func (c *NodeGroupsClient) Get(ctx context.Context, req *computepb.GetNodeGroupRequest, opts ...gax.CallOption) (*computepb.NodeGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *NodeGroupsClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeGroupRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a NodeGroup resource in the specified project using the data included in the request. +func (c *NodeGroupsClient) Insert(ctx context.Context, req *computepb.InsertNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of node groups available to the specified project. Note: use nodeGroups.listNodes for more details about each group. +func (c *NodeGroupsClient) List(ctx context.Context, req *computepb.ListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListNodes lists nodes in the node group. +func (c *NodeGroupsClient) ListNodes(ctx context.Context, req *computepb.ListNodesNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupsListNodes, error) { + return c.internalClient.ListNodes(ctx, req, opts...) +} + +// Patch updates the specified node group. +func (c *NodeGroupsClient) Patch(ctx context.Context, req *computepb.PatchNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *NodeGroupsClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyNodeGroupRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetNodeTemplate updates the node template of the node group. +func (c *NodeGroupsClient) SetNodeTemplate(ctx context.Context, req *computepb.SetNodeTemplateNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetNodeTemplate(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *NodeGroupsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNodeGroupRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type nodeGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNodeGroupsRESTClient creates a new node groups rest client. +// +// The NodeGroups API. +func NewNodeGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*NodeGroupsClient, error) { + clientOpts := append(defaultNodeGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &nodeGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &NodeGroupsClient{internalClient: c, CallOptions: &NodeGroupsCallOptions{}}, nil +} + +func defaultNodeGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *nodeGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *nodeGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *nodeGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddNodes adds specified number of nodes to the node group. +func (c *nodeGroupsRESTClient) AddNodes(ctx context.Context, req *computepb.AddNodesNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeGroupsAddNodesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/addNodes", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. +func (c *nodeGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeGroups", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeGroupAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified NodeGroup resource. +func (c *nodeGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteNodes deletes specified nodes from the node group. +func (c *nodeGroupsRESTClient) DeleteNodes(ctx context.Context, req *computepb.DeleteNodesNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeGroupsDeleteNodesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/deleteNodes", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. Note: the “nodes” field should not be used. Use nodeGroups.listNodes instead. +func (c *nodeGroupsRESTClient) Get(ctx context.Context, req *computepb.GetNodeGroupRequest, opts ...gax.CallOption) (*computepb.NodeGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *nodeGroupsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeGroupRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a NodeGroup resource in the specified project using the data included in the request. +func (c *nodeGroupsRESTClient) Insert(ctx context.Context, req *computepb.InsertNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req.GetInitialNodeCount() != 0 { + params.Add("initialNodeCount", fmt.Sprintf("%v", req.GetInitialNodeCount())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of node groups available to the specified project. Note: use nodeGroups.listNodes for more details about each group. +func (c *nodeGroupsRESTClient) List(ctx context.Context, req *computepb.ListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListNodes lists nodes in the node group. +func (c *nodeGroupsRESTClient) ListNodes(ctx context.Context, req *computepb.ListNodesNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupsListNodes, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/listNodes", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeGroupsListNodes{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified node group. +func (c *nodeGroupsRESTClient) Patch(ctx context.Context, req *computepb.PatchNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *nodeGroupsRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyNodeGroupRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetZoneSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/setIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetNodeTemplate updates the node template of the node group. +func (c *nodeGroupsRESTClient) SetNodeTemplate(ctx context.Context, req *computepb.SetNodeTemplateNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeGroupsSetNodeTemplateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/setNodeTemplate", req.GetProject(), req.GetZone(), req.GetNodeGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *nodeGroupsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNodeGroupRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/testIamPermissions", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/node_groups_client_example_test.go b/compute/apiv1/node_groups_client_example_test.go new file mode 100644 index 000000000000..8cb69f98e69e --- /dev/null +++ b/compute/apiv1/node_groups_client_example_test.go @@ -0,0 +1,283 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewNodeGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleNodeGroupsClient_AddNodes() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddNodesNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddNodes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListNodeGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_Delete() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_DeleteNodes() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteNodesNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteNodes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_Insert() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNodeGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_ListNodes() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNodesNodeGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListNodes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_Patch() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_SetNodeTemplate() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetNodeTemplateNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNodeTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeGroupsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewNodeGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsNodeGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/node_templates_client.go b/compute/apiv1/node_templates_client.go new file mode 100644 index 000000000000..eebf6d2a0a06 --- /dev/null +++ b/compute/apiv1/node_templates_client.go @@ -0,0 +1,611 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newNodeTemplatesClientHook clientHook + +// NodeTemplatesCallOptions contains the retry settings for each method of NodeTemplatesClient. +type NodeTemplatesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalNodeTemplatesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalNodeTemplatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListNodeTemplatesRequest, ...gax.CallOption) (*computepb.NodeTemplateAggregatedList, error) + Delete(context.Context, *computepb.DeleteNodeTemplateRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetNodeTemplateRequest, ...gax.CallOption) (*computepb.NodeTemplate, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyNodeTemplateRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertNodeTemplateRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListNodeTemplatesRequest, ...gax.CallOption) (*computepb.NodeTemplateList, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyNodeTemplateRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsNodeTemplateRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// NodeTemplatesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The NodeTemplates API. +type NodeTemplatesClient struct { + // The internal transport-dependent client. + internalClient internalNodeTemplatesClient + + // The call options for this service. + CallOptions *NodeTemplatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NodeTemplatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NodeTemplatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *NodeTemplatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of node templates. +func (c *NodeTemplatesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified NodeTemplate resource. +func (c *NodeTemplatesClient) Delete(ctx context.Context, req *computepb.DeleteNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified node template. Gets a list of available node templates by making a list() request. +func (c *NodeTemplatesClient) Get(ctx context.Context, req *computepb.GetNodeTemplateRequest, opts ...gax.CallOption) (*computepb.NodeTemplate, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *NodeTemplatesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a NodeTemplate resource in the specified project using the data included in the request. +func (c *NodeTemplatesClient) Insert(ctx context.Context, req *computepb.InsertNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of node templates available to the specified project. +func (c *NodeTemplatesClient) List(ctx context.Context, req *computepb.ListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *NodeTemplatesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *NodeTemplatesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNodeTemplateRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type nodeTemplatesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNodeTemplatesRESTClient creates a new node templates rest client. +// +// The NodeTemplates API. +func NewNodeTemplatesRESTClient(ctx context.Context, opts ...option.ClientOption) (*NodeTemplatesClient, error) { + clientOpts := append(defaultNodeTemplatesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &nodeTemplatesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &NodeTemplatesClient{internalClient: c, CallOptions: &NodeTemplatesCallOptions{}}, nil +} + +func defaultNodeTemplatesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *nodeTemplatesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *nodeTemplatesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *nodeTemplatesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of node templates. +func (c *nodeTemplatesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeTemplates", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeTemplateAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified NodeTemplate resource. +func (c *nodeTemplatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v", req.GetProject(), req.GetRegion(), req.GetNodeTemplate()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified node template. Gets a list of available node templates by making a list() request. +func (c *nodeTemplatesRESTClient) Get(ctx context.Context, req *computepb.GetNodeTemplateRequest, opts ...gax.CallOption) (*computepb.NodeTemplate, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v", req.GetProject(), req.GetRegion(), req.GetNodeTemplate()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeTemplate{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *nodeTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a NodeTemplate resource in the specified project using the data included in the request. +func (c *nodeTemplatesRESTClient) Insert(ctx context.Context, req *computepb.InsertNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNodeTemplateResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of node templates available to the specified project. +func (c *nodeTemplatesRESTClient) List(ctx context.Context, req *computepb.ListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeTemplateList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *nodeTemplatesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v/setIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *nodeTemplatesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsNodeTemplateRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/node_templates_client_example_test.go b/compute/apiv1/node_templates_client_example_test.go new file mode 100644 index 000000000000..e589d2ededda --- /dev/null +++ b/compute/apiv1/node_templates_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewNodeTemplatesRESTClient() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleNodeTemplatesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListNodeTemplatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_Delete() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_Get() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_Insert() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_List() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNodeTemplatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTemplatesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewNodeTemplatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsNodeTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/node_types_client.go b/compute/apiv1/node_types_client.go new file mode 100644 index 000000000000..5c72753393b7 --- /dev/null +++ b/compute/apiv1/node_types_client.go @@ -0,0 +1,337 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newNodeTypesClientHook clientHook + +// NodeTypesCallOptions contains the retry settings for each method of NodeTypesClient. +type NodeTypesCallOptions struct { + AggregatedList []gax.CallOption + Get []gax.CallOption + List []gax.CallOption +} + +// internalNodeTypesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalNodeTypesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListNodeTypesRequest, ...gax.CallOption) (*computepb.NodeTypeAggregatedList, error) + Get(context.Context, *computepb.GetNodeTypeRequest, ...gax.CallOption) (*computepb.NodeType, error) + List(context.Context, *computepb.ListNodeTypesRequest, ...gax.CallOption) (*computepb.NodeTypeList, error) +} + +// NodeTypesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The NodeTypes API. +type NodeTypesClient struct { + // The internal transport-dependent client. + internalClient internalNodeTypesClient + + // The call options for this service. + CallOptions *NodeTypesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NodeTypesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NodeTypesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *NodeTypesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of node types. +func (c *NodeTypesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Get returns the specified node type. Gets a list of available node types by making a list() request. +func (c *NodeTypesClient) Get(ctx context.Context, req *computepb.GetNodeTypeRequest, opts ...gax.CallOption) (*computepb.NodeType, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of node types available to the specified project. +func (c *NodeTypesClient) List(ctx context.Context, req *computepb.ListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type nodeTypesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNodeTypesRESTClient creates a new node types rest client. +// +// The NodeTypes API. +func NewNodeTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*NodeTypesClient, error) { + clientOpts := append(defaultNodeTypesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &nodeTypesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &NodeTypesClient{internalClient: c, CallOptions: &NodeTypesCallOptions{}}, nil +} + +func defaultNodeTypesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *nodeTypesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *nodeTypesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *nodeTypesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of node types. +func (c *nodeTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeTypes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeTypeAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified node type. Gets a list of available node types by making a list() request. +func (c *nodeTypesRESTClient) Get(ctx context.Context, req *computepb.GetNodeTypeRequest, opts ...gax.CallOption) (*computepb.NodeType, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeTypes/%v", req.GetProject(), req.GetZone(), req.GetNodeType()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeType{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of node types available to the specified project. +func (c *nodeTypesRESTClient) List(ctx context.Context, req *computepb.ListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeTypes", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NodeTypeList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/node_types_client_example_test.go b/compute/apiv1/node_types_client_example_test.go new file mode 100644 index 000000000000..9f184468eac4 --- /dev/null +++ b/compute/apiv1/node_types_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewNodeTypesRESTClient() { + ctx := context.Background() + c, err := compute.NewNodeTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleNodeTypesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewNodeTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListNodeTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTypesClient_Get() { + ctx := context.Background() + c, err := compute.NewNodeTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNodeTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNodeTypesClient_List() { + ctx := context.Background() + c, err := compute.NewNodeTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListNodeTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/packet_mirrorings_client.go b/compute/apiv1/packet_mirrorings_client.go new file mode 100644 index 000000000000..2ddda96fccb1 --- /dev/null +++ b/compute/apiv1/packet_mirrorings_client.go @@ -0,0 +1,561 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newPacketMirroringsClientHook clientHook + +// PacketMirroringsCallOptions contains the retry settings for each method of PacketMirroringsClient. +type PacketMirroringsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalPacketMirroringsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalPacketMirroringsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListPacketMirroringsRequest, ...gax.CallOption) (*computepb.PacketMirroringAggregatedList, error) + Delete(context.Context, *computepb.DeletePacketMirroringRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetPacketMirroringRequest, ...gax.CallOption) (*computepb.PacketMirroring, error) + Insert(context.Context, *computepb.InsertPacketMirroringRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListPacketMirroringsRequest, ...gax.CallOption) (*computepb.PacketMirroringList, error) + Patch(context.Context, *computepb.PatchPacketMirroringRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsPacketMirroringRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// PacketMirroringsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The PacketMirrorings API. +type PacketMirroringsClient struct { + // The internal transport-dependent client. + internalClient internalPacketMirroringsClient + + // The call options for this service. + CallOptions *PacketMirroringsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *PacketMirroringsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *PacketMirroringsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *PacketMirroringsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of packetMirrorings. +func (c *PacketMirroringsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified PacketMirroring resource. +func (c *PacketMirroringsClient) Delete(ctx context.Context, req *computepb.DeletePacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified PacketMirroring resource. +func (c *PacketMirroringsClient) Get(ctx context.Context, req *computepb.GetPacketMirroringRequest, opts ...gax.CallOption) (*computepb.PacketMirroring, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a PacketMirroring resource in the specified project and region using the data included in the request. +func (c *PacketMirroringsClient) Insert(ctx context.Context, req *computepb.InsertPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of PacketMirroring resources available to the specified project and region. +func (c *PacketMirroringsClient) List(ctx context.Context, req *computepb.ListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified PacketMirroring resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *PacketMirroringsClient) Patch(ctx context.Context, req *computepb.PatchPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *PacketMirroringsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsPacketMirroringRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type packetMirroringsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewPacketMirroringsRESTClient creates a new packet mirrorings rest client. +// +// The PacketMirrorings API. +func NewPacketMirroringsRESTClient(ctx context.Context, opts ...option.ClientOption) (*PacketMirroringsClient, error) { + clientOpts := append(defaultPacketMirroringsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &packetMirroringsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &PacketMirroringsClient{internalClient: c, CallOptions: &PacketMirroringsCallOptions{}}, nil +} + +func defaultPacketMirroringsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *packetMirroringsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *packetMirroringsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *packetMirroringsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of packetMirrorings. +func (c *packetMirroringsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/packetMirrorings", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PacketMirroringAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified PacketMirroring resource. +func (c *packetMirroringsRESTClient) Delete(ctx context.Context, req *computepb.DeletePacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v", req.GetProject(), req.GetRegion(), req.GetPacketMirroring()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified PacketMirroring resource. +func (c *packetMirroringsRESTClient) Get(ctx context.Context, req *computepb.GetPacketMirroringRequest, opts ...gax.CallOption) (*computepb.PacketMirroring, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v", req.GetProject(), req.GetRegion(), req.GetPacketMirroring()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PacketMirroring{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a PacketMirroring resource in the specified project and region using the data included in the request. +func (c *packetMirroringsRESTClient) Insert(ctx context.Context, req *computepb.InsertPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPacketMirroringResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of PacketMirroring resources available to the specified project and region. +func (c *packetMirroringsRESTClient) List(ctx context.Context, req *computepb.ListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PacketMirroringList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified PacketMirroring resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *packetMirroringsRESTClient) Patch(ctx context.Context, req *computepb.PatchPacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPacketMirroringResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v", req.GetProject(), req.GetRegion(), req.GetPacketMirroring()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *packetMirroringsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsPacketMirroringRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/packet_mirrorings_client_example_test.go b/compute/apiv1/packet_mirrorings_client_example_test.go new file mode 100644 index 000000000000..6ce5c37025e5 --- /dev/null +++ b/compute/apiv1/packet_mirrorings_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewPacketMirroringsRESTClient() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExamplePacketMirroringsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListPacketMirroringsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_Delete() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeletePacketMirroringRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_Get() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetPacketMirroringRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_Insert() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertPacketMirroringRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_List() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPacketMirroringsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_Patch() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchPacketMirroringRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePacketMirroringsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewPacketMirroringsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsPacketMirroringRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/projects_client.go b/compute/apiv1/projects_client.go new file mode 100644 index 000000000000..03d1aa434dae --- /dev/null +++ b/compute/apiv1/projects_client.go @@ -0,0 +1,905 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newProjectsClientHook clientHook + +// ProjectsCallOptions contains the retry settings for each method of ProjectsClient. +type ProjectsCallOptions struct { + DisableXpnHost []gax.CallOption + DisableXpnResource []gax.CallOption + EnableXpnHost []gax.CallOption + EnableXpnResource []gax.CallOption + Get []gax.CallOption + GetXpnHost []gax.CallOption + GetXpnResources []gax.CallOption + ListXpnHosts []gax.CallOption + MoveDisk []gax.CallOption + MoveInstance []gax.CallOption + SetCommonInstanceMetadata []gax.CallOption + SetDefaultNetworkTier []gax.CallOption + SetUsageExportBucket []gax.CallOption +} + +// internalProjectsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalProjectsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + DisableXpnHost(context.Context, *computepb.DisableXpnHostProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + DisableXpnResource(context.Context, *computepb.DisableXpnResourceProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + EnableXpnHost(context.Context, *computepb.EnableXpnHostProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + EnableXpnResource(context.Context, *computepb.EnableXpnResourceProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetProjectRequest, ...gax.CallOption) (*computepb.Project, error) + GetXpnHost(context.Context, *computepb.GetXpnHostProjectRequest, ...gax.CallOption) (*computepb.Project, error) + GetXpnResources(context.Context, *computepb.GetXpnResourcesProjectsRequest, ...gax.CallOption) (*computepb.ProjectsGetXpnResources, error) + ListXpnHosts(context.Context, *computepb.ListXpnHostsProjectsRequest, ...gax.CallOption) (*computepb.XpnHostList, error) + MoveDisk(context.Context, *computepb.MoveDiskProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + MoveInstance(context.Context, *computepb.MoveInstanceProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + SetCommonInstanceMetadata(context.Context, *computepb.SetCommonInstanceMetadataProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + SetDefaultNetworkTier(context.Context, *computepb.SetDefaultNetworkTierProjectRequest, ...gax.CallOption) (*computepb.Operation, error) + SetUsageExportBucket(context.Context, *computepb.SetUsageExportBucketProjectRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// ProjectsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Projects API. +type ProjectsClient struct { + // The internal transport-dependent client. + internalClient internalProjectsClient + + // The call options for this service. + CallOptions *ProjectsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ProjectsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ProjectsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ProjectsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// DisableXpnHost disable this project as a shared VPC host project. +func (c *ProjectsClient) DisableXpnHost(ctx context.Context, req *computepb.DisableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DisableXpnHost(ctx, req, opts...) +} + +// DisableXpnResource disable a service resource (also known as service project) associated with this host project. +func (c *ProjectsClient) DisableXpnResource(ctx context.Context, req *computepb.DisableXpnResourceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DisableXpnResource(ctx, req, opts...) +} + +// EnableXpnHost enable this project as a shared VPC host project. +func (c *ProjectsClient) EnableXpnHost(ctx context.Context, req *computepb.EnableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.EnableXpnHost(ctx, req, opts...) +} + +// EnableXpnResource enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. +func (c *ProjectsClient) EnableXpnResource(ctx context.Context, req *computepb.EnableXpnResourceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.EnableXpnResource(ctx, req, opts...) +} + +// Get returns the specified Project resource. +func (c *ProjectsClient) Get(ctx context.Context, req *computepb.GetProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetXpnHost gets the shared VPC host project that this project links to. May be empty if no link exists. +func (c *ProjectsClient) GetXpnHost(ctx context.Context, req *computepb.GetXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { + return c.internalClient.GetXpnHost(ctx, req, opts...) +} + +// GetXpnResources gets service resources (a.k.a service project) associated with this host project. +func (c *ProjectsClient) GetXpnResources(ctx context.Context, req *computepb.GetXpnResourcesProjectsRequest, opts ...gax.CallOption) (*computepb.ProjectsGetXpnResources, error) { + return c.internalClient.GetXpnResources(ctx, req, opts...) +} + +// ListXpnHosts lists all shared VPC host projects visible to the user in an organization. +func (c *ProjectsClient) ListXpnHosts(ctx context.Context, req *computepb.ListXpnHostsProjectsRequest, opts ...gax.CallOption) (*computepb.XpnHostList, error) { + return c.internalClient.ListXpnHosts(ctx, req, opts...) +} + +// MoveDisk moves a persistent disk from one zone to another. +func (c *ProjectsClient) MoveDisk(ctx context.Context, req *computepb.MoveDiskProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.MoveDisk(ctx, req, opts...) +} + +// MoveInstance moves an instance and its attached persistent disks from one zone to another. +func (c *ProjectsClient) MoveInstance(ctx context.Context, req *computepb.MoveInstanceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.MoveInstance(ctx, req, opts...) +} + +// SetCommonInstanceMetadata sets metadata common to all instances within the specified project using the data included in the request. +func (c *ProjectsClient) SetCommonInstanceMetadata(ctx context.Context, req *computepb.SetCommonInstanceMetadataProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetCommonInstanceMetadata(ctx, req, opts...) +} + +// SetDefaultNetworkTier sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field. +func (c *ProjectsClient) SetDefaultNetworkTier(ctx context.Context, req *computepb.SetDefaultNetworkTierProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetDefaultNetworkTier(ctx, req, opts...) +} + +// SetUsageExportBucket enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled. +func (c *ProjectsClient) SetUsageExportBucket(ctx context.Context, req *computepb.SetUsageExportBucketProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetUsageExportBucket(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type projectsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewProjectsRESTClient creates a new projects rest client. +// +// The Projects API. +func NewProjectsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ProjectsClient, error) { + clientOpts := append(defaultProjectsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &projectsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ProjectsClient{internalClient: c, CallOptions: &ProjectsCallOptions{}}, nil +} + +func defaultProjectsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *projectsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *projectsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *projectsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// DisableXpnHost disable this project as a shared VPC host project. +func (c *projectsRESTClient) DisableXpnHost(ctx context.Context, req *computepb.DisableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/disableXpnHost", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DisableXpnResource disable a service resource (also known as service project) associated with this host project. +func (c *projectsRESTClient) DisableXpnResource(ctx context.Context, req *computepb.DisableXpnResourceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetProjectsDisableXpnResourceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/disableXpnResource", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// EnableXpnHost enable this project as a shared VPC host project. +func (c *projectsRESTClient) EnableXpnHost(ctx context.Context, req *computepb.EnableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/enableXpnHost", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// EnableXpnResource enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. +func (c *projectsRESTClient) EnableXpnResource(ctx context.Context, req *computepb.EnableXpnResourceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetProjectsEnableXpnResourceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/enableXpnResource", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified Project resource. +func (c *projectsRESTClient) Get(ctx context.Context, req *computepb.GetProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v", req.GetProject()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Project{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetXpnHost gets the shared VPC host project that this project links to. May be empty if no link exists. +func (c *projectsRESTClient) GetXpnHost(ctx context.Context, req *computepb.GetXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/getXpnHost", req.GetProject()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Project{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetXpnResources gets service resources (a.k.a service project) associated with this host project. +func (c *projectsRESTClient) GetXpnResources(ctx context.Context, req *computepb.GetXpnResourcesProjectsRequest, opts ...gax.CallOption) (*computepb.ProjectsGetXpnResources, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/getXpnResources", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ProjectsGetXpnResources{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListXpnHosts lists all shared VPC host projects visible to the user in an organization. +func (c *projectsRESTClient) ListXpnHosts(ctx context.Context, req *computepb.ListXpnHostsProjectsRequest, opts ...gax.CallOption) (*computepb.XpnHostList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetProjectsListXpnHostsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/listXpnHosts", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.XpnHostList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// MoveDisk moves a persistent disk from one zone to another. +func (c *projectsRESTClient) MoveDisk(ctx context.Context, req *computepb.MoveDiskProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDiskMoveRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/moveDisk", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// MoveInstance moves an instance and its attached persistent disks from one zone to another. +func (c *projectsRESTClient) MoveInstance(ctx context.Context, req *computepb.MoveInstanceProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceMoveRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/moveInstance", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetCommonInstanceMetadata sets metadata common to all instances within the specified project using the data included in the request. +func (c *projectsRESTClient) SetCommonInstanceMetadata(ctx context.Context, req *computepb.SetCommonInstanceMetadataProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetMetadataResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/setCommonInstanceMetadata", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetDefaultNetworkTier sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field. +func (c *projectsRESTClient) SetDefaultNetworkTier(ctx context.Context, req *computepb.SetDefaultNetworkTierProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetProjectsSetDefaultNetworkTierRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/setDefaultNetworkTier", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetUsageExportBucket enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled. +func (c *projectsRESTClient) SetUsageExportBucket(ctx context.Context, req *computepb.SetUsageExportBucketProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUsageExportLocationResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/setUsageExportBucket", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/projects_client_example_test.go b/compute/apiv1/projects_client_example_test.go new file mode 100644 index 000000000000..7ef81b628892 --- /dev/null +++ b/compute/apiv1/projects_client_example_test.go @@ -0,0 +1,283 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewProjectsRESTClient() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleProjectsClient_DisableXpnHost() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DisableXpnHostProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DisableXpnHost(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_DisableXpnResource() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DisableXpnResourceProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DisableXpnResource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_EnableXpnHost() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.EnableXpnHostProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.EnableXpnHost(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_EnableXpnResource() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.EnableXpnResourceProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.EnableXpnResource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_Get() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_GetXpnHost() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetXpnHostProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetXpnHost(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_GetXpnResources() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetXpnResourcesProjectsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetXpnResources(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_ListXpnHosts() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListXpnHostsProjectsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListXpnHosts(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_MoveDisk() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.MoveDiskProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.MoveDisk(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_MoveInstance() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.MoveInstanceProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.MoveInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_SetCommonInstanceMetadata() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetCommonInstanceMetadataProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetCommonInstanceMetadata(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_SetDefaultNetworkTier() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetDefaultNetworkTierProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetDefaultNetworkTier(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProjectsClient_SetUsageExportBucket() { + ctx := context.Background() + c, err := compute.NewProjectsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetUsageExportBucketProjectRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetUsageExportBucket(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/public_advertised_prefixes_client.go b/compute/apiv1/public_advertised_prefixes_client.go new file mode 100644 index 000000000000..01f9fa03d1e6 --- /dev/null +++ b/compute/apiv1/public_advertised_prefixes_client.go @@ -0,0 +1,438 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newPublicAdvertisedPrefixesClientHook clientHook + +// PublicAdvertisedPrefixesCallOptions contains the retry settings for each method of PublicAdvertisedPrefixesClient. +type PublicAdvertisedPrefixesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalPublicAdvertisedPrefixesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalPublicAdvertisedPrefixesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeletePublicAdvertisedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetPublicAdvertisedPrefixeRequest, ...gax.CallOption) (*computepb.PublicAdvertisedPrefix, error) + Insert(context.Context, *computepb.InsertPublicAdvertisedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListPublicAdvertisedPrefixesRequest, ...gax.CallOption) (*computepb.PublicAdvertisedPrefixList, error) + Patch(context.Context, *computepb.PatchPublicAdvertisedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// PublicAdvertisedPrefixesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The PublicAdvertisedPrefixes API. +type PublicAdvertisedPrefixesClient struct { + // The internal transport-dependent client. + internalClient internalPublicAdvertisedPrefixesClient + + // The call options for this service. + CallOptions *PublicAdvertisedPrefixesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *PublicAdvertisedPrefixesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *PublicAdvertisedPrefixesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *PublicAdvertisedPrefixesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified PublicAdvertisedPrefix +func (c *PublicAdvertisedPrefixesClient) Delete(ctx context.Context, req *computepb.DeletePublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified PublicAdvertisedPrefix resource. +func (c *PublicAdvertisedPrefixesClient) Get(ctx context.Context, req *computepb.GetPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefix, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a PublicAdvertisedPrefix in the specified project using the parameters that are included in the request. +func (c *PublicAdvertisedPrefixesClient) Insert(ctx context.Context, req *computepb.InsertPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the PublicAdvertisedPrefixes for a project. +func (c *PublicAdvertisedPrefixesClient) List(ctx context.Context, req *computepb.ListPublicAdvertisedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefixList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *PublicAdvertisedPrefixesClient) Patch(ctx context.Context, req *computepb.PatchPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type publicAdvertisedPrefixesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewPublicAdvertisedPrefixesRESTClient creates a new public advertised prefixes rest client. +// +// The PublicAdvertisedPrefixes API. +func NewPublicAdvertisedPrefixesRESTClient(ctx context.Context, opts ...option.ClientOption) (*PublicAdvertisedPrefixesClient, error) { + clientOpts := append(defaultPublicAdvertisedPrefixesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &publicAdvertisedPrefixesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &PublicAdvertisedPrefixesClient{internalClient: c, CallOptions: &PublicAdvertisedPrefixesCallOptions{}}, nil +} + +func defaultPublicAdvertisedPrefixesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *publicAdvertisedPrefixesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *publicAdvertisedPrefixesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *publicAdvertisedPrefixesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified PublicAdvertisedPrefix +func (c *publicAdvertisedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeletePublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes/%v", req.GetProject(), req.GetPublicAdvertisedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified PublicAdvertisedPrefix resource. +func (c *publicAdvertisedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefix, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes/%v", req.GetProject(), req.GetPublicAdvertisedPrefix()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicAdvertisedPrefix{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a PublicAdvertisedPrefix in the specified project using the parameters that are included in the request. +func (c *publicAdvertisedPrefixesRESTClient) Insert(ctx context.Context, req *computepb.InsertPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicAdvertisedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists the PublicAdvertisedPrefixes for a project. +func (c *publicAdvertisedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListPublicAdvertisedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefixList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicAdvertisedPrefixList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *publicAdvertisedPrefixesRESTClient) Patch(ctx context.Context, req *computepb.PatchPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicAdvertisedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes/%v", req.GetProject(), req.GetPublicAdvertisedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/public_advertised_prefixes_client_example_test.go b/compute/apiv1/public_advertised_prefixes_client_example_test.go new file mode 100644 index 000000000000..157318c0c4d1 --- /dev/null +++ b/compute/apiv1/public_advertised_prefixes_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewPublicAdvertisedPrefixesRESTClient() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExamplePublicAdvertisedPrefixesClient_Delete() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeletePublicAdvertisedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicAdvertisedPrefixesClient_Get() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetPublicAdvertisedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicAdvertisedPrefixesClient_Insert() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertPublicAdvertisedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicAdvertisedPrefixesClient_List() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPublicAdvertisedPrefixesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicAdvertisedPrefixesClient_Patch() { + ctx := context.Background() + c, err := compute.NewPublicAdvertisedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchPublicAdvertisedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/public_delegated_prefixes_client.go b/compute/apiv1/public_delegated_prefixes_client.go new file mode 100644 index 000000000000..5a186c8800eb --- /dev/null +++ b/compute/apiv1/public_delegated_prefixes_client.go @@ -0,0 +1,510 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newPublicDelegatedPrefixesClientHook clientHook + +// PublicDelegatedPrefixesCallOptions contains the retry settings for each method of PublicDelegatedPrefixesClient. +type PublicDelegatedPrefixesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalPublicDelegatedPrefixesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalPublicDelegatedPrefixesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListPublicDelegatedPrefixesRequest, ...gax.CallOption) (*computepb.PublicDelegatedPrefixAggregatedList, error) + Delete(context.Context, *computepb.DeletePublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) + Insert(context.Context, *computepb.InsertPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListPublicDelegatedPrefixesRequest, ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) + Patch(context.Context, *computepb.PatchPublicDelegatedPrefixeRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// PublicDelegatedPrefixesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The PublicDelegatedPrefixes API. +type PublicDelegatedPrefixesClient struct { + // The internal transport-dependent client. + internalClient internalPublicDelegatedPrefixesClient + + // The call options for this service. + CallOptions *PublicDelegatedPrefixesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *PublicDelegatedPrefixesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *PublicDelegatedPrefixesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *PublicDelegatedPrefixesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList lists all PublicDelegatedPrefix resources owned by the specific project across all scopes. +func (c *PublicDelegatedPrefixesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified PublicDelegatedPrefix in the given region. +func (c *PublicDelegatedPrefixesClient) Delete(ctx context.Context, req *computepb.DeletePublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified PublicDelegatedPrefix resource in the given region. +func (c *PublicDelegatedPrefixesClient) Get(ctx context.Context, req *computepb.GetPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a PublicDelegatedPrefix in the specified project in the given region using the parameters that are included in the request. +func (c *PublicDelegatedPrefixesClient) Insert(ctx context.Context, req *computepb.InsertPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the PublicDelegatedPrefixes for a project in the given region. +func (c *PublicDelegatedPrefixesClient) List(ctx context.Context, req *computepb.ListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *PublicDelegatedPrefixesClient) Patch(ctx context.Context, req *computepb.PatchPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type publicDelegatedPrefixesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewPublicDelegatedPrefixesRESTClient creates a new public delegated prefixes rest client. +// +// The PublicDelegatedPrefixes API. +func NewPublicDelegatedPrefixesRESTClient(ctx context.Context, opts ...option.ClientOption) (*PublicDelegatedPrefixesClient, error) { + clientOpts := append(defaultPublicDelegatedPrefixesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &publicDelegatedPrefixesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &PublicDelegatedPrefixesClient{internalClient: c, CallOptions: &PublicDelegatedPrefixesCallOptions{}}, nil +} + +func defaultPublicDelegatedPrefixesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *publicDelegatedPrefixesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *publicDelegatedPrefixesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *publicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList lists all PublicDelegatedPrefix resources owned by the specific project across all scopes. +func (c *publicDelegatedPrefixesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/publicDelegatedPrefixes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicDelegatedPrefixAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified PublicDelegatedPrefix in the given region. +func (c *publicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeletePublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes/%v", req.GetProject(), req.GetRegion(), req.GetPublicDelegatedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified PublicDelegatedPrefix resource in the given region. +func (c *publicDelegatedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes/%v", req.GetProject(), req.GetRegion(), req.GetPublicDelegatedPrefix()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicDelegatedPrefix{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a PublicDelegatedPrefix in the specified project in the given region using the parameters that are included in the request. +func (c *publicDelegatedPrefixesRESTClient) Insert(ctx context.Context, req *computepb.InsertPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicDelegatedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists the PublicDelegatedPrefixes for a project in the given region. +func (c *publicDelegatedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.PublicDelegatedPrefixList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *publicDelegatedPrefixesRESTClient) Patch(ctx context.Context, req *computepb.PatchPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetPublicDelegatedPrefixResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes/%v", req.GetProject(), req.GetRegion(), req.GetPublicDelegatedPrefix()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/public_delegated_prefixes_client_example_test.go b/compute/apiv1/public_delegated_prefixes_client_example_test.go new file mode 100644 index 000000000000..c17586ce868a --- /dev/null +++ b/compute/apiv1/public_delegated_prefixes_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewPublicDelegatedPrefixesRESTClient() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExamplePublicDelegatedPrefixesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListPublicDelegatedPrefixesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicDelegatedPrefixesClient_Delete() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeletePublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicDelegatedPrefixesClient_Get() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicDelegatedPrefixesClient_Insert() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicDelegatedPrefixesClient_List() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPublicDelegatedPrefixesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublicDelegatedPrefixesClient_Patch() { + ctx := context.Background() + c, err := compute.NewPublicDelegatedPrefixesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchPublicDelegatedPrefixeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_autoscalers_client.go b/compute/apiv1/region_autoscalers_client.go new file mode 100644 index 000000000000..32c026f5dccf --- /dev/null +++ b/compute/apiv1/region_autoscalers_client.go @@ -0,0 +1,508 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionAutoscalersClientHook clientHook + +// RegionAutoscalersCallOptions contains the retry settings for each method of RegionAutoscalersClient. +type RegionAutoscalersCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalRegionAutoscalersClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionAutoscalersClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionAutoscalerRequest, ...gax.CallOption) (*computepb.Autoscaler, error) + Insert(context.Context, *computepb.InsertRegionAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionAutoscalersRequest, ...gax.CallOption) (*computepb.RegionAutoscalerList, error) + Patch(context.Context, *computepb.PatchRegionAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateRegionAutoscalerRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionAutoscalersClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionAutoscalers API. +type RegionAutoscalersClient struct { + // The internal transport-dependent client. + internalClient internalRegionAutoscalersClient + + // The call options for this service. + CallOptions *RegionAutoscalersCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionAutoscalersClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionAutoscalersClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionAutoscalersClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified autoscaler. +func (c *RegionAutoscalersClient) Delete(ctx context.Context, req *computepb.DeleteRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified autoscaler. +func (c *RegionAutoscalersClient) Get(ctx context.Context, req *computepb.GetRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates an autoscaler in the specified project using the data included in the request. +func (c *RegionAutoscalersClient) Insert(ctx context.Context, req *computepb.InsertRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of autoscalers contained within the specified region. +func (c *RegionAutoscalersClient) List(ctx context.Context, req *computepb.ListRegionAutoscalersRequest, opts ...gax.CallOption) (*computepb.RegionAutoscalerList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *RegionAutoscalersClient) Patch(ctx context.Context, req *computepb.PatchRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates an autoscaler in the specified project using the data included in the request. +func (c *RegionAutoscalersClient) Update(ctx context.Context, req *computepb.UpdateRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionAutoscalersRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionAutoscalersRESTClient creates a new region autoscalers rest client. +// +// The RegionAutoscalers API. +func NewRegionAutoscalersRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionAutoscalersClient, error) { + clientOpts := append(defaultRegionAutoscalersRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionAutoscalersRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionAutoscalersClient{internalClient: c, CallOptions: &RegionAutoscalersCallOptions{}}, nil +} + +func defaultRegionAutoscalersRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionAutoscalersRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionAutoscalersRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionAutoscalersRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified autoscaler. +func (c *regionAutoscalersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers/%v", req.GetProject(), req.GetRegion(), req.GetAutoscaler()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified autoscaler. +func (c *regionAutoscalersRESTClient) Get(ctx context.Context, req *computepb.GetRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers/%v", req.GetProject(), req.GetRegion(), req.GetAutoscaler()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Autoscaler{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates an autoscaler in the specified project using the data included in the request. +func (c *regionAutoscalersRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of autoscalers contained within the specified region. +func (c *regionAutoscalersRESTClient) List(ctx context.Context, req *computepb.ListRegionAutoscalersRequest, opts ...gax.CallOption) (*computepb.RegionAutoscalerList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionAutoscalerList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *regionAutoscalersRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Autoscaler != nil { + params.Add("autoscaler", fmt.Sprintf("%v", req.GetAutoscaler())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates an autoscaler in the specified project using the data included in the request. +func (c *regionAutoscalersRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetAutoscalerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req != nil && req.Autoscaler != nil { + params.Add("autoscaler", fmt.Sprintf("%v", req.GetAutoscaler())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req.GetRegion() != "" { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_autoscalers_client_example_test.go b/compute/apiv1/region_autoscalers_client_example_test.go new file mode 100644 index 000000000000..b3cf73327a8f --- /dev/null +++ b/compute/apiv1/region_autoscalers_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionAutoscalersRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionAutoscalersClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionAutoscalersClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionAutoscalersClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionAutoscalersClient_List() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionAutoscalersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionAutoscalersClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionAutoscalersClient_Update() { + ctx := context.Background() + c, err := compute.NewRegionAutoscalersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateRegionAutoscalerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_backend_services_client.go b/compute/apiv1/region_backend_services_client.go new file mode 100644 index 000000000000..eae95808d2ef --- /dev/null +++ b/compute/apiv1/region_backend_services_client.go @@ -0,0 +1,556 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionBackendServicesClientHook clientHook + +// RegionBackendServicesCallOptions contains the retry settings for each method of RegionBackendServicesClient. +type RegionBackendServicesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + GetHealth []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalRegionBackendServicesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionBackendServicesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionBackendServiceRequest, ...gax.CallOption) (*computepb.BackendService, error) + GetHealth(context.Context, *computepb.GetHealthRegionBackendServiceRequest, ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) + Insert(context.Context, *computepb.InsertRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionBackendServicesRequest, ...gax.CallOption) (*computepb.BackendServiceList, error) + Patch(context.Context, *computepb.PatchRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionBackendServicesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionBackendServices API. +type RegionBackendServicesClient struct { + // The internal transport-dependent client. + internalClient internalRegionBackendServicesClient + + // The call options for this service. + CallOptions *RegionBackendServicesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionBackendServicesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionBackendServicesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionBackendServicesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified regional BackendService resource. +func (c *RegionBackendServicesClient) Delete(ctx context.Context, req *computepb.DeleteRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified regional BackendService resource. +func (c *RegionBackendServicesClient) Get(ctx context.Context, req *computepb.GetRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetHealth gets the most recent health check results for this regional BackendService. +func (c *RegionBackendServicesClient) GetHealth(ctx context.Context, req *computepb.GetHealthRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) { + return c.internalClient.GetHealth(ctx, req, opts...) +} + +// Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +func (c *RegionBackendServicesClient) Insert(ctx context.Context, req *computepb.InsertRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of regional BackendService resources available to the specified project in the given region. +func (c *RegionBackendServicesClient) List(ctx context.Context, req *computepb.ListRegionBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified regional BackendService resource with the data included in the request. For more information, see Understanding backend services This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *RegionBackendServicesClient) Patch(ctx context.Context, req *computepb.PatchRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview. +func (c *RegionBackendServicesClient) Update(ctx context.Context, req *computepb.UpdateRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionBackendServicesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionBackendServicesRESTClient creates a new region backend services rest client. +// +// The RegionBackendServices API. +func NewRegionBackendServicesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionBackendServicesClient, error) { + clientOpts := append(defaultRegionBackendServicesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionBackendServicesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionBackendServicesClient{internalClient: c, CallOptions: &RegionBackendServicesCallOptions{}}, nil +} + +func defaultRegionBackendServicesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionBackendServicesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionBackendServicesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionBackendServicesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified regional BackendService resource. +func (c *regionBackendServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v", req.GetProject(), req.GetRegion(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified regional BackendService resource. +func (c *regionBackendServicesRESTClient) Get(ctx context.Context, req *computepb.GetRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v", req.GetProject(), req.GetRegion(), req.GetBackendService()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendService{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetHealth gets the most recent health check results for this regional BackendService. +func (c *regionBackendServicesRESTClient) GetHealth(ctx context.Context, req *computepb.GetHealthRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetResourceGroupReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v/getHealth", req.GetProject(), req.GetRegion(), req.GetBackendService()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendServiceGroupHealth{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +func (c *regionBackendServicesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of regional BackendService resources available to the specified project in the given region. +func (c *regionBackendServicesRESTClient) List(ctx context.Context, req *computepb.ListRegionBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.BackendServiceList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified regional BackendService resource with the data included in the request. For more information, see Understanding backend services This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *regionBackendServicesRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v", req.GetProject(), req.GetRegion(), req.GetBackendService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview. +func (c *regionBackendServicesRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBackendServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetBackendService() != "" { + params.Add("backendService", fmt.Sprintf("%v", req.GetBackendService())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req.GetRegion() != "" { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_backend_services_client_example_test.go b/compute/apiv1/region_backend_services_client_example_test.go new file mode 100644 index 000000000000..389fa3210c5d --- /dev/null +++ b/compute/apiv1/region_backend_services_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionBackendServicesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionBackendServicesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_GetHealth() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetHealthRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetHealth(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionBackendServicesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionBackendServicesClient_Update() { + ctx := context.Background() + c, err := compute.NewRegionBackendServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateRegionBackendServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_commitments_client.go b/compute/apiv1/region_commitments_client.go new file mode 100644 index 000000000000..c0990697de29 --- /dev/null +++ b/compute/apiv1/region_commitments_client.go @@ -0,0 +1,395 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionCommitmentsClientHook clientHook + +// RegionCommitmentsCallOptions contains the retry settings for each method of RegionCommitmentsClient. +type RegionCommitmentsCallOptions struct { + AggregatedList []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalRegionCommitmentsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionCommitmentsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListRegionCommitmentsRequest, ...gax.CallOption) (*computepb.CommitmentAggregatedList, error) + Get(context.Context, *computepb.GetRegionCommitmentRequest, ...gax.CallOption) (*computepb.Commitment, error) + Insert(context.Context, *computepb.InsertRegionCommitmentRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionCommitmentsRequest, ...gax.CallOption) (*computepb.CommitmentList, error) +} + +// RegionCommitmentsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionCommitments API. +type RegionCommitmentsClient struct { + // The internal transport-dependent client. + internalClient internalRegionCommitmentsClient + + // The call options for this service. + CallOptions *RegionCommitmentsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionCommitmentsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionCommitmentsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionCommitmentsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of commitments. +func (c *RegionCommitmentsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Get returns the specified commitment resource. Gets a list of available commitments by making a list() request. +func (c *RegionCommitmentsClient) Get(ctx context.Context, req *computepb.GetRegionCommitmentRequest, opts ...gax.CallOption) (*computepb.Commitment, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a commitment in the specified project using the data included in the request. +func (c *RegionCommitmentsClient) Insert(ctx context.Context, req *computepb.InsertRegionCommitmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of commitments contained within the specified region. +func (c *RegionCommitmentsClient) List(ctx context.Context, req *computepb.ListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionCommitmentsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionCommitmentsRESTClient creates a new region commitments rest client. +// +// The RegionCommitments API. +func NewRegionCommitmentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionCommitmentsClient, error) { + clientOpts := append(defaultRegionCommitmentsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionCommitmentsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionCommitmentsClient{internalClient: c, CallOptions: &RegionCommitmentsCallOptions{}}, nil +} + +func defaultRegionCommitmentsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionCommitmentsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionCommitmentsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionCommitmentsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of commitments. +func (c *regionCommitmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/commitments", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.CommitmentAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified commitment resource. Gets a list of available commitments by making a list() request. +func (c *regionCommitmentsRESTClient) Get(ctx context.Context, req *computepb.GetRegionCommitmentRequest, opts ...gax.CallOption) (*computepb.Commitment, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/commitments/%v", req.GetProject(), req.GetRegion(), req.GetCommitment()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Commitment{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a commitment in the specified project using the data included in the request. +func (c *regionCommitmentsRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionCommitmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetCommitmentResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/commitments", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of commitments contained within the specified region. +func (c *regionCommitmentsRESTClient) List(ctx context.Context, req *computepb.ListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/commitments", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.CommitmentList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_commitments_client_example_test.go b/compute/apiv1/region_commitments_client_example_test.go new file mode 100644 index 000000000000..5cc685667d44 --- /dev/null +++ b/compute/apiv1/region_commitments_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionCommitmentsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionCommitmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionCommitmentsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewRegionCommitmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListRegionCommitmentsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionCommitmentsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionCommitmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionCommitmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionCommitmentsClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionCommitmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionCommitmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionCommitmentsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionCommitmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionCommitmentsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_disk_types_client.go b/compute/apiv1/region_disk_types_client.go new file mode 100644 index 000000000000..cc443bbbbfdb --- /dev/null +++ b/compute/apiv1/region_disk_types_client.go @@ -0,0 +1,265 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionDiskTypesClientHook clientHook + +// RegionDiskTypesCallOptions contains the retry settings for each method of RegionDiskTypesClient. +type RegionDiskTypesCallOptions struct { + Get []gax.CallOption + List []gax.CallOption +} + +// internalRegionDiskTypesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionDiskTypesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetRegionDiskTypeRequest, ...gax.CallOption) (*computepb.DiskType, error) + List(context.Context, *computepb.ListRegionDiskTypesRequest, ...gax.CallOption) (*computepb.RegionDiskTypeList, error) +} + +// RegionDiskTypesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionDiskTypes API. +type RegionDiskTypesClient struct { + // The internal transport-dependent client. + internalClient internalRegionDiskTypesClient + + // The call options for this service. + CallOptions *RegionDiskTypesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionDiskTypesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionDiskTypesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionDiskTypesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the specified regional disk type. Gets a list of available disk types by making a list() request. +func (c *RegionDiskTypesClient) Get(ctx context.Context, req *computepb.GetRegionDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of regional disk types available to the specified project. +func (c *RegionDiskTypesClient) List(ctx context.Context, req *computepb.ListRegionDiskTypesRequest, opts ...gax.CallOption) (*computepb.RegionDiskTypeList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionDiskTypesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionDiskTypesRESTClient creates a new region disk types rest client. +// +// The RegionDiskTypes API. +func NewRegionDiskTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionDiskTypesClient, error) { + clientOpts := append(defaultRegionDiskTypesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionDiskTypesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionDiskTypesClient{internalClient: c, CallOptions: &RegionDiskTypesCallOptions{}}, nil +} + +func defaultRegionDiskTypesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionDiskTypesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionDiskTypesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionDiskTypesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the specified regional disk type. Gets a list of available disk types by making a list() request. +func (c *regionDiskTypesRESTClient) Get(ctx context.Context, req *computepb.GetRegionDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/diskTypes/%v", req.GetProject(), req.GetRegion(), req.GetDiskType()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskType{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of regional disk types available to the specified project. +func (c *regionDiskTypesRESTClient) List(ctx context.Context, req *computepb.ListRegionDiskTypesRequest, opts ...gax.CallOption) (*computepb.RegionDiskTypeList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/diskTypes", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionDiskTypeList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_disk_types_client_example_test.go b/compute/apiv1/region_disk_types_client_example_test.go new file mode 100644 index 000000000000..a7d34452891e --- /dev/null +++ b/compute/apiv1/region_disk_types_client_example_test.go @@ -0,0 +1,74 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionDiskTypesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionDiskTypesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionDiskTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDiskTypesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionDiskTypesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionDiskTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_disks_client.go b/compute/apiv1/region_disks_client.go new file mode 100644 index 000000000000..5707403df027 --- /dev/null +++ b/compute/apiv1/region_disks_client.go @@ -0,0 +1,832 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionDisksClientHook clientHook + +// RegionDisksCallOptions contains the retry settings for each method of RegionDisksClient. +type RegionDisksCallOptions struct { + AddResourcePolicies []gax.CallOption + CreateSnapshot []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + RemoveResourcePolicies []gax.CallOption + Resize []gax.CallOption + SetIamPolicy []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalRegionDisksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionDisksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddResourcePolicies(context.Context, *computepb.AddResourcePoliciesRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + CreateSnapshot(context.Context, *computepb.CreateSnapshotRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionDiskRequest, ...gax.CallOption) (*computepb.Disk, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyRegionDiskRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionDisksRequest, ...gax.CallOption) (*computepb.DiskList, error) + RemoveResourcePolicies(context.Context, *computepb.RemoveResourcePoliciesRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + Resize(context.Context, *computepb.ResizeRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyRegionDiskRequest, ...gax.CallOption) (*computepb.Policy, error) + SetLabels(context.Context, *computepb.SetLabelsRegionDiskRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsRegionDiskRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// RegionDisksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionDisks API. +type RegionDisksClient struct { + // The internal transport-dependent client. + internalClient internalRegionDisksClient + + // The call options for this service. + CallOptions *RegionDisksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionDisksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionDisksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionDisksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddResourcePolicies adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. +func (c *RegionDisksClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddResourcePolicies(ctx, req, opts...) +} + +// CreateSnapshot creates a snapshot of this regional disk. +func (c *RegionDisksClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.CreateSnapshot(ctx, req, opts...) +} + +// Delete deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. +func (c *RegionDisksClient) Delete(ctx context.Context, req *computepb.DeleteRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns a specified regional persistent disk. +func (c *RegionDisksClient) Get(ctx context.Context, req *computepb.GetRegionDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *RegionDisksClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyRegionDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a persistent regional disk in the specified project using the data included in the request. +func (c *RegionDisksClient) Insert(ctx context.Context, req *computepb.InsertRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of persistent disks contained within the specified region. +func (c *RegionDisksClient) List(ctx context.Context, req *computepb.ListRegionDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// RemoveResourcePolicies removes resource policies from a regional disk. +func (c *RegionDisksClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveResourcePolicies(ctx, req, opts...) +} + +// Resize resizes the specified regional persistent disk. +func (c *RegionDisksClient) Resize(ctx context.Context, req *computepb.ResizeRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Resize(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *RegionDisksClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyRegionDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetLabels sets the labels on the target regional disk. +func (c *RegionDisksClient) SetLabels(ctx context.Context, req *computepb.SetLabelsRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *RegionDisksClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsRegionDiskRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionDisksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionDisksRESTClient creates a new region disks rest client. +// +// The RegionDisks API. +func NewRegionDisksRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionDisksClient, error) { + clientOpts := append(defaultRegionDisksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionDisksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionDisksClient{internalClient: c, CallOptions: &RegionDisksCallOptions{}}, nil +} + +func defaultRegionDisksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionDisksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionDisksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionDisksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddResourcePolicies adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. +func (c *regionDisksRESTClient) AddResourcePolicies(ctx context.Context, req *computepb.AddResourcePoliciesRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionDisksAddResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/addResourcePolicies", req.GetProject(), req.GetRegion(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// CreateSnapshot creates a snapshot of this regional disk. +func (c *regionDisksRESTClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSnapshotResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/createSnapshot", req.GetProject(), req.GetRegion(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. +func (c *regionDisksRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v", req.GetProject(), req.GetRegion(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns a specified regional persistent disk. +func (c *regionDisksRESTClient) Get(ctx context.Context, req *computepb.GetRegionDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v", req.GetProject(), req.GetRegion(), req.GetDisk()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Disk{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *regionDisksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyRegionDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a persistent regional disk in the specified project using the data included in the request. +func (c *regionDisksRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetDiskResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req != nil && req.SourceImage != nil { + params.Add("sourceImage", fmt.Sprintf("%v", req.GetSourceImage())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of persistent disks contained within the specified region. +func (c *regionDisksRESTClient) List(ctx context.Context, req *computepb.ListRegionDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DiskList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveResourcePolicies removes resource policies from a regional disk. +func (c *regionDisksRESTClient) RemoveResourcePolicies(ctx context.Context, req *computepb.RemoveResourcePoliciesRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionDisksRemoveResourcePoliciesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/removeResourcePolicies", req.GetProject(), req.GetRegion(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Resize resizes the specified regional persistent disk. +func (c *regionDisksRESTClient) Resize(ctx context.Context, req *computepb.ResizeRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionDisksResizeRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/resize", req.GetProject(), req.GetRegion(), req.GetDisk()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *regionDisksRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyRegionDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/setIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on the target regional disk. +func (c *regionDisksRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *regionDisksRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsRegionDiskRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_disks_client_example_test.go b/compute/apiv1/region_disks_client_example_test.go new file mode 100644 index 000000000000..fbef39463580 --- /dev/null +++ b/compute/apiv1/region_disks_client_example_test.go @@ -0,0 +1,264 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionDisksRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionDisksClient_AddResourcePolicies() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddResourcePoliciesRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_CreateSnapshot() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.CreateSnapshotRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_List() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionDisksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_RemoveResourcePolicies() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveResourcePoliciesRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveResourcePolicies(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_Resize() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResizeRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Resize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionDisksClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewRegionDisksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsRegionDiskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_health_check_services_client.go b/compute/apiv1/region_health_check_services_client.go new file mode 100644 index 000000000000..7e7ece75de3a --- /dev/null +++ b/compute/apiv1/region_health_check_services_client.go @@ -0,0 +1,438 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionHealthCheckServicesClientHook clientHook + +// RegionHealthCheckServicesCallOptions contains the retry settings for each method of RegionHealthCheckServicesClient. +type RegionHealthCheckServicesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalRegionHealthCheckServicesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionHealthCheckServicesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionHealthCheckServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionHealthCheckServiceRequest, ...gax.CallOption) (*computepb.HealthCheckService, error) + Insert(context.Context, *computepb.InsertRegionHealthCheckServiceRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionHealthCheckServicesRequest, ...gax.CallOption) (*computepb.HealthCheckServicesList, error) + Patch(context.Context, *computepb.PatchRegionHealthCheckServiceRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionHealthCheckServicesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionHealthCheckServices API. +type RegionHealthCheckServicesClient struct { + // The internal transport-dependent client. + internalClient internalRegionHealthCheckServicesClient + + // The call options for this service. + CallOptions *RegionHealthCheckServicesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionHealthCheckServicesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionHealthCheckServicesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionHealthCheckServicesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified regional HealthCheckService. +func (c *RegionHealthCheckServicesClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified regional HealthCheckService resource. +func (c *RegionHealthCheckServicesClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.HealthCheckService, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a regional HealthCheckService resource in the specified project and region using the data included in the request. +func (c *RegionHealthCheckServicesClient) Insert(ctx context.Context, req *computepb.InsertRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists all the HealthCheckService resources that have been configured for the specified project in the given region. +func (c *RegionHealthCheckServicesClient) List(ctx context.Context, req *computepb.ListRegionHealthCheckServicesRequest, opts ...gax.CallOption) (*computepb.HealthCheckServicesList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates the specified regional HealthCheckService resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *RegionHealthCheckServicesClient) Patch(ctx context.Context, req *computepb.PatchRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionHealthCheckServicesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionHealthCheckServicesRESTClient creates a new region health check services rest client. +// +// The RegionHealthCheckServices API. +func NewRegionHealthCheckServicesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionHealthCheckServicesClient, error) { + clientOpts := append(defaultRegionHealthCheckServicesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionHealthCheckServicesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionHealthCheckServicesClient{internalClient: c, CallOptions: &RegionHealthCheckServicesCallOptions{}}, nil +} + +func defaultRegionHealthCheckServicesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionHealthCheckServicesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionHealthCheckServicesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionHealthCheckServicesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified regional HealthCheckService. +func (c *regionHealthCheckServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheckService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified regional HealthCheckService resource. +func (c *regionHealthCheckServicesRESTClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.HealthCheckService, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheckService()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheckService{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a regional HealthCheckService resource in the specified project and region using the data included in the request. +func (c *regionHealthCheckServicesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists all the HealthCheckService resources that have been configured for the specified project in the given region. +func (c *regionHealthCheckServicesRESTClient) List(ctx context.Context, req *computepb.ListRegionHealthCheckServicesRequest, opts ...gax.CallOption) (*computepb.HealthCheckServicesList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheckServicesList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates the specified regional HealthCheckService resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *regionHealthCheckServicesRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckServiceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheckService()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_health_check_services_client_example_test.go b/compute/apiv1/region_health_check_services_client_example_test.go new file mode 100644 index 000000000000..bbaf17d81523 --- /dev/null +++ b/compute/apiv1/region_health_check_services_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionHealthCheckServicesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionHealthCheckServicesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionHealthCheckServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthCheckServicesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionHealthCheckServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthCheckServicesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionHealthCheckServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthCheckServicesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionHealthCheckServicesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthCheckServicesClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionHealthCheckServicesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionHealthCheckServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_health_checks_client.go b/compute/apiv1/region_health_checks_client.go new file mode 100644 index 000000000000..18afaa3dbb31 --- /dev/null +++ b/compute/apiv1/region_health_checks_client.go @@ -0,0 +1,505 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionHealthChecksClientHook clientHook + +// RegionHealthChecksCallOptions contains the retry settings for each method of RegionHealthChecksClient. +type RegionHealthChecksCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption +} + +// internalRegionHealthChecksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionHealthChecksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionHealthCheckRequest, ...gax.CallOption) (*computepb.HealthCheck, error) + Insert(context.Context, *computepb.InsertRegionHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionHealthChecksRequest, ...gax.CallOption) (*computepb.HealthCheckList, error) + Patch(context.Context, *computepb.PatchRegionHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateRegionHealthCheckRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionHealthChecksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionHealthChecks API. +type RegionHealthChecksClient struct { + // The internal transport-dependent client. + internalClient internalRegionHealthChecksClient + + // The call options for this service. + CallOptions *RegionHealthChecksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionHealthChecksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionHealthChecksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionHealthChecksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified HealthCheck resource. +func (c *RegionHealthChecksClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. +func (c *RegionHealthChecksClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a HealthCheck resource in the specified project using the data included in the request. +func (c *RegionHealthChecksClient) Insert(ctx context.Context, req *computepb.InsertRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of HealthCheck resources available to the specified project. +func (c *RegionHealthChecksClient) List(ctx context.Context, req *computepb.ListRegionHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *RegionHealthChecksClient) Patch(ctx context.Context, req *computepb.PatchRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates a HealthCheck resource in the specified project using the data included in the request. +func (c *RegionHealthChecksClient) Update(ctx context.Context, req *computepb.UpdateRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionHealthChecksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionHealthChecksRESTClient creates a new region health checks rest client. +// +// The RegionHealthChecks API. +func NewRegionHealthChecksRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionHealthChecksClient, error) { + clientOpts := append(defaultRegionHealthChecksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionHealthChecksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionHealthChecksClient{internalClient: c, CallOptions: &RegionHealthChecksCallOptions{}}, nil +} + +func defaultRegionHealthChecksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionHealthChecksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionHealthChecksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionHealthChecksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified HealthCheck resource. +func (c *regionHealthChecksRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheck()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. +func (c *regionHealthChecksRESTClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheck()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheck{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a HealthCheck resource in the specified project using the data included in the request. +func (c *regionHealthChecksRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of HealthCheck resources available to the specified project. +func (c *regionHealthChecksRESTClient) List(ctx context.Context, req *computepb.ListRegionHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.HealthCheckList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *regionHealthChecksRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheck()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates a HealthCheck resource in the specified project using the data included in the request. +func (c *regionHealthChecksRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetHealthCheckResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetHealthCheck() != "" { + params.Add("healthCheck", fmt.Sprintf("%v", req.GetHealthCheck())) + } + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req.GetRegion() != "" { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_health_checks_client_example_test.go b/compute/apiv1/region_health_checks_client_example_test.go new file mode 100644 index 000000000000..2264ab8e6716 --- /dev/null +++ b/compute/apiv1/region_health_checks_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionHealthChecksRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionHealthChecksClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthChecksClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthChecksClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthChecksClient_List() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionHealthChecksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthChecksClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionHealthChecksClient_Update() { + ctx := context.Background() + c, err := compute.NewRegionHealthChecksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateRegionHealthCheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_instance_group_managers_client.go b/compute/apiv1/region_instance_group_managers_client.go new file mode 100644 index 000000000000..4e108c40cd95 --- /dev/null +++ b/compute/apiv1/region_instance_group_managers_client.go @@ -0,0 +1,1307 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionInstanceGroupManagersClientHook clientHook + +// RegionInstanceGroupManagersCallOptions contains the retry settings for each method of RegionInstanceGroupManagersClient. +type RegionInstanceGroupManagersCallOptions struct { + AbandonInstances []gax.CallOption + ApplyUpdatesToInstances []gax.CallOption + CreateInstances []gax.CallOption + Delete []gax.CallOption + DeleteInstances []gax.CallOption + DeletePerInstanceConfigs []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListErrors []gax.CallOption + ListManagedInstances []gax.CallOption + ListPerInstanceConfigs []gax.CallOption + Patch []gax.CallOption + PatchPerInstanceConfigs []gax.CallOption + RecreateInstances []gax.CallOption + Resize []gax.CallOption + SetInstanceTemplate []gax.CallOption + SetTargetPools []gax.CallOption + UpdatePerInstanceConfigs []gax.CallOption +} + +// internalRegionInstanceGroupManagersClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionInstanceGroupManagersClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AbandonInstances(context.Context, *computepb.AbandonInstancesRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + ApplyUpdatesToInstances(context.Context, *computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + CreateInstances(context.Context, *computepb.CreateInstancesRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + DeleteInstances(context.Context, *computepb.DeleteInstancesRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + DeletePerInstanceConfigs(context.Context, *computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.InstanceGroupManager, error) + Insert(context.Context, *computepb.InsertRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupManagerList, error) + ListErrors(context.Context, *computepb.ListErrorsRegionInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListErrorsResponse, error) + ListManagedInstances(context.Context, *computepb.ListManagedInstancesRegionInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstancesResponse, error) + ListPerInstanceConfigs(context.Context, *computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstanceConfigsResp, error) + Patch(context.Context, *computepb.PatchRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + PatchPerInstanceConfigs(context.Context, *computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + RecreateInstances(context.Context, *computepb.RecreateInstancesRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + Resize(context.Context, *computepb.ResizeRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + SetInstanceTemplate(context.Context, *computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + SetTargetPools(context.Context, *computepb.SetTargetPoolsRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) + UpdatePerInstanceConfigs(context.Context, *computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionInstanceGroupManagersClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionInstanceGroupManagers API. +type RegionInstanceGroupManagersClient struct { + // The internal transport-dependent client. + internalClient internalRegionInstanceGroupManagersClient + + // The call options for this service. + CallOptions *RegionInstanceGroupManagersCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionInstanceGroupManagersClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionInstanceGroupManagersClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionInstanceGroupManagersClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AbandonInstances flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *RegionInstanceGroupManagersClient) AbandonInstances(ctx context.Context, req *computepb.AbandonInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AbandonInstances(ctx, req, opts...) +} + +// ApplyUpdatesToInstances apply updates to selected instances the managed instance group. +func (c *RegionInstanceGroupManagersClient) ApplyUpdatesToInstances(ctx context.Context, req *computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.ApplyUpdatesToInstances(ctx, req, opts...) +} + +// CreateInstances creates instances with per-instance configs in this regional managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. +func (c *RegionInstanceGroupManagersClient) CreateInstances(ctx context.Context, req *computepb.CreateInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.CreateInstances(ctx, req, opts...) +} + +// Delete deletes the specified managed instance group and all of the instances in that group. +func (c *RegionInstanceGroupManagersClient) Delete(ctx context.Context, req *computepb.DeleteRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// DeleteInstances flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *RegionInstanceGroupManagersClient) DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeleteInstances(ctx, req, opts...) +} + +// DeletePerInstanceConfigs deletes selected per-instance configs for the managed instance group. +func (c *RegionInstanceGroupManagersClient) DeletePerInstanceConfigs(ctx context.Context, req *computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.DeletePerInstanceConfigs(ctx, req, opts...) +} + +// Get returns all of the details about the specified managed instance group. +func (c *RegionInstanceGroupManagersClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +// +// A regional managed instance group can contain up to 2000 instances. +func (c *RegionInstanceGroupManagersClient) Insert(ctx context.Context, req *computepb.InsertRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of managed instance groups that are contained within the specified region. +func (c *RegionInstanceGroupManagersClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagerList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListErrors lists all errors thrown by actions on instances for a given regional managed instance group. The filter and orderBy query parameters are not supported. +func (c *RegionInstanceGroupManagersClient) ListErrors(ctx context.Context, req *computepb.ListErrorsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListErrorsResponse, error) { + return c.internalClient.ListErrors(ctx, req, opts...) +} + +// ListManagedInstances lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances. The orderBy query parameter is not supported. +func (c *RegionInstanceGroupManagersClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstancesResponse, error) { + return c.internalClient.ListManagedInstances(ctx, req, opts...) +} + +// ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. +func (c *RegionInstanceGroupManagersClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstanceConfigsResp, error) { + return c.internalClient.ListPerInstanceConfigs(ctx, req, opts...) +} + +// Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *RegionInstanceGroupManagersClient) Patch(ctx context.Context, req *computepb.PatchRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// PatchPerInstanceConfigs inserts or patches per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *RegionInstanceGroupManagersClient) PatchPerInstanceConfigs(ctx context.Context, req *computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.PatchPerInstanceConfigs(ctx, req, opts...) +} + +// RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *RegionInstanceGroupManagersClient) RecreateInstances(ctx context.Context, req *computepb.RecreateInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RecreateInstances(ctx, req, opts...) +} + +// Resize changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. +// +// The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +func (c *RegionInstanceGroupManagersClient) Resize(ctx context.Context, req *computepb.ResizeRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Resize(ctx, req, opts...) +} + +// SetInstanceTemplate sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected. +func (c *RegionInstanceGroupManagersClient) SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetInstanceTemplate(ctx, req, opts...) +} + +// SetTargetPools modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected. +func (c *RegionInstanceGroupManagersClient) SetTargetPools(ctx context.Context, req *computepb.SetTargetPoolsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetTargetPools(ctx, req, opts...) +} + +// UpdatePerInstanceConfigs inserts or updates per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *RegionInstanceGroupManagersClient) UpdatePerInstanceConfigs(ctx context.Context, req *computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.UpdatePerInstanceConfigs(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionInstanceGroupManagersRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionInstanceGroupManagersRESTClient creates a new region instance group managers rest client. +// +// The RegionInstanceGroupManagers API. +func NewRegionInstanceGroupManagersRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionInstanceGroupManagersClient, error) { + clientOpts := append(defaultRegionInstanceGroupManagersRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionInstanceGroupManagersRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionInstanceGroupManagersClient{internalClient: c, CallOptions: &RegionInstanceGroupManagersCallOptions{}}, nil +} + +func defaultRegionInstanceGroupManagersRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionInstanceGroupManagersRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionInstanceGroupManagersRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionInstanceGroupManagersRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AbandonInstances flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *regionInstanceGroupManagersRESTClient) AbandonInstances(ctx context.Context, req *computepb.AbandonInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersAbandonInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/abandonInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ApplyUpdatesToInstances apply updates to selected instances the managed instance group. +func (c *regionInstanceGroupManagersRESTClient) ApplyUpdatesToInstances(ctx context.Context, req *computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersApplyUpdatesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/applyUpdatesToInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// CreateInstances creates instances with per-instance configs in this regional managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. +func (c *regionInstanceGroupManagersRESTClient) CreateInstances(ctx context.Context, req *computepb.CreateInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersCreateInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/createInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified managed instance group and all of the instances in that group. +func (c *regionInstanceGroupManagersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeleteInstances flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *regionInstanceGroupManagersRESTClient) DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersDeleteInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/deleteInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// DeletePerInstanceConfigs deletes selected per-instance configs for the managed instance group. +func (c *regionInstanceGroupManagersRESTClient) DeletePerInstanceConfigs(ctx context.Context, req *computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagerDeleteInstanceConfigReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/deletePerInstanceConfigs", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns all of the details about the specified managed instance group. +func (c *regionInstanceGroupManagersRESTClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroupManager{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +// +// A regional managed instance group can contain up to 2000 instances. +func (c *regionInstanceGroupManagersRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of managed instance groups that are contained within the specified region. +func (c *regionInstanceGroupManagersRESTClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagerList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupManagerList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListErrors lists all errors thrown by actions on instances for a given regional managed instance group. The filter and orderBy query parameters are not supported. +func (c *regionInstanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *computepb.ListErrorsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListErrorsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listErrors", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupManagersListErrorsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListManagedInstances lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances. The orderBy query parameter is not supported. +func (c *regionInstanceGroupManagersRESTClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstancesResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listManagedInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupManagersListInstancesResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. +func (c *regionInstanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstanceConfigsResp, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listPerInstanceConfigs", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupManagersListInstanceConfigsResp{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *regionInstanceGroupManagersRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceGroupManagerResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// PatchPerInstanceConfigs inserts or patches per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *regionInstanceGroupManagersRESTClient) PatchPerInstanceConfigs(ctx context.Context, req *computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagerPatchInstanceConfigReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/patchPerInstanceConfigs", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +// +// You can specify a maximum of 1000 instances with this method per request. +func (c *regionInstanceGroupManagersRESTClient) RecreateInstances(ctx context.Context, req *computepb.RecreateInstancesRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersRecreateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/recreateInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Resize changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. +// +// The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. +// +// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. +func (c *regionInstanceGroupManagersRESTClient) Resize(ctx context.Context, req *computepb.ResizeRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetSize() != 0 { + params.Add("size", fmt.Sprintf("%v", req.GetSize())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetInstanceTemplate sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected. +func (c *regionInstanceGroupManagersRESTClient) SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersSetTemplateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/setInstanceTemplate", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetTargetPools modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected. +func (c *regionInstanceGroupManagersRESTClient) SetTargetPools(ctx context.Context, req *computepb.SetTargetPoolsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagersSetTargetPoolsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/setTargetPools", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// UpdatePerInstanceConfigs inserts or updates per-instance configs for the managed instance group. perInstanceConfig.name (at http://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch. +func (c *regionInstanceGroupManagersRESTClient) UpdatePerInstanceConfigs(ctx context.Context, req *computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupManagerUpdateInstanceConfigReqResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/updatePerInstanceConfigs", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_instance_group_managers_client_example_test.go b/compute/apiv1/region_instance_group_managers_client_example_test.go new file mode 100644 index 000000000000..cf0c18b60034 --- /dev/null +++ b/compute/apiv1/region_instance_group_managers_client_example_test.go @@ -0,0 +1,397 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionInstanceGroupManagersRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionInstanceGroupManagersClient_AbandonInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AbandonInstancesRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AbandonInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_ApplyUpdatesToInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ApplyUpdatesToInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_CreateInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.CreateInstancesRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_DeleteInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteInstancesRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_DeletePerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeletePerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_List() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_ListErrors() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListErrorsRegionInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListErrors(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_ListManagedInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListManagedInstancesRegionInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListManagedInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_ListPerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListPerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_PatchPerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PatchPerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_RecreateInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RecreateInstancesRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RecreateInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_Resize() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResizeRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Resize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_SetInstanceTemplate() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetInstanceTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_SetTargetPools() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetTargetPoolsRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetTargetPools(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupManagersClient_UpdatePerInstanceConfigs() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupManagersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdatePerInstanceConfigs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_instance_groups_client.go b/compute/apiv1/region_instance_groups_client.go new file mode 100644 index 000000000000..d2698ffb112c --- /dev/null +++ b/compute/apiv1/region_instance_groups_client.go @@ -0,0 +1,393 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionInstanceGroupsClientHook clientHook + +// RegionInstanceGroupsCallOptions contains the retry settings for each method of RegionInstanceGroupsClient. +type RegionInstanceGroupsCallOptions struct { + Get []gax.CallOption + List []gax.CallOption + ListInstances []gax.CallOption + SetNamedPorts []gax.CallOption +} + +// internalRegionInstanceGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionInstanceGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetRegionInstanceGroupRequest, ...gax.CallOption) (*computepb.InstanceGroup, error) + List(context.Context, *computepb.ListRegionInstanceGroupsRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupList, error) + ListInstances(context.Context, *computepb.ListInstancesRegionInstanceGroupsRequest, ...gax.CallOption) (*computepb.RegionInstanceGroupsListInstances, error) + SetNamedPorts(context.Context, *computepb.SetNamedPortsRegionInstanceGroupRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionInstanceGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionInstanceGroups API. +type RegionInstanceGroupsClient struct { + // The internal transport-dependent client. + internalClient internalRegionInstanceGroupsClient + + // The call options for this service. + CallOptions *RegionInstanceGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionInstanceGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionInstanceGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionInstanceGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the specified instance group resource. +func (c *RegionInstanceGroupsClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves the list of instance group resources contained within the specified region. +func (c *RegionInstanceGroupsClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListInstances lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported. +func (c *RegionInstanceGroupsClient) ListInstances(ctx context.Context, req *computepb.ListInstancesRegionInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupsListInstances, error) { + return c.internalClient.ListInstances(ctx, req, opts...) +} + +// SetNamedPorts sets the named ports for the specified regional instance group. +func (c *RegionInstanceGroupsClient) SetNamedPorts(ctx context.Context, req *computepb.SetNamedPortsRegionInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetNamedPorts(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionInstanceGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionInstanceGroupsRESTClient creates a new region instance groups rest client. +// +// The RegionInstanceGroups API. +func NewRegionInstanceGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionInstanceGroupsClient, error) { + clientOpts := append(defaultRegionInstanceGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionInstanceGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionInstanceGroupsClient{internalClient: c, CallOptions: &RegionInstanceGroupsCallOptions{}}, nil +} + +func defaultRegionInstanceGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionInstanceGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionInstanceGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionInstanceGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the specified instance group resource. +func (c *regionInstanceGroupsRESTClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.InstanceGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of instance group resources contained within the specified region. +func (c *regionInstanceGroupsRESTClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListInstances lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported. +func (c *regionInstanceGroupsRESTClient) ListInstances(ctx context.Context, req *computepb.ListInstancesRegionInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupsListInstances, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupsListInstancesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups/%v/listInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionInstanceGroupsListInstances{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetNamedPorts sets the named ports for the specified regional instance group. +func (c *regionInstanceGroupsRESTClient) SetNamedPorts(ctx context.Context, req *computepb.SetNamedPortsRegionInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionInstanceGroupsSetNamedPortsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups/%v/setNamedPorts", req.GetProject(), req.GetRegion(), req.GetInstanceGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_instance_groups_client_example_test.go b/compute/apiv1/region_instance_groups_client_example_test.go new file mode 100644 index 000000000000..646c6f1843d9 --- /dev/null +++ b/compute/apiv1/region_instance_groups_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionInstanceGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionInstanceGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionInstanceGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupsClient_ListInstances() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListInstancesRegionInstanceGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListInstances(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionInstanceGroupsClient_SetNamedPorts() { + ctx := context.Background() + c, err := compute.NewRegionInstanceGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetNamedPortsRegionInstanceGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNamedPorts(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_instances_client.go b/compute/apiv1/region_instances_client.go new file mode 100644 index 000000000000..e9a7f88fdf8d --- /dev/null +++ b/compute/apiv1/region_instances_client.go @@ -0,0 +1,204 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionInstancesClientHook clientHook + +// RegionInstancesCallOptions contains the retry settings for each method of RegionInstancesClient. +type RegionInstancesCallOptions struct { + BulkInsert []gax.CallOption +} + +// internalRegionInstancesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionInstancesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + BulkInsert(context.Context, *computepb.BulkInsertRegionInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionInstancesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionInstances API. +type RegionInstancesClient struct { + // The internal transport-dependent client. + internalClient internalRegionInstancesClient + + // The call options for this service. + CallOptions *RegionInstancesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionInstancesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionInstancesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionInstancesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// BulkInsert creates multiple instances in a given region. Count specifies the number of instances to create. +func (c *RegionInstancesClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertRegionInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.BulkInsert(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionInstancesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionInstancesRESTClient creates a new region instances rest client. +// +// The RegionInstances API. +func NewRegionInstancesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionInstancesClient, error) { + clientOpts := append(defaultRegionInstancesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionInstancesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionInstancesClient{internalClient: c, CallOptions: &RegionInstancesCallOptions{}}, nil +} + +func defaultRegionInstancesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionInstancesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionInstancesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionInstancesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// BulkInsert creates multiple instances in a given region. Count specifies the number of instances to create. +func (c *regionInstancesRESTClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertRegionInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetBulkInsertInstanceResourceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instances/bulkInsert", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_instances_client_example_test.go b/compute/apiv1/region_instances_client_example_test.go new file mode 100644 index 000000000000..9856d6f60c71 --- /dev/null +++ b/compute/apiv1/region_instances_client_example_test.go @@ -0,0 +1,55 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionInstancesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionInstancesClient_BulkInsert() { + ctx := context.Background() + c, err := compute.NewRegionInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.BulkInsertRegionInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BulkInsert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_network_endpoint_groups_client.go b/compute/apiv1/region_network_endpoint_groups_client.go new file mode 100644 index 000000000000..ace6be51de18 --- /dev/null +++ b/compute/apiv1/region_network_endpoint_groups_client.go @@ -0,0 +1,380 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionNetworkEndpointGroupsClientHook clientHook + +// RegionNetworkEndpointGroupsCallOptions contains the retry settings for each method of RegionNetworkEndpointGroupsClient. +type RegionNetworkEndpointGroupsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalRegionNetworkEndpointGroupsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionNetworkEndpointGroupsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) + Insert(context.Context, *computepb.InsertRegionNetworkEndpointGroupRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionNetworkEndpointGroupsRequest, ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) +} + +// RegionNetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionNetworkEndpointGroups API. +type RegionNetworkEndpointGroupsClient struct { + // The internal transport-dependent client. + internalClient internalRegionNetworkEndpointGroupsClient + + // The call options for this service. + CallOptions *RegionNetworkEndpointGroupsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionNetworkEndpointGroupsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionNetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionNetworkEndpointGroupsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified network endpoint group. Note that the NEG cannot be deleted if it is configured as a backend of a backend service. +func (c *RegionNetworkEndpointGroupsClient) Delete(ctx context.Context, req *computepb.DeleteRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *RegionNetworkEndpointGroupsClient) Get(ctx context.Context, req *computepb.GetRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *RegionNetworkEndpointGroupsClient) Insert(ctx context.Context, req *computepb.InsertRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of regional network endpoint groups available to the specified project in the given region. +func (c *RegionNetworkEndpointGroupsClient) List(ctx context.Context, req *computepb.ListRegionNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionNetworkEndpointGroupsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionNetworkEndpointGroupsRESTClient creates a new region network endpoint groups rest client. +// +// The RegionNetworkEndpointGroups API. +func NewRegionNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionNetworkEndpointGroupsClient, error) { + clientOpts := append(defaultRegionNetworkEndpointGroupsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionNetworkEndpointGroupsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionNetworkEndpointGroupsClient{internalClient: c, CallOptions: &RegionNetworkEndpointGroupsCallOptions{}}, nil +} + +func defaultRegionNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionNetworkEndpointGroupsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionNetworkEndpointGroupsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionNetworkEndpointGroupsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified network endpoint group. Note that the NEG cannot be deleted if it is configured as a backend of a backend service. +func (c *regionNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups/%v", req.GetProject(), req.GetRegion(), req.GetNetworkEndpointGroup()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +func (c *regionNetworkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups/%v", req.GetProject(), req.GetRegion(), req.GetNetworkEndpointGroup()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroup{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a network endpoint group in the specified project using the parameters that are included in the request. +func (c *regionNetworkEndpointGroupsRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNetworkEndpointGroupResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of regional network endpoint groups available to the specified project in the given region. +func (c *regionNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListRegionNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NetworkEndpointGroupList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_network_endpoint_groups_client_example_test.go b/compute/apiv1/region_network_endpoint_groups_client_example_test.go new file mode 100644 index 000000000000..507dceea9339 --- /dev/null +++ b/compute/apiv1/region_network_endpoint_groups_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionNetworkEndpointGroupsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionNetworkEndpointGroupsClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNetworkEndpointGroupsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNetworkEndpointGroupsClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionNetworkEndpointGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNetworkEndpointGroupsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionNetworkEndpointGroupsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionNetworkEndpointGroupsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_notification_endpoints_client.go b/compute/apiv1/region_notification_endpoints_client.go new file mode 100644 index 000000000000..1ab164842601 --- /dev/null +++ b/compute/apiv1/region_notification_endpoints_client.go @@ -0,0 +1,380 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionNotificationEndpointsClientHook clientHook + +// RegionNotificationEndpointsCallOptions contains the retry settings for each method of RegionNotificationEndpointsClient. +type RegionNotificationEndpointsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalRegionNotificationEndpointsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionNotificationEndpointsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionNotificationEndpointRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionNotificationEndpointRequest, ...gax.CallOption) (*computepb.NotificationEndpoint, error) + Insert(context.Context, *computepb.InsertRegionNotificationEndpointRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionNotificationEndpointsRequest, ...gax.CallOption) (*computepb.NotificationEndpointList, error) +} + +// RegionNotificationEndpointsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionNotificationEndpoints API. +type RegionNotificationEndpointsClient struct { + // The internal transport-dependent client. + internalClient internalRegionNotificationEndpointsClient + + // The call options for this service. + CallOptions *RegionNotificationEndpointsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionNotificationEndpointsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionNotificationEndpointsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionNotificationEndpointsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified NotificationEndpoint in the given region +func (c *RegionNotificationEndpointsClient) Delete(ctx context.Context, req *computepb.DeleteRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified NotificationEndpoint resource in the given region. +func (c *RegionNotificationEndpointsClient) Get(ctx context.Context, req *computepb.GetRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.NotificationEndpoint, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert create a NotificationEndpoint in the specified project in the given region using the parameters that are included in the request. +func (c *RegionNotificationEndpointsClient) Insert(ctx context.Context, req *computepb.InsertRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the NotificationEndpoints for a project in the given region. +func (c *RegionNotificationEndpointsClient) List(ctx context.Context, req *computepb.ListRegionNotificationEndpointsRequest, opts ...gax.CallOption) (*computepb.NotificationEndpointList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionNotificationEndpointsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionNotificationEndpointsRESTClient creates a new region notification endpoints rest client. +// +// The RegionNotificationEndpoints API. +func NewRegionNotificationEndpointsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionNotificationEndpointsClient, error) { + clientOpts := append(defaultRegionNotificationEndpointsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionNotificationEndpointsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionNotificationEndpointsClient{internalClient: c, CallOptions: &RegionNotificationEndpointsCallOptions{}}, nil +} + +func defaultRegionNotificationEndpointsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionNotificationEndpointsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionNotificationEndpointsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionNotificationEndpointsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified NotificationEndpoint in the given region +func (c *regionNotificationEndpointsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints/%v", req.GetProject(), req.GetRegion(), req.GetNotificationEndpoint()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified NotificationEndpoint resource in the given region. +func (c *regionNotificationEndpointsRESTClient) Get(ctx context.Context, req *computepb.GetRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.NotificationEndpoint, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints/%v", req.GetProject(), req.GetRegion(), req.GetNotificationEndpoint()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NotificationEndpoint{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert create a NotificationEndpoint in the specified project in the given region using the parameters that are included in the request. +func (c *regionNotificationEndpointsRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetNotificationEndpointResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists the NotificationEndpoints for a project in the given region. +func (c *regionNotificationEndpointsRESTClient) List(ctx context.Context, req *computepb.ListRegionNotificationEndpointsRequest, opts ...gax.CallOption) (*computepb.NotificationEndpointList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.NotificationEndpointList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_notification_endpoints_client_example_test.go b/compute/apiv1/region_notification_endpoints_client_example_test.go new file mode 100644 index 000000000000..708851924c5e --- /dev/null +++ b/compute/apiv1/region_notification_endpoints_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionNotificationEndpointsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionNotificationEndpointsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionNotificationEndpointsClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionNotificationEndpointsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionNotificationEndpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNotificationEndpointsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionNotificationEndpointsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionNotificationEndpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNotificationEndpointsClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionNotificationEndpointsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionNotificationEndpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionNotificationEndpointsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionNotificationEndpointsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionNotificationEndpointsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_operations_client.go b/compute/apiv1/region_operations_client.go new file mode 100644 index 000000000000..cccff7a0508f --- /dev/null +++ b/compute/apiv1/region_operations_client.go @@ -0,0 +1,377 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionOperationsClientHook clientHook + +// RegionOperationsCallOptions contains the retry settings for each method of RegionOperationsClient. +type RegionOperationsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + List []gax.CallOption + Wait []gax.CallOption +} + +// internalRegionOperationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionOperationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionOperationRequest, ...gax.CallOption) (*computepb.DeleteRegionOperationResponse, error) + Get(context.Context, *computepb.GetRegionOperationRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionOperationsRequest, ...gax.CallOption) (*computepb.OperationList, error) + Wait(context.Context, *computepb.WaitRegionOperationRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionOperationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionOperations API. +type RegionOperationsClient struct { + // The internal transport-dependent client. + internalClient internalRegionOperationsClient + + // The call options for this service. + CallOptions *RegionOperationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionOperationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionOperationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionOperationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified region-specific Operations resource. +func (c *RegionOperationsClient) Delete(ctx context.Context, req *computepb.DeleteRegionOperationRequest, opts ...gax.CallOption) (*computepb.DeleteRegionOperationResponse, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves the specified region-specific Operations resource. +func (c *RegionOperationsClient) Get(ctx context.Context, req *computepb.GetRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of Operation resources contained within the specified region. +func (c *RegionOperationsClient) List(ctx context.Context, req *computepb.ListRegionOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *RegionOperationsClient) Wait(ctx context.Context, req *computepb.WaitRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Wait(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionOperationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionOperationsRESTClient creates a new region operations rest client. +// +// The RegionOperations API. +func NewRegionOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionOperationsClient, error) { + clientOpts := append(defaultRegionOperationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionOperationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionOperationsClient{internalClient: c, CallOptions: &RegionOperationsCallOptions{}}, nil +} + +func defaultRegionOperationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionOperationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionOperationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionOperationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified region-specific Operations resource. +func (c *regionOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionOperationRequest, opts ...gax.CallOption) (*computepb.DeleteRegionOperationResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v", req.GetProject(), req.GetRegion(), req.GetOperation()) + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DeleteRegionOperationResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves the specified region-specific Operations resource. +func (c *regionOperationsRESTClient) Get(ctx context.Context, req *computepb.GetRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v", req.GetProject(), req.GetRegion(), req.GetOperation()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of Operation resources contained within the specified region. +func (c *regionOperationsRESTClient) List(ctx context.Context, req *computepb.ListRegionOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.OperationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *regionOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v/wait", req.GetProject(), req.GetRegion(), req.GetOperation()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_operations_client_example_test.go b/compute/apiv1/region_operations_client_example_test.go new file mode 100644 index 000000000000..75736e6beccb --- /dev/null +++ b/compute/apiv1/region_operations_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionOperationsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionOperationsClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionOperationsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionOperationsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionOperationsClient_Wait() { + ctx := context.Background() + c, err := compute.NewRegionOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.WaitRegionOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Wait(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_ssl_certificates_client.go b/compute/apiv1/region_ssl_certificates_client.go new file mode 100644 index 000000000000..bcf069420d65 --- /dev/null +++ b/compute/apiv1/region_ssl_certificates_client.go @@ -0,0 +1,380 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionSslCertificatesClientHook clientHook + +// RegionSslCertificatesCallOptions contains the retry settings for each method of RegionSslCertificatesClient. +type RegionSslCertificatesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalRegionSslCertificatesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionSslCertificatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionSslCertificateRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionSslCertificateRequest, ...gax.CallOption) (*computepb.SslCertificate, error) + Insert(context.Context, *computepb.InsertRegionSslCertificateRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionSslCertificatesRequest, ...gax.CallOption) (*computepb.SslCertificateList, error) +} + +// RegionSslCertificatesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionSslCertificates API. +type RegionSslCertificatesClient struct { + // The internal transport-dependent client. + internalClient internalRegionSslCertificatesClient + + // The call options for this service. + CallOptions *RegionSslCertificatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionSslCertificatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionSslCertificatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionSslCertificatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified SslCertificate resource in the region. +func (c *RegionSslCertificatesClient) Delete(ctx context.Context, req *computepb.DeleteRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified SslCertificate resource in the specified region. Get a list of available SSL certificates by making a list() request. +func (c *RegionSslCertificatesClient) Get(ctx context.Context, req *computepb.GetRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a SslCertificate resource in the specified project and region using the data included in the request +func (c *RegionSslCertificatesClient) Insert(ctx context.Context, req *computepb.InsertRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of SslCertificate resources available to the specified project in the specified region. +func (c *RegionSslCertificatesClient) List(ctx context.Context, req *computepb.ListRegionSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionSslCertificatesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionSslCertificatesRESTClient creates a new region ssl certificates rest client. +// +// The RegionSslCertificates API. +func NewRegionSslCertificatesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionSslCertificatesClient, error) { + clientOpts := append(defaultRegionSslCertificatesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionSslCertificatesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionSslCertificatesClient{internalClient: c, CallOptions: &RegionSslCertificatesCallOptions{}}, nil +} + +func defaultRegionSslCertificatesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionSslCertificatesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionSslCertificatesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionSslCertificatesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified SslCertificate resource in the region. +func (c *regionSslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates/%v", req.GetProject(), req.GetRegion(), req.GetSslCertificate()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified SslCertificate resource in the specified region. Get a list of available SSL certificates by making a list() request. +func (c *regionSslCertificatesRESTClient) Get(ctx context.Context, req *computepb.GetRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates/%v", req.GetProject(), req.GetRegion(), req.GetSslCertificate()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslCertificate{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a SslCertificate resource in the specified project and region using the data included in the request +func (c *regionSslCertificatesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslCertificateResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of SslCertificate resources available to the specified project in the specified region. +func (c *regionSslCertificatesRESTClient) List(ctx context.Context, req *computepb.ListRegionSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslCertificateList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_ssl_certificates_client_example_test.go b/compute/apiv1/region_ssl_certificates_client_example_test.go new file mode 100644 index 000000000000..016dcb96a149 --- /dev/null +++ b/compute/apiv1/region_ssl_certificates_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionSslCertificatesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionSslCertificatesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionSslCertificatesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionSslCertificatesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionSslCertificatesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionSslCertificatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_target_http_proxies_client.go b/compute/apiv1/region_target_http_proxies_client.go new file mode 100644 index 000000000000..f2a338841e27 --- /dev/null +++ b/compute/apiv1/region_target_http_proxies_client.go @@ -0,0 +1,438 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionTargetHttpProxiesClientHook clientHook + +// RegionTargetHttpProxiesCallOptions contains the retry settings for each method of RegionTargetHttpProxiesClient. +type RegionTargetHttpProxiesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetUrlMap []gax.CallOption +} + +// internalRegionTargetHttpProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionTargetHttpProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionTargetHttpProxyRequest, ...gax.CallOption) (*computepb.TargetHttpProxy, error) + Insert(context.Context, *computepb.InsertRegionTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionTargetHttpProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpProxyList, error) + SetUrlMap(context.Context, *computepb.SetUrlMapRegionTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionTargetHttpProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionTargetHttpProxies API. +type RegionTargetHttpProxiesClient struct { + // The internal transport-dependent client. + internalClient internalRegionTargetHttpProxiesClient + + // The call options for this service. + CallOptions *RegionTargetHttpProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionTargetHttpProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionTargetHttpProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionTargetHttpProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified TargetHttpProxy resource. +func (c *RegionTargetHttpProxiesClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetHttpProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. +func (c *RegionTargetHttpProxiesClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetHttpProxy resource in the specified project and region using the data included in the request. +func (c *RegionTargetHttpProxiesClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetHttpProxy resources available to the specified project in the specified region. +func (c *RegionTargetHttpProxiesClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetUrlMap changes the URL map for TargetHttpProxy. +func (c *RegionTargetHttpProxiesClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetUrlMap(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionTargetHttpProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionTargetHttpProxiesRESTClient creates a new region target http proxies rest client. +// +// The RegionTargetHttpProxies API. +func NewRegionTargetHttpProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionTargetHttpProxiesClient, error) { + clientOpts := append(defaultRegionTargetHttpProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionTargetHttpProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionTargetHttpProxiesClient{internalClient: c, CallOptions: &RegionTargetHttpProxiesCallOptions{}}, nil +} + +func defaultRegionTargetHttpProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionTargetHttpProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionTargetHttpProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionTargetHttpProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified TargetHttpProxy resource. +func (c *regionTargetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetHttpProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. +func (c *regionTargetHttpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetHttpProxy resource in the specified project and region using the data included in the request. +func (c *regionTargetHttpProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetHttpProxy resources available to the specified project in the specified region. +func (c *regionTargetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetUrlMap changes the URL map for TargetHttpProxy. +func (c *regionTargetHttpProxiesRESTClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies/%v/setUrlMap", req.GetProject(), req.GetRegion(), req.GetTargetHttpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_target_http_proxies_client_example_test.go b/compute/apiv1/region_target_http_proxies_client_example_test.go new file mode 100644 index 000000000000..0ccd58f88ce4 --- /dev/null +++ b/compute/apiv1/region_target_http_proxies_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionTargetHttpProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionTargetHttpProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionTargetHttpProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpProxiesClient_SetUrlMap() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetUrlMapRegionTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetUrlMap(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_target_https_proxies_client.go b/compute/apiv1/region_target_https_proxies_client.go new file mode 100644 index 000000000000..af6c5481aa66 --- /dev/null +++ b/compute/apiv1/region_target_https_proxies_client.go @@ -0,0 +1,496 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionTargetHttpsProxiesClientHook clientHook + +// RegionTargetHttpsProxiesCallOptions contains the retry settings for each method of RegionTargetHttpsProxiesClient. +type RegionTargetHttpsProxiesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetSslCertificates []gax.CallOption + SetUrlMap []gax.CallOption +} + +// internalRegionTargetHttpsProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionTargetHttpsProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.TargetHttpsProxy, error) + Insert(context.Context, *computepb.InsertRegionTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionTargetHttpsProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) + SetSslCertificates(context.Context, *computepb.SetSslCertificatesRegionTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetUrlMap(context.Context, *computepb.SetUrlMapRegionTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RegionTargetHttpsProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionTargetHttpsProxies API. +type RegionTargetHttpsProxiesClient struct { + // The internal transport-dependent client. + internalClient internalRegionTargetHttpsProxiesClient + + // The call options for this service. + CallOptions *RegionTargetHttpsProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionTargetHttpsProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionTargetHttpsProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionTargetHttpsProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified TargetHttpsProxy resource. +func (c *RegionTargetHttpsProxiesClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetHttpsProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. +func (c *RegionTargetHttpsProxiesClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetHttpsProxy resource in the specified project and region using the data included in the request. +func (c *RegionTargetHttpsProxiesClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetHttpsProxy resources available to the specified project in the specified region. +func (c *RegionTargetHttpsProxiesClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetSslCertificates replaces SslCertificates for TargetHttpsProxy. +func (c *RegionTargetHttpsProxiesClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSslCertificates(ctx, req, opts...) +} + +// SetUrlMap changes the URL map for TargetHttpsProxy. +func (c *RegionTargetHttpsProxiesClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetUrlMap(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionTargetHttpsProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionTargetHttpsProxiesRESTClient creates a new region target https proxies rest client. +// +// The RegionTargetHttpsProxies API. +func NewRegionTargetHttpsProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionTargetHttpsProxiesClient, error) { + clientOpts := append(defaultRegionTargetHttpsProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionTargetHttpsProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionTargetHttpsProxiesClient{internalClient: c, CallOptions: &RegionTargetHttpsProxiesCallOptions{}}, nil +} + +func defaultRegionTargetHttpsProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionTargetHttpsProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionTargetHttpsProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionTargetHttpsProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified TargetHttpsProxy resource. +func (c *regionTargetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetHttpsProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. +func (c *regionTargetHttpsProxiesRESTClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpsProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetHttpsProxy resource in the specified project and region using the data included in the request. +func (c *regionTargetHttpsProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpsProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetHttpsProxy resources available to the specified project in the specified region. +func (c *regionTargetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpsProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSslCertificates replaces SslCertificates for TargetHttpsProxy. +func (c *regionTargetHttpsProxiesRESTClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionTargetHttpsProxiesSetSslCertificatesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v/setSslCertificates", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetUrlMap changes the URL map for TargetHttpsProxy. +func (c *regionTargetHttpsProxiesRESTClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v/setUrlMap", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_target_https_proxies_client_example_test.go b/compute/apiv1/region_target_https_proxies_client_example_test.go new file mode 100644 index 000000000000..2e5ecb82af5d --- /dev/null +++ b/compute/apiv1/region_target_https_proxies_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionTargetHttpsProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionTargetHttpsProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpsProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpsProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpsProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionTargetHttpsProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpsProxiesClient_SetSslCertificates() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSslCertificatesRegionTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSslCertificates(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionTargetHttpsProxiesClient_SetUrlMap() { + ctx := context.Background() + c, err := compute.NewRegionTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetUrlMapRegionTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetUrlMap(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/region_url_maps_client.go b/compute/apiv1/region_url_maps_client.go new file mode 100644 index 000000000000..732c9c082d21 --- /dev/null +++ b/compute/apiv1/region_url_maps_client.go @@ -0,0 +1,556 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionUrlMapsClientHook clientHook + +// RegionUrlMapsCallOptions contains the retry settings for each method of RegionUrlMapsClient. +type RegionUrlMapsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption + Validate []gax.CallOption +} + +// internalRegionUrlMapsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionUrlMapsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRegionUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRegionUrlMapRequest, ...gax.CallOption) (*computepb.UrlMap, error) + Insert(context.Context, *computepb.InsertRegionUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRegionUrlMapsRequest, ...gax.CallOption) (*computepb.UrlMapList, error) + Patch(context.Context, *computepb.PatchRegionUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateRegionUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Validate(context.Context, *computepb.ValidateRegionUrlMapRequest, ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) +} + +// RegionUrlMapsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The RegionUrlMaps API. +type RegionUrlMapsClient struct { + // The internal transport-dependent client. + internalClient internalRegionUrlMapsClient + + // The call options for this service. + CallOptions *RegionUrlMapsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionUrlMapsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionUrlMapsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionUrlMapsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified UrlMap resource. +func (c *RegionUrlMapsClient) Delete(ctx context.Context, req *computepb.DeleteRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. +func (c *RegionUrlMapsClient) Get(ctx context.Context, req *computepb.GetRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a UrlMap resource in the specified project using the data included in the request. +func (c *RegionUrlMapsClient) Insert(ctx context.Context, req *computepb.InsertRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of UrlMap resources available to the specified project in the specified region. +func (c *RegionUrlMapsClient) List(ctx context.Context, req *computepb.ListRegionUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *RegionUrlMapsClient) Patch(ctx context.Context, req *computepb.PatchRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates the specified UrlMap resource with the data included in the request. +func (c *RegionUrlMapsClient) Update(ctx context.Context, req *computepb.UpdateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. +func (c *RegionUrlMapsClient) Validate(ctx context.Context, req *computepb.ValidateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) { + return c.internalClient.Validate(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionUrlMapsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionUrlMapsRESTClient creates a new region url maps rest client. +// +// The RegionUrlMaps API. +func NewRegionUrlMapsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionUrlMapsClient, error) { + clientOpts := append(defaultRegionUrlMapsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionUrlMapsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionUrlMapsClient{internalClient: c, CallOptions: &RegionUrlMapsCallOptions{}}, nil +} + +func defaultRegionUrlMapsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionUrlMapsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionUrlMapsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionUrlMapsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified UrlMap resource. +func (c *regionUrlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. +func (c *regionUrlMapsRESTClient) Get(ctx context.Context, req *computepb.GetRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMap{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a UrlMap resource in the specified project using the data included in the request. +func (c *regionUrlMapsRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of UrlMap resources available to the specified project in the specified region. +func (c *regionUrlMapsRESTClient) List(ctx context.Context, req *computepb.ListRegionUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMapList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *regionUrlMapsRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified UrlMap resource with the data included in the request. +func (c *regionUrlMapsRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req.GetRegion() != "" { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetUrlMap() != "" { + params.Add("urlMap", fmt.Sprintf("%v", req.GetUrlMap())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. +func (c *regionUrlMapsRESTClient) Validate(ctx context.Context, req *computepb.ValidateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionUrlMapsValidateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v/validate", req.GetProject(), req.GetRegion(), req.GetUrlMap()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMapsValidateResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/region_url_maps_client_example_test.go b/compute/apiv1/region_url_maps_client_example_test.go new file mode 100644 index 000000000000..8a20f7262513 --- /dev/null +++ b/compute/apiv1/region_url_maps_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionUrlMapsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionUrlMapsClient_Delete() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_Insert() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionUrlMapsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_Patch() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_Update() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionUrlMapsClient_Validate() { + ctx := context.Background() + c, err := compute.NewRegionUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ValidateRegionUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Validate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/regions_client.go b/compute/apiv1/regions_client.go new file mode 100644 index 000000000000..9d26c40564b7 --- /dev/null +++ b/compute/apiv1/regions_client.go @@ -0,0 +1,265 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRegionsClientHook clientHook + +// RegionsCallOptions contains the retry settings for each method of RegionsClient. +type RegionsCallOptions struct { + Get []gax.CallOption + List []gax.CallOption +} + +// internalRegionsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRegionsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetRegionRequest, ...gax.CallOption) (*computepb.Region, error) + List(context.Context, *computepb.ListRegionsRequest, ...gax.CallOption) (*computepb.RegionList, error) +} + +// RegionsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Regions API. +type RegionsClient struct { + // The internal transport-dependent client. + internalClient internalRegionsClient + + // The call options for this service. + CallOptions *RegionsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RegionsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RegionsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RegionsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the specified Region resource. Gets a list of available regions by making a list() request. +func (c *RegionsClient) Get(ctx context.Context, req *computepb.GetRegionRequest, opts ...gax.CallOption) (*computepb.Region, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves the list of region resources available to the specified project. +func (c *RegionsClient) List(ctx context.Context, req *computepb.ListRegionsRequest, opts ...gax.CallOption) (*computepb.RegionList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type regionsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRegionsRESTClient creates a new regions rest client. +// +// The Regions API. +func NewRegionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionsClient, error) { + clientOpts := append(defaultRegionsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := ®ionsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RegionsClient{internalClient: c, CallOptions: &RegionsCallOptions{}}, nil +} + +func defaultRegionsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *regionsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *regionsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *regionsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the specified Region resource. Gets a list of available regions by making a list() request. +func (c *regionsRESTClient) Get(ctx context.Context, req *computepb.GetRegionRequest, opts ...gax.CallOption) (*computepb.Region, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v", req.GetProject(), req.GetRegion()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Region{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of region resources available to the specified project. +func (c *regionsRESTClient) List(ctx context.Context, req *computepb.ListRegionsRequest, opts ...gax.CallOption) (*computepb.RegionList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RegionList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/regions_client_example_test.go b/compute/apiv1/regions_client_example_test.go new file mode 100644 index 000000000000..80af1fd0722e --- /dev/null +++ b/compute/apiv1/regions_client_example_test.go @@ -0,0 +1,74 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRegionsRESTClient() { + ctx := context.Background() + c, err := compute.NewRegionsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRegionsClient_Get() { + ctx := context.Background() + c, err := compute.NewRegionsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRegionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRegionsClient_List() { + ctx := context.Background() + c, err := compute.NewRegionsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRegionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/reservations_client.go b/compute/apiv1/reservations_client.go new file mode 100644 index 000000000000..9c3cd718cce9 --- /dev/null +++ b/compute/apiv1/reservations_client.go @@ -0,0 +1,669 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newReservationsClientHook clientHook + +// ReservationsCallOptions contains the retry settings for each method of ReservationsClient. +type ReservationsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Resize []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalReservationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalReservationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListReservationsRequest, ...gax.CallOption) (*computepb.ReservationAggregatedList, error) + Delete(context.Context, *computepb.DeleteReservationRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetReservationRequest, ...gax.CallOption) (*computepb.Reservation, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyReservationRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertReservationRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListReservationsRequest, ...gax.CallOption) (*computepb.ReservationList, error) + Resize(context.Context, *computepb.ResizeReservationRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyReservationRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsReservationRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// ReservationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Reservations API. +type ReservationsClient struct { + // The internal transport-dependent client. + internalClient internalReservationsClient + + // The call options for this service. + CallOptions *ReservationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ReservationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ReservationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ReservationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of reservations. +func (c *ReservationsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified reservation. +func (c *ReservationsClient) Delete(ctx context.Context, req *computepb.DeleteReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves information about the specified reservation. +func (c *ReservationsClient) Get(ctx context.Context, req *computepb.GetReservationRequest, opts ...gax.CallOption) (*computepb.Reservation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *ReservationsClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyReservationRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a new reservation. For more information, read Reserving zonal resources. +func (c *ReservationsClient) Insert(ctx context.Context, req *computepb.InsertReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List a list of all the reservations that have been configured for the specified project in specified zone. +func (c *ReservationsClient) List(ctx context.Context, req *computepb.ListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Resize resizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations. +func (c *ReservationsClient) Resize(ctx context.Context, req *computepb.ResizeReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Resize(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *ReservationsClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyReservationRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *ReservationsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsReservationRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type reservationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewReservationsRESTClient creates a new reservations rest client. +// +// The Reservations API. +func NewReservationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ReservationsClient, error) { + clientOpts := append(defaultReservationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &reservationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ReservationsClient{internalClient: c, CallOptions: &ReservationsCallOptions{}}, nil +} + +func defaultReservationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *reservationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *reservationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *reservationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of reservations. +func (c *reservationsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/reservations", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ReservationAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified reservation. +func (c *reservationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v", req.GetProject(), req.GetZone(), req.GetReservation()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves information about the specified reservation. +func (c *reservationsRESTClient) Get(ctx context.Context, req *computepb.GetReservationRequest, opts ...gax.CallOption) (*computepb.Reservation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v", req.GetProject(), req.GetZone(), req.GetReservation()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Reservation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *reservationsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyReservationRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a new reservation. For more information, read Reserving zonal resources. +func (c *reservationsRESTClient) Insert(ctx context.Context, req *computepb.InsertReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetReservationResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List a list of all the reservations that have been configured for the specified project in specified zone. +func (c *reservationsRESTClient) List(ctx context.Context, req *computepb.ListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ReservationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Resize resizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations. +func (c *reservationsRESTClient) Resize(ctx context.Context, req *computepb.ResizeReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetReservationsResizeRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v/resize", req.GetProject(), req.GetZone(), req.GetReservation()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *reservationsRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyReservationRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetZoneSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v/setIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *reservationsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsReservationRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v/testIamPermissions", req.GetProject(), req.GetZone(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/reservations_client_example_test.go b/compute/apiv1/reservations_client_example_test.go new file mode 100644 index 000000000000..dda54366096e --- /dev/null +++ b/compute/apiv1/reservations_client_example_test.go @@ -0,0 +1,207 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewReservationsRESTClient() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleReservationsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListReservationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_Delete() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_Get() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_Insert() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_List() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListReservationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_Resize() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ResizeReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Resize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleReservationsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewReservationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsReservationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/resource_policies_client.go b/compute/apiv1/resource_policies_client.go new file mode 100644 index 000000000000..4e2b4d862734 --- /dev/null +++ b/compute/apiv1/resource_policies_client.go @@ -0,0 +1,611 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newResourcePoliciesClientHook clientHook + +// ResourcePoliciesCallOptions contains the retry settings for each method of ResourcePoliciesClient. +type ResourcePoliciesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalResourcePoliciesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalResourcePoliciesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListResourcePoliciesRequest, ...gax.CallOption) (*computepb.ResourcePolicyAggregatedList, error) + Delete(context.Context, *computepb.DeleteResourcePolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetResourcePolicyRequest, ...gax.CallOption) (*computepb.ResourcePolicy, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyResourcePolicyRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertResourcePolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListResourcePoliciesRequest, ...gax.CallOption) (*computepb.ResourcePolicyList, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyResourcePolicyRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsResourcePolicyRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// ResourcePoliciesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The ResourcePolicies API. +type ResourcePoliciesClient struct { + // The internal transport-dependent client. + internalClient internalResourcePoliciesClient + + // The call options for this service. + CallOptions *ResourcePoliciesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ResourcePoliciesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ResourcePoliciesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ResourcePoliciesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of resource policies. +func (c *ResourcePoliciesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified resource policy. +func (c *ResourcePoliciesClient) Delete(ctx context.Context, req *computepb.DeleteResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves all information of the specified resource policy. +func (c *ResourcePoliciesClient) Get(ctx context.Context, req *computepb.GetResourcePolicyRequest, opts ...gax.CallOption) (*computepb.ResourcePolicy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *ResourcePoliciesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a new resource policy. +func (c *ResourcePoliciesClient) Insert(ctx context.Context, req *computepb.InsertResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List a list all the resource policies that have been configured for the specified project in specified region. +func (c *ResourcePoliciesClient) List(ctx context.Context, req *computepb.ListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *ResourcePoliciesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *ResourcePoliciesClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsResourcePolicyRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type resourcePoliciesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewResourcePoliciesRESTClient creates a new resource policies rest client. +// +// The ResourcePolicies API. +func NewResourcePoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ResourcePoliciesClient, error) { + clientOpts := append(defaultResourcePoliciesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &resourcePoliciesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ResourcePoliciesClient{internalClient: c, CallOptions: &ResourcePoliciesCallOptions{}}, nil +} + +func defaultResourcePoliciesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *resourcePoliciesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *resourcePoliciesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *resourcePoliciesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of resource policies. +func (c *resourcePoliciesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/resourcePolicies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ResourcePolicyAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified resource policy. +func (c *resourcePoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v", req.GetProject(), req.GetRegion(), req.GetResourcePolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves all information of the specified resource policy. +func (c *resourcePoliciesRESTClient) Get(ctx context.Context, req *computepb.GetResourcePolicyRequest, opts ...gax.CallOption) (*computepb.ResourcePolicy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v", req.GetProject(), req.GetRegion(), req.GetResourcePolicy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ResourcePolicy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *resourcePoliciesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a new resource policy. +func (c *resourcePoliciesRESTClient) Insert(ctx context.Context, req *computepb.InsertResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetResourcePolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List a list all the resource policies that have been configured for the specified project in specified region. +func (c *resourcePoliciesRESTClient) List(ctx context.Context, req *computepb.ListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ResourcePolicyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *resourcePoliciesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v/setIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *resourcePoliciesRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsResourcePolicyRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/resource_policies_client_example_test.go b/compute/apiv1/resource_policies_client_example_test.go new file mode 100644 index 000000000000..361e180ee6ef --- /dev/null +++ b/compute/apiv1/resource_policies_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewResourcePoliciesRESTClient() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleResourcePoliciesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListResourcePoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_Delete() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_Get() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_Insert() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_List() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListResourcePoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleResourcePoliciesClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewResourcePoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsResourcePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/routers_client.go b/compute/apiv1/routers_client.go new file mode 100644 index 000000000000..b454d1707d66 --- /dev/null +++ b/compute/apiv1/routers_client.go @@ -0,0 +1,747 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRoutersClientHook clientHook + +// RoutersCallOptions contains the retry settings for each method of RoutersClient. +type RoutersCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetNatMappingInfo []gax.CallOption + GetRouterStatus []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Preview []gax.CallOption + Update []gax.CallOption +} + +// internalRoutersClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRoutersClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListRoutersRequest, ...gax.CallOption) (*computepb.RouterAggregatedList, error) + Delete(context.Context, *computepb.DeleteRouterRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRouterRequest, ...gax.CallOption) (*computepb.Router, error) + GetNatMappingInfo(context.Context, *computepb.GetNatMappingInfoRoutersRequest, ...gax.CallOption) (*computepb.VmEndpointNatMappingsList, error) + GetRouterStatus(context.Context, *computepb.GetRouterStatusRouterRequest, ...gax.CallOption) (*computepb.RouterStatusResponse, error) + Insert(context.Context, *computepb.InsertRouterRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRoutersRequest, ...gax.CallOption) (*computepb.RouterList, error) + Patch(context.Context, *computepb.PatchRouterRequest, ...gax.CallOption) (*computepb.Operation, error) + Preview(context.Context, *computepb.PreviewRouterRequest, ...gax.CallOption) (*computepb.RoutersPreviewResponse, error) + Update(context.Context, *computepb.UpdateRouterRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// RoutersClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Routers API. +type RoutersClient struct { + // The internal transport-dependent client. + internalClient internalRoutersClient + + // The call options for this service. + CallOptions *RoutersCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RoutersClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RoutersClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RoutersClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of routers. +func (c *RoutersClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified Router resource. +func (c *RoutersClient) Delete(ctx context.Context, req *computepb.DeleteRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified Router resource. Gets a list of available routers by making a list() request. +func (c *RoutersClient) Get(ctx context.Context, req *computepb.GetRouterRequest, opts ...gax.CallOption) (*computepb.Router, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetNatMappingInfo retrieves runtime Nat mapping information of VM endpoints. +func (c *RoutersClient) GetNatMappingInfo(ctx context.Context, req *computepb.GetNatMappingInfoRoutersRequest, opts ...gax.CallOption) (*computepb.VmEndpointNatMappingsList, error) { + return c.internalClient.GetNatMappingInfo(ctx, req, opts...) +} + +// GetRouterStatus retrieves runtime information of the specified router. +func (c *RoutersClient) GetRouterStatus(ctx context.Context, req *computepb.GetRouterStatusRouterRequest, opts ...gax.CallOption) (*computepb.RouterStatusResponse, error) { + return c.internalClient.GetRouterStatus(ctx, req, opts...) +} + +// Insert creates a Router resource in the specified project and region using the data included in the request. +func (c *RoutersClient) Insert(ctx context.Context, req *computepb.InsertRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of Router resources available to the specified project. +func (c *RoutersClient) List(ctx context.Context, req *computepb.ListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *RoutersClient) Patch(ctx context.Context, req *computepb.PatchRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Preview preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router. +func (c *RoutersClient) Preview(ctx context.Context, req *computepb.PreviewRouterRequest, opts ...gax.CallOption) (*computepb.RoutersPreviewResponse, error) { + return c.internalClient.Preview(ctx, req, opts...) +} + +// Update updates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload. +func (c *RoutersClient) Update(ctx context.Context, req *computepb.UpdateRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type routersRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRoutersRESTClient creates a new routers rest client. +// +// The Routers API. +func NewRoutersRESTClient(ctx context.Context, opts ...option.ClientOption) (*RoutersClient, error) { + clientOpts := append(defaultRoutersRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &routersRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RoutersClient{internalClient: c, CallOptions: &RoutersCallOptions{}}, nil +} + +func defaultRoutersRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *routersRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *routersRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *routersRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of routers. +func (c *routersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/routers", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RouterAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified Router resource. +func (c *routersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v", req.GetProject(), req.GetRegion(), req.GetRouter()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified Router resource. Gets a list of available routers by making a list() request. +func (c *routersRESTClient) Get(ctx context.Context, req *computepb.GetRouterRequest, opts ...gax.CallOption) (*computepb.Router, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v", req.GetProject(), req.GetRegion(), req.GetRouter()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Router{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetNatMappingInfo retrieves runtime Nat mapping information of VM endpoints. +func (c *routersRESTClient) GetNatMappingInfo(ctx context.Context, req *computepb.GetNatMappingInfoRoutersRequest, opts ...gax.CallOption) (*computepb.VmEndpointNatMappingsList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v/getNatMappingInfo", req.GetProject(), req.GetRegion(), req.GetRouter()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VmEndpointNatMappingsList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetRouterStatus retrieves runtime information of the specified router. +func (c *routersRESTClient) GetRouterStatus(ctx context.Context, req *computepb.GetRouterStatusRouterRequest, opts ...gax.CallOption) (*computepb.RouterStatusResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v/getRouterStatus", req.GetProject(), req.GetRegion(), req.GetRouter()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RouterStatusResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a Router resource in the specified project and region using the data included in the request. +func (c *routersRESTClient) Insert(ctx context.Context, req *computepb.InsertRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRouterResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of Router resources available to the specified project. +func (c *routersRESTClient) List(ctx context.Context, req *computepb.ListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RouterList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *routersRESTClient) Patch(ctx context.Context, req *computepb.PatchRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRouterResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v", req.GetProject(), req.GetRegion(), req.GetRouter()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Preview preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router. +func (c *routersRESTClient) Preview(ctx context.Context, req *computepb.PreviewRouterRequest, opts ...gax.CallOption) (*computepb.RoutersPreviewResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRouterResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v/preview", req.GetProject(), req.GetRegion(), req.GetRouter()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RoutersPreviewResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload. +func (c *routersRESTClient) Update(ctx context.Context, req *computepb.UpdateRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRouterResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req.GetRegion() != "" { + params.Add("region", fmt.Sprintf("%v", req.GetRegion())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetRouter() != "" { + params.Add("router", fmt.Sprintf("%v", req.GetRouter())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/routers_client_example_test.go b/compute/apiv1/routers_client_example_test.go new file mode 100644 index 000000000000..96553d9bd1da --- /dev/null +++ b/compute/apiv1/routers_client_example_test.go @@ -0,0 +1,226 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRoutersRESTClient() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRoutersClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListRoutersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Delete() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Get() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_GetNatMappingInfo() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetNatMappingInfoRoutersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetNatMappingInfo(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_GetRouterStatus() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRouterStatusRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRouterStatus(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Insert() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_List() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRoutersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Patch() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Preview() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PreviewRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Preview(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutersClient_Update() { + ctx := context.Background() + c, err := compute.NewRoutersRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateRouterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/routes_client.go b/compute/apiv1/routes_client.go new file mode 100644 index 000000000000..cd8f909f21b6 --- /dev/null +++ b/compute/apiv1/routes_client.go @@ -0,0 +1,380 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newRoutesClientHook clientHook + +// RoutesCallOptions contains the retry settings for each method of RoutesClient. +type RoutesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalRoutesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalRoutesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteRouteRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetRouteRequest, ...gax.CallOption) (*computepb.Route, error) + Insert(context.Context, *computepb.InsertRouteRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListRoutesRequest, ...gax.CallOption) (*computepb.RouteList, error) +} + +// RoutesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Routes API. +type RoutesClient struct { + // The internal transport-dependent client. + internalClient internalRoutesClient + + // The call options for this service. + CallOptions *RoutesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *RoutesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *RoutesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *RoutesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified Route resource. +func (c *RoutesClient) Delete(ctx context.Context, req *computepb.DeleteRouteRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified Route resource. Gets a list of available routes by making a list() request. +func (c *RoutesClient) Get(ctx context.Context, req *computepb.GetRouteRequest, opts ...gax.CallOption) (*computepb.Route, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a Route resource in the specified project using the data included in the request. +func (c *RoutesClient) Insert(ctx context.Context, req *computepb.InsertRouteRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of Route resources available to the specified project. +func (c *RoutesClient) List(ctx context.Context, req *computepb.ListRoutesRequest, opts ...gax.CallOption) (*computepb.RouteList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type routesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewRoutesRESTClient creates a new routes rest client. +// +// The Routes API. +func NewRoutesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RoutesClient, error) { + clientOpts := append(defaultRoutesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &routesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &RoutesClient{internalClient: c, CallOptions: &RoutesCallOptions{}}, nil +} + +func defaultRoutesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *routesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *routesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *routesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified Route resource. +func (c *routesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRouteRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes/%v", req.GetProject(), req.GetRoute()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified Route resource. Gets a list of available routes by making a list() request. +func (c *routesRESTClient) Get(ctx context.Context, req *computepb.GetRouteRequest, opts ...gax.CallOption) (*computepb.Route, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes/%v", req.GetProject(), req.GetRoute()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Route{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a Route resource in the specified project using the data included in the request. +func (c *routesRESTClient) Insert(ctx context.Context, req *computepb.InsertRouteRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRouteResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of Route resources available to the specified project. +func (c *routesRESTClient) List(ctx context.Context, req *computepb.ListRoutesRequest, opts ...gax.CallOption) (*computepb.RouteList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.RouteList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/routes_client_example_test.go b/compute/apiv1/routes_client_example_test.go new file mode 100644 index 000000000000..730354784ead --- /dev/null +++ b/compute/apiv1/routes_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewRoutesRESTClient() { + ctx := context.Background() + c, err := compute.NewRoutesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleRoutesClient_Delete() { + ctx := context.Background() + c, err := compute.NewRoutesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteRouteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutesClient_Get() { + ctx := context.Background() + c, err := compute.NewRoutesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRouteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutesClient_Insert() { + ctx := context.Background() + c, err := compute.NewRoutesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertRouteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleRoutesClient_List() { + ctx := context.Background() + c, err := compute.NewRoutesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListRoutesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/security_policies_client.go b/compute/apiv1/security_policies_client.go new file mode 100644 index 000000000000..fceb1652547c --- /dev/null +++ b/compute/apiv1/security_policies_client.go @@ -0,0 +1,730 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newSecurityPoliciesClientHook clientHook + +// SecurityPoliciesCallOptions contains the retry settings for each method of SecurityPoliciesClient. +type SecurityPoliciesCallOptions struct { + AddRule []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetRule []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListPreconfiguredExpressionSets []gax.CallOption + Patch []gax.CallOption + PatchRule []gax.CallOption + RemoveRule []gax.CallOption +} + +// internalSecurityPoliciesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalSecurityPoliciesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddRule(context.Context, *computepb.AddRuleSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Delete(context.Context, *computepb.DeleteSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetSecurityPolicyRequest, ...gax.CallOption) (*computepb.SecurityPolicy, error) + GetRule(context.Context, *computepb.GetRuleSecurityPolicyRequest, ...gax.CallOption) (*computepb.SecurityPolicyRule, error) + Insert(context.Context, *computepb.InsertSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListSecurityPoliciesRequest, ...gax.CallOption) (*computepb.SecurityPolicyList, error) + ListPreconfiguredExpressionSets(context.Context, *computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, ...gax.CallOption) (*computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse, error) + Patch(context.Context, *computepb.PatchSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + PatchRule(context.Context, *computepb.PatchRuleSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + RemoveRule(context.Context, *computepb.RemoveRuleSecurityPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// SecurityPoliciesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The SecurityPolicies API. +type SecurityPoliciesClient struct { + // The internal transport-dependent client. + internalClient internalSecurityPoliciesClient + + // The call options for this service. + CallOptions *SecurityPoliciesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SecurityPoliciesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SecurityPoliciesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SecurityPoliciesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddRule inserts a rule into a security policy. +func (c *SecurityPoliciesClient) AddRule(ctx context.Context, req *computepb.AddRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddRule(ctx, req, opts...) +} + +// Delete deletes the specified policy. +func (c *SecurityPoliciesClient) Delete(ctx context.Context, req *computepb.DeleteSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get list all of the ordered rules present in a single specified policy. +func (c *SecurityPoliciesClient) Get(ctx context.Context, req *computepb.GetSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetRule gets a rule at the specified priority. +func (c *SecurityPoliciesClient) GetRule(ctx context.Context, req *computepb.GetRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyRule, error) { + return c.internalClient.GetRule(ctx, req, opts...) +} + +// Insert creates a new policy in the specified project using the data included in the request. +func (c *SecurityPoliciesClient) Insert(ctx context.Context, req *computepb.InsertSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List list all the policies that have been configured for the specified project. +func (c *SecurityPoliciesClient) List(ctx context.Context, req *computepb.ListSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListPreconfiguredExpressionSets gets the current list of preconfigured Web Application Firewall (WAF) expressions. +func (c *SecurityPoliciesClient) ListPreconfiguredExpressionSets(ctx context.Context, req *computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse, error) { + return c.internalClient.ListPreconfiguredExpressionSets(ctx, req, opts...) +} + +// Patch patches the specified policy with the data included in the request. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead. +func (c *SecurityPoliciesClient) Patch(ctx context.Context, req *computepb.PatchSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// PatchRule patches a rule at the specified priority. +func (c *SecurityPoliciesClient) PatchRule(ctx context.Context, req *computepb.PatchRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.PatchRule(ctx, req, opts...) +} + +// RemoveRule deletes a rule at the specified priority. +func (c *SecurityPoliciesClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveRule(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type securityPoliciesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSecurityPoliciesRESTClient creates a new security policies rest client. +// +// The SecurityPolicies API. +func NewSecurityPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SecurityPoliciesClient, error) { + clientOpts := append(defaultSecurityPoliciesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &securityPoliciesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &SecurityPoliciesClient{internalClient: c, CallOptions: &SecurityPoliciesCallOptions{}}, nil +} + +func defaultSecurityPoliciesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *securityPoliciesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *securityPoliciesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *securityPoliciesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddRule inserts a rule into a security policy. +func (c *securityPoliciesRESTClient) AddRule(ctx context.Context, req *computepb.AddRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSecurityPolicyRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/addRule", req.GetProject(), req.GetSecurityPolicy()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified policy. +func (c *securityPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v", req.GetProject(), req.GetSecurityPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get list all of the ordered rules present in a single specified policy. +func (c *securityPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v", req.GetProject(), req.GetSecurityPolicy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SecurityPolicy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetRule gets a rule at the specified priority. +func (c *securityPoliciesRESTClient) GetRule(ctx context.Context, req *computepb.GetRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyRule, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/getRule", req.GetProject(), req.GetSecurityPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SecurityPolicyRule{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a new policy in the specified project using the data included in the request. +func (c *securityPoliciesRESTClient) Insert(ctx context.Context, req *computepb.InsertSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSecurityPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List list all the policies that have been configured for the specified project. +func (c *securityPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SecurityPolicyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListPreconfiguredExpressionSets gets the current list of preconfigured Web Application Firewall (WAF) expressions. +func (c *securityPoliciesRESTClient) ListPreconfiguredExpressionSets(ctx context.Context, req *computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/listPreconfiguredExpressionSets", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified policy with the data included in the request. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead. +func (c *securityPoliciesRESTClient) Patch(ctx context.Context, req *computepb.PatchSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSecurityPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v", req.GetProject(), req.GetSecurityPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// PatchRule patches a rule at the specified priority. +func (c *securityPoliciesRESTClient) PatchRule(ctx context.Context, req *computepb.PatchRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSecurityPolicyRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/patchRule", req.GetProject(), req.GetSecurityPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveRule deletes a rule at the specified priority. +func (c *securityPoliciesRESTClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/removeRule", req.GetProject(), req.GetSecurityPolicy()) + + params := url.Values{} + if req != nil && req.Priority != nil { + params.Add("priority", fmt.Sprintf("%v", req.GetPriority())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/security_policies_client_example_test.go b/compute/apiv1/security_policies_client_example_test.go new file mode 100644 index 000000000000..65dbeb4fc520 --- /dev/null +++ b/compute/apiv1/security_policies_client_example_test.go @@ -0,0 +1,226 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewSecurityPoliciesRESTClient() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSecurityPoliciesClient_AddRule() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddRuleSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_Delete() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_Get() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_GetRule() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetRuleSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_Insert() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_List() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListSecurityPoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_ListPreconfiguredExpressionSets() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListPreconfiguredExpressionSets(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_Patch() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_PatchRule() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchRuleSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PatchRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSecurityPoliciesClient_RemoveRule() { + ctx := context.Background() + c, err := compute.NewSecurityPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveRuleSecurityPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveRule(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/snapshots_client.go b/compute/apiv1/snapshots_client.go new file mode 100644 index 000000000000..d95bf38a6f81 --- /dev/null +++ b/compute/apiv1/snapshots_client.go @@ -0,0 +1,536 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newSnapshotsClientHook clientHook + +// SnapshotsCallOptions contains the retry settings for each method of SnapshotsClient. +type SnapshotsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + List []gax.CallOption + SetIamPolicy []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalSnapshotsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalSnapshotsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteSnapshotRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetSnapshotRequest, ...gax.CallOption) (*computepb.Snapshot, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicySnapshotRequest, ...gax.CallOption) (*computepb.Policy, error) + List(context.Context, *computepb.ListSnapshotsRequest, ...gax.CallOption) (*computepb.SnapshotList, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicySnapshotRequest, ...gax.CallOption) (*computepb.Policy, error) + SetLabels(context.Context, *computepb.SetLabelsSnapshotRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsSnapshotRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// SnapshotsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Snapshots API. +type SnapshotsClient struct { + // The internal transport-dependent client. + internalClient internalSnapshotsClient + + // The call options for this service. + CallOptions *SnapshotsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SnapshotsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SnapshotsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SnapshotsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. +// +// For more information, see Deleting snapshots. +func (c *SnapshotsClient) Delete(ctx context.Context, req *computepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request. +func (c *SnapshotsClient) Get(ctx context.Context, req *computepb.GetSnapshotRequest, opts ...gax.CallOption) (*computepb.Snapshot, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *SnapshotsClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySnapshotRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// List retrieves the list of Snapshot resources contained within the specified project. +func (c *SnapshotsClient) List(ctx context.Context, req *computepb.ListSnapshotsRequest, opts ...gax.CallOption) (*computepb.SnapshotList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *SnapshotsClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicySnapshotRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetLabels sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation. +func (c *SnapshotsClient) SetLabels(ctx context.Context, req *computepb.SetLabelsSnapshotRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *SnapshotsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsSnapshotRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type snapshotsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSnapshotsRESTClient creates a new snapshots rest client. +// +// The Snapshots API. +func NewSnapshotsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SnapshotsClient, error) { + clientOpts := append(defaultSnapshotsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &snapshotsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &SnapshotsClient{internalClient: c, CallOptions: &SnapshotsCallOptions{}}, nil +} + +func defaultSnapshotsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *snapshotsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *snapshotsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *snapshotsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. +// +// For more information, see Deleting snapshots. +func (c *snapshotsRESTClient) Delete(ctx context.Context, req *computepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v", req.GetProject(), req.GetSnapshot()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request. +func (c *snapshotsRESTClient) Get(ctx context.Context, req *computepb.GetSnapshotRequest, opts ...gax.CallOption) (*computepb.Snapshot, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v", req.GetProject(), req.GetSnapshot()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Snapshot{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *snapshotsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySnapshotRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v/getIamPolicy", req.GetProject(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of Snapshot resources contained within the specified project. +func (c *snapshotsRESTClient) List(ctx context.Context, req *computepb.ListSnapshotsRequest, opts ...gax.CallOption) (*computepb.SnapshotList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SnapshotList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *snapshotsRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicySnapshotRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v/setIamPolicy", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation. +func (c *snapshotsRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsSnapshotRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetGlobalSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v/setLabels", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *snapshotsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsSnapshotRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v/testIamPermissions", req.GetProject(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/snapshots_client_example_test.go b/compute/apiv1/snapshots_client_example_test.go new file mode 100644 index 000000000000..ebdb2d2c3775 --- /dev/null +++ b/compute/apiv1/snapshots_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewSnapshotsRESTClient() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSnapshotsClient_Delete() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_Get() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicySnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_List() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListSnapshotsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicySnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSnapshotsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewSnapshotsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/ssl_certificates_client.go b/compute/apiv1/ssl_certificates_client.go new file mode 100644 index 000000000000..509741ea1e8a --- /dev/null +++ b/compute/apiv1/ssl_certificates_client.go @@ -0,0 +1,452 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newSslCertificatesClientHook clientHook + +// SslCertificatesCallOptions contains the retry settings for each method of SslCertificatesClient. +type SslCertificatesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalSslCertificatesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalSslCertificatesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListSslCertificatesRequest, ...gax.CallOption) (*computepb.SslCertificateAggregatedList, error) + Delete(context.Context, *computepb.DeleteSslCertificateRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetSslCertificateRequest, ...gax.CallOption) (*computepb.SslCertificate, error) + Insert(context.Context, *computepb.InsertSslCertificateRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListSslCertificatesRequest, ...gax.CallOption) (*computepb.SslCertificateList, error) +} + +// SslCertificatesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The SslCertificates API. +type SslCertificatesClient struct { + // The internal transport-dependent client. + internalClient internalSslCertificatesClient + + // The call options for this service. + CallOptions *SslCertificatesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SslCertificatesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SslCertificatesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SslCertificatesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all SslCertificate resources, regional and global, available to the specified project. +func (c *SslCertificatesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified SslCertificate resource. +func (c *SslCertificatesClient) Delete(ctx context.Context, req *computepb.DeleteSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified SslCertificate resource. Gets a list of available SSL certificates by making a list() request. +func (c *SslCertificatesClient) Get(ctx context.Context, req *computepb.GetSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a SslCertificate resource in the specified project using the data included in the request. +func (c *SslCertificatesClient) Insert(ctx context.Context, req *computepb.InsertSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of SslCertificate resources available to the specified project. +func (c *SslCertificatesClient) List(ctx context.Context, req *computepb.ListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type sslCertificatesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSslCertificatesRESTClient creates a new ssl certificates rest client. +// +// The SslCertificates API. +func NewSslCertificatesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SslCertificatesClient, error) { + clientOpts := append(defaultSslCertificatesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &sslCertificatesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &SslCertificatesClient{internalClient: c, CallOptions: &SslCertificatesCallOptions{}}, nil +} + +func defaultSslCertificatesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *sslCertificatesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *sslCertificatesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *sslCertificatesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all SslCertificate resources, regional and global, available to the specified project. +func (c *sslCertificatesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/sslCertificates", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslCertificateAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified SslCertificate resource. +func (c *sslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates/%v", req.GetProject(), req.GetSslCertificate()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified SslCertificate resource. Gets a list of available SSL certificates by making a list() request. +func (c *sslCertificatesRESTClient) Get(ctx context.Context, req *computepb.GetSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates/%v", req.GetProject(), req.GetSslCertificate()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslCertificate{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a SslCertificate resource in the specified project using the data included in the request. +func (c *sslCertificatesRESTClient) Insert(ctx context.Context, req *computepb.InsertSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslCertificateResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of SslCertificate resources available to the specified project. +func (c *sslCertificatesRESTClient) List(ctx context.Context, req *computepb.ListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslCertificateList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/ssl_certificates_client_example_test.go b/compute/apiv1/ssl_certificates_client_example_test.go new file mode 100644 index 000000000000..2859305e6cf5 --- /dev/null +++ b/compute/apiv1/ssl_certificates_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewSslCertificatesRESTClient() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSslCertificatesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListSslCertificatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslCertificatesClient_Delete() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslCertificatesClient_Get() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslCertificatesClient_Insert() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertSslCertificateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslCertificatesClient_List() { + ctx := context.Background() + c, err := compute.NewSslCertificatesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListSslCertificatesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/ssl_policies_client.go b/compute/apiv1/ssl_policies_client.go new file mode 100644 index 000000000000..b3ead7c8b809 --- /dev/null +++ b/compute/apiv1/ssl_policies_client.go @@ -0,0 +1,507 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newSslPoliciesClientHook clientHook + +// SslPoliciesCallOptions contains the retry settings for each method of SslPoliciesClient. +type SslPoliciesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListAvailableFeatures []gax.CallOption + Patch []gax.CallOption +} + +// internalSslPoliciesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalSslPoliciesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteSslPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetSslPolicyRequest, ...gax.CallOption) (*computepb.SslPolicy, error) + Insert(context.Context, *computepb.InsertSslPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListSslPoliciesRequest, ...gax.CallOption) (*computepb.SslPoliciesList, error) + ListAvailableFeatures(context.Context, *computepb.ListAvailableFeaturesSslPoliciesRequest, ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) + Patch(context.Context, *computepb.PatchSslPolicyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// SslPoliciesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The SslPolicies API. +type SslPoliciesClient struct { + // The internal transport-dependent client. + internalClient internalSslPoliciesClient + + // The call options for this service. + CallOptions *SslPoliciesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SslPoliciesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SslPoliciesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SslPoliciesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources. +func (c *SslPoliciesClient) Delete(ctx context.Context, req *computepb.DeleteSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get lists all of the ordered rules present in a single specified policy. +func (c *SslPoliciesClient) Get(ctx context.Context, req *computepb.GetSslPolicyRequest, opts ...gax.CallOption) (*computepb.SslPolicy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert returns the specified SSL policy resource. Gets a list of available SSL policies by making a list() request. +func (c *SslPoliciesClient) Insert(ctx context.Context, req *computepb.InsertSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists all the SSL policies that have been configured for the specified project. +func (c *SslPoliciesClient) List(ctx context.Context, req *computepb.ListSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile. +func (c *SslPoliciesClient) ListAvailableFeatures(ctx context.Context, req *computepb.ListAvailableFeaturesSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) { + return c.internalClient.ListAvailableFeatures(ctx, req, opts...) +} + +// Patch patches the specified SSL policy with the data included in the request. +func (c *SslPoliciesClient) Patch(ctx context.Context, req *computepb.PatchSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type sslPoliciesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSslPoliciesRESTClient creates a new ssl policies rest client. +// +// The SslPolicies API. +func NewSslPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SslPoliciesClient, error) { + clientOpts := append(defaultSslPoliciesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &sslPoliciesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &SslPoliciesClient{internalClient: c, CallOptions: &SslPoliciesCallOptions{}}, nil +} + +func defaultSslPoliciesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *sslPoliciesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *sslPoliciesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *sslPoliciesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources. +func (c *sslPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/%v", req.GetProject(), req.GetSslPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get lists all of the ordered rules present in a single specified policy. +func (c *sslPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetSslPolicyRequest, opts ...gax.CallOption) (*computepb.SslPolicy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/%v", req.GetProject(), req.GetSslPolicy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslPolicy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert returns the specified SSL policy resource. Gets a list of available SSL policies by making a list() request. +func (c *sslPoliciesRESTClient) Insert(ctx context.Context, req *computepb.InsertSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists all the SSL policies that have been configured for the specified project. +func (c *sslPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslPoliciesList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile. +func (c *sslPoliciesRESTClient) ListAvailableFeatures(ctx context.Context, req *computepb.ListAvailableFeaturesSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/listAvailableFeatures", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SslPoliciesListAvailableFeaturesResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified SSL policy with the data included in the request. +func (c *sslPoliciesRESTClient) Patch(ctx context.Context, req *computepb.PatchSslPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslPolicyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/%v", req.GetProject(), req.GetSslPolicy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/ssl_policies_client_example_test.go b/compute/apiv1/ssl_policies_client_example_test.go new file mode 100644 index 000000000000..a74e2832e048 --- /dev/null +++ b/compute/apiv1/ssl_policies_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewSslPoliciesRESTClient() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSslPoliciesClient_Delete() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSslPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslPoliciesClient_Get() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSslPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslPoliciesClient_Insert() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertSslPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslPoliciesClient_List() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListSslPoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslPoliciesClient_ListAvailableFeatures() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListAvailableFeaturesSslPoliciesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListAvailableFeatures(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSslPoliciesClient_Patch() { + ctx := context.Background() + c, err := compute.NewSslPoliciesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchSslPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/subnetworks_client.go b/compute/apiv1/subnetworks_client.go new file mode 100644 index 000000000000..d0bcf696135c --- /dev/null +++ b/compute/apiv1/subnetworks_client.go @@ -0,0 +1,857 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newSubnetworksClientHook clientHook + +// SubnetworksCallOptions contains the retry settings for each method of SubnetworksClient. +type SubnetworksCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + ExpandIpCidrRange []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + ListUsable []gax.CallOption + Patch []gax.CallOption + SetIamPolicy []gax.CallOption + SetPrivateIpGoogleAccess []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalSubnetworksClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalSubnetworksClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListSubnetworksRequest, ...gax.CallOption) (*computepb.SubnetworkAggregatedList, error) + Delete(context.Context, *computepb.DeleteSubnetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + ExpandIpCidrRange(context.Context, *computepb.ExpandIpCidrRangeSubnetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetSubnetworkRequest, ...gax.CallOption) (*computepb.Subnetwork, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicySubnetworkRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertSubnetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListSubnetworksRequest, ...gax.CallOption) (*computepb.SubnetworkList, error) + ListUsable(context.Context, *computepb.ListUsableSubnetworksRequest, ...gax.CallOption) (*computepb.UsableSubnetworksAggregatedList, error) + Patch(context.Context, *computepb.PatchSubnetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicySubnetworkRequest, ...gax.CallOption) (*computepb.Policy, error) + SetPrivateIpGoogleAccess(context.Context, *computepb.SetPrivateIpGoogleAccessSubnetworkRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsSubnetworkRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// SubnetworksClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Subnetworks API. +type SubnetworksClient struct { + // The internal transport-dependent client. + internalClient internalSubnetworksClient + + // The call options for this service. + CallOptions *SubnetworksCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SubnetworksClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SubnetworksClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SubnetworksClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of subnetworks. +func (c *SubnetworksClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified subnetwork. +func (c *SubnetworksClient) Delete(ctx context.Context, req *computepb.DeleteSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// ExpandIpCidrRange expands the IP CIDR range of the subnetwork to a specified value. +func (c *SubnetworksClient) ExpandIpCidrRange(ctx context.Context, req *computepb.ExpandIpCidrRangeSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.ExpandIpCidrRange(ctx, req, opts...) +} + +// Get returns the specified subnetwork. Gets a list of available subnetworks list() request. +func (c *SubnetworksClient) Get(ctx context.Context, req *computepb.GetSubnetworkRequest, opts ...gax.CallOption) (*computepb.Subnetwork, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *SubnetworksClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySubnetworkRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a subnetwork in the specified project using the data included in the request. +func (c *SubnetworksClient) Insert(ctx context.Context, req *computepb.InsertSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of subnetworks available to the specified project. +func (c *SubnetworksClient) List(ctx context.Context, req *computepb.ListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// ListUsable retrieves an aggregated list of all usable subnetworks in the project. +func (c *SubnetworksClient) ListUsable(ctx context.Context, req *computepb.ListUsableSubnetworksRequest, opts ...gax.CallOption) (*computepb.UsableSubnetworksAggregatedList, error) { + return c.internalClient.ListUsable(ctx, req, opts...) +} + +// Patch patches the specified subnetwork with the data included in the request. Only certain fields can be updated with a patch request as indicated in the field descriptions. You must specify the current fingerprint of the subnetwork resource being patched. +func (c *SubnetworksClient) Patch(ctx context.Context, req *computepb.PatchSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *SubnetworksClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicySubnetworkRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// SetPrivateIpGoogleAccess set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access. +func (c *SubnetworksClient) SetPrivateIpGoogleAccess(ctx context.Context, req *computepb.SetPrivateIpGoogleAccessSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetPrivateIpGoogleAccess(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *SubnetworksClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsSubnetworkRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type subnetworksRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSubnetworksRESTClient creates a new subnetworks rest client. +// +// The Subnetworks API. +func NewSubnetworksRESTClient(ctx context.Context, opts ...option.ClientOption) (*SubnetworksClient, error) { + clientOpts := append(defaultSubnetworksRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &subnetworksRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &SubnetworksClient{internalClient: c, CallOptions: &SubnetworksCallOptions{}}, nil +} + +func defaultSubnetworksRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *subnetworksRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *subnetworksRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *subnetworksRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of subnetworks. +func (c *subnetworksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/subnetworks", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SubnetworkAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified subnetwork. +func (c *subnetworksRESTClient) Delete(ctx context.Context, req *computepb.DeleteSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ExpandIpCidrRange expands the IP CIDR range of the subnetwork to a specified value. +func (c *subnetworksRESTClient) ExpandIpCidrRange(ctx context.Context, req *computepb.ExpandIpCidrRangeSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSubnetworksExpandIpCidrRangeRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/expandIpCidrRange", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified subnetwork. Gets a list of available subnetworks list() request. +func (c *subnetworksRESTClient) Get(ctx context.Context, req *computepb.GetSubnetworkRequest, opts ...gax.CallOption) (*computepb.Subnetwork, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Subnetwork{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *subnetworksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySubnetworkRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.OptionsRequestedPolicyVersion != nil { + params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a subnetwork in the specified project using the data included in the request. +func (c *subnetworksRESTClient) Insert(ctx context.Context, req *computepb.InsertSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSubnetworkResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of subnetworks available to the specified project. +func (c *subnetworksRESTClient) List(ctx context.Context, req *computepb.ListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SubnetworkList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// ListUsable retrieves an aggregated list of all usable subnetworks in the project. +func (c *subnetworksRESTClient) ListUsable(ctx context.Context, req *computepb.ListUsableSubnetworksRequest, opts ...gax.CallOption) (*computepb.UsableSubnetworksAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/subnetworks/listUsable", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UsableSubnetworksAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified subnetwork with the data included in the request. Only certain fields can be updated with a patch request as indicated in the field descriptions. You must specify the current fingerprint of the subnetwork resource being patched. +func (c *subnetworksRESTClient) Patch(ctx context.Context, req *computepb.PatchSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSubnetworkResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) + + params := url.Values{} + if req != nil && req.DrainTimeoutSeconds != nil { + params.Add("drainTimeoutSeconds", fmt.Sprintf("%v", req.GetDrainTimeoutSeconds())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *subnetworksRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicySubnetworkRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetPolicyRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/setIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetPrivateIpGoogleAccess set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access. +func (c *subnetworksRESTClient) SetPrivateIpGoogleAccess(ctx context.Context, req *computepb.SetPrivateIpGoogleAccessSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSubnetworksSetPrivateIpGoogleAccessRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/setPrivateIpGoogleAccess", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *subnetworksRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsSubnetworkRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/subnetworks_client_example_test.go b/compute/apiv1/subnetworks_client_example_test.go new file mode 100644 index 000000000000..c561c8311df8 --- /dev/null +++ b/compute/apiv1/subnetworks_client_example_test.go @@ -0,0 +1,264 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewSubnetworksRESTClient() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSubnetworksClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListSubnetworksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_Delete() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_ExpandIpCidrRange() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ExpandIpCidrRangeSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ExpandIpCidrRange(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_Get() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicySubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_Insert() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_List() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListSubnetworksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_ListUsable() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListUsableSubnetworksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListUsable(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_Patch() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicySubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_SetPrivateIpGoogleAccess() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetPrivateIpGoogleAccessSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetPrivateIpGoogleAccess(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubnetworksClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewSubnetworksRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsSubnetworkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_grpc_proxies_client.go b/compute/apiv1/target_grpc_proxies_client.go new file mode 100644 index 000000000000..da17c2d17f9a --- /dev/null +++ b/compute/apiv1/target_grpc_proxies_client.go @@ -0,0 +1,438 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetGrpcProxiesClientHook clientHook + +// TargetGrpcProxiesCallOptions contains the retry settings for each method of TargetGrpcProxiesClient. +type TargetGrpcProxiesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption +} + +// internalTargetGrpcProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetGrpcProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteTargetGrpcProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetGrpcProxyRequest, ...gax.CallOption) (*computepb.TargetGrpcProxy, error) + Insert(context.Context, *computepb.InsertTargetGrpcProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetGrpcProxiesRequest, ...gax.CallOption) (*computepb.TargetGrpcProxyList, error) + Patch(context.Context, *computepb.PatchTargetGrpcProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetGrpcProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetGrpcProxies API. +type TargetGrpcProxiesClient struct { + // The internal transport-dependent client. + internalClient internalTargetGrpcProxiesClient + + // The call options for this service. + CallOptions *TargetGrpcProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetGrpcProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetGrpcProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetGrpcProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified TargetGrpcProxy in the given scope +func (c *TargetGrpcProxiesClient) Delete(ctx context.Context, req *computepb.DeleteTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetGrpcProxy resource in the given scope. +func (c *TargetGrpcProxiesClient) Get(ctx context.Context, req *computepb.GetTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetGrpcProxy in the specified project in the given scope using the parameters that are included in the request. +func (c *TargetGrpcProxiesClient) Insert(ctx context.Context, req *computepb.InsertTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the TargetGrpcProxies for a project in the given scope. +func (c *TargetGrpcProxiesClient) List(ctx context.Context, req *computepb.ListTargetGrpcProxiesRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *TargetGrpcProxiesClient) Patch(ctx context.Context, req *computepb.PatchTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetGrpcProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetGrpcProxiesRESTClient creates a new target grpc proxies rest client. +// +// The TargetGrpcProxies API. +func NewTargetGrpcProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetGrpcProxiesClient, error) { + clientOpts := append(defaultTargetGrpcProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetGrpcProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetGrpcProxiesClient{internalClient: c, CallOptions: &TargetGrpcProxiesCallOptions{}}, nil +} + +func defaultTargetGrpcProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetGrpcProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetGrpcProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetGrpcProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified TargetGrpcProxy in the given scope +func (c *targetGrpcProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies/%v", req.GetProject(), req.GetTargetGrpcProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetGrpcProxy resource in the given scope. +func (c *targetGrpcProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies/%v", req.GetProject(), req.GetTargetGrpcProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetGrpcProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetGrpcProxy in the specified project in the given scope using the parameters that are included in the request. +func (c *targetGrpcProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetGrpcProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List lists the TargetGrpcProxies for a project in the given scope. +func (c *targetGrpcProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetGrpcProxiesRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetGrpcProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *targetGrpcProxiesRESTClient) Patch(ctx context.Context, req *computepb.PatchTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetGrpcProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies/%v", req.GetProject(), req.GetTargetGrpcProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_grpc_proxies_client_example_test.go b/compute/apiv1/target_grpc_proxies_client_example_test.go new file mode 100644 index 000000000000..b1fdef199714 --- /dev/null +++ b/compute/apiv1/target_grpc_proxies_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetGrpcProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetGrpcProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetGrpcProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetGrpcProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetGrpcProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetGrpcProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetGrpcProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetGrpcProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetGrpcProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetGrpcProxiesClient_Patch() { + ctx := context.Background() + c, err := compute.NewTargetGrpcProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchTargetGrpcProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_http_proxies_client.go b/compute/apiv1/target_http_proxies_client.go new file mode 100644 index 000000000000..a7dea19c74e7 --- /dev/null +++ b/compute/apiv1/target_http_proxies_client.go @@ -0,0 +1,568 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetHttpProxiesClientHook clientHook + +// TargetHttpProxiesCallOptions contains the retry settings for each method of TargetHttpProxiesClient. +type TargetHttpProxiesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetUrlMap []gax.CallOption +} + +// internalTargetHttpProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetHttpProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListTargetHttpProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpProxyAggregatedList, error) + Delete(context.Context, *computepb.DeleteTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetHttpProxyRequest, ...gax.CallOption) (*computepb.TargetHttpProxy, error) + Insert(context.Context, *computepb.InsertTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetHttpProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpProxyList, error) + Patch(context.Context, *computepb.PatchTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetUrlMap(context.Context, *computepb.SetUrlMapTargetHttpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetHttpProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetHttpProxies API. +type TargetHttpProxiesClient struct { + // The internal transport-dependent client. + internalClient internalTargetHttpProxiesClient + + // The call options for this service. + CallOptions *TargetHttpProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetHttpProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetHttpProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetHttpProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all TargetHttpProxy resources, regional and global, available to the specified project. +func (c *TargetHttpProxiesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified TargetHttpProxy resource. +func (c *TargetHttpProxiesClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by making a list() request. +func (c *TargetHttpProxiesClient) Get(ctx context.Context, req *computepb.GetTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetHttpProxy resource in the specified project using the data included in the request. +func (c *TargetHttpProxiesClient) Insert(ctx context.Context, req *computepb.InsertTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetHttpProxy resources available to the specified project. +func (c *TargetHttpProxiesClient) List(ctx context.Context, req *computepb.ListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified TargetHttpProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. (== suppress_warning http-rest-shadowed ==) +func (c *TargetHttpProxiesClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetUrlMap changes the URL map for TargetHttpProxy. +func (c *TargetHttpProxiesClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetUrlMap(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetHttpProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetHttpProxiesRESTClient creates a new target http proxies rest client. +// +// The TargetHttpProxies API. +func NewTargetHttpProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetHttpProxiesClient, error) { + clientOpts := append(defaultTargetHttpProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetHttpProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetHttpProxiesClient{internalClient: c, CallOptions: &TargetHttpProxiesCallOptions{}}, nil +} + +func defaultTargetHttpProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetHttpProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetHttpProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetHttpProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all TargetHttpProxy resources, regional and global, available to the specified project. +func (c *targetHttpProxiesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetHttpProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpProxyAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified TargetHttpProxy resource. +func (c *targetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies/%v", req.GetProject(), req.GetTargetHttpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by making a list() request. +func (c *targetHttpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies/%v", req.GetProject(), req.GetTargetHttpProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetHttpProxy resource in the specified project using the data included in the request. +func (c *targetHttpProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetHttpProxy resources available to the specified project. +func (c *targetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified TargetHttpProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. (== suppress_warning http-rest-shadowed ==) +func (c *targetHttpProxiesRESTClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies/%v", req.GetProject(), req.GetTargetHttpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetUrlMap changes the URL map for TargetHttpProxy. +func (c *targetHttpProxiesRESTClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/targetHttpProxies/%v/setUrlMap", req.GetProject(), req.GetTargetHttpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_http_proxies_client_example_test.go b/compute/apiv1/target_http_proxies_client_example_test.go new file mode 100644 index 000000000000..07d31ff9562b --- /dev/null +++ b/compute/apiv1/target_http_proxies_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetHttpProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetHttpProxiesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListTargetHttpProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetHttpProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_Patch() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpProxiesClient_SetUrlMap() { + ctx := context.Background() + c, err := compute.NewTargetHttpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetUrlMapTargetHttpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetUrlMap(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_https_proxies_client.go b/compute/apiv1/target_https_proxies_client.go new file mode 100644 index 000000000000..c2af2689ab42 --- /dev/null +++ b/compute/apiv1/target_https_proxies_client.go @@ -0,0 +1,742 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetHttpsProxiesClientHook clientHook + +// TargetHttpsProxiesCallOptions contains the retry settings for each method of TargetHttpsProxiesClient. +type TargetHttpsProxiesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetQuicOverride []gax.CallOption + SetSslCertificates []gax.CallOption + SetSslPolicy []gax.CallOption + SetUrlMap []gax.CallOption +} + +// internalTargetHttpsProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetHttpsProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListTargetHttpsProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpsProxyAggregatedList, error) + Delete(context.Context, *computepb.DeleteTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.TargetHttpsProxy, error) + Insert(context.Context, *computepb.InsertTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetHttpsProxiesRequest, ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) + Patch(context.Context, *computepb.PatchTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetQuicOverride(context.Context, *computepb.SetQuicOverrideTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetSslCertificates(context.Context, *computepb.SetSslCertificatesTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetSslPolicy(context.Context, *computepb.SetSslPolicyTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetUrlMap(context.Context, *computepb.SetUrlMapTargetHttpsProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetHttpsProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetHttpsProxies API. +type TargetHttpsProxiesClient struct { + // The internal transport-dependent client. + internalClient internalTargetHttpsProxiesClient + + // The call options for this service. + CallOptions *TargetHttpsProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetHttpsProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetHttpsProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetHttpsProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all TargetHttpsProxy resources, regional and global, available to the specified project. +func (c *TargetHttpsProxiesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified TargetHttpsProxy resource. +func (c *TargetHttpsProxiesClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies by making a list() request. +func (c *TargetHttpsProxiesClient) Get(ctx context.Context, req *computepb.GetTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetHttpsProxy resource in the specified project using the data included in the request. +func (c *TargetHttpsProxiesClient) Insert(ctx context.Context, req *computepb.InsertTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetHttpsProxy resources available to the specified project. +func (c *TargetHttpsProxiesClient) List(ctx context.Context, req *computepb.ListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. (== suppress_warning http-rest-shadowed ==) +func (c *TargetHttpsProxiesClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// SetQuicOverride sets the QUIC override policy for TargetHttpsProxy. +func (c *TargetHttpsProxiesClient) SetQuicOverride(ctx context.Context, req *computepb.SetQuicOverrideTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetQuicOverride(ctx, req, opts...) +} + +// SetSslCertificates replaces SslCertificates for TargetHttpsProxy. +func (c *TargetHttpsProxiesClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSslCertificates(ctx, req, opts...) +} + +// SetSslPolicy sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the HTTPS proxy load balancer. They do not affect the connection between the load balancer and the backends. +func (c *TargetHttpsProxiesClient) SetSslPolicy(ctx context.Context, req *computepb.SetSslPolicyTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSslPolicy(ctx, req, opts...) +} + +// SetUrlMap changes the URL map for TargetHttpsProxy. +func (c *TargetHttpsProxiesClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetUrlMap(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetHttpsProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetHttpsProxiesRESTClient creates a new target https proxies rest client. +// +// The TargetHttpsProxies API. +func NewTargetHttpsProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetHttpsProxiesClient, error) { + clientOpts := append(defaultTargetHttpsProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetHttpsProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetHttpsProxiesClient{internalClient: c, CallOptions: &TargetHttpsProxiesCallOptions{}}, nil +} + +func defaultTargetHttpsProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetHttpsProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetHttpsProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetHttpsProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all TargetHttpsProxy resources, regional and global, available to the specified project. +func (c *targetHttpsProxiesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetHttpsProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpsProxyAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified TargetHttpsProxy resource. +func (c *targetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies by making a list() request. +func (c *targetHttpsProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v", req.GetProject(), req.GetTargetHttpsProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpsProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetHttpsProxy resource in the specified project using the data included in the request. +func (c *targetHttpsProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpsProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetHttpsProxy resources available to the specified project. +func (c *targetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetHttpsProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. (== suppress_warning http-rest-shadowed ==) +func (c *targetHttpsProxiesRESTClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpsProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetQuicOverride sets the QUIC override policy for TargetHttpsProxy. +func (c *targetHttpsProxiesRESTClient) SetQuicOverride(ctx context.Context, req *computepb.SetQuicOverrideTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpsProxiesSetQuicOverrideRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v/setQuicOverride", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSslCertificates replaces SslCertificates for TargetHttpsProxy. +func (c *targetHttpsProxiesRESTClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetHttpsProxiesSetSslCertificatesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/targetHttpsProxies/%v/setSslCertificates", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSslPolicy sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the HTTPS proxy load balancer. They do not affect the connection between the load balancer and the backends. +func (c *targetHttpsProxiesRESTClient) SetSslPolicy(ctx context.Context, req *computepb.SetSslPolicyTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslPolicyReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v/setSslPolicy", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetUrlMap changes the URL map for TargetHttpsProxy. +func (c *targetHttpsProxiesRESTClient) SetUrlMap(ctx context.Context, req *computepb.SetUrlMapTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/targetHttpsProxies/%v/setUrlMap", req.GetProject(), req.GetTargetHttpsProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_https_proxies_client_example_test.go b/compute/apiv1/target_https_proxies_client_example_test.go new file mode 100644 index 000000000000..3430ce2206fd --- /dev/null +++ b/compute/apiv1/target_https_proxies_client_example_test.go @@ -0,0 +1,226 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetHttpsProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetHttpsProxiesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListTargetHttpsProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetHttpsProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_Patch() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_SetQuicOverride() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetQuicOverrideTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetQuicOverride(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_SetSslCertificates() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSslCertificatesTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSslCertificates(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_SetSslPolicy() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSslPolicyTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSslPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetHttpsProxiesClient_SetUrlMap() { + ctx := context.Background() + c, err := compute.NewTargetHttpsProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetUrlMapTargetHttpsProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetUrlMap(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_instances_client.go b/compute/apiv1/target_instances_client.go new file mode 100644 index 000000000000..25b0514dc64e --- /dev/null +++ b/compute/apiv1/target_instances_client.go @@ -0,0 +1,452 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetInstancesClientHook clientHook + +// TargetInstancesCallOptions contains the retry settings for each method of TargetInstancesClient. +type TargetInstancesCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalTargetInstancesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetInstancesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListTargetInstancesRequest, ...gax.CallOption) (*computepb.TargetInstanceAggregatedList, error) + Delete(context.Context, *computepb.DeleteTargetInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetInstanceRequest, ...gax.CallOption) (*computepb.TargetInstance, error) + Insert(context.Context, *computepb.InsertTargetInstanceRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetInstancesRequest, ...gax.CallOption) (*computepb.TargetInstanceList, error) +} + +// TargetInstancesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetInstances API. +type TargetInstancesClient struct { + // The internal transport-dependent client. + internalClient internalTargetInstancesClient + + // The call options for this service. + CallOptions *TargetInstancesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetInstancesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetInstancesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetInstancesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of target instances. +func (c *TargetInstancesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified TargetInstance resource. +func (c *TargetInstancesClient) Delete(ctx context.Context, req *computepb.DeleteTargetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetInstance resource. Gets a list of available target instances by making a list() request. +func (c *TargetInstancesClient) Get(ctx context.Context, req *computepb.GetTargetInstanceRequest, opts ...gax.CallOption) (*computepb.TargetInstance, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetInstance resource in the specified project and zone using the data included in the request. +func (c *TargetInstancesClient) Insert(ctx context.Context, req *computepb.InsertTargetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of TargetInstance resources available to the specified project and zone. +func (c *TargetInstancesClient) List(ctx context.Context, req *computepb.ListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetInstancesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetInstancesRESTClient creates a new target instances rest client. +// +// The TargetInstances API. +func NewTargetInstancesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetInstancesClient, error) { + clientOpts := append(defaultTargetInstancesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetInstancesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetInstancesClient{internalClient: c, CallOptions: &TargetInstancesCallOptions{}}, nil +} + +func defaultTargetInstancesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetInstancesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetInstancesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetInstancesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of target instances. +func (c *targetInstancesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetInstances", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetInstanceAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified TargetInstance resource. +func (c *targetInstancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances/%v", req.GetProject(), req.GetZone(), req.GetTargetInstance()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetInstance resource. Gets a list of available target instances by making a list() request. +func (c *targetInstancesRESTClient) Get(ctx context.Context, req *computepb.GetTargetInstanceRequest, opts ...gax.CallOption) (*computepb.TargetInstance, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances/%v", req.GetProject(), req.GetZone(), req.GetTargetInstance()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetInstance{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetInstance resource in the specified project and zone using the data included in the request. +func (c *targetInstancesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetInstanceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of TargetInstance resources available to the specified project and zone. +func (c *targetInstancesRESTClient) List(ctx context.Context, req *computepb.ListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetInstanceList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_instances_client_example_test.go b/compute/apiv1/target_instances_client_example_test.go new file mode 100644 index 000000000000..de3679b30762 --- /dev/null +++ b/compute/apiv1/target_instances_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetInstancesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetInstancesClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListTargetInstancesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetInstancesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetInstancesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetInstancesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetInstancesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetInstancesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_pools_client.go b/compute/apiv1/target_pools_client.go new file mode 100644 index 000000000000..f05abeca64d9 --- /dev/null +++ b/compute/apiv1/target_pools_client.go @@ -0,0 +1,796 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetPoolsClientHook clientHook + +// TargetPoolsCallOptions contains the retry settings for each method of TargetPoolsClient. +type TargetPoolsCallOptions struct { + AddHealthCheck []gax.CallOption + AddInstance []gax.CallOption + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetHealth []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + RemoveHealthCheck []gax.CallOption + RemoveInstance []gax.CallOption + SetBackup []gax.CallOption +} + +// internalTargetPoolsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetPoolsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AddHealthCheck(context.Context, *computepb.AddHealthCheckTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + AddInstance(context.Context, *computepb.AddInstanceTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + AggregatedList(context.Context, *computepb.AggregatedListTargetPoolsRequest, ...gax.CallOption) (*computepb.TargetPoolAggregatedList, error) + Delete(context.Context, *computepb.DeleteTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetPoolRequest, ...gax.CallOption) (*computepb.TargetPool, error) + GetHealth(context.Context, *computepb.GetHealthTargetPoolRequest, ...gax.CallOption) (*computepb.TargetPoolInstanceHealth, error) + Insert(context.Context, *computepb.InsertTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetPoolsRequest, ...gax.CallOption) (*computepb.TargetPoolList, error) + RemoveHealthCheck(context.Context, *computepb.RemoveHealthCheckTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + RemoveInstance(context.Context, *computepb.RemoveInstanceTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) + SetBackup(context.Context, *computepb.SetBackupTargetPoolRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetPoolsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetPools API. +type TargetPoolsClient struct { + // The internal transport-dependent client. + internalClient internalTargetPoolsClient + + // The call options for this service. + CallOptions *TargetPoolsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetPoolsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetPoolsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetPoolsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AddHealthCheck adds health check URLs to a target pool. +func (c *TargetPoolsClient) AddHealthCheck(ctx context.Context, req *computepb.AddHealthCheckTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddHealthCheck(ctx, req, opts...) +} + +// AddInstance adds an instance to a target pool. +func (c *TargetPoolsClient) AddInstance(ctx context.Context, req *computepb.AddInstanceTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.AddInstance(ctx, req, opts...) +} + +// AggregatedList retrieves an aggregated list of target pools. +func (c *TargetPoolsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified target pool. +func (c *TargetPoolsClient) Delete(ctx context.Context, req *computepb.DeleteTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified target pool. Gets a list of available target pools by making a list() request. +func (c *TargetPoolsClient) Get(ctx context.Context, req *computepb.GetTargetPoolRequest, opts ...gax.CallOption) (*computepb.TargetPool, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetHealth gets the most recent health check results for each IP for the instance that is referenced by the given target pool. +func (c *TargetPoolsClient) GetHealth(ctx context.Context, req *computepb.GetHealthTargetPoolRequest, opts ...gax.CallOption) (*computepb.TargetPoolInstanceHealth, error) { + return c.internalClient.GetHealth(ctx, req, opts...) +} + +// Insert creates a target pool in the specified project and region using the data included in the request. +func (c *TargetPoolsClient) Insert(ctx context.Context, req *computepb.InsertTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of target pools available to the specified project and region. +func (c *TargetPoolsClient) List(ctx context.Context, req *computepb.ListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// RemoveHealthCheck removes health check URL from a target pool. +func (c *TargetPoolsClient) RemoveHealthCheck(ctx context.Context, req *computepb.RemoveHealthCheckTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveHealthCheck(ctx, req, opts...) +} + +// RemoveInstance removes instance URL from a target pool. +func (c *TargetPoolsClient) RemoveInstance(ctx context.Context, req *computepb.RemoveInstanceTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.RemoveInstance(ctx, req, opts...) +} + +// SetBackup changes a backup target pool’s configurations. +func (c *TargetPoolsClient) SetBackup(ctx context.Context, req *computepb.SetBackupTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetBackup(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetPoolsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetPoolsRESTClient creates a new target pools rest client. +// +// The TargetPools API. +func NewTargetPoolsRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetPoolsClient, error) { + clientOpts := append(defaultTargetPoolsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetPoolsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetPoolsClient{internalClient: c, CallOptions: &TargetPoolsCallOptions{}}, nil +} + +func defaultTargetPoolsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetPoolsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetPoolsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetPoolsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AddHealthCheck adds health check URLs to a target pool. +func (c *targetPoolsRESTClient) AddHealthCheck(ctx context.Context, req *computepb.AddHealthCheckTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetPoolsAddHealthCheckRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/addHealthCheck", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AddInstance adds an instance to a target pool. +func (c *targetPoolsRESTClient) AddInstance(ctx context.Context, req *computepb.AddInstanceTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetPoolsAddInstanceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/addInstance", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// AggregatedList retrieves an aggregated list of target pools. +func (c *targetPoolsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetPools", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetPoolAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified target pool. +func (c *targetPoolsRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified target pool. Gets a list of available target pools by making a list() request. +func (c *targetPoolsRESTClient) Get(ctx context.Context, req *computepb.GetTargetPoolRequest, opts ...gax.CallOption) (*computepb.TargetPool, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetPool{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetHealth gets the most recent health check results for each IP for the instance that is referenced by the given target pool. +func (c *targetPoolsRESTClient) GetHealth(ctx context.Context, req *computepb.GetHealthTargetPoolRequest, opts ...gax.CallOption) (*computepb.TargetPoolInstanceHealth, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetInstanceReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/getHealth", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetPoolInstanceHealth{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a target pool in the specified project and region using the data included in the request. +func (c *targetPoolsRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetPoolResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of target pools available to the specified project and region. +func (c *targetPoolsRESTClient) List(ctx context.Context, req *computepb.ListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetPoolList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveHealthCheck removes health check URL from a target pool. +func (c *targetPoolsRESTClient) RemoveHealthCheck(ctx context.Context, req *computepb.RemoveHealthCheckTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetPoolsRemoveHealthCheckRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/removeHealthCheck", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// RemoveInstance removes instance URL from a target pool. +func (c *targetPoolsRESTClient) RemoveInstance(ctx context.Context, req *computepb.RemoveInstanceTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetPoolsRemoveInstanceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/removeInstance", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetBackup changes a backup target pool’s configurations. +func (c *targetPoolsRESTClient) SetBackup(ctx context.Context, req *computepb.SetBackupTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v/setBackup", req.GetProject(), req.GetRegion(), req.GetTargetPool()) + + params := url.Values{} + if req != nil && req.FailoverRatio != nil { + params.Add("failoverRatio", fmt.Sprintf("%v", req.GetFailoverRatio())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_pools_client_example_test.go b/compute/apiv1/target_pools_client_example_test.go new file mode 100644 index 000000000000..480016f09ebd --- /dev/null +++ b/compute/apiv1/target_pools_client_example_test.go @@ -0,0 +1,245 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetPoolsRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetPoolsClient_AddHealthCheck() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddHealthCheckTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddHealthCheck(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_AddInstance() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AddInstanceTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AddInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListTargetPoolsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_GetHealth() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetHealthTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetHealth(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_List() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetPoolsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_RemoveHealthCheck() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveHealthCheckTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveHealthCheck(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_RemoveInstance() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.RemoveInstanceTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RemoveInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetPoolsClient_SetBackup() { + ctx := context.Background() + c, err := compute.NewTargetPoolsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetBackupTargetPoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_ssl_proxies_client.go b/compute/apiv1/target_ssl_proxies_client.go new file mode 100644 index 000000000000..bbbd9dc73647 --- /dev/null +++ b/compute/apiv1/target_ssl_proxies_client.go @@ -0,0 +1,612 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetSslProxiesClientHook clientHook + +// TargetSslProxiesCallOptions contains the retry settings for each method of TargetSslProxiesClient. +type TargetSslProxiesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetBackendService []gax.CallOption + SetProxyHeader []gax.CallOption + SetSslCertificates []gax.CallOption + SetSslPolicy []gax.CallOption +} + +// internalTargetSslProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetSslProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetSslProxyRequest, ...gax.CallOption) (*computepb.TargetSslProxy, error) + Insert(context.Context, *computepb.InsertTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetSslProxiesRequest, ...gax.CallOption) (*computepb.TargetSslProxyList, error) + SetBackendService(context.Context, *computepb.SetBackendServiceTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetProxyHeader(context.Context, *computepb.SetProxyHeaderTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetSslCertificates(context.Context, *computepb.SetSslCertificatesTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetSslPolicy(context.Context, *computepb.SetSslPolicyTargetSslProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetSslProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetSslProxies API. +type TargetSslProxiesClient struct { + // The internal transport-dependent client. + internalClient internalTargetSslProxiesClient + + // The call options for this service. + CallOptions *TargetSslProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetSslProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetSslProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetSslProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified TargetSslProxy resource. +func (c *TargetSslProxiesClient) Delete(ctx context.Context, req *computepb.DeleteTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by making a list() request. +func (c *TargetSslProxiesClient) Get(ctx context.Context, req *computepb.GetTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.TargetSslProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetSslProxy resource in the specified project using the data included in the request. +func (c *TargetSslProxiesClient) Insert(ctx context.Context, req *computepb.InsertTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetSslProxy resources available to the specified project. +func (c *TargetSslProxiesClient) List(ctx context.Context, req *computepb.ListTargetSslProxiesRequest, opts ...gax.CallOption) (*computepb.TargetSslProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetBackendService changes the BackendService for TargetSslProxy. +func (c *TargetSslProxiesClient) SetBackendService(ctx context.Context, req *computepb.SetBackendServiceTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetBackendService(ctx, req, opts...) +} + +// SetProxyHeader changes the ProxyHeaderType for TargetSslProxy. +func (c *TargetSslProxiesClient) SetProxyHeader(ctx context.Context, req *computepb.SetProxyHeaderTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetProxyHeader(ctx, req, opts...) +} + +// SetSslCertificates changes SslCertificates for TargetSslProxy. +func (c *TargetSslProxiesClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSslCertificates(ctx, req, opts...) +} + +// SetSslPolicy sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the SSL proxy load balancer. They do not affect the connection between the load balancer and the backends. +func (c *TargetSslProxiesClient) SetSslPolicy(ctx context.Context, req *computepb.SetSslPolicyTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetSslPolicy(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetSslProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetSslProxiesRESTClient creates a new target ssl proxies rest client. +// +// The TargetSslProxies API. +func NewTargetSslProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetSslProxiesClient, error) { + clientOpts := append(defaultTargetSslProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetSslProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetSslProxiesClient{internalClient: c, CallOptions: &TargetSslProxiesCallOptions{}}, nil +} + +func defaultTargetSslProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetSslProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetSslProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetSslProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified TargetSslProxy resource. +func (c *targetSslProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v", req.GetProject(), req.GetTargetSslProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by making a list() request. +func (c *targetSslProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.TargetSslProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v", req.GetProject(), req.GetTargetSslProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetSslProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetSslProxy resource in the specified project using the data included in the request. +func (c *targetSslProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetSslProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetSslProxy resources available to the specified project. +func (c *targetSslProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetSslProxiesRequest, opts ...gax.CallOption) (*computepb.TargetSslProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetSslProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetBackendService changes the BackendService for TargetSslProxy. +func (c *targetSslProxiesRESTClient) SetBackendService(ctx context.Context, req *computepb.SetBackendServiceTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetSslProxiesSetBackendServiceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v/setBackendService", req.GetProject(), req.GetTargetSslProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetProxyHeader changes the ProxyHeaderType for TargetSslProxy. +func (c *targetSslProxiesRESTClient) SetProxyHeader(ctx context.Context, req *computepb.SetProxyHeaderTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetSslProxiesSetProxyHeaderRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v/setProxyHeader", req.GetProject(), req.GetTargetSslProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSslCertificates changes SslCertificates for TargetSslProxy. +func (c *targetSslProxiesRESTClient) SetSslCertificates(ctx context.Context, req *computepb.SetSslCertificatesTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetSslProxiesSetSslCertificatesRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v/setSslCertificates", req.GetProject(), req.GetTargetSslProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetSslPolicy sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the SSL proxy load balancer. They do not affect the connection between the load balancer and the backends. +func (c *targetSslProxiesRESTClient) SetSslPolicy(ctx context.Context, req *computepb.SetSslPolicyTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetSslPolicyReferenceResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v/setSslPolicy", req.GetProject(), req.GetTargetSslProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_ssl_proxies_client_example_test.go b/compute/apiv1/target_ssl_proxies_client_example_test.go new file mode 100644 index 000000000000..09db740716cd --- /dev/null +++ b/compute/apiv1/target_ssl_proxies_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetSslProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetSslProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetSslProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_SetBackendService() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetBackendServiceTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetBackendService(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_SetProxyHeader() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetProxyHeaderTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetProxyHeader(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_SetSslCertificates() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSslCertificatesTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSslCertificates(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetSslProxiesClient_SetSslPolicy() { + ctx := context.Background() + c, err := compute.NewTargetSslProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetSslPolicyTargetSslProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetSslPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_tcp_proxies_client.go b/compute/apiv1/target_tcp_proxies_client.go new file mode 100644 index 000000000000..f2631211628d --- /dev/null +++ b/compute/apiv1/target_tcp_proxies_client.go @@ -0,0 +1,496 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetTcpProxiesClientHook clientHook + +// TargetTcpProxiesCallOptions contains the retry settings for each method of TargetTcpProxiesClient. +type TargetTcpProxiesCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetBackendService []gax.CallOption + SetProxyHeader []gax.CallOption +} + +// internalTargetTcpProxiesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetTcpProxiesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteTargetTcpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetTcpProxyRequest, ...gax.CallOption) (*computepb.TargetTcpProxy, error) + Insert(context.Context, *computepb.InsertTargetTcpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetTcpProxiesRequest, ...gax.CallOption) (*computepb.TargetTcpProxyList, error) + SetBackendService(context.Context, *computepb.SetBackendServiceTargetTcpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) + SetProxyHeader(context.Context, *computepb.SetProxyHeaderTargetTcpProxyRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// TargetTcpProxiesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetTcpProxies API. +type TargetTcpProxiesClient struct { + // The internal transport-dependent client. + internalClient internalTargetTcpProxiesClient + + // The call options for this service. + CallOptions *TargetTcpProxiesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetTcpProxiesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetTcpProxiesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetTcpProxiesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified TargetTcpProxy resource. +func (c *TargetTcpProxiesClient) Delete(ctx context.Context, req *computepb.DeleteTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by making a list() request. +func (c *TargetTcpProxiesClient) Get(ctx context.Context, req *computepb.GetTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxy, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a TargetTcpProxy resource in the specified project using the data included in the request. +func (c *TargetTcpProxiesClient) Insert(ctx context.Context, req *computepb.InsertTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves the list of TargetTcpProxy resources available to the specified project. +func (c *TargetTcpProxiesClient) List(ctx context.Context, req *computepb.ListTargetTcpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxyList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetBackendService changes the BackendService for TargetTcpProxy. +func (c *TargetTcpProxiesClient) SetBackendService(ctx context.Context, req *computepb.SetBackendServiceTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetBackendService(ctx, req, opts...) +} + +// SetProxyHeader changes the ProxyHeaderType for TargetTcpProxy. +func (c *TargetTcpProxiesClient) SetProxyHeader(ctx context.Context, req *computepb.SetProxyHeaderTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetProxyHeader(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetTcpProxiesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetTcpProxiesRESTClient creates a new target tcp proxies rest client. +// +// The TargetTcpProxies API. +func NewTargetTcpProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetTcpProxiesClient, error) { + clientOpts := append(defaultTargetTcpProxiesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetTcpProxiesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetTcpProxiesClient{internalClient: c, CallOptions: &TargetTcpProxiesCallOptions{}}, nil +} + +func defaultTargetTcpProxiesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetTcpProxiesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetTcpProxiesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetTcpProxiesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified TargetTcpProxy resource. +func (c *targetTcpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v", req.GetProject(), req.GetTargetTcpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by making a list() request. +func (c *targetTcpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxy, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v", req.GetProject(), req.GetTargetTcpProxy()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetTcpProxy{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a TargetTcpProxy resource in the specified project using the data included in the request. +func (c *targetTcpProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetTcpProxyResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of TargetTcpProxy resources available to the specified project. +func (c *targetTcpProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetTcpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxyList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetTcpProxyList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetBackendService changes the BackendService for TargetTcpProxy. +func (c *targetTcpProxiesRESTClient) SetBackendService(ctx context.Context, req *computepb.SetBackendServiceTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetTcpProxiesSetBackendServiceRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v/setBackendService", req.GetProject(), req.GetTargetTcpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetProxyHeader changes the ProxyHeaderType for TargetTcpProxy. +func (c *targetTcpProxiesRESTClient) SetProxyHeader(ctx context.Context, req *computepb.SetProxyHeaderTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetTcpProxiesSetProxyHeaderRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v/setProxyHeader", req.GetProject(), req.GetTargetTcpProxy()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_tcp_proxies_client_example_test.go b/compute/apiv1/target_tcp_proxies_client_example_test.go new file mode 100644 index 000000000000..0e95e1f74eb6 --- /dev/null +++ b/compute/apiv1/target_tcp_proxies_client_example_test.go @@ -0,0 +1,150 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetTcpProxiesRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetTcpProxiesClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetTcpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetTcpProxiesClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetTcpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetTcpProxiesClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetTcpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetTcpProxiesClient_List() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetTcpProxiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetTcpProxiesClient_SetBackendService() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetBackendServiceTargetTcpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetBackendService(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetTcpProxiesClient_SetProxyHeader() { + ctx := context.Background() + c, err := compute.NewTargetTcpProxiesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetProxyHeaderTargetTcpProxyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetProxyHeader(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/target_vpn_gateways_client.go b/compute/apiv1/target_vpn_gateways_client.go new file mode 100644 index 000000000000..996e785297fc --- /dev/null +++ b/compute/apiv1/target_vpn_gateways_client.go @@ -0,0 +1,452 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newTargetVpnGatewaysClientHook clientHook + +// TargetVpnGatewaysCallOptions contains the retry settings for each method of TargetVpnGatewaysClient. +type TargetVpnGatewaysCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalTargetVpnGatewaysClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalTargetVpnGatewaysClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListTargetVpnGatewaysRequest, ...gax.CallOption) (*computepb.TargetVpnGatewayAggregatedList, error) + Delete(context.Context, *computepb.DeleteTargetVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetTargetVpnGatewayRequest, ...gax.CallOption) (*computepb.TargetVpnGateway, error) + Insert(context.Context, *computepb.InsertTargetVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListTargetVpnGatewaysRequest, ...gax.CallOption) (*computepb.TargetVpnGatewayList, error) +} + +// TargetVpnGatewaysClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The TargetVpnGateways API. +type TargetVpnGatewaysClient struct { + // The internal transport-dependent client. + internalClient internalTargetVpnGatewaysClient + + // The call options for this service. + CallOptions *TargetVpnGatewaysCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *TargetVpnGatewaysClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *TargetVpnGatewaysClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *TargetVpnGatewaysClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of target VPN gateways. +func (c *TargetVpnGatewaysClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified target VPN gateway. +func (c *TargetVpnGatewaysClient) Delete(ctx context.Context, req *computepb.DeleteTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified target VPN gateway. Gets a list of available target VPN gateways by making a list() request. +func (c *TargetVpnGatewaysClient) Get(ctx context.Context, req *computepb.GetTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TargetVpnGateway, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a target VPN gateway in the specified project and region using the data included in the request. +func (c *TargetVpnGatewaysClient) Insert(ctx context.Context, req *computepb.InsertTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of target VPN gateways available to the specified project and region. +func (c *TargetVpnGatewaysClient) List(ctx context.Context, req *computepb.ListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type targetVpnGatewaysRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewTargetVpnGatewaysRESTClient creates a new target vpn gateways rest client. +// +// The TargetVpnGateways API. +func NewTargetVpnGatewaysRESTClient(ctx context.Context, opts ...option.ClientOption) (*TargetVpnGatewaysClient, error) { + clientOpts := append(defaultTargetVpnGatewaysRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &targetVpnGatewaysRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &TargetVpnGatewaysClient{internalClient: c, CallOptions: &TargetVpnGatewaysCallOptions{}}, nil +} + +func defaultTargetVpnGatewaysRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *targetVpnGatewaysRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *targetVpnGatewaysRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *targetVpnGatewaysRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of target VPN gateways. +func (c *targetVpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetVpnGateways", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetVpnGatewayAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified target VPN gateway. +func (c *targetVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetTargetVpnGateway()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified target VPN gateway. Gets a list of available target VPN gateways by making a list() request. +func (c *targetVpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TargetVpnGateway, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetTargetVpnGateway()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetVpnGateway{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a target VPN gateway in the specified project and region using the data included in the request. +func (c *targetVpnGatewaysRESTClient) Insert(ctx context.Context, req *computepb.InsertTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTargetVpnGatewayResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of target VPN gateways available to the specified project and region. +func (c *targetVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TargetVpnGatewayList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/target_vpn_gateways_client_example_test.go b/compute/apiv1/target_vpn_gateways_client_example_test.go new file mode 100644 index 000000000000..1c8e35cd6069 --- /dev/null +++ b/compute/apiv1/target_vpn_gateways_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewTargetVpnGatewaysRESTClient() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleTargetVpnGatewaysClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListTargetVpnGatewaysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetVpnGatewaysClient_Delete() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteTargetVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetVpnGatewaysClient_Get() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetTargetVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetVpnGatewaysClient_Insert() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertTargetVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleTargetVpnGatewaysClient_List() { + ctx := context.Background() + c, err := compute.NewTargetVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListTargetVpnGatewaysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/url_maps_client.go b/compute/apiv1/url_maps_client.go new file mode 100644 index 000000000000..798e93645d93 --- /dev/null +++ b/compute/apiv1/url_maps_client.go @@ -0,0 +1,687 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newUrlMapsClientHook clientHook + +// UrlMapsCallOptions contains the retry settings for each method of UrlMapsClient. +type UrlMapsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + InvalidateCache []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + Update []gax.CallOption + Validate []gax.CallOption +} + +// internalUrlMapsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalUrlMapsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListUrlMapsRequest, ...gax.CallOption) (*computepb.UrlMapsAggregatedList, error) + Delete(context.Context, *computepb.DeleteUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetUrlMapRequest, ...gax.CallOption) (*computepb.UrlMap, error) + Insert(context.Context, *computepb.InsertUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + InvalidateCache(context.Context, *computepb.InvalidateCacheUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListUrlMapsRequest, ...gax.CallOption) (*computepb.UrlMapList, error) + Patch(context.Context, *computepb.PatchUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Update(context.Context, *computepb.UpdateUrlMapRequest, ...gax.CallOption) (*computepb.Operation, error) + Validate(context.Context, *computepb.ValidateUrlMapRequest, ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) +} + +// UrlMapsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The UrlMaps API. +type UrlMapsClient struct { + // The internal transport-dependent client. + internalClient internalUrlMapsClient + + // The call options for this service. + CallOptions *UrlMapsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *UrlMapsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *UrlMapsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *UrlMapsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all UrlMap resources, regional and global, available to the specified project. +func (c *UrlMapsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapsAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified UrlMap resource. +func (c *UrlMapsClient) Delete(ctx context.Context, req *computepb.DeleteUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. +func (c *UrlMapsClient) Get(ctx context.Context, req *computepb.GetUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a UrlMap resource in the specified project using the data included in the request. +func (c *UrlMapsClient) Insert(ctx context.Context, req *computepb.InsertUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// InvalidateCache initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. +// +// For more information, see Invalidating cached content (at /cdn/docs/invalidating-cached-content). +func (c *UrlMapsClient) InvalidateCache(ctx context.Context, req *computepb.InvalidateCacheUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.InvalidateCache(ctx, req, opts...) +} + +// List retrieves the list of UrlMap resources available to the specified project. +func (c *UrlMapsClient) List(ctx context.Context, req *computepb.ListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *UrlMapsClient) Patch(ctx context.Context, req *computepb.PatchUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Patch(ctx, req, opts...) +} + +// Update updates the specified UrlMap resource with the data included in the request. +func (c *UrlMapsClient) Update(ctx context.Context, req *computepb.UpdateUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Update(ctx, req, opts...) +} + +// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. +func (c *UrlMapsClient) Validate(ctx context.Context, req *computepb.ValidateUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) { + return c.internalClient.Validate(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type urlMapsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewUrlMapsRESTClient creates a new url maps rest client. +// +// The UrlMaps API. +func NewUrlMapsRESTClient(ctx context.Context, opts ...option.ClientOption) (*UrlMapsClient, error) { + clientOpts := append(defaultUrlMapsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &urlMapsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &UrlMapsClient{internalClient: c, CallOptions: &UrlMapsCallOptions{}}, nil +} + +func defaultUrlMapsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *urlMapsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *urlMapsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *urlMapsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all UrlMap resources, regional and global, available to the specified project. +func (c *urlMapsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapsAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/urlMaps", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMapsAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified UrlMap resource. +func (c *urlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v", req.GetProject(), req.GetUrlMap()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. +func (c *urlMapsRESTClient) Get(ctx context.Context, req *computepb.GetUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v", req.GetProject(), req.GetUrlMap()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMap{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a UrlMap resource in the specified project using the data included in the request. +func (c *urlMapsRESTClient) Insert(ctx context.Context, req *computepb.InsertUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps", req.GetProject()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// InvalidateCache initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. +// +// For more information, see Invalidating cached content (at /cdn/docs/invalidating-cached-content). +func (c *urlMapsRESTClient) InvalidateCache(ctx context.Context, req *computepb.InvalidateCacheUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetCacheInvalidationRuleResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v/invalidateCache", req.GetProject(), req.GetUrlMap()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of UrlMap resources available to the specified project. +func (c *urlMapsRESTClient) List(ctx context.Context, req *computepb.ListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMapList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +func (c *urlMapsRESTClient) Patch(ctx context.Context, req *computepb.PatchUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v", req.GetProject(), req.GetUrlMap()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Update updates the specified UrlMap resource with the data included in the request. +func (c *urlMapsRESTClient) Update(ctx context.Context, req *computepb.UpdateUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("") + + params := url.Values{} + if req.GetProject() != "" { + params.Add("project", fmt.Sprintf("%v", req.GetProject())) + } + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + if req.GetUrlMap() != "" { + params.Add("urlMap", fmt.Sprintf("%v", req.GetUrlMap())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. +func (c *urlMapsRESTClient) Validate(ctx context.Context, req *computepb.ValidateUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetUrlMapsValidateRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v/validate", req.GetProject(), req.GetUrlMap()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.UrlMapsValidateResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/url_maps_client_example_test.go b/compute/apiv1/url_maps_client_example_test.go new file mode 100644 index 000000000000..d6f8304d1e70 --- /dev/null +++ b/compute/apiv1/url_maps_client_example_test.go @@ -0,0 +1,207 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewUrlMapsRESTClient() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleUrlMapsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListUrlMapsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Delete() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Get() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Insert() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_InvalidateCache() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InvalidateCacheUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.InvalidateCache(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_List() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListUrlMapsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Patch() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Update() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.UpdateUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Update(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUrlMapsClient_Validate() { + ctx := context.Background() + c, err := compute.NewUrlMapsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ValidateUrlMapRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Validate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/vpn_gateways_client.go b/compute/apiv1/vpn_gateways_client.go new file mode 100644 index 000000000000..80eb318a484b --- /dev/null +++ b/compute/apiv1/vpn_gateways_client.go @@ -0,0 +1,611 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newVpnGatewaysClientHook clientHook + +// VpnGatewaysCallOptions contains the retry settings for each method of VpnGatewaysClient. +type VpnGatewaysCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetStatus []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + SetLabels []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalVpnGatewaysClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalVpnGatewaysClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListVpnGatewaysRequest, ...gax.CallOption) (*computepb.VpnGatewayAggregatedList, error) + Delete(context.Context, *computepb.DeleteVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetVpnGatewayRequest, ...gax.CallOption) (*computepb.VpnGateway, error) + GetStatus(context.Context, *computepb.GetStatusVpnGatewayRequest, ...gax.CallOption) (*computepb.VpnGatewaysGetStatusResponse, error) + Insert(context.Context, *computepb.InsertVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListVpnGatewaysRequest, ...gax.CallOption) (*computepb.VpnGatewayList, error) + SetLabels(context.Context, *computepb.SetLabelsVpnGatewayRequest, ...gax.CallOption) (*computepb.Operation, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsVpnGatewayRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// VpnGatewaysClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The VpnGateways API. +type VpnGatewaysClient struct { + // The internal transport-dependent client. + internalClient internalVpnGatewaysClient + + // The call options for this service. + CallOptions *VpnGatewaysCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *VpnGatewaysClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *VpnGatewaysClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *VpnGatewaysClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of VPN gateways. +func (c *VpnGatewaysClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified VPN gateway. +func (c *VpnGatewaysClient) Delete(ctx context.Context, req *computepb.DeleteVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified VPN gateway. Gets a list of available VPN gateways by making a list() request. +func (c *VpnGatewaysClient) Get(ctx context.Context, req *computepb.GetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGateway, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// GetStatus returns the status for the specified VPN gateway. +func (c *VpnGatewaysClient) GetStatus(ctx context.Context, req *computepb.GetStatusVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGatewaysGetStatusResponse, error) { + return c.internalClient.GetStatus(ctx, req, opts...) +} + +// Insert creates a VPN gateway in the specified project and region using the data included in the request. +func (c *VpnGatewaysClient) Insert(ctx context.Context, req *computepb.InsertVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of VPN gateways available to the specified project and region. +func (c *VpnGatewaysClient) List(ctx context.Context, req *computepb.ListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// SetLabels sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation. +func (c *VpnGatewaysClient) SetLabels(ctx context.Context, req *computepb.SetLabelsVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.SetLabels(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *VpnGatewaysClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type vpnGatewaysRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewVpnGatewaysRESTClient creates a new vpn gateways rest client. +// +// The VpnGateways API. +func NewVpnGatewaysRESTClient(ctx context.Context, opts ...option.ClientOption) (*VpnGatewaysClient, error) { + clientOpts := append(defaultVpnGatewaysRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &vpnGatewaysRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &VpnGatewaysClient{internalClient: c, CallOptions: &VpnGatewaysCallOptions{}}, nil +} + +func defaultVpnGatewaysRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *vpnGatewaysRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *vpnGatewaysRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *vpnGatewaysRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of VPN gateways. +func (c *vpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/vpnGateways", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnGatewayAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified VPN gateway. +func (c *vpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified VPN gateway. Gets a list of available VPN gateways by making a list() request. +func (c *vpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGateway, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnGateway{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// GetStatus returns the status for the specified VPN gateway. +func (c *vpnGatewaysRESTClient) GetStatus(ctx context.Context, req *computepb.GetStatusVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGatewaysGetStatusResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v/getStatus", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnGatewaysGetStatusResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a VPN gateway in the specified project and region using the data included in the request. +func (c *vpnGatewaysRESTClient) Insert(ctx context.Context, req *computepb.InsertVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetVpnGatewayResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of VPN gateways available to the specified project and region. +func (c *vpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnGatewayList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// SetLabels sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation. +func (c *vpnGatewaysRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetRegionSetLabelsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *vpnGatewaysRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetTestPermissionsRequestResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v/testIamPermissions", req.GetProject(), req.GetRegion(), req.GetResource()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/vpn_gateways_client_example_test.go b/compute/apiv1/vpn_gateways_client_example_test.go new file mode 100644 index 000000000000..74b8ecf2f1a9 --- /dev/null +++ b/compute/apiv1/vpn_gateways_client_example_test.go @@ -0,0 +1,188 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewVpnGatewaysRESTClient() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleVpnGatewaysClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListVpnGatewaysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_Delete() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_Get() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_GetStatus() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetStatusVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetStatus(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_Insert() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_List() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListVpnGatewaysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_SetLabels() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetLabelsVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnGatewaysClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewVpnGatewaysRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsVpnGatewayRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/vpn_tunnels_client.go b/compute/apiv1/vpn_tunnels_client.go new file mode 100644 index 000000000000..718d75406b2d --- /dev/null +++ b/compute/apiv1/vpn_tunnels_client.go @@ -0,0 +1,452 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newVpnTunnelsClientHook clientHook + +// VpnTunnelsCallOptions contains the retry settings for each method of VpnTunnelsClient. +type VpnTunnelsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption +} + +// internalVpnTunnelsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalVpnTunnelsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListVpnTunnelsRequest, ...gax.CallOption) (*computepb.VpnTunnelAggregatedList, error) + Delete(context.Context, *computepb.DeleteVpnTunnelRequest, ...gax.CallOption) (*computepb.Operation, error) + Get(context.Context, *computepb.GetVpnTunnelRequest, ...gax.CallOption) (*computepb.VpnTunnel, error) + Insert(context.Context, *computepb.InsertVpnTunnelRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListVpnTunnelsRequest, ...gax.CallOption) (*computepb.VpnTunnelList, error) +} + +// VpnTunnelsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The VpnTunnels API. +type VpnTunnelsClient struct { + // The internal transport-dependent client. + internalClient internalVpnTunnelsClient + + // The call options for this service. + CallOptions *VpnTunnelsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *VpnTunnelsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *VpnTunnelsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *VpnTunnelsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves an aggregated list of VPN tunnels. +func (c *VpnTunnelsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelAggregatedList, error) { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified VpnTunnel resource. +func (c *VpnTunnelsClient) Delete(ctx context.Context, req *computepb.DeleteVpnTunnelRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. +func (c *VpnTunnelsClient) Get(ctx context.Context, req *computepb.GetVpnTunnelRequest, opts ...gax.CallOption) (*computepb.VpnTunnel, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Insert creates a VpnTunnel resource in the specified project and region using the data included in the request. +func (c *VpnTunnelsClient) Insert(ctx context.Context, req *computepb.InsertVpnTunnelRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List retrieves a list of VpnTunnel resources contained in the specified project and region. +func (c *VpnTunnelsClient) List(ctx context.Context, req *computepb.ListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type vpnTunnelsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewVpnTunnelsRESTClient creates a new vpn tunnels rest client. +// +// The VpnTunnels API. +func NewVpnTunnelsRESTClient(ctx context.Context, opts ...option.ClientOption) (*VpnTunnelsClient, error) { + clientOpts := append(defaultVpnTunnelsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &vpnTunnelsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &VpnTunnelsClient{internalClient: c, CallOptions: &VpnTunnelsCallOptions{}}, nil +} + +func defaultVpnTunnelsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *vpnTunnelsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *vpnTunnelsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *vpnTunnelsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves an aggregated list of VPN tunnels. +func (c *vpnTunnelsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelAggregatedList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/vpnTunnels", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.IncludeAllScopes != nil { + params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnTunnelAggregatedList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Delete deletes the specified VpnTunnel resource. +func (c *vpnTunnelsRESTClient) Delete(ctx context.Context, req *computepb.DeleteVpnTunnelRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels/%v", req.GetProject(), req.GetRegion(), req.GetVpnTunnel()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. +func (c *vpnTunnelsRESTClient) Get(ctx context.Context, req *computepb.GetVpnTunnelRequest, opts ...gax.CallOption) (*computepb.VpnTunnel, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels/%v", req.GetProject(), req.GetRegion(), req.GetVpnTunnel()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnTunnel{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Insert creates a VpnTunnel resource in the specified project and region using the data included in the request. +func (c *vpnTunnelsRESTClient) Insert(ctx context.Context, req *computepb.InsertVpnTunnelRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + body := req.GetVpnTunnelResource() + jsonReq, err := m.Marshal(body) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.RequestId != nil { + params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of VpnTunnel resources contained in the specified project and region. +func (c *vpnTunnelsRESTClient) List(ctx context.Context, req *computepb.ListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels", req.GetProject(), req.GetRegion()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.VpnTunnelList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/vpn_tunnels_client_example_test.go b/compute/apiv1/vpn_tunnels_client_example_test.go new file mode 100644 index 000000000000..d5354e683eeb --- /dev/null +++ b/compute/apiv1/vpn_tunnels_client_example_test.go @@ -0,0 +1,131 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewVpnTunnelsRESTClient() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleVpnTunnelsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListVpnTunnelsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AggregatedList(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnTunnelsClient_Delete() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteVpnTunnelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnTunnelsClient_Get() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetVpnTunnelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnTunnelsClient_Insert() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertVpnTunnelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleVpnTunnelsClient_List() { + ctx := context.Background() + c, err := compute.NewVpnTunnelsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListVpnTunnelsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/zone_operations_client.go b/compute/apiv1/zone_operations_client.go new file mode 100644 index 000000000000..e77c5b333007 --- /dev/null +++ b/compute/apiv1/zone_operations_client.go @@ -0,0 +1,377 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newZoneOperationsClientHook clientHook + +// ZoneOperationsCallOptions contains the retry settings for each method of ZoneOperationsClient. +type ZoneOperationsCallOptions struct { + Delete []gax.CallOption + Get []gax.CallOption + List []gax.CallOption + Wait []gax.CallOption +} + +// internalZoneOperationsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalZoneOperationsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Delete(context.Context, *computepb.DeleteZoneOperationRequest, ...gax.CallOption) (*computepb.DeleteZoneOperationResponse, error) + Get(context.Context, *computepb.GetZoneOperationRequest, ...gax.CallOption) (*computepb.Operation, error) + List(context.Context, *computepb.ListZoneOperationsRequest, ...gax.CallOption) (*computepb.OperationList, error) + Wait(context.Context, *computepb.WaitZoneOperationRequest, ...gax.CallOption) (*computepb.Operation, error) +} + +// ZoneOperationsClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The ZoneOperations API. +type ZoneOperationsClient struct { + // The internal transport-dependent client. + internalClient internalZoneOperationsClient + + // The call options for this service. + CallOptions *ZoneOperationsCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ZoneOperationsClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ZoneOperationsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ZoneOperationsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Delete deletes the specified zone-specific Operations resource. +func (c *ZoneOperationsClient) Delete(ctx context.Context, req *computepb.DeleteZoneOperationRequest, opts ...gax.CallOption) (*computepb.DeleteZoneOperationResponse, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get retrieves the specified zone-specific Operations resource. +func (c *ZoneOperationsClient) Get(ctx context.Context, req *computepb.GetZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves a list of Operation resources contained within the specified zone. +func (c *ZoneOperationsClient) List(ctx context.Context, req *computepb.ListZoneOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *ZoneOperationsClient) Wait(ctx context.Context, req *computepb.WaitZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + return c.internalClient.Wait(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type zoneOperationsRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewZoneOperationsRESTClient creates a new zone operations rest client. +// +// The ZoneOperations API. +func NewZoneOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ZoneOperationsClient, error) { + clientOpts := append(defaultZoneOperationsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &zoneOperationsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ZoneOperationsClient{internalClient: c, CallOptions: &ZoneOperationsCallOptions{}}, nil +} + +func defaultZoneOperationsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *zoneOperationsRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *zoneOperationsRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *zoneOperationsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Delete deletes the specified zone-specific Operations resource. +func (c *zoneOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteZoneOperationRequest, opts ...gax.CallOption) (*computepb.DeleteZoneOperationResponse, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v", req.GetProject(), req.GetZone(), req.GetOperation()) + + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.DeleteZoneOperationResponse{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Get retrieves the specified zone-specific Operations resource. +func (c *zoneOperationsRESTClient) Get(ctx context.Context, req *computepb.GetZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v", req.GetProject(), req.GetZone(), req.GetOperation()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves a list of Operation resources contained within the specified zone. +func (c *zoneOperationsRESTClient) List(ctx context.Context, req *computepb.ListZoneOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations", req.GetProject(), req.GetZone()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.OperationList{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. +// +// This method is called on a best-effort basis. Specifically: +// +// In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. +// +// If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. +func (c *zoneOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v/wait", req.GetProject(), req.GetZone(), req.GetOperation()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/zone_operations_client_example_test.go b/compute/apiv1/zone_operations_client_example_test.go new file mode 100644 index 000000000000..f7f1c346c637 --- /dev/null +++ b/compute/apiv1/zone_operations_client_example_test.go @@ -0,0 +1,112 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewZoneOperationsRESTClient() { + ctx := context.Background() + c, err := compute.NewZoneOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleZoneOperationsClient_Delete() { + ctx := context.Background() + c, err := compute.NewZoneOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteZoneOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleZoneOperationsClient_Get() { + ctx := context.Background() + c, err := compute.NewZoneOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetZoneOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleZoneOperationsClient_List() { + ctx := context.Background() + c, err := compute.NewZoneOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListZoneOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleZoneOperationsClient_Wait() { + ctx := context.Background() + c, err := compute.NewZoneOperationsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.WaitZoneOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Wait(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/compute/apiv1/zones_client.go b/compute/apiv1/zones_client.go new file mode 100644 index 000000000000..bc02f75e4b68 --- /dev/null +++ b/compute/apiv1/zones_client.go @@ -0,0 +1,265 @@ +// Copyright 2021 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 compute + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + httptransport "google.golang.org/api/transport/http" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" +) + +var newZonesClientHook clientHook + +// ZonesCallOptions contains the retry settings for each method of ZonesClient. +type ZonesCallOptions struct { + Get []gax.CallOption + List []gax.CallOption +} + +// internalZonesClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalZonesClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetZoneRequest, ...gax.CallOption) (*computepb.Zone, error) + List(context.Context, *computepb.ListZonesRequest, ...gax.CallOption) (*computepb.ZoneList, error) +} + +// ZonesClient is a client for interacting with Google Compute Engine API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The Zones API. +type ZonesClient struct { + // The internal transport-dependent client. + internalClient internalZonesClient + + // The call options for this service. + CallOptions *ZonesCallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ZonesClient) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ZonesClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ZonesClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the specified Zone resource. Gets a list of available zones by making a list() request. +func (c *ZonesClient) Get(ctx context.Context, req *computepb.GetZoneRequest, opts ...gax.CallOption) (*computepb.Zone, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// List retrieves the list of Zone resources available to the specified project. +func (c *ZonesClient) List(ctx context.Context, req *computepb.ListZonesRequest, opts ...gax.CallOption) (*computepb.ZoneList, error) { + return c.internalClient.List(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type zonesRESTClient struct { + // The http endpoint to connect to. + endpoint string + + // The http client. + httpClient *http.Client + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewZonesRESTClient creates a new zones rest client. +// +// The Zones API. +func NewZonesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ZonesClient, error) { + clientOpts := append(defaultZonesRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &zonesRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ZonesClient{internalClient: c, CallOptions: &ZonesCallOptions{}}, nil +} + +func defaultZonesRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultAudience("https://compute.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + } +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *zonesRESTClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN") + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *zonesRESTClient) Close() error { + // Replace httpClient with nil to force cleanup. + c.httpClient = nil + return nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *zonesRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the specified Zone resource. Gets a list of available zones by making a list() request. +func (c *zonesRESTClient) Get(ctx context.Context, req *computepb.GetZoneRequest, opts ...gax.CallOption) (*computepb.Zone, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v", req.GetProject(), req.GetZone()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Zone{} + + return rsp, unm.Unmarshal(buf, rsp) +} + +// List retrieves the list of Zone resources available to the specified project. +func (c *zonesRESTClient) List(ctx context.Context, req *computepb.ListZonesRequest, opts ...gax.CallOption) (*computepb.ZoneList, error) { + m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} + jsonReq, err := m.Marshal(req) + if err != nil { + return nil, err + } + + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones", req.GetProject()) + + params := url.Values{} + if req != nil && req.Filter != nil { + params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) + } + if req != nil && req.MaxResults != nil { + params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults())) + } + if req != nil && req.OrderBy != nil { + params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) + } + if req != nil && req.PageToken != nil { + params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) + } + if req != nil && req.ReturnPartialSuccess != nil { + params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess())) + } + + baseUrl.RawQuery = params.Encode() + + httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if httpRsp.StatusCode != http.StatusOK { + return nil, fmt.Errorf(httpRsp.Status) + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ZoneList{} + + return rsp, unm.Unmarshal(buf, rsp) +} diff --git a/compute/apiv1/zones_client_example_test.go b/compute/apiv1/zones_client_example_test.go new file mode 100644 index 000000000000..109f4704bb86 --- /dev/null +++ b/compute/apiv1/zones_client_example_test.go @@ -0,0 +1,74 @@ +// Copyright 2021 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 compute_test + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewZonesRESTClient() { + ctx := context.Background() + c, err := compute.NewZonesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleZonesClient_Get() { + ctx := context.Background() + c, err := compute.NewZonesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetZoneRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleZonesClient_List() { + ctx := context.Background() + c, err := compute.NewZonesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListZonesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.List(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 1d782ddcefa2..4e9f7ec2c641 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -314,6 +314,15 @@ "release_level": "beta", "library_type": "" }, + "cloud.google.com/go/compute/apiv1": { + "distribution_name": "cloud.google.com/go/compute/apiv1", + "description": "Google Compute Engine API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/compute/apiv1", + "release_level": "alpha", + "library_type": "" + }, "cloud.google.com/go/compute/metadata": { "distribution_name": "cloud.google.com/go/compute/metadata", "description": "Service Metadata API", From 0ef2a3b88e6341277ff5d14cf651e3b2e9a47106 Mon Sep 17 00:00:00 2001 From: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Date: Thu, 1 Jul 2021 13:19:37 -0700 Subject: [PATCH 15/18] chore: release 0.86.0 (#4367) Co-authored-by: Cody Oss <6331106+codyoss@users.noreply.github.com> --- CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e2db8879fb4f..b0d936c6057c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.86.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.85.0...v0.86.0) (2021-07-01) + + +### Features + +* **bigquery managedwriter:** schema conversion support ([#4357](https://www.github.com/googleapis/google-cloud-go/issues/4357)) ([f2b20f4](https://www.github.com/googleapis/google-cloud-go/commit/f2b20f493e2ed5a883ce42fa65695c03c574feb5)) + ## [0.85.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.84.0...v0.85.0) (2021-06-30) From ef019401630c089ae81400d6eefdafc914312c2b Mon Sep 17 00:00:00 2001 From: tmdiep Date: Fri, 2 Jul 2021 07:02:31 +1000 Subject: [PATCH 16/18] test(pubsublite): testing support for operations (#4361) --- pubsublite/internal/test/mock.go | 53 ++++++++++++++++++++++++---- pubsublite/internal/test/util.go | 12 +++++++ pubsublite/internal/wire/rpc_test.go | 18 +++------- 3 files changed, 63 insertions(+), 20 deletions(-) diff --git a/pubsublite/internal/test/mock.go b/pubsublite/internal/test/mock.go index 425cda76c37a..7ff8275d8ecb 100644 --- a/pubsublite/internal/test/mock.go +++ b/pubsublite/internal/test/mock.go @@ -29,6 +29,7 @@ import ( emptypb "github.com/golang/protobuf/ptypes/empty" pb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1" + lrpb "google.golang.org/genproto/googleapis/longrunning" ) // MockServer is an in-memory mock implementation of a Pub/Sub Lite service, @@ -62,6 +63,7 @@ func NewServer() (*Server, error) { pb.RegisterSubscriberServiceServer(srv.Gsrv, liteServer) pb.RegisterCursorServiceServer(srv.Gsrv, liteServer) pb.RegisterPartitionAssignmentServiceServer(srv.Gsrv, liteServer) + lrpb.RegisterOperationsServer(srv.Gsrv, liteServer) srv.Start() return &Server{LiteServer: liteServer, gRPCServer: srv}, nil } @@ -87,6 +89,7 @@ type mockLiteServer struct { pb.SubscriberServiceServer pb.CursorServiceServer pb.PartitionAssignmentServiceServer + lrpb.OperationsServer mu sync.Mutex @@ -277,7 +280,7 @@ func (s *mockLiteServer) doTopicResponse(ctx context.Context, req interface{}) ( } resp, ok := retResponse.(*pb.Topic) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -289,7 +292,19 @@ func (s *mockLiteServer) doSubscriptionResponse(ctx context.Context, req interfa } resp, ok := retResponse.(*pb.Subscription) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) + } + return resp, nil +} + +func (s *mockLiteServer) doOperationResponse(ctx context.Context, req interface{}) (*lrpb.Operation, error) { + retResponse, retErr := s.popGlobalVerifiers(req) + if retErr != nil { + return nil, retErr + } + resp, ok := retResponse.(*lrpb.Operation) + if !ok { + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -301,7 +316,7 @@ func (s *mockLiteServer) doEmptyResponse(ctx context.Context, req interface{}) ( } resp, ok := retResponse.(*emptypb.Empty) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -325,7 +340,7 @@ func (s *mockLiteServer) GetTopicPartitions(ctx context.Context, req *pb.GetTopi } resp, ok := retResponse.(*pb.TopicPartitions) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -346,6 +361,10 @@ func (s *mockLiteServer) UpdateSubscription(ctx context.Context, req *pb.UpdateS return s.doSubscriptionResponse(ctx, req) } +func (s *mockLiteServer) SeekSubscription(ctx context.Context, req *pb.SeekSubscriptionRequest) (*lrpb.Operation, error) { + return s.doOperationResponse(ctx, req) +} + func (s *mockLiteServer) DeleteSubscription(ctx context.Context, req *pb.DeleteSubscriptionRequest) (*emptypb.Empty, error) { return s.doEmptyResponse(ctx, req) } @@ -357,7 +376,7 @@ func (s *mockLiteServer) ListTopics(ctx context.Context, req *pb.ListTopicsReque } resp, ok := retResponse.(*pb.ListTopicsResponse) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -369,7 +388,7 @@ func (s *mockLiteServer) ListTopicSubscriptions(ctx context.Context, req *pb.Lis } resp, ok := retResponse.(*pb.ListTopicSubscriptionsResponse) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } @@ -381,7 +400,27 @@ func (s *mockLiteServer) ListSubscriptions(ctx context.Context, req *pb.ListSubs } resp, ok := retResponse.(*pb.ListSubscriptionsResponse) if !ok { - return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %v", reflect.TypeOf(retResponse)) + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) } return resp, nil } + +func (s *mockLiteServer) GetOperation(ctx context.Context, req *lrpb.GetOperationRequest) (*lrpb.Operation, error) { + return s.doOperationResponse(ctx, req) +} + +func (s *mockLiteServer) ListOperations(ctx context.Context, req *lrpb.ListOperationsRequest) (*lrpb.ListOperationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "Unexpected ListOperations call") +} + +func (s *mockLiteServer) DeleteOperation(ctx context.Context, req *lrpb.DeleteOperationRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "Unexpected DeleteOperation call") +} + +func (s *mockLiteServer) CancelOperation(ctx context.Context, req *lrpb.CancelOperationRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "Unexpected CancelOperation call") +} + +func (s *mockLiteServer) WaitOperation(ctx context.Context, req *lrpb.WaitOperationRequest) (*lrpb.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "Unexpected WaitOperation call") +} diff --git a/pubsublite/internal/test/util.go b/pubsublite/internal/test/util.go index 6a35095afdf1..29afb9a35f84 100644 --- a/pubsublite/internal/test/util.go +++ b/pubsublite/internal/test/util.go @@ -14,6 +14,7 @@ package test import ( + "log" "strings" "github.com/google/go-cmp/cmp" @@ -21,6 +22,8 @@ import ( "golang.org/x/xerrors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" ) // ErrorEqual compares two errors for equivalence. @@ -54,3 +57,12 @@ func (f *FakeSource) Int63() int64 { return f.Ret } // Seed is unimplemented. func (f *FakeSource) Seed(seed int64) {} + +// MakeAny packs a message into an Any proto. +func MakeAny(msg proto.Message) *anypb.Any { + any, err := anypb.New(msg) + if err != nil { + log.Fatalf("Failed to make Any: %v", err) + } + return any +} diff --git a/pubsublite/internal/wire/rpc_test.go b/pubsublite/internal/wire/rpc_test.go index 850a946a76fb..e624b9e70e28 100644 --- a/pubsublite/internal/wire/rpc_test.go +++ b/pubsublite/internal/wire/rpc_test.go @@ -16,10 +16,10 @@ package wire import ( "encoding/base64" "errors" - "log" "testing" "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/pubsublite/internal/test" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -30,18 +30,10 @@ import ( spb "google.golang.org/genproto/googleapis/rpc/status" ) -func makeAny(msg proto.Message) *anypb.Any { - any, err := anypb.New(msg) - if err != nil { - log.Fatalf("Failed to make Any: %v", err) - } - return any -} - func makeStreamResetSignal() error { statuspb := &spb.Status{ Code: int32(codes.Aborted), - Details: []*anypb.Any{makeAny(&errdetails.ErrorInfo{ + Details: []*anypb.Any{test.MakeAny(&errdetails.ErrorInfo{ Reason: "RESET", Domain: "pubsublite.googleapis.com", })}, } @@ -63,7 +55,7 @@ func TestIsStreamResetSignal(t *testing.T) { desc: "non-retryable code", err: status.ErrorProto(&spb.Status{ Code: int32(codes.FailedPrecondition), - Details: []*anypb.Any{makeAny(&errdetails.ErrorInfo{Reason: "RESET", Domain: "pubsublite.googleapis.com"})}, + Details: []*anypb.Any{test.MakeAny(&errdetails.ErrorInfo{Reason: "RESET", Domain: "pubsublite.googleapis.com"})}, }), want: false, }, @@ -71,7 +63,7 @@ func TestIsStreamResetSignal(t *testing.T) { desc: "wrong domain", err: status.ErrorProto(&spb.Status{ Code: int32(codes.Aborted), - Details: []*anypb.Any{makeAny(&errdetails.ErrorInfo{Reason: "RESET"})}, + Details: []*anypb.Any{test.MakeAny(&errdetails.ErrorInfo{Reason: "RESET"})}, }), want: false, }, @@ -79,7 +71,7 @@ func TestIsStreamResetSignal(t *testing.T) { desc: "wrong reason", err: status.ErrorProto(&spb.Status{ Code: int32(codes.Aborted), - Details: []*anypb.Any{makeAny(&errdetails.ErrorInfo{Domain: "pubsublite.googleapis.com"})}, + Details: []*anypb.Any{test.MakeAny(&errdetails.ErrorInfo{Domain: "pubsublite.googleapis.com"})}, }), want: false, }, From 2b3bb856961c324c0717b460d50f7af0cd1fb046 Mon Sep 17 00:00:00 2001 From: tmdiep Date: Fri, 2 Jul 2021 07:24:14 +1000 Subject: [PATCH 17/18] refactor(pubsublite): internal utils for reservations (#4363) Adds ReservationPath and modifies LocationPath to support zones or regions. --- pubsublite/integration_test.go | 2 +- pubsublite/internal/wire/resources.go | 48 +++++++++++++++--- pubsublite/internal/wire/resources_test.go | 59 +++++++++++++++++++++- 3 files changed, 100 insertions(+), 9 deletions(-) diff --git a/pubsublite/integration_test.go b/pubsublite/integration_test.go index 80076f59a012..53aff1ba3998 100644 --- a/pubsublite/integration_test.go +++ b/pubsublite/integration_test.go @@ -130,7 +130,7 @@ func TestIntegration_ResourceAdminOperations(t *testing.T) { region, _ := wire.ZoneToRegion(zone) resourceID := resourceIDs.New() - locationPath := wire.LocationPath{Project: proj, Zone: zone}.String() + locationPath := wire.LocationPath{Project: proj, Location: zone}.String() topicPath := wire.TopicPath{Project: proj, Zone: zone, TopicID: resourceID}.String() subscriptionPath := wire.SubscriptionPath{Project: proj, Zone: zone, SubscriptionID: resourceID}.String() t.Logf("Topic path: %s", topicPath) diff --git a/pubsublite/internal/wire/resources.go b/pubsublite/internal/wire/resources.go index 228d632235b1..f76bf5cedaf1 100644 --- a/pubsublite/internal/wire/resources.go +++ b/pubsublite/internal/wire/resources.go @@ -49,18 +49,18 @@ func ZoneToRegion(zone string) (string, error) { return zone[0:strings.LastIndex(zone, "-")], nil } -// LocationPath stores a path consisting of a project and zone. +// LocationPath stores a path consisting of a project and zone/region. type LocationPath struct { // A Google Cloud project. The project ID (e.g. "my-project") or the project // number (e.g. "987654321") can be provided. Project string - // A Google Cloud zone, for example "us-central1-a". - Zone string + // A Google Cloud zone or region, for example "us-central1-a", "us-central1". + Location string } func (l LocationPath) String() string { - return fmt.Sprintf("projects/%s/locations/%s", l.Project, l.Zone) + return fmt.Sprintf("projects/%s/locations/%s", l.Project, l.Location) } var locPathRE = regexp.MustCompile(`^projects/([^/]+)/locations/([^/]+)$`) @@ -72,7 +72,7 @@ func ParseLocationPath(input string) (LocationPath, error) { return LocationPath{}, fmt.Errorf("pubsublite: invalid location path %q. valid format is %q", input, "projects/PROJECT_ID/locations/ZONE") } - return LocationPath{Project: parts[1], Zone: parts[2]}, nil + return LocationPath{Project: parts[1], Location: parts[2]}, nil } // TopicPath stores the full path of a Pub/Sub Lite topic. @@ -94,7 +94,7 @@ func (t TopicPath) String() string { // Location returns the topic's location path. func (t TopicPath) Location() LocationPath { - return LocationPath{Project: t.Project, Zone: t.Zone} + return LocationPath{Project: t.Project, Location: t.Zone} } var topicPathRE = regexp.MustCompile(`^projects/([^/]+)/locations/([^/]+)/topics/([^/]+)$`) @@ -129,7 +129,7 @@ func (s SubscriptionPath) String() string { // Location returns the subscription's location path. func (s SubscriptionPath) Location() LocationPath { - return LocationPath{Project: s.Project, Zone: s.Zone} + return LocationPath{Project: s.Project, Location: s.Zone} } var subsPathRE = regexp.MustCompile(`^projects/([^/]+)/locations/([^/]+)/subscriptions/([^/]+)$`) @@ -144,6 +144,40 @@ func ParseSubscriptionPath(input string) (SubscriptionPath, error) { return SubscriptionPath{Project: parts[1], Zone: parts[2], SubscriptionID: parts[3]}, nil } +// ReservationPath stores the full path of a Pub/Sub Lite reservation. +type ReservationPath struct { + // A Google Cloud project. The project ID (e.g. "my-project") or the project + // number (e.g. "987654321") can be provided. + Project string + + // A Google Cloud region. An example region is "us-central1". + Region string + + // The ID of the Pub/Sub Lite reservation, for example "my-reservation-name". + ReservationID string +} + +func (r ReservationPath) String() string { + return fmt.Sprintf("projects/%s/locations/%s/reservations/%s", r.Project, r.Region, r.ReservationID) +} + +// Location returns the reservation's location path. +func (r ReservationPath) Location() LocationPath { + return LocationPath{Project: r.Project, Location: r.Region} +} + +var reservationPathRE = regexp.MustCompile(`^projects/([^/]+)/locations/([^/]+)/reservations/([^/]+)$`) + +// ParseReservationPath parses the full path of a Pub/Sub Lite reservation. +func ParseReservationPath(input string) (ReservationPath, error) { + parts := reservationPathRE.FindStringSubmatch(input) + if len(parts) < 4 { + return ReservationPath{}, fmt.Errorf("pubsublite: invalid reservation path %q. valid format is %q", + input, "projects/PROJECT_ID/locations/REGION/reservations/RESERVATION_ID") + } + return ReservationPath{Project: parts[1], Region: parts[2], ReservationID: parts[3]}, nil +} + type topicPartition struct { Path string Partition int diff --git a/pubsublite/internal/wire/resources_test.go b/pubsublite/internal/wire/resources_test.go index 40582ebbde85..45772fbcaf61 100644 --- a/pubsublite/internal/wire/resources_test.go +++ b/pubsublite/internal/wire/resources_test.go @@ -120,7 +120,7 @@ func TestParseLocationPath(t *testing.T) { { desc: "valid: location path", input: "projects/987654321/locations/europe-west1-d", - wantPath: LocationPath{Project: "987654321", Zone: "europe-west1-d"}, + wantPath: LocationPath{Project: "987654321", Location: "europe-west1-d"}, }, { desc: "invalid: zone", @@ -270,3 +270,60 @@ func TestParseSubscriptionPath(t *testing.T) { }) } } + +func TestParseReservationPath(t *testing.T) { + for _, tc := range []struct { + desc string + input string + wantPath ReservationPath + wantErr bool + }{ + { + desc: "valid: reservation path", + input: "projects/987654321/locations/europe-west1/reservations/my-reservation", + wantPath: ReservationPath{Project: "987654321", Region: "europe-west1", ReservationID: "my-reservation"}, + }, + { + desc: "invalid: region only", + input: "europe-west1", + wantErr: true, + }, + { + desc: "invalid: topic path", + input: "projects/987654321/locations/europe-west1-d/topics/my-topic", + wantErr: true, + }, + { + desc: "invalid: missing project", + input: "projects//locations/europe-west1/reservations/my-reservation", + wantErr: true, + }, + { + desc: "invalid: missing region", + input: "projects/987654321/locations//reservations/my-reservation", + wantErr: true, + }, + { + desc: "invalid: missing reservation id", + input: "projects/987654321/locations/europe-west1/reservations/", + wantErr: true, + }, + { + desc: "invalid: has prefix", + input: "prefix/projects/987654321/locations/europe-west1/reservations/my-reservation", + wantErr: true, + }, + { + desc: "invalid: has suffix", + input: "projects/my-project/locations/us-west1/reservations/my-reservation/subresource/desc", + wantErr: true, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + gotPath, gotErr := ParseReservationPath(tc.input) + if gotPath != tc.wantPath || (gotErr != nil) != tc.wantErr { + t.Errorf("ParseReservationPath(%q) = (%v, %v), want (%v, err=%v)", tc.input, gotPath, gotErr, tc.wantPath, tc.wantErr) + } + }) + } +} From 7c07a3d332546828cdcc990a8e6a1beee7972548 Mon Sep 17 00:00:00 2001 From: tmdiep Date: Fri, 2 Jul 2021 07:55:51 +1000 Subject: [PATCH 18/18] test(pubsublite): testing support for reservations (#4362) --- pubsublite/internal/test/mock.go | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pubsublite/internal/test/mock.go b/pubsublite/internal/test/mock.go index 7ff8275d8ecb..770e5b4c24dd 100644 --- a/pubsublite/internal/test/mock.go +++ b/pubsublite/internal/test/mock.go @@ -309,6 +309,18 @@ func (s *mockLiteServer) doOperationResponse(ctx context.Context, req interface{ return resp, nil } +func (s *mockLiteServer) doReservationResponse(ctx context.Context, req interface{}) (*pb.Reservation, error) { + retResponse, retErr := s.popGlobalVerifiers(req) + if retErr != nil { + return nil, retErr + } + resp, ok := retResponse.(*pb.Reservation) + if !ok { + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) + } + return resp, nil +} + func (s *mockLiteServer) doEmptyResponse(ctx context.Context, req interface{}) (*emptypb.Empty, error) { retResponse, retErr := s.popGlobalVerifiers(req) if retErr != nil { @@ -369,6 +381,22 @@ func (s *mockLiteServer) DeleteSubscription(ctx context.Context, req *pb.DeleteS return s.doEmptyResponse(ctx, req) } +func (s *mockLiteServer) CreateReservation(ctx context.Context, req *pb.CreateReservationRequest) (*pb.Reservation, error) { + return s.doReservationResponse(ctx, req) +} + +func (s *mockLiteServer) GetReservation(ctx context.Context, req *pb.GetReservationRequest) (*pb.Reservation, error) { + return s.doReservationResponse(ctx, req) +} + +func (s *mockLiteServer) UpdateReservation(ctx context.Context, req *pb.UpdateReservationRequest) (*pb.Reservation, error) { + return s.doReservationResponse(ctx, req) +} + +func (s *mockLiteServer) DeleteReservation(ctx context.Context, req *pb.DeleteReservationRequest) (*emptypb.Empty, error) { + return s.doEmptyResponse(ctx, req) +} + func (s *mockLiteServer) ListTopics(ctx context.Context, req *pb.ListTopicsRequest) (*pb.ListTopicsResponse, error) { retResponse, retErr := s.popGlobalVerifiers(req) if retErr != nil { @@ -405,6 +433,30 @@ func (s *mockLiteServer) ListSubscriptions(ctx context.Context, req *pb.ListSubs return resp, nil } +func (s *mockLiteServer) ListReservations(ctx context.Context, req *pb.ListReservationsRequest) (*pb.ListReservationsResponse, error) { + retResponse, retErr := s.popGlobalVerifiers(req) + if retErr != nil { + return nil, retErr + } + resp, ok := retResponse.(*pb.ListReservationsResponse) + if !ok { + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) + } + return resp, nil +} + +func (s *mockLiteServer) ListReservationTopics(ctx context.Context, req *pb.ListReservationTopicsRequest) (*pb.ListReservationTopicsResponse, error) { + retResponse, retErr := s.popGlobalVerifiers(req) + if retErr != nil { + return nil, retErr + } + resp, ok := retResponse.(*pb.ListReservationTopicsResponse) + if !ok { + return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse) + } + return resp, nil +} + func (s *mockLiteServer) GetOperation(ctx context.Context, req *lrpb.GetOperationRequest) (*lrpb.Operation, error) { return s.doOperationResponse(ctx, req) }