From 83b941c0983e44fdd18ceee8c6f3e91219d72ad1 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 4 Nov 2021 14:52:20 -0700 Subject: [PATCH] chore(all): auto-regenerate gapics (#5082) 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/715 Changes: feat(dialogflow/cx): added support for comparing between versions docs: clarified security settings API reference PiperOrigin-RevId: 407624272 Source-Link: https://github.com/googleapis/googleapis/commit/eb773f2c089d7f11efbf6f72239db6c16189927a docs(channel): clarified usage of entitlement parameters PiperOrigin-RevId: 407463572 Source-Link: https://github.com/googleapis/googleapis/commit/e4c5b78723b0860903c4ee6eb5ce56f7bfcbb8bf feat(osconfig): OSConfig: add OS policy assignment rpcs Committer: @adjackura PiperOrigin-RevId: 407422484 Source-Link: https://github.com/googleapis/googleapis/commit/c11bc3edab44a009dfafd13525d3a38548d823fa fix(security/privateca): repair service config to enable mixins PiperOrigin-RevId: 407356040 Source-Link: https://github.com/googleapis/googleapis/commit/171e2c7b07eaa01d05349243773ab8bc3ffee73d --- channel/apiv1/doc.go | 2 +- channel/go.mod | 2 +- channel/go.sum | 4 +- compute/apiv1/backend_services_client.go | 20 +- compute/apiv1/doc.go | 2 +- compute/apiv1/firewall_policies_client.go | 4 +- compute/apiv1/gapic_metadata.json | 73 ++ .../apiv1/global_forwarding_rules_client.go | 4 +- compute/apiv1/global_operations_client.go | 20 +- compute/apiv1/image_family_views_client.go | 193 ++++ .../image_family_views_client_example_test.go | 56 ++ compute/apiv1/images_client.go | 8 +- .../apiv1/instance_group_managers_client.go | 72 +- compute/apiv1/instance_groups_client.go | 32 +- compute/apiv1/instances_client.go | 55 +- .../apiv1/instances_client_example_test.go | 20 + compute/apiv1/license_codes_client.go | 8 +- compute/apiv1/licenses_client.go | 28 +- compute/apiv1/networks_client.go | 4 +- .../apiv1/region_backend_services_client.go | 12 +- compute/apiv1/region_commitments_client.go | 4 +- .../region_instance_group_managers_client.go | 60 +- compute/apiv1/region_operations_client.go | 16 +- compute/apiv1/service_attachments_client.go | 831 ++++++++++++++++++ ...service_attachments_client_example_test.go | 229 +++++ compute/apiv1/snapshots_client.go | 8 +- compute/apiv1/target_http_proxies_client.go | 4 +- compute/apiv1/target_https_proxies_client.go | 4 +- compute/apiv1/url_maps_client.go | 8 +- compute/apiv1/zone_operations_client.go | 16 +- dialogflow/cx/apiv3beta1/doc.go | 2 +- dialogflow/cx/apiv3beta1/gapic_metadata.json | 5 + dialogflow/cx/apiv3beta1/versions_client.go | 51 +- .../versions_client_example_test.go | 20 + dialogflow/go.mod | 2 +- dialogflow/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- .../apiv1/ImageFamilyViewsClient/Get/main.go | 48 + .../SendDiagnosticInterrupt/main.go | 48 + .../AggregatedList/main.go | 55 ++ .../ServiceAttachmentsClient/Delete/main.go | 48 + .../ServiceAttachmentsClient/Get/main.go | 48 + .../GetIamPolicy/main.go | 48 + .../ServiceAttachmentsClient/Insert/main.go | 48 + .../ServiceAttachmentsClient/List/main.go | 55 ++ .../ServiceAttachmentsClient/Patch/main.go | 48 + .../SetIamPolicy/main.go | 48 + .../TestIamPermissions/main.go | 48 + .../VersionsClient/CompareVersions/main.go | 48 + internal/generated/snippets/go.mod | 2 +- internal/generated/snippets/go.sum | 3 +- .../CreateOSPolicyAssignment/main.go | 53 ++ .../DeleteOSPolicyAssignment/main.go | 51 ++ .../GetOSPolicyAssignment/main.go | 48 + .../GetOSPolicyAssignmentReport/main.go | 48 + .../ListOSPolicyAssignmentReports/main.go | 55 ++ .../ListOSPolicyAssignmentRevisions/main.go | 55 ++ .../ListOSPolicyAssignments/main.go | 55 ++ .../UpdateOSPolicyAssignment/main.go | 53 ++ internal/godocfx/go.sum | 4 +- osconfig/apiv1/doc.go | 2 +- osconfig/apiv1/gapic_metadata.json | 40 + osconfig/apiv1/os_config_zonal_client.go | 765 +++++++++++++++- .../os_config_zonal_client_example_test.go | 191 ++++ osconfig/go.mod | 2 +- osconfig/go.sum | 4 +- security/go.mod | 2 +- security/go.sum | 4 +- security/privateca/apiv1/doc.go | 4 +- 70 files changed, 3641 insertions(+), 279 deletions(-) create mode 100644 compute/apiv1/image_family_views_client.go create mode 100644 compute/apiv1/image_family_views_client_example_test.go create mode 100644 compute/apiv1/service_attachments_client.go create mode 100644 compute/apiv1/service_attachments_client_example_test.go create mode 100644 internal/generated/snippets/compute/apiv1/ImageFamilyViewsClient/Get/main.go create mode 100644 internal/generated/snippets/compute/apiv1/InstancesClient/SendDiagnosticInterrupt/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/AggregatedList/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Delete/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Get/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Insert/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/List/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Patch/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/TestIamPermissions/main.go create mode 100644 internal/generated/snippets/dialogflow/cx/apiv3beta1/VersionsClient/CompareVersions/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/CreateOSPolicyAssignment/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/DeleteOSPolicyAssignment/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignment/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignmentReport/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentReports/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentRevisions/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignments/main.go create mode 100644 internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/UpdateOSPolicyAssignment/main.go diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 0ccfdb76137..8d867fa8a00 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -92,7 +92,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211030" +const versionClient = "20211104" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/channel/go.mod b/channel/go.mod index d1572bc884d..4cdf5a3698b 100644 --- a/channel/go.mod +++ b/channel/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.97.0 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/channel/go.sum b/channel/go.sum index 4a0ee7cc155..24ce3cdb506 100644 --- a/channel/go.sum +++ b/channel/go.sum @@ -503,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 h1:vum3nDKdleYb+aePXKFEDT2+ghuH00EgYp9B7Q7EZZE= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/compute/apiv1/backend_services_client.go b/compute/apiv1/backend_services_client.go index 037c1bc3bc2..45d5d6f6039 100644 --- a/compute/apiv1/backend_services_client.go +++ b/compute/apiv1/backend_services_client.go @@ -133,16 +133,12 @@ func (c *BackendServicesClient) Get(ctx context.Context, req *computepb.GetBacke 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” } +// 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. +// 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) (*Operation, error) { return c.internalClient.Insert(ctx, req, opts...) } @@ -152,7 +148,7 @@ func (c *BackendServicesClient) List(ctx context.Context, req *computepb.ListBac 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. +// 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) (*Operation, error) { return c.internalClient.Patch(ctx, req, opts...) } @@ -519,11 +515,7 @@ func (c *backendServicesRESTClient) Get(ctx context.Context, req *computepb.GetB return rsp, nil } -// GetHealth gets the most recent health check results for this BackendService. -// -// Example request body: -// -// { “group”: “/zones/us-east1-b/instanceGroups/lb-backend-example” } +// 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} body := req.GetResourceGroupReferenceResource() @@ -570,7 +562,7 @@ func (c *backendServicesRESTClient) GetHealth(ctx context.Context, req *computep return rsp, nil } -// Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetBackendServiceResource() @@ -709,7 +701,7 @@ func (c *backendServicesRESTClient) List(ctx context.Context, req *computepb.Lis return it } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetBackendServiceResource() diff --git a/compute/apiv1/doc.go b/compute/apiv1/doc.go index b9349e20d63..64f4e625440 100644 --- a/compute/apiv1/doc.go +++ b/compute/apiv1/doc.go @@ -91,7 +91,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211030" +const versionClient = "20211104" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/compute/apiv1/firewall_policies_client.go b/compute/apiv1/firewall_policies_client.go index abf640d0902..4bd7d2d9c0a 100644 --- a/compute/apiv1/firewall_policies_client.go +++ b/compute/apiv1/firewall_policies_client.go @@ -166,7 +166,7 @@ func (c *FirewallPoliciesClient) Insert(ctx context.Context, req *computepb.Inse return c.internalClient.Insert(ctx, req, opts...) } -// List lists all the policies that have been configured for the specified project. +// List lists all the policies that have been configured for the specified folder or organization. func (c *FirewallPoliciesClient) List(ctx context.Context, req *computepb.ListFirewallPoliciesRequest, opts ...gax.CallOption) *FirewallPolicyIterator { return c.internalClient.List(ctx, req, opts...) } @@ -726,7 +726,7 @@ func (c *firewallPoliciesRESTClient) Insert(ctx context.Context, req *computepb. return op, err } -// List lists all the policies that have been configured for the specified project. +// List lists all the policies that have been configured for the specified folder or organization. func (c *firewallPoliciesRESTClient) List(ctx context.Context, req *computepb.ListFirewallPoliciesRequest, opts ...gax.CallOption) *FirewallPolicyIterator { it := &FirewallPolicyIterator{} req = proto.Clone(req).(*computepb.ListFirewallPoliciesRequest) diff --git a/compute/apiv1/gapic_metadata.json b/compute/apiv1/gapic_metadata.json index 6474e15ecd9..7df71c72a73 100644 --- a/compute/apiv1/gapic_metadata.json +++ b/compute/apiv1/gapic_metadata.json @@ -797,6 +797,20 @@ } } }, + "ImageFamilyViews": { + "clients": { + "rest": { + "libraryClient": "ImageFamilyViewsClient", + "rpcs": { + "Get": { + "methods": [ + "Get" + ] + } + } + } + } + }, "Images": { "clients": { "rest": { @@ -1173,6 +1187,11 @@ "Reset" ] }, + "SendDiagnosticInterrupt": { + "methods": [ + "SendDiagnosticInterrupt" + ] + }, "SetDeletionProtection": { "methods": [ "SetDeletionProtection" @@ -2849,6 +2868,60 @@ } } }, + "ServiceAttachments": { + "clients": { + "rest": { + "libraryClient": "ServiceAttachmentsClient", + "rpcs": { + "AggregatedList": { + "methods": [ + "AggregatedList" + ] + }, + "Delete": { + "methods": [ + "Delete" + ] + }, + "Get": { + "methods": [ + "Get" + ] + }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, + "Insert": { + "methods": [ + "Insert" + ] + }, + "List": { + "methods": [ + "List" + ] + }, + "Patch": { + "methods": [ + "Patch" + ] + }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + } + } + } + } + }, "Snapshots": { "clients": { "rest": { diff --git a/compute/apiv1/global_forwarding_rules_client.go b/compute/apiv1/global_forwarding_rules_client.go index 22aea9b76a5..7e9e03f775a 100644 --- a/compute/apiv1/global_forwarding_rules_client.go +++ b/compute/apiv1/global_forwarding_rules_client.go @@ -124,7 +124,7 @@ func (c *GlobalForwardingRulesClient) Patch(ctx context.Context, req *computepb. 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. +// 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) (*Operation, error) { return c.internalClient.SetLabels(ctx, req, opts...) } @@ -480,7 +480,7 @@ func (c *globalForwardingRulesRESTClient) Patch(ctx context.Context, req *comput return op, err } -// SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetGlobalSetLabelsRequestResource() diff --git a/compute/apiv1/global_operations_client.go b/compute/apiv1/global_operations_client.go index 74a314bcb7d..4695c01bbe1 100644 --- a/compute/apiv1/global_operations_client.go +++ b/compute/apiv1/global_operations_client.go @@ -105,7 +105,7 @@ func (c *GlobalOperationsClient) Delete(ctx context.Context, req *computepb.Dele return c.internalClient.Delete(ctx, req, opts...) } -// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +// Get retrieves the specified Operations resource. func (c *GlobalOperationsClient) Get(ctx context.Context, req *computepb.GetGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { return c.internalClient.Get(ctx, req, opts...) } @@ -115,13 +115,7 @@ func (c *GlobalOperationsClient) List(ctx context.Context, req *computepb.ListGl 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. +// 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...) } @@ -324,7 +318,7 @@ func (c *globalOperationsRESTClient) Delete(ctx context.Context, req *computepb. return rsp, nil } -// Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. +// Get retrieves the specified Operations resource. func (c *globalOperationsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v", req.GetProject(), req.GetOperation()) @@ -448,13 +442,7 @@ func (c *globalOperationsRESTClient) List(ctx context.Context, req *computepb.Li return it } -// 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. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v/wait", req.GetProject(), req.GetOperation()) diff --git a/compute/apiv1/image_family_views_client.go b/compute/apiv1/image_family_views_client.go new file mode 100644 index 00000000000..2a859ebb1a5 --- /dev/null +++ b/compute/apiv1/image_family_views_client.go @@ -0,0 +1,193 @@ +// 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 ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/googleapi" + "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 newImageFamilyViewsClientHook clientHook + +// ImageFamilyViewsCallOptions contains the retry settings for each method of ImageFamilyViewsClient. +type ImageFamilyViewsCallOptions struct { + Get []gax.CallOption +} + +// internalImageFamilyViewsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalImageFamilyViewsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Get(context.Context, *computepb.GetImageFamilyViewRequest, ...gax.CallOption) (*computepb.ImageFamilyView, error) +} + +// ImageFamilyViewsClient 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 ImageFamilyViews API. +type ImageFamilyViewsClient struct { + // The internal transport-dependent client. + internalClient internalImageFamilyViewsClient + + // The call options for this service. + CallOptions *ImageFamilyViewsCallOptions +} + +// 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 *ImageFamilyViewsClient) 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 *ImageFamilyViewsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ImageFamilyViewsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Get returns the latest image that is part of an image family, is not deprecated and is rolled out in the specified zone. +func (c *ImageFamilyViewsClient) Get(ctx context.Context, req *computepb.GetImageFamilyViewRequest, opts ...gax.CallOption) (*computepb.ImageFamilyView, error) { + return c.internalClient.Get(ctx, req, opts...) +} + +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type imageFamilyViewsRESTClient 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 +} + +// NewImageFamilyViewsRESTClient creates a new image family views rest client. +// +// The ImageFamilyViews API. +func NewImageFamilyViewsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ImageFamilyViewsClient, error) { + clientOpts := append(defaultImageFamilyViewsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &imageFamilyViewsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ImageFamilyViewsClient{internalClient: c, CallOptions: &ImageFamilyViewsCallOptions{}}, nil +} + +func defaultImageFamilyViewsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://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 *imageFamilyViewsRESTClient) 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 *imageFamilyViewsRESTClient) 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 *imageFamilyViewsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// Get returns the latest image that is part of an image family, is not deprecated and is rolled out in the specified zone. +func (c *imageFamilyViewsRESTClient) Get(ctx context.Context, req *computepb.GetImageFamilyViewRequest, opts ...gax.CallOption) (*computepb.ImageFamilyView, error) { + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/imageFamilyViews/%v", req.GetProject(), req.GetZone(), req.GetFamily()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ImageFamilyView{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} diff --git a/compute/apiv1/image_family_views_client_example_test.go b/compute/apiv1/image_family_views_client_example_test.go new file mode 100644 index 00000000000..ffa32c252f0 --- /dev/null +++ b/compute/apiv1/image_family_views_client_example_test.go @@ -0,0 +1,56 @@ +// 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 ExampleNewImageFamilyViewsRESTClient() { + ctx := context.Background() + c, err := compute.NewImageFamilyViewsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleImageFamilyViewsClient_Get() { + ctx := context.Background() + c, err := compute.NewImageFamilyViewsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetImageFamilyViewRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetImageFamilyViewRequest. + } + resp, err := c.Get(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 index abf5a97449f..329dbfdb307 100644 --- a/compute/apiv1/images_client.go +++ b/compute/apiv1/images_client.go @@ -112,9 +112,7 @@ func (c *ImagesClient) Delete(ctx context.Context, req *computepb.DeleteImageReq 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. +// 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) (*Operation, error) { return c.internalClient.Deprecate(ctx, req, opts...) } @@ -276,9 +274,7 @@ func (c *imagesRESTClient) Delete(ctx context.Context, req *computepb.DeleteImag return op, err } -// Deprecate sets the deprecation status of an image. -// -// If an empty request body is given, clears the deprecation status instead. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetDeprecationStatusResource() diff --git a/compute/apiv1/instance_group_managers_client.go b/compute/apiv1/instance_group_managers_client.go index 051f90040f6..634950d2f45 100644 --- a/compute/apiv1/instance_group_managers_client.go +++ b/compute/apiv1/instance_group_managers_client.go @@ -126,11 +126,7 @@ 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. +// 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) (*Operation, error) { return c.internalClient.AbandonInstances(ctx, req, opts...) } @@ -150,16 +146,12 @@ func (c *InstanceGroupManagersClient) CreateInstances(ctx context.Context, req * 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. +// 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) (*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. +// 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) (*Operation, error) { return c.internalClient.DeleteInstances(ctx, req, opts...) } @@ -174,9 +166,7 @@ func (c *InstanceGroupManagersClient) Get(ctx context.Context, req *computepb.Ge 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. +// 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) (*Operation, error) { return c.internalClient.Insert(ctx, req, opts...) } @@ -201,7 +191,7 @@ func (c *InstanceGroupManagersClient) ListPerInstanceConfigs(ctx context.Context 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. +// 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. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. func (c *InstanceGroupManagersClient) Patch(ctx context.Context, req *computepb.PatchInstanceGroupManagerRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.Patch(ctx, req, opts...) } @@ -211,24 +201,12 @@ func (c *InstanceGroupManagersClient) PatchPerInstanceConfigs(ctx context.Contex 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. +// 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) (*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. +// 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) (*Operation, error) { return c.internalClient.Resize(ctx, req, opts...) } @@ -312,11 +290,7 @@ 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagersAbandonInstancesRequestResource() @@ -568,7 +542,7 @@ func (c *instanceGroupManagersRESTClient) CreateInstances(ctx context.Context, r return op, err } -// 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -616,11 +590,7 @@ func (c *instanceGroupManagersRESTClient) Delete(ctx context.Context, req *compu return op, err } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagersDeleteInstancesRequestResource() @@ -763,9 +733,7 @@ func (c *instanceGroupManagersRESTClient) Get(ctx context.Context, req *computep return rsp, nil } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagerResource() @@ -1156,7 +1124,7 @@ func (c *instanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Con return it } -// 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. +// 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. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. func (c *instanceGroupManagersRESTClient) Patch(ctx context.Context, req *computepb.PatchInstanceGroupManagerRequest, opts ...gax.CallOption) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagerResource() @@ -1266,11 +1234,7 @@ func (c *instanceGroupManagersRESTClient) PatchPerInstanceConfigs(ctx context.Co return op, err } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagersRecreateInstancesRequestResource() @@ -1325,15 +1289,7 @@ func (c *instanceGroupManagersRESTClient) RecreateInstances(ctx context.Context, return op, err } -// 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) diff --git a/compute/apiv1/instance_groups_client.go b/compute/apiv1/instance_groups_client.go index a4817890e87..3b7adc0338d 100644 --- a/compute/apiv1/instance_groups_client.go +++ b/compute/apiv1/instance_groups_client.go @@ -104,7 +104,7 @@ 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. +// 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) (*Operation, error) { return c.internalClient.AddInstances(ctx, req, opts...) } @@ -114,14 +114,12 @@ func (c *InstanceGroupsClient) AggregatedList(ctx context.Context, req *computep 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. +// 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) (*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. +// 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...) } @@ -131,9 +129,7 @@ func (c *InstanceGroupsClient) Insert(ctx context.Context, req *computepb.Insert 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. +// 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) *InstanceGroupIterator { return c.internalClient.List(ctx, req, opts...) } @@ -143,9 +139,7 @@ func (c *InstanceGroupsClient) ListInstances(ctx context.Context, req *computepb 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. +// 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) (*Operation, error) { return c.internalClient.RemoveInstances(ctx, req, opts...) } @@ -219,7 +213,7 @@ 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupsAddInstancesRequestResource() @@ -368,7 +362,7 @@ func (c *instanceGroupsRESTClient) AggregatedList(ctx context.Context, req *comp return it } -// 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) @@ -416,9 +410,7 @@ func (c *instanceGroupsRESTClient) Delete(ctx context.Context, req *computepb.De return op, err } -// 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. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) @@ -513,9 +505,7 @@ func (c *instanceGroupsRESTClient) Insert(ctx context.Context, req *computepb.In return op, err } -// 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. +// 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) *InstanceGroupIterator { it := &InstanceGroupIterator{} req = proto.Clone(req).(*computepb.ListInstanceGroupsRequest) @@ -689,9 +679,7 @@ func (c *instanceGroupsRESTClient) ListInstances(ctx context.Context, req *compu return it } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupsRemoveInstancesRequestResource() diff --git a/compute/apiv1/instances_client.go b/compute/apiv1/instances_client.go index 7d8decc075c..c3e3cbdd246 100644 --- a/compute/apiv1/instances_client.go +++ b/compute/apiv1/instances_client.go @@ -63,6 +63,7 @@ type InstancesCallOptions struct { ListReferrers []gax.CallOption RemoveResourcePolicies []gax.CallOption Reset []gax.CallOption + SendDiagnosticInterrupt []gax.CallOption SetDeletionProtection []gax.CallOption SetDiskAutoDelete []gax.CallOption SetIamPolicy []gax.CallOption @@ -112,6 +113,7 @@ type internalInstancesClient interface { ListReferrers(context.Context, *computepb.ListReferrersInstancesRequest, ...gax.CallOption) *ReferenceIterator RemoveResourcePolicies(context.Context, *computepb.RemoveResourcePoliciesInstanceRequest, ...gax.CallOption) (*Operation, error) Reset(context.Context, *computepb.ResetInstanceRequest, ...gax.CallOption) (*Operation, error) + SendDiagnosticInterrupt(context.Context, *computepb.SendDiagnosticInterruptInstanceRequest, ...gax.CallOption) (*computepb.SendDiagnosticInterruptInstanceResponse, error) SetDeletionProtection(context.Context, *computepb.SetDeletionProtectionInstanceRequest, ...gax.CallOption) (*Operation, error) SetDiskAutoDelete(context.Context, *computepb.SetDiskAutoDeleteInstanceRequest, ...gax.CallOption) (*Operation, error) SetIamPolicy(context.Context, *computepb.SetIamPolicyInstanceRequest, ...gax.CallOption) (*computepb.Policy, error) @@ -180,7 +182,7 @@ func (c *InstancesClient) AddResourcePolicies(ctx context.Context, req *computep return c.internalClient.AddResourcePolicies(ctx, req, opts...) } -// AggregatedList retrieves aggregated list of all of the instances in your project across all regions and zones. +// AggregatedList retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. func (c *InstancesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstancesRequest, opts ...gax.CallOption) *InstancesScopedListPairIterator { return c.internalClient.AggregatedList(ctx, req, opts...) } @@ -270,6 +272,11 @@ func (c *InstancesClient) Reset(ctx context.Context, req *computepb.ResetInstanc return c.internalClient.Reset(ctx, req, opts...) } +// SendDiagnosticInterrupt sends diagnostic interrupt to the instance. +func (c *InstancesClient) SendDiagnosticInterrupt(ctx context.Context, req *computepb.SendDiagnosticInterruptInstanceRequest, opts ...gax.CallOption) (*computepb.SendDiagnosticInterruptInstanceResponse, error) { + return c.internalClient.SendDiagnosticInterrupt(ctx, req, opts...) +} + // SetDeletionProtection sets deletion protection on the instance. func (c *InstancesClient) SetDeletionProtection(ctx context.Context, req *computepb.SetDeletionProtectionInstanceRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.SetDeletionProtection(ctx, req, opts...) @@ -355,7 +362,7 @@ func (c *InstancesClient) TestIamPermissions(ctx context.Context, req *computepb 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. +// 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) (*Operation, error) { return c.internalClient.Update(ctx, req, opts...) } @@ -557,7 +564,7 @@ func (c *instancesRESTClient) AddResourcePolicies(ctx context.Context, req *comp return op, err } -// AggregatedList retrieves aggregated list of all of the instances in your project across all regions and zones. +// AggregatedList retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. func (c *instancesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstancesRequest, opts ...gax.CallOption) *InstancesScopedListPairIterator { it := &InstancesScopedListPairIterator{} req = proto.Clone(req).(*computepb.AggregatedListInstancesRequest) @@ -1560,6 +1567,46 @@ func (c *instancesRESTClient) Reset(ctx context.Context, req *computepb.ResetIns return op, err } +// SendDiagnosticInterrupt sends diagnostic interrupt to the instance. +func (c *instancesRESTClient) SendDiagnosticInterrupt(ctx context.Context, req *computepb.SendDiagnosticInterruptInstanceRequest, opts ...gax.CallOption) (*computepb.SendDiagnosticInterruptInstanceResponse, error) { + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/sendDiagnosticInterrupt", req.GetProject(), req.GetZone(), req.GetInstance()) + + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.SendDiagnosticInterruptInstanceResponse{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} + // SetDeletionProtection sets deletion protection on the instance. func (c *instancesRESTClient) SetDeletionProtection(ctx context.Context, req *computepb.SetDeletionProtectionInstanceRequest, opts ...gax.CallOption) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) @@ -2446,7 +2493,7 @@ func (c *instancesRESTClient) TestIamPermissions(ctx context.Context, req *compu return rsp, nil } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceResource() diff --git a/compute/apiv1/instances_client_example_test.go b/compute/apiv1/instances_client_example_test.go index 8ac477bd085..0329d7e6b8f 100644 --- a/compute/apiv1/instances_client_example_test.go +++ b/compute/apiv1/instances_client_example_test.go @@ -454,6 +454,26 @@ func ExampleInstancesClient_Reset() { _ = resp } +func ExampleInstancesClient_SendDiagnosticInterrupt() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SendDiagnosticInterruptInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#SendDiagnosticInterruptInstanceRequest. + } + resp, err := c.SendDiagnosticInterrupt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleInstancesClient_SetDeletionProtection() { ctx := context.Background() c, err := compute.NewInstancesRESTClient(ctx) diff --git a/compute/apiv1/license_codes_client.go b/compute/apiv1/license_codes_client.go index f41935f75b8..bde57d20c2d 100644 --- a/compute/apiv1/license_codes_client.go +++ b/compute/apiv1/license_codes_client.go @@ -86,12 +86,12 @@ 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. +// 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. +// 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...) } @@ -160,7 +160,7 @@ 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. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenseCodes/%v", req.GetProject(), req.GetLicenseCode()) @@ -200,7 +200,7 @@ func (c *licenseCodesRESTClient) Get(ctx context.Context, req *computepb.GetLice return rsp, nil } -// 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. +// 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} body := req.GetTestPermissionsRequestResource() diff --git a/compute/apiv1/licenses_client.go b/compute/apiv1/licenses_client.go index 43117b30f24..ab1eabece80 100644 --- a/compute/apiv1/licenses_client.go +++ b/compute/apiv1/licenses_client.go @@ -99,37 +99,37 @@ 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. +// 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) (*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. +// 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. +// 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. +// 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) (*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. +// 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) *LicenseIterator { 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. +// 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. +// 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...) } @@ -198,7 +198,7 @@ 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) @@ -246,7 +246,7 @@ func (c *licensesRESTClient) Delete(ctx context.Context, req *computepb.DeleteLi return op, err } -// Get returns the specified License resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) @@ -286,7 +286,7 @@ func (c *licensesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseR return rsp, nil } -// 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. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v/getIamPolicy", req.GetProject(), req.GetResource()) @@ -333,7 +333,7 @@ func (c *licensesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.Ge return rsp, nil } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetLicenseResource() @@ -388,7 +388,7 @@ func (c *licensesRESTClient) Insert(ctx context.Context, req *computepb.InsertLi return op, err } -// 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. +// 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) *LicenseIterator { it := &LicenseIterator{} req = proto.Clone(req).(*computepb.ListLicensesRequest) @@ -472,7 +472,7 @@ func (c *licensesRESTClient) List(ctx context.Context, req *computepb.ListLicens return it } -// 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. +// 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} body := req.GetGlobalSetPolicyRequestResource() @@ -519,7 +519,7 @@ func (c *licensesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.Se return rsp, nil } -// 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. +// 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} body := req.GetTestPermissionsRequestResource() diff --git a/compute/apiv1/networks_client.go b/compute/apiv1/networks_client.go index 38dc9109158..050db51eb80 100644 --- a/compute/apiv1/networks_client.go +++ b/compute/apiv1/networks_client.go @@ -157,7 +157,7 @@ func (c *NetworksClient) SwitchToCustomMode(ctx context.Context, req *computepb. 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 +// UpdatePeering updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field. func (c *NetworksClient) UpdatePeering(ctx context.Context, req *computepb.UpdatePeeringNetworkRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.UpdatePeering(ctx, req, opts...) } @@ -799,7 +799,7 @@ func (c *networksRESTClient) SwitchToCustomMode(ctx context.Context, req *comput return op, err } -// 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 +// UpdatePeering updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field. func (c *networksRESTClient) UpdatePeering(ctx context.Context, req *computepb.UpdatePeeringNetworkRequest, opts ...gax.CallOption) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetNetworksUpdatePeeringRequestResource() diff --git a/compute/apiv1/region_backend_services_client.go b/compute/apiv1/region_backend_services_client.go index 0d7435659f6..1a702713839 100644 --- a/compute/apiv1/region_backend_services_client.go +++ b/compute/apiv1/region_backend_services_client.go @@ -114,7 +114,7 @@ func (c *RegionBackendServicesClient) GetHealth(ctx context.Context, req *comput 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. +// 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) (*Operation, error) { return c.internalClient.Insert(ctx, req, opts...) } @@ -124,12 +124,12 @@ func (c *RegionBackendServicesClient) List(ctx context.Context, req *computepb.L 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. +// 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) (*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. +// 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) (*Operation, error) { return c.internalClient.Update(ctx, req, opts...) } @@ -333,7 +333,7 @@ func (c *regionBackendServicesRESTClient) GetHealth(ctx context.Context, req *co return rsp, nil } -// Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetBackendServiceResource() @@ -472,7 +472,7 @@ func (c *regionBackendServicesRESTClient) List(ctx context.Context, req *compute return it } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetBackendServiceResource() @@ -527,7 +527,7 @@ func (c *regionBackendServicesRESTClient) Patch(ctx context.Context, req *comput return op, err } -// Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetBackendServiceResource() diff --git a/compute/apiv1/region_commitments_client.go b/compute/apiv1/region_commitments_client.go index d34298da1b5..a9295a7774e 100644 --- a/compute/apiv1/region_commitments_client.go +++ b/compute/apiv1/region_commitments_client.go @@ -94,7 +94,7 @@ func (c *RegionCommitmentsClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// AggregatedList retrieves an aggregated list of commitments. +// AggregatedList retrieves an aggregated list of commitments by region. func (c *RegionCommitmentsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRegionCommitmentsRequest, opts ...gax.CallOption) *CommitmentsScopedListPairIterator { return c.internalClient.AggregatedList(ctx, req, opts...) } @@ -178,7 +178,7 @@ func (c *regionCommitmentsRESTClient) Connection() *grpc.ClientConn { return nil } -// AggregatedList retrieves an aggregated list of commitments. +// AggregatedList retrieves an aggregated list of commitments by region. func (c *regionCommitmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRegionCommitmentsRequest, opts ...gax.CallOption) *CommitmentsScopedListPairIterator { it := &CommitmentsScopedListPairIterator{} req = proto.Clone(req).(*computepb.AggregatedListRegionCommitmentsRequest) diff --git a/compute/apiv1/region_instance_group_managers_client.go b/compute/apiv1/region_instance_group_managers_client.go index 3dfc812b726..3c8b8be52fd 100644 --- a/compute/apiv1/region_instance_group_managers_client.go +++ b/compute/apiv1/region_instance_group_managers_client.go @@ -123,11 +123,7 @@ 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. +// 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) (*Operation, error) { return c.internalClient.AbandonInstances(ctx, req, opts...) } @@ -147,11 +143,7 @@ func (c *RegionInstanceGroupManagersClient) Delete(ctx context.Context, req *com 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. +// 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) (*Operation, error) { return c.internalClient.DeleteInstances(ctx, req, opts...) } @@ -166,9 +158,7 @@ func (c *RegionInstanceGroupManagersClient) Get(ctx context.Context, req *comput 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. +// 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) (*Operation, error) { return c.internalClient.Insert(ctx, req, opts...) } @@ -193,7 +183,7 @@ func (c *RegionInstanceGroupManagersClient) ListPerInstanceConfigs(ctx context.C 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. +// 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. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. func (c *RegionInstanceGroupManagersClient) Patch(ctx context.Context, req *computepb.PatchRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.Patch(ctx, req, opts...) } @@ -203,20 +193,12 @@ func (c *RegionInstanceGroupManagersClient) PatchPerInstanceConfigs(ctx context. 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. +// 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) (*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. +// 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) (*Operation, error) { return c.internalClient.Resize(ctx, req, opts...) } @@ -300,11 +282,7 @@ 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetRegionInstanceGroupManagersAbandonInstancesRequestResource() @@ -510,11 +488,7 @@ func (c *regionInstanceGroupManagersRESTClient) Delete(ctx context.Context, req return op, err } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetRegionInstanceGroupManagersDeleteInstancesRequestResource() @@ -657,9 +631,7 @@ func (c *regionInstanceGroupManagersRESTClient) Get(ctx context.Context, req *co return rsp, nil } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagerResource() @@ -1050,7 +1022,7 @@ func (c *regionInstanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx conte return it } -// 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. +// 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. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. func (c *regionInstanceGroupManagersRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetInstanceGroupManagerResource() @@ -1160,11 +1132,7 @@ func (c *regionInstanceGroupManagersRESTClient) PatchPerInstanceConfigs(ctx cont return op, err } -// 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. +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetRegionInstanceGroupManagersRecreateRequestResource() @@ -1219,11 +1187,7 @@ func (c *regionInstanceGroupManagersRESTClient) RecreateInstances(ctx context.Co return op, err } -// 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) diff --git a/compute/apiv1/region_operations_client.go b/compute/apiv1/region_operations_client.go index 23ec77ce169..189e64d5c24 100644 --- a/compute/apiv1/region_operations_client.go +++ b/compute/apiv1/region_operations_client.go @@ -107,13 +107,7 @@ func (c *RegionOperationsClient) List(ctx context.Context, req *computepb.ListRe 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. +// 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...) } @@ -346,13 +340,7 @@ func (c *regionOperationsRESTClient) List(ctx context.Context, req *computepb.Li return it } -// 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. +// 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v/wait", req.GetProject(), req.GetRegion(), req.GetOperation()) diff --git a/compute/apiv1/service_attachments_client.go b/compute/apiv1/service_attachments_client.go new file mode 100644 index 00000000000..d9a776d3258 --- /dev/null +++ b/compute/apiv1/service_attachments_client.go @@ -0,0 +1,831 @@ +// 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" + "math" + "net/http" + "net/url" + "sort" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/googleapi" + "google.golang.org/api/iterator" + "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" + "google.golang.org/protobuf/proto" +) + +var newServiceAttachmentsClientHook clientHook + +// ServiceAttachmentsCallOptions contains the retry settings for each method of ServiceAttachmentsClient. +type ServiceAttachmentsCallOptions struct { + AggregatedList []gax.CallOption + Delete []gax.CallOption + Get []gax.CallOption + GetIamPolicy []gax.CallOption + Insert []gax.CallOption + List []gax.CallOption + Patch []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +// internalServiceAttachmentsClient is an interface that defines the methods availaible from Google Compute Engine API. +type internalServiceAttachmentsClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + AggregatedList(context.Context, *computepb.AggregatedListServiceAttachmentsRequest, ...gax.CallOption) *ServiceAttachmentsScopedListPairIterator + Delete(context.Context, *computepb.DeleteServiceAttachmentRequest, ...gax.CallOption) (*Operation, error) + Get(context.Context, *computepb.GetServiceAttachmentRequest, ...gax.CallOption) (*computepb.ServiceAttachment, error) + GetIamPolicy(context.Context, *computepb.GetIamPolicyServiceAttachmentRequest, ...gax.CallOption) (*computepb.Policy, error) + Insert(context.Context, *computepb.InsertServiceAttachmentRequest, ...gax.CallOption) (*Operation, error) + List(context.Context, *computepb.ListServiceAttachmentsRequest, ...gax.CallOption) *ServiceAttachmentIterator + Patch(context.Context, *computepb.PatchServiceAttachmentRequest, ...gax.CallOption) (*Operation, error) + SetIamPolicy(context.Context, *computepb.SetIamPolicyServiceAttachmentRequest, ...gax.CallOption) (*computepb.Policy, error) + TestIamPermissions(context.Context, *computepb.TestIamPermissionsServiceAttachmentRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error) +} + +// ServiceAttachmentsClient 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 ServiceAttachments API. +type ServiceAttachmentsClient struct { + // The internal transport-dependent client. + internalClient internalServiceAttachmentsClient + + // The call options for this service. + CallOptions *ServiceAttachmentsCallOptions +} + +// 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 *ServiceAttachmentsClient) 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 *ServiceAttachmentsClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *ServiceAttachmentsClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// AggregatedList retrieves the list of all ServiceAttachment resources, regional and global, available to the specified project. +func (c *ServiceAttachmentsClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListServiceAttachmentsRequest, opts ...gax.CallOption) *ServiceAttachmentsScopedListPairIterator { + return c.internalClient.AggregatedList(ctx, req, opts...) +} + +// Delete deletes the specified ServiceAttachment in the given scope +func (c *ServiceAttachmentsClient) Delete(ctx context.Context, req *computepb.DeleteServiceAttachmentRequest, opts ...gax.CallOption) (*Operation, error) { + return c.internalClient.Delete(ctx, req, opts...) +} + +// Get returns the specified ServiceAttachment resource in the given scope. +func (c *ServiceAttachmentsClient) Get(ctx context.Context, req *computepb.GetServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.ServiceAttachment, 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 *ServiceAttachmentsClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// Insert creates a ServiceAttachment in the specified project in the given scope using the parameters that are included in the request. +func (c *ServiceAttachmentsClient) Insert(ctx context.Context, req *computepb.InsertServiceAttachmentRequest, opts ...gax.CallOption) (*Operation, error) { + return c.internalClient.Insert(ctx, req, opts...) +} + +// List lists the ServiceAttachments for a project in the given scope. +func (c *ServiceAttachmentsClient) List(ctx context.Context, req *computepb.ListServiceAttachmentsRequest, opts ...gax.CallOption) *ServiceAttachmentIterator { + return c.internalClient.List(ctx, req, opts...) +} + +// Patch patches the specified ServiceAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *ServiceAttachmentsClient) Patch(ctx context.Context, req *computepb.PatchServiceAttachmentRequest, opts ...gax.CallOption) (*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 *ServiceAttachmentsClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyServiceAttachmentRequest, 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 *ServiceAttachmentsClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsServiceAttachmentRequest, 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 serviceAttachmentsRESTClient 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 +} + +// NewServiceAttachmentsRESTClient creates a new service attachments rest client. +// +// The ServiceAttachments API. +func NewServiceAttachmentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ServiceAttachmentsClient, error) { + clientOpts := append(defaultServiceAttachmentsRESTClientOptions(), opts...) + httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) + if err != nil { + return nil, err + } + + c := &serviceAttachmentsRESTClient{ + endpoint: endpoint, + httpClient: httpClient, + } + c.setGoogleClientInfo() + + return &ServiceAttachmentsClient{internalClient: c, CallOptions: &ServiceAttachmentsCallOptions{}}, nil +} + +func defaultServiceAttachmentsRESTClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://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 *serviceAttachmentsRESTClient) 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 *serviceAttachmentsRESTClient) 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 *serviceAttachmentsRESTClient) Connection() *grpc.ClientConn { + return nil +} + +// AggregatedList retrieves the list of all ServiceAttachment resources, regional and global, available to the specified project. +func (c *serviceAttachmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListServiceAttachmentsRequest, opts ...gax.CallOption) *ServiceAttachmentsScopedListPairIterator { + it := &ServiceAttachmentsScopedListPairIterator{} + req = proto.Clone(req).(*computepb.AggregatedListServiceAttachmentsRequest) + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + it.InternalFetch = func(pageSize int, pageToken string) ([]ServiceAttachmentsScopedListPair, string, error) { + resp := &computepb.ServiceAttachmentAggregatedList{} + if pageToken != "" { + req.PageToken = proto.String(pageToken) + } + if pageSize > math.MaxInt32 { + req.MaxResults = proto.Uint32(math.MaxInt32) + } else if pageSize != 0 { + req.MaxResults = proto.Uint32(uint32(pageSize)) + } + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/serviceAttachments", 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(), nil) + if err != nil { + return nil, "", err + } + + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + + httpReq.Header["Content-Type"] = []string{"application/json"} + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, "", err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, "", err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, "", err + } + + unm.Unmarshal(buf, resp) + it.Response = resp + + elems := make([]ServiceAttachmentsScopedListPair, 0, len(resp.GetItems())) + for k, v := range resp.GetItems() { + elems = append(elems, ServiceAttachmentsScopedListPair{k, v}) + } + sort.Slice(elems, func(i, j int) bool { return elems[i].Key < elems[j].Key }) + + return elems, 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.GetMaxResults()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +// Delete deletes the specified ServiceAttachment in the given scope +func (c *serviceAttachmentsRESTClient) Delete(ctx context.Context, req *computepb.DeleteServiceAttachmentRequest, opts ...gax.CallOption) (*Operation, error) { + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/serviceAttachments/%v", req.GetProject(), req.GetRegion(), req.GetServiceAttachment()) + + 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(), nil) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + op := &Operation{proto: rsp} + return op, err +} + +// Get returns the specified ServiceAttachment resource in the given scope. +func (c *serviceAttachmentsRESTClient) Get(ctx context.Context, req *computepb.GetServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.ServiceAttachment, error) { + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/serviceAttachments/%v", req.GetProject(), req.GetRegion(), req.GetServiceAttachment()) + + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.ServiceAttachment{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} + +// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. +func (c *serviceAttachmentsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/serviceAttachments/%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(), nil) + if err != nil { + return nil, err + } + httpReq = httpReq.WithContext(ctx) + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + httpReq.Header["Content-Type"] = []string{"application/json"} + + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} + +// Insert creates a ServiceAttachment in the specified project in the given scope using the parameters that are included in the request. +func (c *serviceAttachmentsRESTClient) Insert(ctx context.Context, req *computepb.InsertServiceAttachmentRequest, opts ...gax.CallOption) (*Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true} + body := req.GetServiceAttachmentResource() + 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/serviceAttachments", 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 err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + op := &Operation{proto: rsp} + return op, err +} + +// List lists the ServiceAttachments for a project in the given scope. +func (c *serviceAttachmentsRESTClient) List(ctx context.Context, req *computepb.ListServiceAttachmentsRequest, opts ...gax.CallOption) *ServiceAttachmentIterator { + it := &ServiceAttachmentIterator{} + req = proto.Clone(req).(*computepb.ListServiceAttachmentsRequest) + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + it.InternalFetch = func(pageSize int, pageToken string) ([]*computepb.ServiceAttachment, string, error) { + resp := &computepb.ServiceAttachmentList{} + if pageToken != "" { + req.PageToken = proto.String(pageToken) + } + if pageSize > math.MaxInt32 { + req.MaxResults = proto.Uint32(math.MaxInt32) + } else if pageSize != 0 { + req.MaxResults = proto.Uint32(uint32(pageSize)) + } + baseUrl, _ := url.Parse(c.endpoint) + baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/serviceAttachments", 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(), nil) + if err != nil { + return nil, "", err + } + + // Set the headers + for k, v := range c.xGoogMetadata { + httpReq.Header[k] = v + } + + httpReq.Header["Content-Type"] = []string{"application/json"} + httpRsp, err := c.httpClient.Do(httpReq) + if err != nil { + return nil, "", err + } + defer httpRsp.Body.Close() + + if err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, "", err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, "", err + } + + unm.Unmarshal(buf, resp) + it.Response = resp + return resp.GetItems(), 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.GetMaxResults()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +// Patch patches the specified ServiceAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. +func (c *serviceAttachmentsRESTClient) Patch(ctx context.Context, req *computepb.PatchServiceAttachmentRequest, opts ...gax.CallOption) (*Operation, error) { + m := protojson.MarshalOptions{AllowPartial: true} + body := req.GetServiceAttachmentResource() + 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/serviceAttachments/%v", req.GetProject(), req.GetRegion(), req.GetServiceAttachment()) + + 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 err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Operation{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + op := &Operation{proto: rsp} + return op, err +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. +func (c *serviceAttachmentsRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.Policy, error) { + m := protojson.MarshalOptions{AllowPartial: 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/serviceAttachments/%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 err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.Policy{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. +func (c *serviceAttachmentsRESTClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsServiceAttachmentRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) { + m := protojson.MarshalOptions{AllowPartial: 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/serviceAttachments/%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 err = googleapi.CheckResponse(httpRsp); err != nil { + return nil, err + } + + buf, err := ioutil.ReadAll(httpRsp.Body) + if err != nil { + return nil, err + } + + unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} + rsp := &computepb.TestPermissionsResponse{} + + if err := unm.Unmarshal(buf, rsp); err != nil { + return nil, maybeUnknownEnum(err) + } + return rsp, nil +} + +// ServiceAttachmentIterator manages a stream of *computepb.ServiceAttachment. +type ServiceAttachmentIterator struct { + items []*computepb.ServiceAttachment + 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 []*computepb.ServiceAttachment, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ServiceAttachmentIterator) 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 *ServiceAttachmentIterator) Next() (*computepb.ServiceAttachment, error) { + var item *computepb.ServiceAttachment + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ServiceAttachmentIterator) bufLen() int { + return len(it.items) +} + +func (it *ServiceAttachmentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ServiceAttachmentsScopedListPair is a holder type for string/*computepb.ServiceAttachmentsScopedList map entries +type ServiceAttachmentsScopedListPair struct { + Key string + Value *computepb.ServiceAttachmentsScopedList +} + +// ServiceAttachmentsScopedListPairIterator manages a stream of ServiceAttachmentsScopedListPair. +type ServiceAttachmentsScopedListPairIterator struct { + items []ServiceAttachmentsScopedListPair + 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 []ServiceAttachmentsScopedListPair, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ServiceAttachmentsScopedListPairIterator) 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 *ServiceAttachmentsScopedListPairIterator) Next() (ServiceAttachmentsScopedListPair, error) { + var item ServiceAttachmentsScopedListPair + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ServiceAttachmentsScopedListPairIterator) bufLen() int { + return len(it.items) +} + +func (it *ServiceAttachmentsScopedListPairIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/compute/apiv1/service_attachments_client_example_test.go b/compute/apiv1/service_attachments_client_example_test.go new file mode 100644 index 00000000000..c8ab57274e8 --- /dev/null +++ b/compute/apiv1/service_attachments_client_example_test.go @@ -0,0 +1,229 @@ +// 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" + "google.golang.org/api/iterator" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func ExampleNewServiceAttachmentsRESTClient() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleServiceAttachmentsClient_AggregatedList() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListServiceAttachmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#AggregatedListServiceAttachmentsRequest. + } + it := c.AggregatedList(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleServiceAttachmentsClient_Delete() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#DeleteServiceAttachmentRequest. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_Get() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetServiceAttachmentRequest. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_GetIamPolicy() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetIamPolicyServiceAttachmentRequest. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_Insert() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#InsertServiceAttachmentRequest. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_List() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListServiceAttachmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#ListServiceAttachmentsRequest. + } + it := c.List(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleServiceAttachmentsClient_Patch() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#PatchServiceAttachmentRequest. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_SetIamPolicy() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#SetIamPolicyServiceAttachmentRequest. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleServiceAttachmentsClient_TestIamPermissions() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#TestIamPermissionsServiceAttachmentRequest. + } + resp, err := c.TestIamPermissions(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 index a731565dd4b..af716825b9d 100644 --- a/compute/apiv1/snapshots_client.go +++ b/compute/apiv1/snapshots_client.go @@ -99,9 +99,7 @@ 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. +// 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) (*Operation, error) { return c.internalClient.Delete(ctx, req, opts...) } @@ -200,9 +198,7 @@ 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. +// 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) (*Operation, error) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v", req.GetProject(), req.GetSnapshot()) diff --git a/compute/apiv1/target_http_proxies_client.go b/compute/apiv1/target_http_proxies_client.go index c1adc1fbbe1..eb3f1ef9949 100644 --- a/compute/apiv1/target_http_proxies_client.go +++ b/compute/apiv1/target_http_proxies_client.go @@ -125,7 +125,7 @@ func (c *TargetHttpProxiesClient) List(ctx context.Context, req *computepb.ListT 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 ==) +// 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. func (c *TargetHttpProxiesClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpProxyRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.Patch(ctx, req, opts...) } @@ -520,7 +520,7 @@ func (c *targetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.L return it } -// 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 ==) +// 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. func (c *targetHttpProxiesRESTClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpProxyRequest, opts ...gax.CallOption) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetTargetHttpProxyResource() diff --git a/compute/apiv1/target_https_proxies_client.go b/compute/apiv1/target_https_proxies_client.go index a4811c5bd61..e4f94335c79 100644 --- a/compute/apiv1/target_https_proxies_client.go +++ b/compute/apiv1/target_https_proxies_client.go @@ -131,7 +131,7 @@ func (c *TargetHttpsProxiesClient) List(ctx context.Context, req *computepb.List 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 ==) +// 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. func (c *TargetHttpsProxiesClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpsProxyRequest, opts ...gax.CallOption) (*Operation, error) { return c.internalClient.Patch(ctx, req, opts...) } @@ -541,7 +541,7 @@ func (c *targetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb. return it } -// 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 ==) +// 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. func (c *targetHttpsProxiesRESTClient) Patch(ctx context.Context, req *computepb.PatchTargetHttpsProxyRequest, opts ...gax.CallOption) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetTargetHttpsProxyResource() diff --git a/compute/apiv1/url_maps_client.go b/compute/apiv1/url_maps_client.go index 06632d0b13f..c4cfa137642 100644 --- a/compute/apiv1/url_maps_client.go +++ b/compute/apiv1/url_maps_client.go @@ -124,9 +124,7 @@ func (c *UrlMapsClient) Insert(ctx context.Context, req *computepb.InsertUrlMapR 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). +// 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) (*Operation, error) { return c.internalClient.InvalidateCache(ctx, req, opts...) } @@ -452,9 +450,7 @@ func (c *urlMapsRESTClient) Insert(ctx context.Context, req *computepb.InsertUrl return op, err } -// 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). +// 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) (*Operation, error) { m := protojson.MarshalOptions{AllowPartial: true} body := req.GetCacheInvalidationRuleResource() diff --git a/compute/apiv1/zone_operations_client.go b/compute/apiv1/zone_operations_client.go index be5b7f1126e..ee352449f22 100644 --- a/compute/apiv1/zone_operations_client.go +++ b/compute/apiv1/zone_operations_client.go @@ -107,13 +107,7 @@ func (c *ZoneOperationsClient) List(ctx context.Context, req *computepb.ListZone 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. +// 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 waits for no more than the 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...) } @@ -346,13 +340,7 @@ func (c *zoneOperationsRESTClient) List(ctx context.Context, req *computepb.List return it } -// 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. +// 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 waits for no more than the 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) { baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v/wait", req.GetProject(), req.GetZone(), req.GetOperation()) diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index f61ff95dc7b..15e90e33854 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -93,7 +93,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211030" +const versionClient = "20211104" 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 63b98af8191..80c9441e6b1 100644 --- a/dialogflow/cx/apiv3beta1/gapic_metadata.json +++ b/dialogflow/cx/apiv3beta1/gapic_metadata.json @@ -561,6 +561,11 @@ "grpc": { "libraryClient": "VersionsClient", "rpcs": { + "CompareVersions": { + "methods": [ + "CompareVersions" + ] + }, "CreateVersion": { "methods": [ "CreateVersion" diff --git a/dialogflow/cx/apiv3beta1/versions_client.go b/dialogflow/cx/apiv3beta1/versions_client.go index 6d1829102a6..d69e97465c8 100644 --- a/dialogflow/cx/apiv3beta1/versions_client.go +++ b/dialogflow/cx/apiv3beta1/versions_client.go @@ -43,12 +43,13 @@ var newVersionsClientHook clientHook // VersionsCallOptions contains the retry settings for each method of VersionsClient. type VersionsCallOptions struct { - ListVersions []gax.CallOption - GetVersion []gax.CallOption - CreateVersion []gax.CallOption - UpdateVersion []gax.CallOption - DeleteVersion []gax.CallOption - LoadVersion []gax.CallOption + ListVersions []gax.CallOption + GetVersion []gax.CallOption + CreateVersion []gax.CallOption + UpdateVersion []gax.CallOption + DeleteVersion []gax.CallOption + LoadVersion []gax.CallOption + CompareVersions []gax.CallOption } func defaultVersionsGRPCClientOptions() []option.ClientOption { @@ -132,6 +133,17 @@ func defaultVersionsCallOptions() *VersionsCallOptions { }) }), }, + CompareVersions: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -148,6 +160,7 @@ type internalVersionsClient interface { DeleteVersion(context.Context, *cxpb.DeleteVersionRequest, ...gax.CallOption) error LoadVersion(context.Context, *cxpb.LoadVersionRequest, ...gax.CallOption) (*LoadVersionOperation, error) LoadVersionOperation(name string) *LoadVersionOperation + CompareVersions(context.Context, *cxpb.CompareVersionsRequest, ...gax.CallOption) (*cxpb.CompareVersionsResponse, error) } // VersionsClient is a client for interacting with Dialogflow API. @@ -249,6 +262,11 @@ func (c *VersionsClient) LoadVersionOperation(name string) *LoadVersionOperation return c.internalClient.LoadVersionOperation(name) } +// CompareVersions compares the specified base version with target version. +func (c *VersionsClient) CompareVersions(ctx context.Context, req *cxpb.CompareVersionsRequest, opts ...gax.CallOption) (*cxpb.CompareVersionsResponse, error) { + return c.internalClient.CompareVersions(ctx, req, opts...) +} + // versionsGRPCClient is a client for interacting with Dialogflow API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -494,6 +512,27 @@ func (c *versionsGRPCClient) LoadVersion(ctx context.Context, req *cxpb.LoadVers }, nil } +func (c *versionsGRPCClient) CompareVersions(ctx context.Context, req *cxpb.CompareVersionsRequest, opts ...gax.CallOption) (*cxpb.CompareVersionsResponse, 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", "base_version", url.QueryEscape(req.GetBaseVersion()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CompareVersions[0:len((*c.CallOptions).CompareVersions):len((*c.CallOptions).CompareVersions)], opts...) + var resp *cxpb.CompareVersionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.versionsClient.CompareVersions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // CreateVersionOperation manages a long-running operation from CreateVersion. type CreateVersionOperation struct { lro *longrunning.Operation diff --git a/dialogflow/cx/apiv3beta1/versions_client_example_test.go b/dialogflow/cx/apiv3beta1/versions_client_example_test.go index b86043023e9..3da44b027e8 100644 --- a/dialogflow/cx/apiv3beta1/versions_client_example_test.go +++ b/dialogflow/cx/apiv3beta1/versions_client_example_test.go @@ -167,3 +167,23 @@ func ExampleVersionsClient_LoadVersion() { // TODO: Handle error. } } + +func ExampleVersionsClient_CompareVersions() { + ctx := context.Background() + c, err := cx.NewVersionsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.CompareVersionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1#CompareVersionsRequest. + } + resp, err := c.CompareVersions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dialogflow/go.mod b/dialogflow/go.mod index 1c5386f0efb..ef878593b24 100644 --- a/dialogflow/go.mod +++ b/dialogflow/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/dialogflow/go.sum b/dialogflow/go.sum index 4a0ee7cc155..24ce3cdb506 100644 --- a/dialogflow/go.sum +++ b/dialogflow/go.sum @@ -503,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 h1:vum3nDKdleYb+aePXKFEDT2+ghuH00EgYp9B7Q7EZZE= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/go.mod b/go.mod index ace27340295..9f1337bf1ec 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index b8d4894c09e..9204426bda9 100644 --- a/go.sum +++ b/go.sum @@ -511,8 +511,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c h1:UQDUEuW1R2dcciOjiFmuzE4skW4n/zGGNMU0RhU3hQI= -google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/compute/apiv1/ImageFamilyViewsClient/Get/main.go b/internal/generated/snippets/compute/apiv1/ImageFamilyViewsClient/Get/main.go new file mode 100644 index 00000000000..f139c09ad99 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ImageFamilyViewsClient/Get/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ImageFamilyViews_Get_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewImageFamilyViewsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetImageFamilyViewRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetImageFamilyViewRequest. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ImageFamilyViews_Get_sync] diff --git a/internal/generated/snippets/compute/apiv1/InstancesClient/SendDiagnosticInterrupt/main.go b/internal/generated/snippets/compute/apiv1/InstancesClient/SendDiagnosticInterrupt/main.go new file mode 100644 index 00000000000..9f8d682cae4 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/InstancesClient/SendDiagnosticInterrupt/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_Instances_SendDiagnosticInterrupt_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewInstancesRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SendDiagnosticInterruptInstanceRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#SendDiagnosticInterruptInstanceRequest. + } + resp, err := c.SendDiagnosticInterrupt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_Instances_SendDiagnosticInterrupt_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/AggregatedList/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/AggregatedList/main.go new file mode 100644 index 00000000000..fb4f655162b --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/AggregatedList/main.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 +// +// 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 compute_v1_generated_ServiceAttachments_AggregatedList_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + "google.golang.org/api/iterator" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.AggregatedListServiceAttachmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#AggregatedListServiceAttachmentsRequest. + } + it := c.AggregatedList(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END compute_v1_generated_ServiceAttachments_AggregatedList_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Delete/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Delete/main.go new file mode 100644 index 00000000000..7077e4d251a --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Delete/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_Delete_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.DeleteServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#DeleteServiceAttachmentRequest. + } + resp, err := c.Delete(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_Delete_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Get/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Get/main.go new file mode 100644 index 00000000000..e0bab3e429c --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Get/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_Get_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetServiceAttachmentRequest. + } + resp, err := c.Get(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_Get_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/GetIamPolicy/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/GetIamPolicy/main.go new file mode 100644 index 00000000000..0686c38a4db --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/GetIamPolicy/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_GetIamPolicy_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.GetIamPolicyServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#GetIamPolicyServiceAttachmentRequest. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_GetIamPolicy_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Insert/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Insert/main.go new file mode 100644 index 00000000000..db304295723 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Insert/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_Insert_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.InsertServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#InsertServiceAttachmentRequest. + } + resp, err := c.Insert(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_Insert_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/List/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/List/main.go new file mode 100644 index 00000000000..7e03df3df72 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/List/main.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 +// +// 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 compute_v1_generated_ServiceAttachments_List_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + "google.golang.org/api/iterator" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.ListServiceAttachmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#ListServiceAttachmentsRequest. + } + it := c.List(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END compute_v1_generated_ServiceAttachments_List_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Patch/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Patch/main.go new file mode 100644 index 00000000000..fc4a57555b6 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/Patch/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_Patch_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.PatchServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#PatchServiceAttachmentRequest. + } + resp, err := c.Patch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_Patch_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/SetIamPolicy/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/SetIamPolicy/main.go new file mode 100644 index 00000000000..1dd26e44a85 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/SetIamPolicy/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_SetIamPolicy_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.SetIamPolicyServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#SetIamPolicyServiceAttachmentRequest. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_SetIamPolicy_sync] diff --git a/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/TestIamPermissions/main.go b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/TestIamPermissions/main.go new file mode 100644 index 00000000000..13ebdaca8c7 --- /dev/null +++ b/internal/generated/snippets/compute/apiv1/ServiceAttachmentsClient/TestIamPermissions/main.go @@ -0,0 +1,48 @@ +// 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 compute_v1_generated_ServiceAttachments_TestIamPermissions_sync] + +package main + +import ( + "context" + + compute "cloud.google.com/go/compute/apiv1" + computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" +) + +func main() { + ctx := context.Background() + c, err := compute.NewServiceAttachmentsRESTClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &computepb.TestIamPermissionsServiceAttachmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#TestIamPermissionsServiceAttachmentRequest. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END compute_v1_generated_ServiceAttachments_TestIamPermissions_sync] diff --git a/internal/generated/snippets/dialogflow/cx/apiv3beta1/VersionsClient/CompareVersions/main.go b/internal/generated/snippets/dialogflow/cx/apiv3beta1/VersionsClient/CompareVersions/main.go new file mode 100644 index 00000000000..a84114a2e4e --- /dev/null +++ b/internal/generated/snippets/dialogflow/cx/apiv3beta1/VersionsClient/CompareVersions/main.go @@ -0,0 +1,48 @@ +// 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 dialogflow_v3beta1_generated_Versions_CompareVersions_sync] + +package main + +import ( + "context" + + cx "cloud.google.com/go/dialogflow/cx/apiv3beta1" + cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1" +) + +func main() { + ctx := context.Background() + c, err := cx.NewVersionsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.CompareVersionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1#CompareVersionsRequest. + } + resp, err := c.CompareVersions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dialogflow_v3beta1_generated_Versions_CompareVersions_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index cea269ac1d3..bc42a151785 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -125,7 +125,7 @@ require ( cloud.google.com/go/websecurityscanner v0.1.0 cloud.google.com/go/workflows v0.1.0 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index fa518beabc5..a81deca0dee 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -165,8 +165,9 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c h1:UQDUEuW1R2dcciOjiFmuzE4skW4n/zGGNMU0RhU3hQI= google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/osconfig/apiv1/OsConfigZonalClient/CreateOSPolicyAssignment/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/CreateOSPolicyAssignment/main.go new file mode 100644 index 00000000000..a7c271e791d --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/CreateOSPolicyAssignment/main.go @@ -0,0 +1,53 @@ +// 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 osconfig_v1_generated_OsConfigZonalService_CreateOSPolicyAssignment_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.CreateOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#CreateOSPolicyAssignmentRequest. + } + op, err := c.CreateOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END osconfig_v1_generated_OsConfigZonalService_CreateOSPolicyAssignment_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/DeleteOSPolicyAssignment/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/DeleteOSPolicyAssignment/main.go new file mode 100644 index 00000000000..a9a9bb70827 --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/DeleteOSPolicyAssignment/main.go @@ -0,0 +1,51 @@ +// 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 osconfig_v1_generated_OsConfigZonalService_DeleteOSPolicyAssignment_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.DeleteOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#DeleteOSPolicyAssignmentRequest. + } + op, err := c.DeleteOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END osconfig_v1_generated_OsConfigZonalService_DeleteOSPolicyAssignment_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignment/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignment/main.go new file mode 100644 index 00000000000..07c81e5913f --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignment/main.go @@ -0,0 +1,48 @@ +// 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 osconfig_v1_generated_OsConfigZonalService_GetOSPolicyAssignment_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.GetOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentRequest. + } + resp, err := c.GetOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END osconfig_v1_generated_OsConfigZonalService_GetOSPolicyAssignment_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignmentReport/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignmentReport/main.go new file mode 100644 index 00000000000..09b9baee8ee --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/GetOSPolicyAssignmentReport/main.go @@ -0,0 +1,48 @@ +// 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 osconfig_v1_generated_OsConfigZonalService_GetOSPolicyAssignmentReport_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.GetOSPolicyAssignmentReportRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentReportRequest. + } + resp, err := c.GetOSPolicyAssignmentReport(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END osconfig_v1_generated_OsConfigZonalService_GetOSPolicyAssignmentReport_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentReports/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentReports/main.go new file mode 100644 index 00000000000..c4372e3da67 --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentReports/main.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 +// +// 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 osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignmentReports_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + "google.golang.org/api/iterator" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentReportsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentReportsRequest. + } + it := c.ListOSPolicyAssignmentReports(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignmentReports_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentRevisions/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentRevisions/main.go new file mode 100644 index 00000000000..6ef099a66d1 --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignmentRevisions/main.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 +// +// 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 osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignmentRevisions_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + "google.golang.org/api/iterator" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentRevisionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentRevisionsRequest. + } + it := c.ListOSPolicyAssignmentRevisions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignmentRevisions_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignments/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignments/main.go new file mode 100644 index 00000000000..160b052c695 --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/ListOSPolicyAssignments/main.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 +// +// 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 osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignments_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + "google.golang.org/api/iterator" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentsRequest. + } + it := c.ListOSPolicyAssignments(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END osconfig_v1_generated_OsConfigZonalService_ListOSPolicyAssignments_sync] diff --git a/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/UpdateOSPolicyAssignment/main.go b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/UpdateOSPolicyAssignment/main.go new file mode 100644 index 00000000000..ee6a6a623c9 --- /dev/null +++ b/internal/generated/snippets/osconfig/apiv1/OsConfigZonalClient/UpdateOSPolicyAssignment/main.go @@ -0,0 +1,53 @@ +// 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 osconfig_v1_generated_OsConfigZonalService_UpdateOSPolicyAssignment_sync] + +package main + +import ( + "context" + + osconfig "cloud.google.com/go/osconfig/apiv1" + osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" +) + +func main() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.UpdateOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#UpdateOSPolicyAssignmentRequest. + } + op, err := c.UpdateOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END osconfig_v1_generated_OsConfigZonalService_UpdateOSPolicyAssignment_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 5cff44f52da..c72f23206fa 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -326,8 +326,8 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c h1:UQDUEuW1R2dcciOjiFmuzE4skW4n/zGGNMU0RhU3hQI= -google.golang.org/genproto v0.0.0-20211102202547-e9cf271f7f2c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index 00ed4788367..0237feba18e 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -85,7 +85,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211030" +const versionClient = "20211104" 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 c24a5a3b61d..713630a4d2c 100644 --- a/osconfig/apiv1/gapic_metadata.json +++ b/osconfig/apiv1/gapic_metadata.json @@ -64,11 +64,31 @@ "grpc": { "libraryClient": "OsConfigZonalClient", "rpcs": { + "CreateOSPolicyAssignment": { + "methods": [ + "CreateOSPolicyAssignment" + ] + }, + "DeleteOSPolicyAssignment": { + "methods": [ + "DeleteOSPolicyAssignment" + ] + }, "GetInventory": { "methods": [ "GetInventory" ] }, + "GetOSPolicyAssignment": { + "methods": [ + "GetOSPolicyAssignment" + ] + }, + "GetOSPolicyAssignmentReport": { + "methods": [ + "GetOSPolicyAssignmentReport" + ] + }, "GetVulnerabilityReport": { "methods": [ "GetVulnerabilityReport" @@ -79,10 +99,30 @@ "ListInventories" ] }, + "ListOSPolicyAssignmentReports": { + "methods": [ + "ListOSPolicyAssignmentReports" + ] + }, + "ListOSPolicyAssignmentRevisions": { + "methods": [ + "ListOSPolicyAssignmentRevisions" + ] + }, + "ListOSPolicyAssignments": { + "methods": [ + "ListOSPolicyAssignments" + ] + }, "ListVulnerabilityReports": { "methods": [ "ListVulnerabilityReports" ] + }, + "UpdateOSPolicyAssignment": { + "methods": [ + "UpdateOSPolicyAssignment" + ] } } } diff --git a/osconfig/apiv1/os_config_zonal_client.go b/osconfig/apiv1/os_config_zonal_client.go index 412012602f4..2182c2ac83c 100644 --- a/osconfig/apiv1/os_config_zonal_client.go +++ b/osconfig/apiv1/os_config_zonal_client.go @@ -23,12 +23,15 @@ import ( "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" osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -39,10 +42,18 @@ var newOsConfigZonalClientHook clientHook // OsConfigZonalCallOptions contains the retry settings for each method of OsConfigZonalClient. type OsConfigZonalCallOptions struct { - GetInventory []gax.CallOption - ListInventories []gax.CallOption - GetVulnerabilityReport []gax.CallOption - ListVulnerabilityReports []gax.CallOption + CreateOSPolicyAssignment []gax.CallOption + UpdateOSPolicyAssignment []gax.CallOption + GetOSPolicyAssignment []gax.CallOption + ListOSPolicyAssignments []gax.CallOption + ListOSPolicyAssignmentRevisions []gax.CallOption + DeleteOSPolicyAssignment []gax.CallOption + GetOSPolicyAssignmentReport []gax.CallOption + ListOSPolicyAssignmentReports []gax.CallOption + GetInventory []gax.CallOption + ListInventories []gax.CallOption + GetVulnerabilityReport []gax.CallOption + ListVulnerabilityReports []gax.CallOption } func defaultOsConfigZonalGRPCClientOptions() []option.ClientOption { @@ -60,6 +71,94 @@ func defaultOsConfigZonalGRPCClientOptions() []option.ClientOption { func defaultOsConfigZonalCallOptions() *OsConfigZonalCallOptions { return &OsConfigZonalCallOptions{ + CreateOSPolicyAssignment: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateOSPolicyAssignment: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetOSPolicyAssignment: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListOSPolicyAssignments: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListOSPolicyAssignmentRevisions: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteOSPolicyAssignment: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetOSPolicyAssignmentReport: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListOSPolicyAssignmentReports: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, GetInventory: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -112,6 +211,17 @@ type internalOsConfigZonalClient interface { Close() error setGoogleClientInfo(...string) Connection() *grpc.ClientConn + CreateOSPolicyAssignment(context.Context, *osconfigpb.CreateOSPolicyAssignmentRequest, ...gax.CallOption) (*CreateOSPolicyAssignmentOperation, error) + CreateOSPolicyAssignmentOperation(name string) *CreateOSPolicyAssignmentOperation + UpdateOSPolicyAssignment(context.Context, *osconfigpb.UpdateOSPolicyAssignmentRequest, ...gax.CallOption) (*UpdateOSPolicyAssignmentOperation, error) + UpdateOSPolicyAssignmentOperation(name string) *UpdateOSPolicyAssignmentOperation + GetOSPolicyAssignment(context.Context, *osconfigpb.GetOSPolicyAssignmentRequest, ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) + ListOSPolicyAssignments(context.Context, *osconfigpb.ListOSPolicyAssignmentsRequest, ...gax.CallOption) *OSPolicyAssignmentIterator + ListOSPolicyAssignmentRevisions(context.Context, *osconfigpb.ListOSPolicyAssignmentRevisionsRequest, ...gax.CallOption) *OSPolicyAssignmentIterator + DeleteOSPolicyAssignment(context.Context, *osconfigpb.DeleteOSPolicyAssignmentRequest, ...gax.CallOption) (*DeleteOSPolicyAssignmentOperation, error) + DeleteOSPolicyAssignmentOperation(name string) *DeleteOSPolicyAssignmentOperation + GetOSPolicyAssignmentReport(context.Context, *osconfigpb.GetOSPolicyAssignmentReportRequest, ...gax.CallOption) (*osconfigpb.OSPolicyAssignmentReport, error) + ListOSPolicyAssignmentReports(context.Context, *osconfigpb.ListOSPolicyAssignmentReportsRequest, ...gax.CallOption) *OSPolicyAssignmentReportIterator GetInventory(context.Context, *osconfigpb.GetInventoryRequest, ...gax.CallOption) (*osconfigpb.Inventory, error) ListInventories(context.Context, *osconfigpb.ListInventoriesRequest, ...gax.CallOption) *InventoryIterator GetVulnerabilityReport(context.Context, *osconfigpb.GetVulnerabilityReportRequest, ...gax.CallOption) (*osconfigpb.VulnerabilityReport, error) @@ -131,6 +241,11 @@ type OsConfigZonalClient struct { // The call options for this service. CallOptions *OsConfigZonalCallOptions + + // 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. @@ -155,6 +270,99 @@ func (c *OsConfigZonalClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } +// CreateOSPolicyAssignment create an OS policy assignment. +// +// This method also creates the first revision of the OS policy assignment. +// +// This method returns a long running operation (LRO) that contains the +// rollout details. The rollout can be cancelled by cancelling the LRO. +// +// For more information, see Method: +// projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). +func (c *OsConfigZonalClient) CreateOSPolicyAssignment(ctx context.Context, req *osconfigpb.CreateOSPolicyAssignmentRequest, opts ...gax.CallOption) (*CreateOSPolicyAssignmentOperation, error) { + return c.internalClient.CreateOSPolicyAssignment(ctx, req, opts...) +} + +// CreateOSPolicyAssignmentOperation returns a new CreateOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created CreateOSPolicyAssignmentOperation, possibly from a different process. +func (c *OsConfigZonalClient) CreateOSPolicyAssignmentOperation(name string) *CreateOSPolicyAssignmentOperation { + return c.internalClient.CreateOSPolicyAssignmentOperation(name) +} + +// UpdateOSPolicyAssignment update an existing OS policy assignment. +// +// This method creates a new revision of the OS policy assignment. +// +// This method returns a long running operation (LRO) that contains the +// rollout details. The rollout can be cancelled by cancelling the LRO. +// +// For more information, see Method: +// projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). +func (c *OsConfigZonalClient) UpdateOSPolicyAssignment(ctx context.Context, req *osconfigpb.UpdateOSPolicyAssignmentRequest, opts ...gax.CallOption) (*UpdateOSPolicyAssignmentOperation, error) { + return c.internalClient.UpdateOSPolicyAssignment(ctx, req, opts...) +} + +// UpdateOSPolicyAssignmentOperation returns a new UpdateOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created UpdateOSPolicyAssignmentOperation, possibly from a different process. +func (c *OsConfigZonalClient) UpdateOSPolicyAssignmentOperation(name string) *UpdateOSPolicyAssignmentOperation { + return c.internalClient.UpdateOSPolicyAssignmentOperation(name) +} + +// GetOSPolicyAssignment retrieve an existing OS policy assignment. +// +// This method always returns the latest revision. In order to retrieve a +// previous revision of the assignment, also provide the revision ID in the +// name parameter. +func (c *OsConfigZonalClient) GetOSPolicyAssignment(ctx context.Context, req *osconfigpb.GetOSPolicyAssignmentRequest, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) { + return c.internalClient.GetOSPolicyAssignment(ctx, req, opts...) +} + +// ListOSPolicyAssignments list the OS policy assignments under the parent resource. +// +// For each OS policy assignment, the latest revision is returned. +func (c *OsConfigZonalClient) ListOSPolicyAssignments(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentsRequest, opts ...gax.CallOption) *OSPolicyAssignmentIterator { + return c.internalClient.ListOSPolicyAssignments(ctx, req, opts...) +} + +// ListOSPolicyAssignmentRevisions list the OS policy assignment revisions for a given OS policy assignment. +func (c *OsConfigZonalClient) ListOSPolicyAssignmentRevisions(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentRevisionsRequest, opts ...gax.CallOption) *OSPolicyAssignmentIterator { + return c.internalClient.ListOSPolicyAssignmentRevisions(ctx, req, opts...) +} + +// DeleteOSPolicyAssignment delete the OS policy assignment. +// +// This method creates a new revision of the OS policy assignment. +// +// This method returns a long running operation (LRO) that contains the +// rollout details. The rollout can be cancelled by cancelling the LRO. +// +// If the LRO completes and is not cancelled, all revisions associated with +// the OS policy assignment are deleted. +// +// For more information, see Method: +// projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). +func (c *OsConfigZonalClient) DeleteOSPolicyAssignment(ctx context.Context, req *osconfigpb.DeleteOSPolicyAssignmentRequest, opts ...gax.CallOption) (*DeleteOSPolicyAssignmentOperation, error) { + return c.internalClient.DeleteOSPolicyAssignment(ctx, req, opts...) +} + +// DeleteOSPolicyAssignmentOperation returns a new DeleteOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created DeleteOSPolicyAssignmentOperation, possibly from a different process. +func (c *OsConfigZonalClient) DeleteOSPolicyAssignmentOperation(name string) *DeleteOSPolicyAssignmentOperation { + return c.internalClient.DeleteOSPolicyAssignmentOperation(name) +} + +// GetOSPolicyAssignmentReport get the OS policy asssignment report for the specified Compute Engine VM +// instance. +func (c *OsConfigZonalClient) GetOSPolicyAssignmentReport(ctx context.Context, req *osconfigpb.GetOSPolicyAssignmentReportRequest, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignmentReport, error) { + return c.internalClient.GetOSPolicyAssignmentReport(ctx, req, opts...) +} + +// ListOSPolicyAssignmentReports list OS policy asssignment reports for all Compute Engine VM instances in +// the specified zone. +func (c *OsConfigZonalClient) ListOSPolicyAssignmentReports(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentReportsRequest, opts ...gax.CallOption) *OSPolicyAssignmentReportIterator { + return c.internalClient.ListOSPolicyAssignmentReports(ctx, req, opts...) +} + // GetInventory get inventory data for the specified VM instance. If the VM has no // associated inventory, the message NOT_FOUND is returned. func (c *OsConfigZonalClient) GetInventory(ctx context.Context, req *osconfigpb.GetInventoryRequest, opts ...gax.CallOption) (*osconfigpb.Inventory, error) { @@ -193,6 +401,11 @@ type osConfigZonalGRPCClient struct { // The gRPC API client. osConfigZonalClient osconfigpb.OsConfigZonalServiceClient + // 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 } @@ -235,6 +448,17 @@ func NewOsConfigZonalClient(ctx context.Context, opts ...option.ClientOption) (* 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 } @@ -260,6 +484,249 @@ func (c *osConfigZonalGRPCClient) Close() error { return c.connPool.Close() } +func (c *osConfigZonalGRPCClient) CreateOSPolicyAssignment(ctx context.Context, req *osconfigpb.CreateOSPolicyAssignmentRequest, opts ...gax.CallOption) (*CreateOSPolicyAssignmentOperation, 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).CreateOSPolicyAssignment[0:len((*c.CallOptions).CreateOSPolicyAssignment):len((*c.CallOptions).CreateOSPolicyAssignment)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.CreateOSPolicyAssignment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateOSPolicyAssignmentOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *osConfigZonalGRPCClient) UpdateOSPolicyAssignment(ctx context.Context, req *osconfigpb.UpdateOSPolicyAssignmentRequest, opts ...gax.CallOption) (*UpdateOSPolicyAssignmentOperation, 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", "os_policy_assignment.name", url.QueryEscape(req.GetOsPolicyAssignment().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateOSPolicyAssignment[0:len((*c.CallOptions).UpdateOSPolicyAssignment):len((*c.CallOptions).UpdateOSPolicyAssignment)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.UpdateOSPolicyAssignment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateOSPolicyAssignmentOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *osConfigZonalGRPCClient) GetOSPolicyAssignment(ctx context.Context, req *osconfigpb.GetOSPolicyAssignmentRequest, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, 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).GetOSPolicyAssignment[0:len((*c.CallOptions).GetOSPolicyAssignment):len((*c.CallOptions).GetOSPolicyAssignment)], opts...) + var resp *osconfigpb.OSPolicyAssignment + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.GetOSPolicyAssignment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *osConfigZonalGRPCClient) ListOSPolicyAssignments(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentsRequest, opts ...gax.CallOption) *OSPolicyAssignmentIterator { + 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).ListOSPolicyAssignments[0:len((*c.CallOptions).ListOSPolicyAssignments):len((*c.CallOptions).ListOSPolicyAssignments)], opts...) + it := &OSPolicyAssignmentIterator{} + req = proto.Clone(req).(*osconfigpb.ListOSPolicyAssignmentsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*osconfigpb.OSPolicyAssignment, string, error) { + resp := &osconfigpb.ListOSPolicyAssignmentsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.ListOSPolicyAssignments(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetOsPolicyAssignments(), 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 *osConfigZonalGRPCClient) ListOSPolicyAssignmentRevisions(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentRevisionsRequest, opts ...gax.CallOption) *OSPolicyAssignmentIterator { + 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).ListOSPolicyAssignmentRevisions[0:len((*c.CallOptions).ListOSPolicyAssignmentRevisions):len((*c.CallOptions).ListOSPolicyAssignmentRevisions)], opts...) + it := &OSPolicyAssignmentIterator{} + req = proto.Clone(req).(*osconfigpb.ListOSPolicyAssignmentRevisionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*osconfigpb.OSPolicyAssignment, string, error) { + resp := &osconfigpb.ListOSPolicyAssignmentRevisionsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.ListOSPolicyAssignmentRevisions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetOsPolicyAssignments(), 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 *osConfigZonalGRPCClient) DeleteOSPolicyAssignment(ctx context.Context, req *osconfigpb.DeleteOSPolicyAssignmentRequest, opts ...gax.CallOption) (*DeleteOSPolicyAssignmentOperation, 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).DeleteOSPolicyAssignment[0:len((*c.CallOptions).DeleteOSPolicyAssignment):len((*c.CallOptions).DeleteOSPolicyAssignment)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.DeleteOSPolicyAssignment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteOSPolicyAssignmentOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *osConfigZonalGRPCClient) GetOSPolicyAssignmentReport(ctx context.Context, req *osconfigpb.GetOSPolicyAssignmentReportRequest, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignmentReport, 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).GetOSPolicyAssignmentReport[0:len((*c.CallOptions).GetOSPolicyAssignmentReport):len((*c.CallOptions).GetOSPolicyAssignmentReport)], opts...) + var resp *osconfigpb.OSPolicyAssignmentReport + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.GetOSPolicyAssignmentReport(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *osConfigZonalGRPCClient) ListOSPolicyAssignmentReports(ctx context.Context, req *osconfigpb.ListOSPolicyAssignmentReportsRequest, opts ...gax.CallOption) *OSPolicyAssignmentReportIterator { + 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).ListOSPolicyAssignmentReports[0:len((*c.CallOptions).ListOSPolicyAssignmentReports):len((*c.CallOptions).ListOSPolicyAssignmentReports)], opts...) + it := &OSPolicyAssignmentReportIterator{} + req = proto.Clone(req).(*osconfigpb.ListOSPolicyAssignmentReportsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*osconfigpb.OSPolicyAssignmentReport, string, error) { + resp := &osconfigpb.ListOSPolicyAssignmentReportsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.osConfigZonalClient.ListOSPolicyAssignmentReports(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetOsPolicyAssignmentReports(), 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 *osConfigZonalGRPCClient) GetInventory(ctx context.Context, req *osconfigpb.GetInventoryRequest, opts ...gax.CallOption) (*osconfigpb.Inventory, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -390,6 +857,202 @@ func (c *osConfigZonalGRPCClient) ListVulnerabilityReports(ctx context.Context, return it } +// CreateOSPolicyAssignmentOperation manages a long-running operation from CreateOSPolicyAssignment. +type CreateOSPolicyAssignmentOperation struct { + lro *longrunning.Operation +} + +// CreateOSPolicyAssignmentOperation returns a new CreateOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created CreateOSPolicyAssignmentOperation, possibly from a different process. +func (c *osConfigZonalGRPCClient) CreateOSPolicyAssignmentOperation(name string) *CreateOSPolicyAssignmentOperation { + return &CreateOSPolicyAssignmentOperation{ + 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 *CreateOSPolicyAssignmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) { + var resp osconfigpb.OSPolicyAssignment + 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 *CreateOSPolicyAssignmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) { + var resp osconfigpb.OSPolicyAssignment + 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 *CreateOSPolicyAssignmentOperation) Metadata() (*osconfigpb.OSPolicyAssignmentOperationMetadata, error) { + var meta osconfigpb.OSPolicyAssignmentOperationMetadata + 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 *CreateOSPolicyAssignmentOperation) 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 *CreateOSPolicyAssignmentOperation) Name() string { + return op.lro.Name() +} + +// DeleteOSPolicyAssignmentOperation manages a long-running operation from DeleteOSPolicyAssignment. +type DeleteOSPolicyAssignmentOperation struct { + lro *longrunning.Operation +} + +// DeleteOSPolicyAssignmentOperation returns a new DeleteOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created DeleteOSPolicyAssignmentOperation, possibly from a different process. +func (c *osConfigZonalGRPCClient) DeleteOSPolicyAssignmentOperation(name string) *DeleteOSPolicyAssignmentOperation { + return &DeleteOSPolicyAssignmentOperation{ + 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 *DeleteOSPolicyAssignmentOperation) 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 *DeleteOSPolicyAssignmentOperation) 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 *DeleteOSPolicyAssignmentOperation) Metadata() (*osconfigpb.OSPolicyAssignmentOperationMetadata, error) { + var meta osconfigpb.OSPolicyAssignmentOperationMetadata + 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 *DeleteOSPolicyAssignmentOperation) 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 *DeleteOSPolicyAssignmentOperation) Name() string { + return op.lro.Name() +} + +// UpdateOSPolicyAssignmentOperation manages a long-running operation from UpdateOSPolicyAssignment. +type UpdateOSPolicyAssignmentOperation struct { + lro *longrunning.Operation +} + +// UpdateOSPolicyAssignmentOperation returns a new UpdateOSPolicyAssignmentOperation from a given name. +// The name must be that of a previously created UpdateOSPolicyAssignmentOperation, possibly from a different process. +func (c *osConfigZonalGRPCClient) UpdateOSPolicyAssignmentOperation(name string) *UpdateOSPolicyAssignmentOperation { + return &UpdateOSPolicyAssignmentOperation{ + 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 *UpdateOSPolicyAssignmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) { + var resp osconfigpb.OSPolicyAssignment + 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 *UpdateOSPolicyAssignmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*osconfigpb.OSPolicyAssignment, error) { + var resp osconfigpb.OSPolicyAssignment + 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 *UpdateOSPolicyAssignmentOperation) Metadata() (*osconfigpb.OSPolicyAssignmentOperationMetadata, error) { + var meta osconfigpb.OSPolicyAssignmentOperationMetadata + 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 *UpdateOSPolicyAssignmentOperation) 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 *UpdateOSPolicyAssignmentOperation) Name() string { + return op.lro.Name() +} + // InventoryIterator manages a stream of *osconfigpb.Inventory. type InventoryIterator struct { items []*osconfigpb.Inventory @@ -437,6 +1100,100 @@ func (it *InventoryIterator) takeBuf() interface{} { return b } +// OSPolicyAssignmentIterator manages a stream of *osconfigpb.OSPolicyAssignment. +type OSPolicyAssignmentIterator struct { + items []*osconfigpb.OSPolicyAssignment + 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 []*osconfigpb.OSPolicyAssignment, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *OSPolicyAssignmentIterator) 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 *OSPolicyAssignmentIterator) Next() (*osconfigpb.OSPolicyAssignment, error) { + var item *osconfigpb.OSPolicyAssignment + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *OSPolicyAssignmentIterator) bufLen() int { + return len(it.items) +} + +func (it *OSPolicyAssignmentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// OSPolicyAssignmentReportIterator manages a stream of *osconfigpb.OSPolicyAssignmentReport. +type OSPolicyAssignmentReportIterator struct { + items []*osconfigpb.OSPolicyAssignmentReport + 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 []*osconfigpb.OSPolicyAssignmentReport, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *OSPolicyAssignmentReportIterator) 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 *OSPolicyAssignmentReportIterator) Next() (*osconfigpb.OSPolicyAssignmentReport, error) { + var item *osconfigpb.OSPolicyAssignmentReport + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *OSPolicyAssignmentReportIterator) bufLen() int { + return len(it.items) +} + +func (it *OSPolicyAssignmentReportIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // VulnerabilityReportIterator manages a stream of *osconfigpb.VulnerabilityReport. type VulnerabilityReportIterator struct { items []*osconfigpb.VulnerabilityReport diff --git a/osconfig/apiv1/os_config_zonal_client_example_test.go b/osconfig/apiv1/os_config_zonal_client_example_test.go index f79f329a391..42c26837977 100644 --- a/osconfig/apiv1/os_config_zonal_client_example_test.go +++ b/osconfig/apiv1/os_config_zonal_client_example_test.go @@ -36,6 +36,197 @@ func ExampleNewOsConfigZonalClient() { _ = c } +func ExampleOsConfigZonalClient_CreateOSPolicyAssignment() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.CreateOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#CreateOSPolicyAssignmentRequest. + } + op, err := c.CreateOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleOsConfigZonalClient_UpdateOSPolicyAssignment() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.UpdateOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#UpdateOSPolicyAssignmentRequest. + } + op, err := c.UpdateOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleOsConfigZonalClient_GetOSPolicyAssignment() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.GetOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentRequest. + } + resp, err := c.GetOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleOsConfigZonalClient_ListOSPolicyAssignments() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentsRequest. + } + it := c.ListOSPolicyAssignments(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleOsConfigZonalClient_ListOSPolicyAssignmentRevisions() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentRevisionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentRevisionsRequest. + } + it := c.ListOSPolicyAssignmentRevisions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleOsConfigZonalClient_DeleteOSPolicyAssignment() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.DeleteOSPolicyAssignmentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#DeleteOSPolicyAssignmentRequest. + } + op, err := c.DeleteOSPolicyAssignment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleOsConfigZonalClient_GetOSPolicyAssignmentReport() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.GetOSPolicyAssignmentReportRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentReportRequest. + } + resp, err := c.GetOSPolicyAssignmentReport(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleOsConfigZonalClient_ListOSPolicyAssignmentReports() { + ctx := context.Background() + c, err := osconfig.NewOsConfigZonalClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &osconfigpb.ListOSPolicyAssignmentReportsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentReportsRequest. + } + it := c.ListOSPolicyAssignmentReports(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + func ExampleOsConfigZonalClient_GetInventory() { ctx := context.Background() c, err := osconfig.NewOsConfigZonalClient(ctx) diff --git a/osconfig/go.mod b/osconfig/go.mod index 0d9771665f1..9d746e6439b 100644 --- a/osconfig/go.mod +++ b/osconfig/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.97.0 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/osconfig/go.sum b/osconfig/go.sum index 4a0ee7cc155..24ce3cdb506 100644 --- a/osconfig/go.sum +++ b/osconfig/go.sum @@ -503,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 h1:vum3nDKdleYb+aePXKFEDT2+ghuH00EgYp9B7Q7EZZE= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/security/go.mod b/security/go.mod index 400f620e1bb..24ba9cf6a72 100644 --- a/security/go.mod +++ b/security/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.97.0 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.60.0 - google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 + google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/security/go.sum b/security/go.sum index 4a0ee7cc155..24ce3cdb506 100644 --- a/security/go.sum +++ b/security/go.sum @@ -503,8 +503,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145 h1:vum3nDKdleYb+aePXKFEDT2+ghuH00EgYp9B7Q7EZZE= -google.golang.org/genproto v0.0.0-20211101144312-62acf1d99145/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 h1:ZONpjmFT5e+I/0/xE3XXbG5OIvX2hRYzol04MhKBl2E= +google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= 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/security/privateca/apiv1/doc.go b/security/privateca/apiv1/doc.go index 574974cf330..66e357b967b 100644 --- a/security/privateca/apiv1/doc.go +++ b/security/privateca/apiv1/doc.go @@ -20,7 +20,7 @@ // The Certificate Authority Service API is a highly-available, scalable // service that enables you to simplify and automate the management of // private certificate authorities (CAs) while staying in control of your -// private keys." +// private keys. // // Example usage // @@ -87,7 +87,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211030" +const versionClient = "20211104" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)