From ce61602b91ba9ecc4e9d82eb1b7a6a6e2e83a490 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 1 Jun 2021 09:12:22 -0700 Subject: [PATCH] chore(all): auto-regenerate gapics (#4192) * chore(all): auto-regenerate gapics This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/607 Changes: chore(privatecatalog): Update privatecatalog_v1 BUILD.bazel for python PiperOrigin-RevId: 376205836 Source-Link: https://github.com/googleapis/googleapis/commit/0e8432b084252dc86d0dc6fce7c7566a659404a9 chore(vpcaccess): migrate vpcaccess to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 376185692 Source-Link: https://github.com/googleapis/googleapis/commit/aa7d606021c498d218286857c958a8277eaed2f8 chore(apigateway): migrate apigateway to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 376182301 Source-Link: https://github.com/googleapis/googleapis/commit/b1e39137445e1675ede13e4c049641274cb48d49 docs(cloudtasks): fix grammar in documentation. PiperOrigin-RevId: 376172241 Source-Link: https://github.com/googleapis/googleapis/commit/df616b587f0b4302f15387f315c286035c3b8bb1 fix!(bigquery/storage): remove default deadline for AppendRows API Committer: @yirutang PiperOrigin-RevId: 376121492 Source-Link: https://github.com/googleapis/googleapis/commit/ad721f20077dc48369def7afe6d48199581444f7 chore(pubsub): migrate PubSub to the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 376047466 Source-Link: https://github.com/googleapis/googleapis/commit/1d2c8471073454fb7ab8d5fa6885025fe8a0e3c9 chore(securitycenter/settings): migrate securitycenter-settings to the PHP microgenerator Committer: @miraleung PiperOrigin-RevId: 375869810 Source-Link: https://github.com/googleapis/googleapis/commit/b3c2e0fa80f195b6c123a8fad130f7148ea16de4 feat(dialogflow/cx): added API for running continuous test PiperOrigin-RevId: 375809988 Source-Link: https://github.com/googleapis/googleapis/commit/b2c4b3d62150a73507cbd3aa816fc0f177873556 feat(analytics/admin): add `GetMeasurementProtocolSecret`, `ListMeasurementProtocolSecrets`, `CreateMeasurementProtocolSecret`, `DeleteMeasurementProtocolSecret`, `UpdateMeasurementProtocolSecret` methods to the API feat: add `GetGoogleSignalsSettings`, `UpdateGoogleSignalsSettings` methods to the API feat: add `CreateConversionEvent`, `GetConversionEvent`, `DeleteConversionEvent`, `ListConversionEvents` methods to the API feat: add `CreateCustomDimension`, `GetCustomDimension`, `UpdateCustomDimension`, `ListCustomDimensions`, `ArchiveCustomDimension` methods to the API feat: add `CreateCustomMetric`, `GetCustomMetric`, `UpdateCustomMetric`, `ListCustomMetrics`, `ArchiveCustomMetric` methods to the API feat: add `GoogleSignalsState`, `GoogleSignalsConsent` types feat: add `GoogleSignalsSettings` type feat: add `MeasurementProtocolSecret` type feat: add `ConversionEvent` type feat: add `CustomDimension` type feat: add `CustomMetric` type feat: extend `ChangeHistoryResourceType` enum to support `GOOGLE_SIGNALS_SETTINGS`, `CONVERSION_EVENT`, `MEASUREMENT_PROTOCOL_SECRET`, `CUSTOM_DIMENSION`, `CUSTOM_METRIC` values fix: label `email_address` field of `UserLink` type as immutable fix: label `name` field of `UserLink` type as output only PiperOrigin-RevId: 375776214 Source-Link: https://github.com/googleapis/googleapis/commit/c3bf1b727510ffc0e2020affff906fbc649cd563 feat(asset): add Cloud Asset List API, add access time as condition context in request and evaluation value in response for Cloud Asset AnalyzeIamPolicy API, add more info (folders, organizations, kms_key, create_time, update_time, state, parent_full_resource_name, parent_asset_type) in response for Cloud Asset SearchAllResources API Committer: @peter-zheng-g PiperOrigin-RevId: 375731640 Source-Link: https://github.com/googleapis/googleapis/commit/de04592991247b9b617d06d4ec68f7e90adf2b81 build(serviceusage): use hyphen in package name PiperOrigin-RevId: 375726895 Source-Link: https://github.com/googleapis/googleapis/commit/c8aaf40d03b28f99953c773cf16e90ab9e7e1296 chore(kms): migrate KMS to the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 375588753 Source-Link: https://github.com/googleapis/googleapis/commit/b59fdf334dd6bba1cf11810e8bb1dbcc0e2196ec fix!(pubsublite): Replace unreleased InitialSubscribeRequest initial_cursor field with initial_location PiperOrigin-RevId: 375562697 Source-Link: https://github.com/googleapis/googleapis/commit/c71311c3e48450d2c9bb2c0e67bed283a29233d5 chore(language): regenerate BUILD.bazel, move yamls to the version folder PiperOrigin-RevId: 375542076 Source-Link: https://github.com/googleapis/googleapis/commit/fc4139da949115cf8953c261c40541de40b72f75 --- .../apiv1alpha/analytics_admin_client.go | 1281 +++++++++++++++-- .../analytics_admin_client_example_test.go | 415 ++++++ analytics/admin/apiv1alpha/doc.go | 2 +- .../admin/apiv1alpha/gapic_metadata.json | 105 ++ apigateway/apiv1/doc.go | 2 +- asset/apiv1/asset_client.go | 107 ++ asset/apiv1/asset_client_example_test.go | 25 + asset/apiv1/doc.go | 2 +- asset/apiv1/gapic_metadata.json | 5 + bigquery/go.mod | 2 +- bigquery/go.sum | 4 +- bigquery/storage/apiv1beta2/doc.go | 2 +- bigtable/go.mod | 2 +- bigtable/go.sum | 4 +- cloudtasks/apiv2beta2/doc.go | 2 +- datastore/go.mod | 2 +- datastore/go.sum | 4 +- dialogflow/cx/apiv3/doc.go | 2 +- dialogflow/cx/apiv3/environments_client.go | 234 ++- .../apiv3/environments_client_example_test.go | 49 + dialogflow/cx/apiv3/gapic_metadata.json | 10 + essentialcontacts/apiv1/doc.go | 6 +- .../apiv1/essential_contacts_client.go | 171 ++- .../essential_contacts_client_example_test.go | 21 +- firestore/go.mod | 2 +- firestore/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- gsuiteaddons/apiv1/doc.go | 6 +- gsuiteaddons/apiv1/g_suite_add_ons_client.go | 220 ++- .../g_suite_add_ons_client_example_test.go | 24 +- internal/.repo-metadata-full.json | 2 +- internal/examples/fake/go.mod | 2 +- internal/examples/fake/go.sum | 4 +- internal/examples/mock/go.mod | 2 +- internal/examples/mock/go.sum | 4 +- internal/gapicgen/go.mod | 2 +- internal/gapicgen/go.sum | 3 +- .../ArchiveCustomDimension/main.go | 43 + .../ArchiveCustomMetric/main.go | 43 + .../CreateConversionEvent/main.go | 45 + .../CreateCustomDimension/main.go | 45 + .../CreateCustomMetric/main.go | 45 + .../CreateMeasurementProtocolSecret/main.go | 45 + .../DeleteConversionEvent/main.go | 43 + .../DeleteMeasurementProtocolSecret/main.go | 43 + .../GetConversionEvent/main.go | 45 + .../GetCustomDimension/main.go | 45 + .../GetCustomMetric/main.go | 45 + .../GetGoogleSignalsSettings/main.go | 45 + .../GetMeasurementProtocolSecret/main.go | 45 + .../ListConversionEvents/main.go | 52 + .../ListCustomDimensions/main.go | 52 + .../ListCustomMetrics/main.go | 52 + .../ListMeasurementProtocolSecrets/main.go | 52 + .../UpdateCustomDimension/main.go | 45 + .../UpdateCustomMetric/main.go | 45 + .../UpdateGoogleSignalsSettings/main.go | 45 + .../UpdateMeasurementProtocolSecret/main.go | 45 + .../asset/apiv1/Client/ListAssets/main.go | 52 + .../ListContinuousTestResults/main.go | 52 + .../RunContinuousTest/main.go | 50 + .../apiv1/Client/ComputeContacts/main.go | 52 + .../apiv1/Client/CreateContact/main.go | 45 + .../apiv1/Client/DeleteContact/main.go | 43 + .../apiv1/Client/GetContact/main.go | 45 + .../apiv1/Client/ListContacts/main.go | 52 + .../apiv1/Client/SendTestMessage/main.go | 43 + .../apiv1/Client/UpdateContact/main.go | 45 + internal/generated/snippets/go.mod | 10 +- internal/generated/snippets/go.sum | 4 +- .../apiv1/Client/CreateDeployment/main.go | 45 + .../apiv1/Client/DeleteDeployment/main.go | 43 + .../apiv1/Client/GetAuthorization/main.go | 45 + .../apiv1/Client/GetDeployment/main.go | 45 + .../apiv1/Client/GetInstallStatus/main.go | 45 + .../apiv1/Client/InstallDeployment/main.go | 43 + .../apiv1/Client/ListDeployments/main.go | 52 + .../apiv1/Client/ReplaceDeployment/main.go | 45 + .../apiv1/Client/UninstallDeployment/main.go | 43 + .../KeyManagementClient/GetIamPolicy/main.go | 45 + .../KeyManagementClient/SetIamPolicy/main.go | 45 + .../TestIamPermissions/main.go | 45 + .../apiv1beta1/Client/SearchCatalogs/main.go | 52 + .../apiv1beta1/Client/SearchProducts/main.go | 52 + .../apiv1beta1/Client/SearchVersions/main.go | 52 + .../PublisherClient/GetIamPolicy/main.go | 45 + .../PublisherClient/SetIamPolicy/main.go | 45 + .../TestIamPermissions/main.go | 45 + .../apiv1/SchemaClient/GetIamPolicy/main.go | 45 + .../apiv1/SchemaClient/SetIamPolicy/main.go | 45 + .../SchemaClient/TestIamPermissions/main.go | 45 + .../SubscriberClient/GetIamPolicy/main.go | 45 + .../SubscriberClient/SetIamPolicy/main.go | 45 + .../TestIamPermissions/main.go | 45 + .../CloudShellClient/AddPublicKey/main.go | 50 + .../AuthorizeEnvironment/main.go | 50 + .../CloudShellClient/GetEnvironment/main.go | 45 + .../CloudShellClient/RemovePublicKey/main.go | 50 + .../CloudShellClient/StartEnvironment/main.go | 50 + .../apiv1/Client/CreateConnector/main.go | 50 + .../apiv1/Client/DeleteConnector/main.go | 48 + .../apiv1/Client/GetConnector/main.go | 45 + .../apiv1/Client/ListConnectors/main.go | 52 + internal/godocfx/go.sum | 4 +- kms/apiv1/doc.go | 2 +- kms/apiv1/gapic_metadata.json | 15 + kms/apiv1/key_management_client.go | 84 ++ .../key_management_client_example_test.go | 58 + language/apiv1/doc.go | 2 +- language/apiv1beta2/doc.go | 10 +- language/apiv1beta2/language_client.go | 6 +- logging/go.mod | 2 +- logging/go.sum | 4 +- privatecatalog/apiv1beta1/doc.go | 2 +- pubsub/apiv1/doc.go | 2 +- pubsub/apiv1/gapic_metadata.json | 45 + pubsub/apiv1/publisher_client.go | 84 ++ pubsub/apiv1/publisher_client_example_test.go | 58 + pubsub/apiv1/schema_client.go | 108 +- pubsub/apiv1/schema_client_example_test.go | 58 + pubsub/apiv1/subscriber_client.go | 84 ++ .../apiv1/subscriber_client_example_test.go | 58 + pubsub/go.mod | 2 +- pubsub/go.sum | 4 +- pubsublite/apiv1/doc.go | 2 +- pubsublite/go.mod | 2 +- pubsublite/go.sum | 4 +- securitycenter/settings/apiv1beta1/doc.go | 2 +- serviceusage/apiv1/doc.go | 2 +- spanner/go.mod | 2 +- spanner/go.sum | 4 +- storage/go.mod | 2 +- storage/go.sum | 4 +- vpcaccess/apiv1/doc.go | 2 +- 135 files changed, 6149 insertions(+), 309 deletions(-) create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomDimension/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomMetric/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateConversionEvent/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomDimension/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomMetric/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateMeasurementProtocolSecret/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteConversionEvent/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteMeasurementProtocolSecret/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetConversionEvent/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomDimension/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomMetric/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetGoogleSignalsSettings/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetMeasurementProtocolSecret/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListConversionEvents/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomDimensions/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomMetrics/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListMeasurementProtocolSecrets/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomDimension/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomMetric/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateGoogleSignalsSettings/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateMeasurementProtocolSecret/main.go create mode 100644 internal/generated/snippets/asset/apiv1/Client/ListAssets/main.go create mode 100644 internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/ListContinuousTestResults/main.go create mode 100644 internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/RunContinuousTest/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/ComputeContacts/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/CreateContact/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/DeleteContact/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/GetContact/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/ListContacts/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/SendTestMessage/main.go create mode 100644 internal/generated/snippets/essentialcontacts/apiv1/Client/UpdateContact/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/CreateDeployment/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/DeleteDeployment/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/GetAuthorization/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/GetDeployment/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/GetInstallStatus/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/InstallDeployment/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/ListDeployments/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/ReplaceDeployment/main.go create mode 100644 internal/generated/snippets/gsuiteaddons/apiv1/Client/UninstallDeployment/main.go create mode 100644 internal/generated/snippets/kms/apiv1/KeyManagementClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/kms/apiv1/KeyManagementClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/kms/apiv1/KeyManagementClient/TestIamPermissions/main.go create mode 100644 internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchCatalogs/main.go create mode 100644 internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchProducts/main.go create mode 100644 internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchVersions/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/PublisherClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/PublisherClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/PublisherClient/TestIamPermissions/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SchemaClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SchemaClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SchemaClient/TestIamPermissions/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SubscriberClient/GetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SubscriberClient/SetIamPolicy/main.go create mode 100644 internal/generated/snippets/pubsub/apiv1/SubscriberClient/TestIamPermissions/main.go create mode 100644 internal/generated/snippets/shell/apiv1/CloudShellClient/AddPublicKey/main.go create mode 100644 internal/generated/snippets/shell/apiv1/CloudShellClient/AuthorizeEnvironment/main.go create mode 100644 internal/generated/snippets/shell/apiv1/CloudShellClient/GetEnvironment/main.go create mode 100644 internal/generated/snippets/shell/apiv1/CloudShellClient/RemovePublicKey/main.go create mode 100644 internal/generated/snippets/shell/apiv1/CloudShellClient/StartEnvironment/main.go create mode 100644 internal/generated/snippets/vpcaccess/apiv1/Client/CreateConnector/main.go create mode 100644 internal/generated/snippets/vpcaccess/apiv1/Client/DeleteConnector/main.go create mode 100644 internal/generated/snippets/vpcaccess/apiv1/Client/GetConnector/main.go create mode 100644 internal/generated/snippets/vpcaccess/apiv1/Client/ListConnectors/main.go diff --git a/analytics/admin/apiv1alpha/analytics_admin_client.go b/analytics/admin/apiv1alpha/analytics_admin_client.go index 05a477202624..a4fb2254aa8e 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client.go @@ -85,7 +85,28 @@ type AnalyticsAdminCallOptions struct { DeleteGoogleAdsLink []gax.CallOption ListGoogleAdsLinks []gax.CallOption GetDataSharingSettings []gax.CallOption + GetMeasurementProtocolSecret []gax.CallOption + ListMeasurementProtocolSecrets []gax.CallOption + CreateMeasurementProtocolSecret []gax.CallOption + DeleteMeasurementProtocolSecret []gax.CallOption + UpdateMeasurementProtocolSecret []gax.CallOption SearchChangeHistoryEvents []gax.CallOption + GetGoogleSignalsSettings []gax.CallOption + UpdateGoogleSignalsSettings []gax.CallOption + CreateConversionEvent []gax.CallOption + GetConversionEvent []gax.CallOption + DeleteConversionEvent []gax.CallOption + ListConversionEvents []gax.CallOption + CreateCustomDimension []gax.CallOption + UpdateCustomDimension []gax.CallOption + ListCustomDimensions []gax.CallOption + ArchiveCustomDimension []gax.CallOption + GetCustomDimension []gax.CallOption + CreateCustomMetric []gax.CallOption + UpdateCustomMetric []gax.CallOption + ListCustomMetrics []gax.CallOption + ArchiveCustomMetric []gax.CallOption + GetCustomMetric []gax.CallOption } func defaultAnalyticsAdminGRPCClientOptions() []option.ClientOption { @@ -181,6 +202,66 @@ func defaultAnalyticsAdminCallOptions() *AnalyticsAdminCallOptions { }) }), }, + GetMeasurementProtocolSecret: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListMeasurementProtocolSecrets: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateMeasurementProtocolSecret: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteMeasurementProtocolSecret: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateMeasurementProtocolSecret: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, SearchChangeHistoryEvents: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -193,6 +274,198 @@ func defaultAnalyticsAdminCallOptions() *AnalyticsAdminCallOptions { }) }), }, + GetGoogleSignalsSettings: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateGoogleSignalsSettings: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateConversionEvent: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetConversionEvent: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + DeleteConversionEvent: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListConversionEvents: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateCustomDimension: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateCustomDimension: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListCustomDimensions: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ArchiveCustomDimension: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetCustomDimension: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + CreateCustomMetric: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + UpdateCustomMetric: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ListCustomMetrics: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ArchiveCustomMetric: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetCustomMetric: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -247,7 +520,28 @@ type internalAnalyticsAdminClient interface { DeleteGoogleAdsLink(context.Context, *adminpb.DeleteGoogleAdsLinkRequest, ...gax.CallOption) error ListGoogleAdsLinks(context.Context, *adminpb.ListGoogleAdsLinksRequest, ...gax.CallOption) *GoogleAdsLinkIterator GetDataSharingSettings(context.Context, *adminpb.GetDataSharingSettingsRequest, ...gax.CallOption) (*adminpb.DataSharingSettings, error) + GetMeasurementProtocolSecret(context.Context, *adminpb.GetMeasurementProtocolSecretRequest, ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) + ListMeasurementProtocolSecrets(context.Context, *adminpb.ListMeasurementProtocolSecretsRequest, ...gax.CallOption) *MeasurementProtocolSecretIterator + CreateMeasurementProtocolSecret(context.Context, *adminpb.CreateMeasurementProtocolSecretRequest, ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) + DeleteMeasurementProtocolSecret(context.Context, *adminpb.DeleteMeasurementProtocolSecretRequest, ...gax.CallOption) error + UpdateMeasurementProtocolSecret(context.Context, *adminpb.UpdateMeasurementProtocolSecretRequest, ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) SearchChangeHistoryEvents(context.Context, *adminpb.SearchChangeHistoryEventsRequest, ...gax.CallOption) *ChangeHistoryEventIterator + GetGoogleSignalsSettings(context.Context, *adminpb.GetGoogleSignalsSettingsRequest, ...gax.CallOption) (*adminpb.GoogleSignalsSettings, error) + UpdateGoogleSignalsSettings(context.Context, *adminpb.UpdateGoogleSignalsSettingsRequest, ...gax.CallOption) (*adminpb.GoogleSignalsSettings, error) + CreateConversionEvent(context.Context, *adminpb.CreateConversionEventRequest, ...gax.CallOption) (*adminpb.ConversionEvent, error) + GetConversionEvent(context.Context, *adminpb.GetConversionEventRequest, ...gax.CallOption) (*adminpb.ConversionEvent, error) + DeleteConversionEvent(context.Context, *adminpb.DeleteConversionEventRequest, ...gax.CallOption) error + ListConversionEvents(context.Context, *adminpb.ListConversionEventsRequest, ...gax.CallOption) *ConversionEventIterator + CreateCustomDimension(context.Context, *adminpb.CreateCustomDimensionRequest, ...gax.CallOption) (*adminpb.CustomDimension, error) + UpdateCustomDimension(context.Context, *adminpb.UpdateCustomDimensionRequest, ...gax.CallOption) (*adminpb.CustomDimension, error) + ListCustomDimensions(context.Context, *adminpb.ListCustomDimensionsRequest, ...gax.CallOption) *CustomDimensionIterator + ArchiveCustomDimension(context.Context, *adminpb.ArchiveCustomDimensionRequest, ...gax.CallOption) error + GetCustomDimension(context.Context, *adminpb.GetCustomDimensionRequest, ...gax.CallOption) (*adminpb.CustomDimension, error) + CreateCustomMetric(context.Context, *adminpb.CreateCustomMetricRequest, ...gax.CallOption) (*adminpb.CustomMetric, error) + UpdateCustomMetric(context.Context, *adminpb.UpdateCustomMetricRequest, ...gax.CallOption) (*adminpb.CustomMetric, error) + ListCustomMetrics(context.Context, *adminpb.ListCustomMetricsRequest, ...gax.CallOption) *CustomMetricIterator + ArchiveCustomMetric(context.Context, *adminpb.ArchiveCustomMetricRequest, ...gax.CallOption) error + GetCustomMetric(context.Context, *adminpb.GetCustomMetricRequest, ...gax.CallOption) (*adminpb.CustomMetric, error) } // AnalyticsAdminClient is a client for interacting with Google Analytics Admin API. @@ -576,27 +870,135 @@ func (c *AnalyticsAdminClient) GetDataSharingSettings(ctx context.Context, req * return c.internalClient.GetDataSharingSettings(ctx, req, opts...) } +// GetMeasurementProtocolSecret lookup for a single “GA4” MeasurementProtocolSecret. +func (c *AnalyticsAdminClient) GetMeasurementProtocolSecret(ctx context.Context, req *adminpb.GetMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) { + return c.internalClient.GetMeasurementProtocolSecret(ctx, req, opts...) +} + +// ListMeasurementProtocolSecrets returns child MeasurementProtocolSecrets under the specified parent +// Property. +func (c *AnalyticsAdminClient) ListMeasurementProtocolSecrets(ctx context.Context, req *adminpb.ListMeasurementProtocolSecretsRequest, opts ...gax.CallOption) *MeasurementProtocolSecretIterator { + return c.internalClient.ListMeasurementProtocolSecrets(ctx, req, opts...) +} + +// CreateMeasurementProtocolSecret creates a measurement protocol secret. +func (c *AnalyticsAdminClient) CreateMeasurementProtocolSecret(ctx context.Context, req *adminpb.CreateMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) { + return c.internalClient.CreateMeasurementProtocolSecret(ctx, req, opts...) +} + +// DeleteMeasurementProtocolSecret deletes target MeasurementProtocolSecret. +func (c *AnalyticsAdminClient) DeleteMeasurementProtocolSecret(ctx context.Context, req *adminpb.DeleteMeasurementProtocolSecretRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteMeasurementProtocolSecret(ctx, req, opts...) +} + +// UpdateMeasurementProtocolSecret updates a measurement protocol secret. +func (c *AnalyticsAdminClient) UpdateMeasurementProtocolSecret(ctx context.Context, req *adminpb.UpdateMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, error) { + return c.internalClient.UpdateMeasurementProtocolSecret(ctx, req, opts...) +} + // SearchChangeHistoryEvents searches through all changes to an account or its children given the // specified set of filters. func (c *AnalyticsAdminClient) SearchChangeHistoryEvents(ctx context.Context, req *adminpb.SearchChangeHistoryEventsRequest, opts ...gax.CallOption) *ChangeHistoryEventIterator { return c.internalClient.SearchChangeHistoryEvents(ctx, req, opts...) } -// analyticsAdminGRPCClient is a client for interacting with Google Analytics Admin API over gRPC transport. -// -// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. -type analyticsAdminGRPCClient struct { - // Connection pool of gRPC connections to the service. - connPool gtransport.ConnPool +// GetGoogleSignalsSettings lookup for Google Signals settings for a property. +func (c *AnalyticsAdminClient) GetGoogleSignalsSettings(ctx context.Context, req *adminpb.GetGoogleSignalsSettingsRequest, opts ...gax.CallOption) (*adminpb.GoogleSignalsSettings, error) { + return c.internalClient.GetGoogleSignalsSettings(ctx, req, opts...) +} - // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE - disableDeadlines bool +// UpdateGoogleSignalsSettings updates Google Signals settings for a property. +func (c *AnalyticsAdminClient) UpdateGoogleSignalsSettings(ctx context.Context, req *adminpb.UpdateGoogleSignalsSettingsRequest, opts ...gax.CallOption) (*adminpb.GoogleSignalsSettings, error) { + return c.internalClient.UpdateGoogleSignalsSettings(ctx, req, opts...) +} - // Points back to the CallOptions field of the containing AnalyticsAdminClient - CallOptions **AnalyticsAdminCallOptions +// CreateConversionEvent creates a conversion event with the specified attributes. +func (c *AnalyticsAdminClient) CreateConversionEvent(ctx context.Context, req *adminpb.CreateConversionEventRequest, opts ...gax.CallOption) (*adminpb.ConversionEvent, error) { + return c.internalClient.CreateConversionEvent(ctx, req, opts...) +} - // The gRPC API client. - analyticsAdminClient adminpb.AnalyticsAdminServiceClient +// GetConversionEvent retrieve a single conversion event. +func (c *AnalyticsAdminClient) GetConversionEvent(ctx context.Context, req *adminpb.GetConversionEventRequest, opts ...gax.CallOption) (*adminpb.ConversionEvent, error) { + return c.internalClient.GetConversionEvent(ctx, req, opts...) +} + +// DeleteConversionEvent deletes a conversion event in a property. +func (c *AnalyticsAdminClient) DeleteConversionEvent(ctx context.Context, req *adminpb.DeleteConversionEventRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteConversionEvent(ctx, req, opts...) +} + +// ListConversionEvents returns a list of conversion events in the specified parent property. +// +// Returns an empty list if no conversion events are found. +func (c *AnalyticsAdminClient) ListConversionEvents(ctx context.Context, req *adminpb.ListConversionEventsRequest, opts ...gax.CallOption) *ConversionEventIterator { + return c.internalClient.ListConversionEvents(ctx, req, opts...) +} + +// CreateCustomDimension creates a CustomDimension. +func (c *AnalyticsAdminClient) CreateCustomDimension(ctx context.Context, req *adminpb.CreateCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, error) { + return c.internalClient.CreateCustomDimension(ctx, req, opts...) +} + +// UpdateCustomDimension updates a CustomDimension on a property. +func (c *AnalyticsAdminClient) UpdateCustomDimension(ctx context.Context, req *adminpb.UpdateCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, error) { + return c.internalClient.UpdateCustomDimension(ctx, req, opts...) +} + +// ListCustomDimensions lists CustomDimensions on a property. +func (c *AnalyticsAdminClient) ListCustomDimensions(ctx context.Context, req *adminpb.ListCustomDimensionsRequest, opts ...gax.CallOption) *CustomDimensionIterator { + return c.internalClient.ListCustomDimensions(ctx, req, opts...) +} + +// ArchiveCustomDimension archives a CustomDimension on a property. +func (c *AnalyticsAdminClient) ArchiveCustomDimension(ctx context.Context, req *adminpb.ArchiveCustomDimensionRequest, opts ...gax.CallOption) error { + return c.internalClient.ArchiveCustomDimension(ctx, req, opts...) +} + +// GetCustomDimension lookup for a single CustomDimension. +func (c *AnalyticsAdminClient) GetCustomDimension(ctx context.Context, req *adminpb.GetCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, error) { + return c.internalClient.GetCustomDimension(ctx, req, opts...) +} + +// CreateCustomMetric creates a CustomMetric. +func (c *AnalyticsAdminClient) CreateCustomMetric(ctx context.Context, req *adminpb.CreateCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, error) { + return c.internalClient.CreateCustomMetric(ctx, req, opts...) +} + +// UpdateCustomMetric updates a CustomMetric on a property. +func (c *AnalyticsAdminClient) UpdateCustomMetric(ctx context.Context, req *adminpb.UpdateCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, error) { + return c.internalClient.UpdateCustomMetric(ctx, req, opts...) +} + +// ListCustomMetrics lists CustomMetrics on a property. +func (c *AnalyticsAdminClient) ListCustomMetrics(ctx context.Context, req *adminpb.ListCustomMetricsRequest, opts ...gax.CallOption) *CustomMetricIterator { + return c.internalClient.ListCustomMetrics(ctx, req, opts...) +} + +// ArchiveCustomMetric archives a CustomMetric on a property. +func (c *AnalyticsAdminClient) ArchiveCustomMetric(ctx context.Context, req *adminpb.ArchiveCustomMetricRequest, opts ...gax.CallOption) error { + return c.internalClient.ArchiveCustomMetric(ctx, req, opts...) +} + +// GetCustomMetric lookup for a single CustomMetric. +func (c *AnalyticsAdminClient) GetCustomMetric(ctx context.Context, req *adminpb.GetCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, error) { + return c.internalClient.GetCustomMetric(ctx, req, opts...) +} + +// analyticsAdminGRPCClient is a client for interacting with Google Analytics Admin API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type analyticsAdminGRPCClient struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // Points back to the CallOptions field of the containing AnalyticsAdminClient + CallOptions **AnalyticsAdminCallOptions + + // The gRPC API client. + analyticsAdminClient adminpb.AnalyticsAdminServiceClient // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD @@ -1600,14 +2002,538 @@ func (c *analyticsAdminGRPCClient) DeleteFirebaseLink(ctx context.Context, req * return err } -func (c *analyticsAdminGRPCClient) ListFirebaseLinks(ctx context.Context, req *adminpb.ListFirebaseLinksRequest, opts ...gax.CallOption) *FirebaseLinkIterator { +func (c *analyticsAdminGRPCClient) ListFirebaseLinks(ctx context.Context, req *adminpb.ListFirebaseLinksRequest, opts ...gax.CallOption) *FirebaseLinkIterator { + 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).ListFirebaseLinks[0:len((*c.CallOptions).ListFirebaseLinks):len((*c.CallOptions).ListFirebaseLinks)], opts...) + it := &FirebaseLinkIterator{} + req = proto.Clone(req).(*adminpb.ListFirebaseLinksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.FirebaseLink, string, error) { + var resp *adminpb.ListFirebaseLinksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListFirebaseLinks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFirebaseLinks(), 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 *analyticsAdminGRPCClient) GetGlobalSiteTag(ctx context.Context, req *adminpb.GetGlobalSiteTagRequest, opts ...gax.CallOption) (*adminpb.GlobalSiteTag, 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).GetGlobalSiteTag[0:len((*c.CallOptions).GetGlobalSiteTag):len((*c.CallOptions).GetGlobalSiteTag)], opts...) + var resp *adminpb.GlobalSiteTag + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetGlobalSiteTag(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) CreateGoogleAdsLink(ctx context.Context, req *adminpb.CreateGoogleAdsLinkRequest, opts ...gax.CallOption) (*adminpb.GoogleAdsLink, 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).CreateGoogleAdsLink[0:len((*c.CallOptions).CreateGoogleAdsLink):len((*c.CallOptions).CreateGoogleAdsLink)], opts...) + var resp *adminpb.GoogleAdsLink + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.CreateGoogleAdsLink(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) UpdateGoogleAdsLink(ctx context.Context, req *adminpb.UpdateGoogleAdsLinkRequest, opts ...gax.CallOption) (*adminpb.GoogleAdsLink, 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", "google_ads_link.name", url.QueryEscape(req.GetGoogleAdsLink().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateGoogleAdsLink[0:len((*c.CallOptions).UpdateGoogleAdsLink):len((*c.CallOptions).UpdateGoogleAdsLink)], opts...) + var resp *adminpb.GoogleAdsLink + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.UpdateGoogleAdsLink(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) DeleteGoogleAdsLink(ctx context.Context, req *adminpb.DeleteGoogleAdsLinkRequest, opts ...gax.CallOption) 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).DeleteGoogleAdsLink[0:len((*c.CallOptions).DeleteGoogleAdsLink):len((*c.CallOptions).DeleteGoogleAdsLink)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.analyticsAdminClient.DeleteGoogleAdsLink(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *analyticsAdminGRPCClient) ListGoogleAdsLinks(ctx context.Context, req *adminpb.ListGoogleAdsLinksRequest, opts ...gax.CallOption) *GoogleAdsLinkIterator { + 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).ListGoogleAdsLinks[0:len((*c.CallOptions).ListGoogleAdsLinks):len((*c.CallOptions).ListGoogleAdsLinks)], opts...) + it := &GoogleAdsLinkIterator{} + req = proto.Clone(req).(*adminpb.ListGoogleAdsLinksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.GoogleAdsLink, string, error) { + var resp *adminpb.ListGoogleAdsLinksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListGoogleAdsLinks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetGoogleAdsLinks(), 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 *analyticsAdminGRPCClient) GetDataSharingSettings(ctx context.Context, req *adminpb.GetDataSharingSettingsRequest, opts ...gax.CallOption) (*adminpb.DataSharingSettings, 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).GetDataSharingSettings[0:len((*c.CallOptions).GetDataSharingSettings):len((*c.CallOptions).GetDataSharingSettings)], opts...) + var resp *adminpb.DataSharingSettings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetDataSharingSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) GetMeasurementProtocolSecret(ctx context.Context, req *adminpb.GetMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, 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).GetMeasurementProtocolSecret[0:len((*c.CallOptions).GetMeasurementProtocolSecret):len((*c.CallOptions).GetMeasurementProtocolSecret)], opts...) + var resp *adminpb.MeasurementProtocolSecret + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetMeasurementProtocolSecret(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) ListMeasurementProtocolSecrets(ctx context.Context, req *adminpb.ListMeasurementProtocolSecretsRequest, opts ...gax.CallOption) *MeasurementProtocolSecretIterator { + 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).ListMeasurementProtocolSecrets[0:len((*c.CallOptions).ListMeasurementProtocolSecrets):len((*c.CallOptions).ListMeasurementProtocolSecrets)], opts...) + it := &MeasurementProtocolSecretIterator{} + req = proto.Clone(req).(*adminpb.ListMeasurementProtocolSecretsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.MeasurementProtocolSecret, string, error) { + var resp *adminpb.ListMeasurementProtocolSecretsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListMeasurementProtocolSecrets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetMeasurementProtocolSecrets(), 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 *analyticsAdminGRPCClient) CreateMeasurementProtocolSecret(ctx context.Context, req *adminpb.CreateMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, 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).CreateMeasurementProtocolSecret[0:len((*c.CallOptions).CreateMeasurementProtocolSecret):len((*c.CallOptions).CreateMeasurementProtocolSecret)], opts...) + var resp *adminpb.MeasurementProtocolSecret + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.CreateMeasurementProtocolSecret(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) DeleteMeasurementProtocolSecret(ctx context.Context, req *adminpb.DeleteMeasurementProtocolSecretRequest, opts ...gax.CallOption) 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).DeleteMeasurementProtocolSecret[0:len((*c.CallOptions).DeleteMeasurementProtocolSecret):len((*c.CallOptions).DeleteMeasurementProtocolSecret)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.analyticsAdminClient.DeleteMeasurementProtocolSecret(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *analyticsAdminGRPCClient) UpdateMeasurementProtocolSecret(ctx context.Context, req *adminpb.UpdateMeasurementProtocolSecretRequest, opts ...gax.CallOption) (*adminpb.MeasurementProtocolSecret, 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", "measurement_protocol_secret.name", url.QueryEscape(req.GetMeasurementProtocolSecret().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateMeasurementProtocolSecret[0:len((*c.CallOptions).UpdateMeasurementProtocolSecret):len((*c.CallOptions).UpdateMeasurementProtocolSecret)], opts...) + var resp *adminpb.MeasurementProtocolSecret + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.UpdateMeasurementProtocolSecret(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) SearchChangeHistoryEvents(ctx context.Context, req *adminpb.SearchChangeHistoryEventsRequest, opts ...gax.CallOption) *ChangeHistoryEventIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "account", url.QueryEscape(req.GetAccount()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).SearchChangeHistoryEvents[0:len((*c.CallOptions).SearchChangeHistoryEvents):len((*c.CallOptions).SearchChangeHistoryEvents)], opts...) + it := &ChangeHistoryEventIterator{} + req = proto.Clone(req).(*adminpb.SearchChangeHistoryEventsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.ChangeHistoryEvent, string, error) { + var resp *adminpb.SearchChangeHistoryEventsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.SearchChangeHistoryEvents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetChangeHistoryEvents(), 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 *analyticsAdminGRPCClient) GetGoogleSignalsSettings(ctx context.Context, req *adminpb.GetGoogleSignalsSettingsRequest, opts ...gax.CallOption) (*adminpb.GoogleSignalsSettings, 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).GetGoogleSignalsSettings[0:len((*c.CallOptions).GetGoogleSignalsSettings):len((*c.CallOptions).GetGoogleSignalsSettings)], opts...) + var resp *adminpb.GoogleSignalsSettings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetGoogleSignalsSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) UpdateGoogleSignalsSettings(ctx context.Context, req *adminpb.UpdateGoogleSignalsSettingsRequest, opts ...gax.CallOption) (*adminpb.GoogleSignalsSettings, 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", "google_signals_settings.name", url.QueryEscape(req.GetGoogleSignalsSettings().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateGoogleSignalsSettings[0:len((*c.CallOptions).UpdateGoogleSignalsSettings):len((*c.CallOptions).UpdateGoogleSignalsSettings)], opts...) + var resp *adminpb.GoogleSignalsSettings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.UpdateGoogleSignalsSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) CreateConversionEvent(ctx context.Context, req *adminpb.CreateConversionEventRequest, opts ...gax.CallOption) (*adminpb.ConversionEvent, 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).CreateConversionEvent[0:len((*c.CallOptions).CreateConversionEvent):len((*c.CallOptions).CreateConversionEvent)], opts...) + var resp *adminpb.ConversionEvent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.CreateConversionEvent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) GetConversionEvent(ctx context.Context, req *adminpb.GetConversionEventRequest, opts ...gax.CallOption) (*adminpb.ConversionEvent, 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).GetConversionEvent[0:len((*c.CallOptions).GetConversionEvent):len((*c.CallOptions).GetConversionEvent)], opts...) + var resp *adminpb.ConversionEvent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetConversionEvent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) DeleteConversionEvent(ctx context.Context, req *adminpb.DeleteConversionEventRequest, opts ...gax.CallOption) 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).DeleteConversionEvent[0:len((*c.CallOptions).DeleteConversionEvent):len((*c.CallOptions).DeleteConversionEvent)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.analyticsAdminClient.DeleteConversionEvent(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *analyticsAdminGRPCClient) ListConversionEvents(ctx context.Context, req *adminpb.ListConversionEventsRequest, opts ...gax.CallOption) *ConversionEventIterator { + 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).ListConversionEvents[0:len((*c.CallOptions).ListConversionEvents):len((*c.CallOptions).ListConversionEvents)], opts...) + it := &ConversionEventIterator{} + req = proto.Clone(req).(*adminpb.ListConversionEventsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.ConversionEvent, string, error) { + var resp *adminpb.ListConversionEventsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListConversionEvents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetConversionEvents(), 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 *analyticsAdminGRPCClient) CreateCustomDimension(ctx context.Context, req *adminpb.CreateCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, 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).CreateCustomDimension[0:len((*c.CallOptions).CreateCustomDimension):len((*c.CallOptions).CreateCustomDimension)], opts...) + var resp *adminpb.CustomDimension + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.CreateCustomDimension(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) UpdateCustomDimension(ctx context.Context, req *adminpb.UpdateCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, 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", "custom_dimension.name", url.QueryEscape(req.GetCustomDimension().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateCustomDimension[0:len((*c.CallOptions).UpdateCustomDimension):len((*c.CallOptions).UpdateCustomDimension)], opts...) + var resp *adminpb.CustomDimension + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.UpdateCustomDimension(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) ListCustomDimensions(ctx context.Context, req *adminpb.ListCustomDimensionsRequest, opts ...gax.CallOption) *CustomDimensionIterator { 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).ListFirebaseLinks[0:len((*c.CallOptions).ListFirebaseLinks):len((*c.CallOptions).ListFirebaseLinks)], opts...) - it := &FirebaseLinkIterator{} - req = proto.Clone(req).(*adminpb.ListFirebaseLinksRequest) - it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.FirebaseLink, string, error) { - var resp *adminpb.ListFirebaseLinksResponse + opts = append((*c.CallOptions).ListCustomDimensions[0:len((*c.CallOptions).ListCustomDimensions):len((*c.CallOptions).ListCustomDimensions)], opts...) + it := &CustomDimensionIterator{} + req = proto.Clone(req).(*adminpb.ListCustomDimensionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.CustomDimension, string, error) { + var resp *adminpb.ListCustomDimensionsResponse req.PageToken = pageToken if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 @@ -1616,7 +2542,7 @@ func (c *analyticsAdminGRPCClient) ListFirebaseLinks(ctx context.Context, req *a } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.ListFirebaseLinks(ctx, req, settings.GRPC...) + resp, err = c.analyticsAdminClient.ListCustomDimensions(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -1624,7 +2550,7 @@ func (c *analyticsAdminGRPCClient) ListFirebaseLinks(ctx context.Context, req *a } it.Response = resp - return resp.GetFirebaseLinks(), resp.GetNextPageToken(), nil + return resp.GetCustomDimensions(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) @@ -1640,7 +2566,7 @@ func (c *analyticsAdminGRPCClient) ListFirebaseLinks(ctx context.Context, req *a return it } -func (c *analyticsAdminGRPCClient) GetGlobalSiteTag(ctx context.Context, req *adminpb.GetGlobalSiteTagRequest, opts ...gax.CallOption) (*adminpb.GlobalSiteTag, error) { +func (c *analyticsAdminGRPCClient) ArchiveCustomDimension(ctx context.Context, req *adminpb.ArchiveCustomDimensionRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1648,32 +2574,28 @@ func (c *analyticsAdminGRPCClient) GetGlobalSiteTag(ctx context.Context, req *ad } 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).GetGlobalSiteTag[0:len((*c.CallOptions).GetGlobalSiteTag):len((*c.CallOptions).GetGlobalSiteTag)], opts...) - var resp *adminpb.GlobalSiteTag + opts = append((*c.CallOptions).ArchiveCustomDimension[0:len((*c.CallOptions).ArchiveCustomDimension):len((*c.CallOptions).ArchiveCustomDimension)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.GetGlobalSiteTag(ctx, req, settings.GRPC...) + _, err = c.analyticsAdminClient.ArchiveCustomDimension(ctx, req, settings.GRPC...) return err }, opts...) - if err != nil { - return nil, err - } - return resp, nil + return err } -func (c *analyticsAdminGRPCClient) CreateGoogleAdsLink(ctx context.Context, req *adminpb.CreateGoogleAdsLinkRequest, opts ...gax.CallOption) (*adminpb.GoogleAdsLink, error) { +func (c *analyticsAdminGRPCClient) GetCustomDimension(ctx context.Context, req *adminpb.GetCustomDimensionRequest, opts ...gax.CallOption) (*adminpb.CustomDimension, 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()))) + 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).CreateGoogleAdsLink[0:len((*c.CallOptions).CreateGoogleAdsLink):len((*c.CallOptions).CreateGoogleAdsLink)], opts...) - var resp *adminpb.GoogleAdsLink + opts = append((*c.CallOptions).GetCustomDimension[0:len((*c.CallOptions).GetCustomDimension):len((*c.CallOptions).GetCustomDimension)], opts...) + var resp *adminpb.CustomDimension err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.CreateGoogleAdsLink(ctx, req, settings.GRPC...) + resp, err = c.analyticsAdminClient.GetCustomDimension(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -1682,19 +2604,19 @@ func (c *analyticsAdminGRPCClient) CreateGoogleAdsLink(ctx context.Context, req return resp, nil } -func (c *analyticsAdminGRPCClient) UpdateGoogleAdsLink(ctx context.Context, req *adminpb.UpdateGoogleAdsLinkRequest, opts ...gax.CallOption) (*adminpb.GoogleAdsLink, error) { +func (c *analyticsAdminGRPCClient) CreateCustomMetric(ctx context.Context, req *adminpb.CreateCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, 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", "google_ads_link.name", url.QueryEscape(req.GetGoogleAdsLink().GetName()))) + 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).UpdateGoogleAdsLink[0:len((*c.CallOptions).UpdateGoogleAdsLink):len((*c.CallOptions).UpdateGoogleAdsLink)], opts...) - var resp *adminpb.GoogleAdsLink + opts = append((*c.CallOptions).CreateCustomMetric[0:len((*c.CallOptions).CreateCustomMetric):len((*c.CallOptions).CreateCustomMetric)], opts...) + var resp *adminpb.CustomMetric err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.UpdateGoogleAdsLink(ctx, req, settings.GRPC...) + resp, err = c.analyticsAdminClient.CreateCustomMetric(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -1703,31 +2625,35 @@ func (c *analyticsAdminGRPCClient) UpdateGoogleAdsLink(ctx context.Context, req return resp, nil } -func (c *analyticsAdminGRPCClient) DeleteGoogleAdsLink(ctx context.Context, req *adminpb.DeleteGoogleAdsLinkRequest, opts ...gax.CallOption) error { +func (c *analyticsAdminGRPCClient) UpdateCustomMetric(ctx context.Context, req *adminpb.UpdateCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, 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()))) + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "custom_metric.name", url.QueryEscape(req.GetCustomMetric().GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).DeleteGoogleAdsLink[0:len((*c.CallOptions).DeleteGoogleAdsLink):len((*c.CallOptions).DeleteGoogleAdsLink)], opts...) + opts = append((*c.CallOptions).UpdateCustomMetric[0:len((*c.CallOptions).UpdateCustomMetric):len((*c.CallOptions).UpdateCustomMetric)], opts...) + var resp *adminpb.CustomMetric err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - _, err = c.analyticsAdminClient.DeleteGoogleAdsLink(ctx, req, settings.GRPC...) + resp, err = c.analyticsAdminClient.UpdateCustomMetric(ctx, req, settings.GRPC...) return err }, opts...) - return err + if err != nil { + return nil, err + } + return resp, nil } -func (c *analyticsAdminGRPCClient) ListGoogleAdsLinks(ctx context.Context, req *adminpb.ListGoogleAdsLinksRequest, opts ...gax.CallOption) *GoogleAdsLinkIterator { +func (c *analyticsAdminGRPCClient) ListCustomMetrics(ctx context.Context, req *adminpb.ListCustomMetricsRequest, opts ...gax.CallOption) *CustomMetricIterator { 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).ListGoogleAdsLinks[0:len((*c.CallOptions).ListGoogleAdsLinks):len((*c.CallOptions).ListGoogleAdsLinks)], opts...) - it := &GoogleAdsLinkIterator{} - req = proto.Clone(req).(*adminpb.ListGoogleAdsLinksRequest) - it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.GoogleAdsLink, string, error) { - var resp *adminpb.ListGoogleAdsLinksResponse + opts = append((*c.CallOptions).ListCustomMetrics[0:len((*c.CallOptions).ListCustomMetrics):len((*c.CallOptions).ListCustomMetrics)], opts...) + it := &CustomMetricIterator{} + req = proto.Clone(req).(*adminpb.ListCustomMetricsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.CustomMetric, string, error) { + var resp *adminpb.ListCustomMetricsResponse req.PageToken = pageToken if pageSize > math.MaxInt32 { req.PageSize = math.MaxInt32 @@ -1736,7 +2662,7 @@ func (c *analyticsAdminGRPCClient) ListGoogleAdsLinks(ctx context.Context, req * } err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.ListGoogleAdsLinks(ctx, req, settings.GRPC...) + resp, err = c.analyticsAdminClient.ListCustomMetrics(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -1744,7 +2670,7 @@ func (c *analyticsAdminGRPCClient) ListGoogleAdsLinks(ctx context.Context, req * } it.Response = resp - return resp.GetGoogleAdsLinks(), resp.GetNextPageToken(), nil + return resp.GetCustomMetrics(), resp.GetNextPageToken(), nil } fetch := func(pageSize int, pageToken string) (string, error) { items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) @@ -1760,7 +2686,7 @@ func (c *analyticsAdminGRPCClient) ListGoogleAdsLinks(ctx context.Context, req * return it } -func (c *analyticsAdminGRPCClient) GetDataSharingSettings(ctx context.Context, req *adminpb.GetDataSharingSettingsRequest, opts ...gax.CallOption) (*adminpb.DataSharingSettings, error) { +func (c *analyticsAdminGRPCClient) ArchiveCustomMetric(ctx context.Context, req *adminpb.ArchiveCustomMetricRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1768,57 +2694,34 @@ func (c *analyticsAdminGRPCClient) GetDataSharingSettings(ctx context.Context, r } 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).GetDataSharingSettings[0:len((*c.CallOptions).GetDataSharingSettings):len((*c.CallOptions).GetDataSharingSettings)], opts...) - var resp *adminpb.DataSharingSettings + opts = append((*c.CallOptions).ArchiveCustomMetric[0:len((*c.CallOptions).ArchiveCustomMetric):len((*c.CallOptions).ArchiveCustomMetric)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.analyticsAdminClient.GetDataSharingSettings(ctx, req, settings.GRPC...) + _, err = c.analyticsAdminClient.ArchiveCustomMetric(ctx, req, settings.GRPC...) return err }, opts...) - if err != nil { - return nil, err - } - return resp, nil + return err } -func (c *analyticsAdminGRPCClient) SearchChangeHistoryEvents(ctx context.Context, req *adminpb.SearchChangeHistoryEventsRequest, opts ...gax.CallOption) *ChangeHistoryEventIterator { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "account", url.QueryEscape(req.GetAccount()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).SearchChangeHistoryEvents[0:len((*c.CallOptions).SearchChangeHistoryEvents):len((*c.CallOptions).SearchChangeHistoryEvents)], opts...) - it := &ChangeHistoryEventIterator{} - req = proto.Clone(req).(*adminpb.SearchChangeHistoryEventsRequest) - it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.ChangeHistoryEvent, string, error) { - var resp *adminpb.SearchChangeHistoryEventsResponse - req.PageToken = pageToken - if pageSize > math.MaxInt32 { - req.PageSize = math.MaxInt32 - } else { - req.PageSize = int32(pageSize) - } - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.analyticsAdminClient.SearchChangeHistoryEvents(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, "", err - } - - it.Response = resp - return resp.GetChangeHistoryEvents(), resp.GetNextPageToken(), nil +func (c *analyticsAdminGRPCClient) GetCustomMetric(ctx context.Context, req *adminpb.GetCustomMetricRequest, opts ...gax.CallOption) (*adminpb.CustomMetric, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + defer cancel() + ctx = cctx } - 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 + 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).GetCustomMetric[0:len((*c.CallOptions).GetCustomMetric):len((*c.CallOptions).GetCustomMetric)], opts...) + var resp *adminpb.CustomMetric + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetCustomMetric(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err } - it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) - it.pageInfo.MaxSize = int(req.GetPageSize()) - it.pageInfo.Token = req.GetPageToken() - return it + return resp, nil } // AccountIterator manages a stream of *adminpb.Account. @@ -2056,6 +2959,147 @@ func (it *ChangeHistoryEventIterator) takeBuf() interface{} { return b } +// ConversionEventIterator manages a stream of *adminpb.ConversionEvent. +type ConversionEventIterator struct { + items []*adminpb.ConversionEvent + 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 []*adminpb.ConversionEvent, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ConversionEventIterator) 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 *ConversionEventIterator) Next() (*adminpb.ConversionEvent, error) { + var item *adminpb.ConversionEvent + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ConversionEventIterator) bufLen() int { + return len(it.items) +} + +func (it *ConversionEventIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CustomDimensionIterator manages a stream of *adminpb.CustomDimension. +type CustomDimensionIterator struct { + items []*adminpb.CustomDimension + 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 []*adminpb.CustomDimension, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CustomDimensionIterator) 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 *CustomDimensionIterator) Next() (*adminpb.CustomDimension, error) { + var item *adminpb.CustomDimension + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CustomDimensionIterator) bufLen() int { + return len(it.items) +} + +func (it *CustomDimensionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CustomMetricIterator manages a stream of *adminpb.CustomMetric. +type CustomMetricIterator struct { + items []*adminpb.CustomMetric + 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 []*adminpb.CustomMetric, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CustomMetricIterator) 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 *CustomMetricIterator) Next() (*adminpb.CustomMetric, error) { + var item *adminpb.CustomMetric + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CustomMetricIterator) bufLen() int { + return len(it.items) +} + +func (it *CustomMetricIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // FirebaseLinkIterator manages a stream of *adminpb.FirebaseLink. type FirebaseLinkIterator struct { items []*adminpb.FirebaseLink @@ -2197,6 +3241,53 @@ func (it *IosAppDataStreamIterator) takeBuf() interface{} { return b } +// MeasurementProtocolSecretIterator manages a stream of *adminpb.MeasurementProtocolSecret. +type MeasurementProtocolSecretIterator struct { + items []*adminpb.MeasurementProtocolSecret + 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 []*adminpb.MeasurementProtocolSecret, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MeasurementProtocolSecretIterator) 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 *MeasurementProtocolSecretIterator) Next() (*adminpb.MeasurementProtocolSecret, error) { + var item *adminpb.MeasurementProtocolSecret + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MeasurementProtocolSecretIterator) bufLen() int { + return len(it.items) +} + +func (it *MeasurementProtocolSecretIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // PropertyIterator manages a stream of *adminpb.Property. type PropertyIterator struct { items []*adminpb.Property diff --git a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go index 708f03276dbe..bfa1a5f1e295 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go @@ -954,6 +954,105 @@ func ExampleAnalyticsAdminClient_GetDataSharingSettings() { _ = resp } +func ExampleAnalyticsAdminClient_GetMeasurementProtocolSecret() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_ListMeasurementProtocolSecrets() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListMeasurementProtocolSecretsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMeasurementProtocolSecrets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnalyticsAdminClient_CreateMeasurementProtocolSecret() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_DeleteMeasurementProtocolSecret() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.DeleteMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAnalyticsAdminClient_UpdateMeasurementProtocolSecret() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleAnalyticsAdminClient_SearchChangeHistoryEvents() { ctx := context.Background() c, err := admin.NewAnalyticsAdminClient(ctx) @@ -978,3 +1077,319 @@ func ExampleAnalyticsAdminClient_SearchChangeHistoryEvents() { _ = resp } } + +func ExampleAnalyticsAdminClient_GetGoogleSignalsSettings() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetGoogleSignalsSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGoogleSignalsSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_UpdateGoogleSignalsSettings() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateGoogleSignalsSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateGoogleSignalsSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_CreateConversionEvent() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateConversionEventRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_GetConversionEvent() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetConversionEventRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_DeleteConversionEvent() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.DeleteConversionEventRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAnalyticsAdminClient_ListConversionEvents() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListConversionEventsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConversionEvents(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnalyticsAdminClient_CreateCustomDimension() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_UpdateCustomDimension() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_ListCustomDimensions() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListCustomDimensionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCustomDimensions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnalyticsAdminClient_ArchiveCustomDimension() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ArchiveCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + err = c.ArchiveCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAnalyticsAdminClient_GetCustomDimension() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_CreateCustomMetric() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_UpdateCustomMetric() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_ListCustomMetrics() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListCustomMetricsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCustomMetrics(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnalyticsAdminClient_ArchiveCustomMetric() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ArchiveCustomMetricRequest{ + // TODO: Fill request struct fields. + } + err = c.ArchiveCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAnalyticsAdminClient_GetCustomMetric() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index 996a36736332..c85ec72a3c5c 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/analytics/admin/apiv1alpha/gapic_metadata.json b/analytics/admin/apiv1alpha/gapic_metadata.json index 7df5658e8884..582fd4892aae 100644 --- a/analytics/admin/apiv1alpha/gapic_metadata.json +++ b/analytics/admin/apiv1alpha/gapic_metadata.json @@ -10,6 +10,16 @@ "grpc": { "libraryClient": "AnalyticsAdminClient", "rpcs": { + "ArchiveCustomDimension": { + "methods": [ + "ArchiveCustomDimension" + ] + }, + "ArchiveCustomMetric": { + "methods": [ + "ArchiveCustomMetric" + ] + }, "AuditUserLinks": { "methods": [ "AuditUserLinks" @@ -35,6 +45,21 @@ "BatchUpdateUserLinks" ] }, + "CreateConversionEvent": { + "methods": [ + "CreateConversionEvent" + ] + }, + "CreateCustomDimension": { + "methods": [ + "CreateCustomDimension" + ] + }, + "CreateCustomMetric": { + "methods": [ + "CreateCustomMetric" + ] + }, "CreateFirebaseLink": { "methods": [ "CreateFirebaseLink" @@ -45,6 +70,11 @@ "CreateGoogleAdsLink" ] }, + "CreateMeasurementProtocolSecret": { + "methods": [ + "CreateMeasurementProtocolSecret" + ] + }, "CreateProperty": { "methods": [ "CreateProperty" @@ -70,6 +100,11 @@ "DeleteAndroidAppDataStream" ] }, + "DeleteConversionEvent": { + "methods": [ + "DeleteConversionEvent" + ] + }, "DeleteFirebaseLink": { "methods": [ "DeleteFirebaseLink" @@ -85,6 +120,11 @@ "DeleteIosAppDataStream" ] }, + "DeleteMeasurementProtocolSecret": { + "methods": [ + "DeleteMeasurementProtocolSecret" + ] + }, "DeleteProperty": { "methods": [ "DeleteProperty" @@ -110,6 +150,21 @@ "GetAndroidAppDataStream" ] }, + "GetConversionEvent": { + "methods": [ + "GetConversionEvent" + ] + }, + "GetCustomDimension": { + "methods": [ + "GetCustomDimension" + ] + }, + "GetCustomMetric": { + "methods": [ + "GetCustomMetric" + ] + }, "GetDataSharingSettings": { "methods": [ "GetDataSharingSettings" @@ -125,11 +180,21 @@ "GetGlobalSiteTag" ] }, + "GetGoogleSignalsSettings": { + "methods": [ + "GetGoogleSignalsSettings" + ] + }, "GetIosAppDataStream": { "methods": [ "GetIosAppDataStream" ] }, + "GetMeasurementProtocolSecret": { + "methods": [ + "GetMeasurementProtocolSecret" + ] + }, "GetProperty": { "methods": [ "GetProperty" @@ -160,6 +225,21 @@ "ListAndroidAppDataStreams" ] }, + "ListConversionEvents": { + "methods": [ + "ListConversionEvents" + ] + }, + "ListCustomDimensions": { + "methods": [ + "ListCustomDimensions" + ] + }, + "ListCustomMetrics": { + "methods": [ + "ListCustomMetrics" + ] + }, "ListFirebaseLinks": { "methods": [ "ListFirebaseLinks" @@ -175,6 +255,11 @@ "ListIosAppDataStreams" ] }, + "ListMeasurementProtocolSecrets": { + "methods": [ + "ListMeasurementProtocolSecrets" + ] + }, "ListProperties": { "methods": [ "ListProperties" @@ -210,6 +295,16 @@ "UpdateAndroidAppDataStream" ] }, + "UpdateCustomDimension": { + "methods": [ + "UpdateCustomDimension" + ] + }, + "UpdateCustomMetric": { + "methods": [ + "UpdateCustomMetric" + ] + }, "UpdateEnhancedMeasurementSettings": { "methods": [ "UpdateEnhancedMeasurementSettings" @@ -225,11 +320,21 @@ "UpdateGoogleAdsLink" ] }, + "UpdateGoogleSignalsSettings": { + "methods": [ + "UpdateGoogleSignalsSettings" + ] + }, "UpdateIosAppDataStream": { "methods": [ "UpdateIosAppDataStream" ] }, + "UpdateMeasurementProtocolSecret": { + "methods": [ + "UpdateMeasurementProtocolSecret" + ] + }, "UpdateProperty": { "methods": [ "UpdateProperty" diff --git a/apigateway/apiv1/doc.go b/apigateway/apiv1/doc.go index d29d1c77f832..bb21367cf928 100644 --- a/apigateway/apiv1/doc.go +++ b/apigateway/apiv1/doc.go @@ -46,7 +46,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/asset_client.go b/asset/apiv1/asset_client.go index 191733636817..d94d417823d1 100644 --- a/asset/apiv1/asset_client.go +++ b/asset/apiv1/asset_client.go @@ -43,6 +43,7 @@ var newClientHook clientHook // CallOptions contains the retry settings for each method of Client. type CallOptions struct { ExportAssets []gax.CallOption + ListAssets []gax.CallOption BatchGetAssetsHistory []gax.CallOption CreateFeed []gax.CallOption GetFeed []gax.CallOption @@ -70,6 +71,18 @@ func defaultGRPCClientOptions() []option.ClientOption { func defaultCallOptions() *CallOptions { return &CallOptions{ ExportAssets: []gax.CallOption{}, + ListAssets: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, BatchGetAssetsHistory: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -166,6 +179,7 @@ type internalClient interface { Connection() *grpc.ClientConn ExportAssets(context.Context, *assetpb.ExportAssetsRequest, ...gax.CallOption) (*ExportAssetsOperation, error) ExportAssetsOperation(name string) *ExportAssetsOperation + ListAssets(context.Context, *assetpb.ListAssetsRequest, ...gax.CallOption) *AssetIterator BatchGetAssetsHistory(context.Context, *assetpb.BatchGetAssetsHistoryRequest, ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) CreateFeed(context.Context, *assetpb.CreateFeedRequest, ...gax.CallOption) (*assetpb.Feed, error) GetFeed(context.Context, *assetpb.GetFeedRequest, ...gax.CallOption) (*assetpb.Feed, error) @@ -238,6 +252,12 @@ func (c *Client) ExportAssetsOperation(name string) *ExportAssetsOperation { return c.internalClient.ExportAssetsOperation(name) } +// ListAssets lists assets with time and resource types and returns paged results in +// response. +func (c *Client) ListAssets(ctx context.Context, req *assetpb.ListAssetsRequest, opts ...gax.CallOption) *AssetIterator { + return c.internalClient.ListAssets(ctx, req, opts...) +} + // BatchGetAssetsHistory batch gets the update history of assets that overlap a time window. // For IAM_POLICY content, this API outputs history when the asset and its // attached IAM POLICY both exist. This can create gaps in the output history. @@ -435,6 +455,46 @@ func (c *gRPCClient) ExportAssets(ctx context.Context, req *assetpb.ExportAssets }, nil } +func (c *gRPCClient) ListAssets(ctx context.Context, req *assetpb.ListAssetsRequest, opts ...gax.CallOption) *AssetIterator { + 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).ListAssets[0:len((*c.CallOptions).ListAssets):len((*c.CallOptions).ListAssets)], opts...) + it := &AssetIterator{} + req = proto.Clone(req).(*assetpb.ListAssetsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*assetpb.Asset, string, error) { + var resp *assetpb.ListAssetsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListAssets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetAssets(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + func (c *gRPCClient) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest, opts ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -819,6 +879,53 @@ func (op *ExportAssetsOperation) Name() string { return op.lro.Name() } +// AssetIterator manages a stream of *assetpb.Asset. +type AssetIterator struct { + items []*assetpb.Asset + 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 []*assetpb.Asset, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *AssetIterator) 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 *AssetIterator) Next() (*assetpb.Asset, error) { + var item *assetpb.Asset + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *AssetIterator) bufLen() int { + return len(it.items) +} + +func (it *AssetIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // IamPolicySearchResultIterator manages a stream of *assetpb.IamPolicySearchResult. type IamPolicySearchResultIterator struct { items []*assetpb.IamPolicySearchResult diff --git a/asset/apiv1/asset_client_example_test.go b/asset/apiv1/asset_client_example_test.go index 42680a57e557..0a337dbf56f6 100644 --- a/asset/apiv1/asset_client_example_test.go +++ b/asset/apiv1/asset_client_example_test.go @@ -60,6 +60,31 @@ func ExampleClient_ExportAssets() { _ = resp } +func ExampleClient_ListAssets() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &assetpb.ListAssetsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAssets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + func ExampleClient_BatchGetAssetsHistory() { ctx := context.Background() c, err := asset.NewClient(ctx) diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index 2d3431932382..5ff44b1e512e 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/asset/apiv1/gapic_metadata.json b/asset/apiv1/gapic_metadata.json index d02d4416b1b5..dd6e9fda56a2 100644 --- a/asset/apiv1/gapic_metadata.json +++ b/asset/apiv1/gapic_metadata.json @@ -45,6 +45,11 @@ "GetFeed" ] }, + "ListAssets": { + "methods": [ + "ListAssets" + ] + }, "ListFeeds": { "methods": [ "ListFeeds" diff --git a/bigquery/go.mod b/bigquery/go.mod index 695d4a0bbc4d..fe2b2047e3f9 100644 --- a/bigquery/go.mod +++ b/bigquery/go.mod @@ -10,6 +10,6 @@ require ( github.com/googleapis/gax-go/v2 v2.0.5 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 ) diff --git a/bigquery/go.sum b/bigquery/go.sum index 5cf48ff552f1..e1b73703ea2f 100644 --- a/bigquery/go.sum +++ b/bigquery/go.sum @@ -442,8 +442,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index 3077a66fdda5..6f31e9404222 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigtable/go.mod b/bigtable/go.mod index 691c16943a07..7b1e74689285 100644 --- a/bigtable/go.mod +++ b/bigtable/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 rsc.io/binaryregexp v0.2.0 diff --git a/bigtable/go.sum b/bigtable/go.sum index 11403772feb2..ab24d1a4e6d3 100644 --- a/bigtable/go.sum +++ b/bigtable/go.sum @@ -442,8 +442,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 3c7c4e7eca47..03a67376d21a 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index 960e8fe3d4d6..53a0bda318fc 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.5 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/datastore/go.sum b/datastore/go.sum index 767e60b48686..7eea0183d319 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -439,8 +439,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/dialogflow/cx/apiv3/doc.go b/dialogflow/cx/apiv3/doc.go index db036d3a0fa3..60295dc7c5ec 100644 --- a/dialogflow/cx/apiv3/doc.go +++ b/dialogflow/cx/apiv3/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/cx/apiv3/environments_client.go b/dialogflow/cx/apiv3/environments_client.go index 19d164e81c97..54b78cded35f 100644 --- a/dialogflow/cx/apiv3/environments_client.go +++ b/dialogflow/cx/apiv3/environments_client.go @@ -43,12 +43,14 @@ var newEnvironmentsClientHook clientHook // EnvironmentsCallOptions contains the retry settings for each method of EnvironmentsClient. type EnvironmentsCallOptions struct { - ListEnvironments []gax.CallOption - GetEnvironment []gax.CallOption - CreateEnvironment []gax.CallOption - UpdateEnvironment []gax.CallOption - DeleteEnvironment []gax.CallOption - LookupEnvironmentHistory []gax.CallOption + ListEnvironments []gax.CallOption + GetEnvironment []gax.CallOption + CreateEnvironment []gax.CallOption + UpdateEnvironment []gax.CallOption + DeleteEnvironment []gax.CallOption + LookupEnvironmentHistory []gax.CallOption + RunContinuousTest []gax.CallOption + ListContinuousTestResults []gax.CallOption } func defaultEnvironmentsGRPCClientOptions() []option.ClientOption { @@ -131,6 +133,28 @@ func defaultEnvironmentsCallOptions() *EnvironmentsCallOptions { }) }), }, + RunContinuousTest: []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, + }) + }), + }, + ListContinuousTestResults: []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, + }) + }), + }, } } @@ -147,6 +171,9 @@ type internalEnvironmentsClient interface { UpdateEnvironmentOperation(name string) *UpdateEnvironmentOperation DeleteEnvironment(context.Context, *cxpb.DeleteEnvironmentRequest, ...gax.CallOption) error LookupEnvironmentHistory(context.Context, *cxpb.LookupEnvironmentHistoryRequest, ...gax.CallOption) *EnvironmentIterator + RunContinuousTest(context.Context, *cxpb.RunContinuousTestRequest, ...gax.CallOption) (*RunContinuousTestOperation, error) + RunContinuousTestOperation(name string) *RunContinuousTestOperation + ListContinuousTestResults(context.Context, *cxpb.ListContinuousTestResultsRequest, ...gax.CallOption) *ContinuousTestResultIterator } // EnvironmentsClient is a client for interacting with Dialogflow API. @@ -230,6 +257,22 @@ func (c *EnvironmentsClient) LookupEnvironmentHistory(ctx context.Context, req * return c.internalClient.LookupEnvironmentHistory(ctx, req, opts...) } +// RunContinuousTest kicks off a continuous test under the specified Environment. +func (c *EnvironmentsClient) RunContinuousTest(ctx context.Context, req *cxpb.RunContinuousTestRequest, opts ...gax.CallOption) (*RunContinuousTestOperation, error) { + return c.internalClient.RunContinuousTest(ctx, req, opts...) +} + +// RunContinuousTestOperation returns a new RunContinuousTestOperation from a given name. +// The name must be that of a previously created RunContinuousTestOperation, possibly from a different process. +func (c *EnvironmentsClient) RunContinuousTestOperation(name string) *RunContinuousTestOperation { + return c.internalClient.RunContinuousTestOperation(name) +} + +// ListContinuousTestResults fetches a list of continuous test results for a given environment. +func (c *EnvironmentsClient) ListContinuousTestResults(ctx context.Context, req *cxpb.ListContinuousTestResultsRequest, opts ...gax.CallOption) *ContinuousTestResultIterator { + return c.internalClient.ListContinuousTestResults(ctx, req, opts...) +} + // environmentsGRPCClient 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. @@ -490,6 +533,69 @@ func (c *environmentsGRPCClient) LookupEnvironmentHistory(ctx context.Context, r return it } +func (c *environmentsGRPCClient) RunContinuousTest(ctx context.Context, req *cxpb.RunContinuousTestRequest, opts ...gax.CallOption) (*RunContinuousTestOperation, 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", "environment", url.QueryEscape(req.GetEnvironment()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).RunContinuousTest[0:len((*c.CallOptions).RunContinuousTest):len((*c.CallOptions).RunContinuousTest)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.environmentsClient.RunContinuousTest(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RunContinuousTestOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *environmentsGRPCClient) ListContinuousTestResults(ctx context.Context, req *cxpb.ListContinuousTestResultsRequest, opts ...gax.CallOption) *ContinuousTestResultIterator { + 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).ListContinuousTestResults[0:len((*c.CallOptions).ListContinuousTestResults):len((*c.CallOptions).ListContinuousTestResults)], opts...) + it := &ContinuousTestResultIterator{} + req = proto.Clone(req).(*cxpb.ListContinuousTestResultsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*cxpb.ContinuousTestResult, string, error) { + var resp *cxpb.ListContinuousTestResultsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.environmentsClient.ListContinuousTestResults(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetContinuousTestResults(), 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 +} + // CreateEnvironmentOperation manages a long-running operation from CreateEnvironment. type CreateEnvironmentOperation struct { lro *longrunning.Operation @@ -559,6 +665,75 @@ func (op *CreateEnvironmentOperation) Name() string { return op.lro.Name() } +// RunContinuousTestOperation manages a long-running operation from RunContinuousTest. +type RunContinuousTestOperation struct { + lro *longrunning.Operation +} + +// RunContinuousTestOperation returns a new RunContinuousTestOperation from a given name. +// The name must be that of a previously created RunContinuousTestOperation, possibly from a different process. +func (c *environmentsGRPCClient) RunContinuousTestOperation(name string) *RunContinuousTestOperation { + return &RunContinuousTestOperation{ + 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 *RunContinuousTestOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cxpb.RunContinuousTestResponse, error) { + var resp cxpb.RunContinuousTestResponse + 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 *RunContinuousTestOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cxpb.RunContinuousTestResponse, error) { + var resp cxpb.RunContinuousTestResponse + 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 *RunContinuousTestOperation) Metadata() (*cxpb.RunContinuousTestMetadata, error) { + var meta cxpb.RunContinuousTestMetadata + 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 *RunContinuousTestOperation) 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 *RunContinuousTestOperation) Name() string { + return op.lro.Name() +} + // UpdateEnvironmentOperation manages a long-running operation from UpdateEnvironment. type UpdateEnvironmentOperation struct { lro *longrunning.Operation @@ -628,6 +803,53 @@ func (op *UpdateEnvironmentOperation) Name() string { return op.lro.Name() } +// ContinuousTestResultIterator manages a stream of *cxpb.ContinuousTestResult. +type ContinuousTestResultIterator struct { + items []*cxpb.ContinuousTestResult + 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 []*cxpb.ContinuousTestResult, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ContinuousTestResultIterator) 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 *ContinuousTestResultIterator) Next() (*cxpb.ContinuousTestResult, error) { + var item *cxpb.ContinuousTestResult + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ContinuousTestResultIterator) bufLen() int { + return len(it.items) +} + +func (it *ContinuousTestResultIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // EnvironmentIterator manages a stream of *cxpb.Environment. type EnvironmentIterator struct { items []*cxpb.Environment diff --git a/dialogflow/cx/apiv3/environments_client_example_test.go b/dialogflow/cx/apiv3/environments_client_example_test.go index ab6c5ae047fb..c89795ca2674 100644 --- a/dialogflow/cx/apiv3/environments_client_example_test.go +++ b/dialogflow/cx/apiv3/environments_client_example_test.go @@ -169,3 +169,52 @@ func ExampleEnvironmentsClient_LookupEnvironmentHistory() { _ = resp } } + +func ExampleEnvironmentsClient_RunContinuousTest() { + ctx := context.Background() + c, err := cx.NewEnvironmentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.RunContinuousTestRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RunContinuousTest(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleEnvironmentsClient_ListContinuousTestResults() { + ctx := context.Background() + c, err := cx.NewEnvironmentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.ListContinuousTestResultsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListContinuousTestResults(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/dialogflow/cx/apiv3/gapic_metadata.json b/dialogflow/cx/apiv3/gapic_metadata.json index 87b69ec90fc0..409bc550939f 100644 --- a/dialogflow/cx/apiv3/gapic_metadata.json +++ b/dialogflow/cx/apiv3/gapic_metadata.json @@ -113,6 +113,11 @@ "GetEnvironment" ] }, + "ListContinuousTestResults": { + "methods": [ + "ListContinuousTestResults" + ] + }, "ListEnvironments": { "methods": [ "ListEnvironments" @@ -123,6 +128,11 @@ "LookupEnvironmentHistory" ] }, + "RunContinuousTest": { + "methods": [ + "RunContinuousTest" + ] + }, "UpdateEnvironment": { "methods": [ "UpdateEnvironment" diff --git a/essentialcontacts/apiv1/doc.go b/essentialcontacts/apiv1/doc.go index d17766e96bf7..def23d28028d 100644 --- a/essentialcontacts/apiv1/doc.go +++ b/essentialcontacts/apiv1/doc.go @@ -17,6 +17,8 @@ // Package essentialcontacts is an auto-generated package for the // Essential Contacts API. // +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -26,7 +28,7 @@ // To close the open connection, use the Close() method. // // For information about setting deadlines, reusing contexts, and more -// please visit pkg.go.dev/cloud.google.com/go. +// please visit https://pkg.go.dev/cloud.google.com/go. package essentialcontacts // import "cloud.google.com/go/essentialcontacts/apiv1" import ( @@ -46,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210518" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/essentialcontacts/apiv1/essential_contacts_client.go b/essentialcontacts/apiv1/essential_contacts_client.go index 826c141d7c16..892e15023411 100644 --- a/essentialcontacts/apiv1/essential_contacts_client.go +++ b/essentialcontacts/apiv1/essential_contacts_client.go @@ -48,7 +48,7 @@ type CallOptions struct { SendTestMessage []gax.CallOption } -func defaultClientOptions() []option.ClientOption { +func defaultGRPCClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("essentialcontacts.googleapis.com:443"), internaloption.WithDefaultMTLSEndpoint("essentialcontacts.mtls.googleapis.com:443"), @@ -92,32 +92,119 @@ func defaultCallOptions() *CallOptions { } } +// internalClient is an interface that defines the methods availaible from Essential Contacts API. +type internalClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateContact(context.Context, *essentialcontactspb.CreateContactRequest, ...gax.CallOption) (*essentialcontactspb.Contact, error) + UpdateContact(context.Context, *essentialcontactspb.UpdateContactRequest, ...gax.CallOption) (*essentialcontactspb.Contact, error) + ListContacts(context.Context, *essentialcontactspb.ListContactsRequest, ...gax.CallOption) *ContactIterator + GetContact(context.Context, *essentialcontactspb.GetContactRequest, ...gax.CallOption) (*essentialcontactspb.Contact, error) + DeleteContact(context.Context, *essentialcontactspb.DeleteContactRequest, ...gax.CallOption) error + ComputeContacts(context.Context, *essentialcontactspb.ComputeContactsRequest, ...gax.CallOption) *ContactIterator + SendTestMessage(context.Context, *essentialcontactspb.SendTestMessageRequest, ...gax.CallOption) error +} + // Client is a client for interacting with Essential Contacts API. -// // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Manages contacts for important Google Cloud notifications. type Client struct { + // The internal transport-dependent client. + internalClient internalClient + + // The call options for this service. + CallOptions *CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateContact adds a new contact for a resource. +func (c *Client) CreateContact(ctx context.Context, req *essentialcontactspb.CreateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { + return c.internalClient.CreateContact(ctx, req, opts...) +} + +// UpdateContact updates a contact. +// Note: A contact’s email address cannot be changed. +func (c *Client) UpdateContact(ctx context.Context, req *essentialcontactspb.UpdateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { + return c.internalClient.UpdateContact(ctx, req, opts...) +} + +// ListContacts lists the contacts that have been set on a resource. +func (c *Client) ListContacts(ctx context.Context, req *essentialcontactspb.ListContactsRequest, opts ...gax.CallOption) *ContactIterator { + return c.internalClient.ListContacts(ctx, req, opts...) +} + +// GetContact gets a single contact. +func (c *Client) GetContact(ctx context.Context, req *essentialcontactspb.GetContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { + return c.internalClient.GetContact(ctx, req, opts...) +} + +// DeleteContact deletes a contact. +func (c *Client) DeleteContact(ctx context.Context, req *essentialcontactspb.DeleteContactRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteContact(ctx, req, opts...) +} + +// ComputeContacts lists all contacts for the resource that are subscribed to the +// specified notification categories, including contacts inherited from +// any parent resources. +func (c *Client) ComputeContacts(ctx context.Context, req *essentialcontactspb.ComputeContactsRequest, opts ...gax.CallOption) *ContactIterator { + return c.internalClient.ComputeContacts(ctx, req, opts...) +} + +// SendTestMessage allows a contact admin to send a test message to contact to verify that it +// has been configured correctly. +func (c *Client) SendTestMessage(ctx context.Context, req *essentialcontactspb.SendTestMessageRequest, opts ...gax.CallOption) error { + return c.internalClient.SendTestMessage(ctx, req, opts...) +} + +// gRPCClient is a client for interacting with Essential Contacts API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type gRPCClient struct { // Connection pool of gRPC connections to the service. connPool gtransport.ConnPool // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE disableDeadlines bool + // Points back to the CallOptions field of the containing Client + CallOptions **CallOptions + // The gRPC API client. client essentialcontactspb.EssentialContactsServiceClient - // The call options for this service. - CallOptions *CallOptions - // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } -// NewClient creates a new essential contacts service client. +// NewClient creates a new essential contacts service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. // // Manages contacts for important Google Cloud notifications. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { - clientOpts := defaultClientOptions() - + clientOpts := defaultGRPCClientOptions() if newClientHook != nil { hookOpts, err := newClientHook(ctx, clientHookParams{}) if err != nil { @@ -135,42 +222,44 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error if err != nil { return nil, err } - c := &Client{ + client := Client{CallOptions: defaultCallOptions()} + + c := &gRPCClient{ connPool: connPool, disableDeadlines: disableDeadlines, - CallOptions: defaultCallOptions(), - - client: essentialcontactspb.NewEssentialContactsServiceClient(connPool), + client: essentialcontactspb.NewEssentialContactsServiceClient(connPool), + CallOptions: &client.CallOptions, } c.setGoogleClientInfo() - return c, nil + client.internalClient = c + + return &client, nil } // Connection returns a connection to the API service. // // Deprecated. -func (c *Client) Connection() *grpc.ClientConn { +func (c *gRPCClient) Connection() *grpc.ClientConn { return c.connPool.Conn() } -// Close closes the connection to the API service. The user should invoke this when -// the client is no longer required. -func (c *Client) Close() error { - return c.connPool.Close() -} - // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. -func (c *Client) setGoogleClientInfo(keyval ...string) { +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", versionGo()}, keyval...) kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) } -// CreateContact adds a new contact for a resource. -func (c *Client) CreateContact(ctx context.Context, req *essentialcontactspb.CreateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *gRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *gRPCClient) CreateContact(ctx context.Context, req *essentialcontactspb.CreateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -178,7 +267,7 @@ func (c *Client) CreateContact(ctx context.Context, req *essentialcontactspb.Cre } 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.CreateContact[0:len(c.CallOptions.CreateContact):len(c.CallOptions.CreateContact)], opts...) + opts = append((*c.CallOptions).CreateContact[0:len((*c.CallOptions).CreateContact):len((*c.CallOptions).CreateContact)], opts...) var resp *essentialcontactspb.Contact err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -191,9 +280,7 @@ func (c *Client) CreateContact(ctx context.Context, req *essentialcontactspb.Cre return resp, nil } -// UpdateContact updates a contact. -// Note: A contact’s email address cannot be changed. -func (c *Client) UpdateContact(ctx context.Context, req *essentialcontactspb.UpdateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { +func (c *gRPCClient) UpdateContact(ctx context.Context, req *essentialcontactspb.UpdateContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -201,7 +288,7 @@ func (c *Client) UpdateContact(ctx context.Context, req *essentialcontactspb.Upd } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "contact.name", url.QueryEscape(req.GetContact().GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append(c.CallOptions.UpdateContact[0:len(c.CallOptions.UpdateContact):len(c.CallOptions.UpdateContact)], opts...) + opts = append((*c.CallOptions).UpdateContact[0:len((*c.CallOptions).UpdateContact):len((*c.CallOptions).UpdateContact)], opts...) var resp *essentialcontactspb.Contact err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -214,11 +301,10 @@ func (c *Client) UpdateContact(ctx context.Context, req *essentialcontactspb.Upd return resp, nil } -// ListContacts lists the contacts that have been set on a resource. -func (c *Client) ListContacts(ctx context.Context, req *essentialcontactspb.ListContactsRequest, opts ...gax.CallOption) *ContactIterator { +func (c *gRPCClient) ListContacts(ctx context.Context, req *essentialcontactspb.ListContactsRequest, opts ...gax.CallOption) *ContactIterator { 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.ListContacts[0:len(c.CallOptions.ListContacts):len(c.CallOptions.ListContacts)], opts...) + opts = append((*c.CallOptions).ListContacts[0:len((*c.CallOptions).ListContacts):len((*c.CallOptions).ListContacts)], opts...) it := &ContactIterator{} req = proto.Clone(req).(*essentialcontactspb.ListContactsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*essentialcontactspb.Contact, string, error) { @@ -255,8 +341,7 @@ func (c *Client) ListContacts(ctx context.Context, req *essentialcontactspb.List return it } -// GetContact gets a single contact. -func (c *Client) GetContact(ctx context.Context, req *essentialcontactspb.GetContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { +func (c *gRPCClient) GetContact(ctx context.Context, req *essentialcontactspb.GetContactRequest, opts ...gax.CallOption) (*essentialcontactspb.Contact, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -264,7 +349,7 @@ func (c *Client) GetContact(ctx context.Context, req *essentialcontactspb.GetCon } 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.GetContact[0:len(c.CallOptions.GetContact):len(c.CallOptions.GetContact)], opts...) + opts = append((*c.CallOptions).GetContact[0:len((*c.CallOptions).GetContact):len((*c.CallOptions).GetContact)], opts...) var resp *essentialcontactspb.Contact err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -277,8 +362,7 @@ func (c *Client) GetContact(ctx context.Context, req *essentialcontactspb.GetCon return resp, nil } -// DeleteContact deletes a contact. -func (c *Client) DeleteContact(ctx context.Context, req *essentialcontactspb.DeleteContactRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteContact(ctx context.Context, req *essentialcontactspb.DeleteContactRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -286,7 +370,7 @@ func (c *Client) DeleteContact(ctx context.Context, req *essentialcontactspb.Del } 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.DeleteContact[0:len(c.CallOptions.DeleteContact):len(c.CallOptions.DeleteContact)], opts...) + opts = append((*c.CallOptions).DeleteContact[0:len((*c.CallOptions).DeleteContact):len((*c.CallOptions).DeleteContact)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = c.client.DeleteContact(ctx, req, settings.GRPC...) @@ -295,13 +379,10 @@ func (c *Client) DeleteContact(ctx context.Context, req *essentialcontactspb.Del return err } -// ComputeContacts lists all contacts for the resource that are subscribed to the -// specified notification categories, including contacts inherited from -// any parent resources. -func (c *Client) ComputeContacts(ctx context.Context, req *essentialcontactspb.ComputeContactsRequest, opts ...gax.CallOption) *ContactIterator { +func (c *gRPCClient) ComputeContacts(ctx context.Context, req *essentialcontactspb.ComputeContactsRequest, opts ...gax.CallOption) *ContactIterator { 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.ComputeContacts[0:len(c.CallOptions.ComputeContacts):len(c.CallOptions.ComputeContacts)], opts...) + opts = append((*c.CallOptions).ComputeContacts[0:len((*c.CallOptions).ComputeContacts):len((*c.CallOptions).ComputeContacts)], opts...) it := &ContactIterator{} req = proto.Clone(req).(*essentialcontactspb.ComputeContactsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*essentialcontactspb.Contact, string, error) { @@ -338,9 +419,7 @@ func (c *Client) ComputeContacts(ctx context.Context, req *essentialcontactspb.C return it } -// SendTestMessage allows a contact admin to send a test message to contact to verify that it -// has been configured correctly. -func (c *Client) SendTestMessage(ctx context.Context, req *essentialcontactspb.SendTestMessageRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) SendTestMessage(ctx context.Context, req *essentialcontactspb.SendTestMessageRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -348,7 +427,7 @@ func (c *Client) SendTestMessage(ctx context.Context, req *essentialcontactspb.S } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append(c.CallOptions.SendTestMessage[0:len(c.CallOptions.SendTestMessage):len(c.CallOptions.SendTestMessage)], opts...) + opts = append((*c.CallOptions).SendTestMessage[0:len((*c.CallOptions).SendTestMessage):len((*c.CallOptions).SendTestMessage)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = c.client.SendTestMessage(ctx, req, settings.GRPC...) diff --git a/essentialcontacts/apiv1/essential_contacts_client_example_test.go b/essentialcontacts/apiv1/essential_contacts_client_example_test.go index d8646ef7e4ff..3e70a88f3342 100644 --- a/essentialcontacts/apiv1/essential_contacts_client_example_test.go +++ b/essentialcontacts/apiv1/essential_contacts_client_example_test.go @@ -30,18 +30,19 @@ func ExampleNewClient() { if err != nil { // TODO: Handle error. } + defer c.Close() + // TODO: Use client. _ = c } func ExampleClient_CreateContact() { - // import essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" - ctx := context.Background() c, err := essentialcontacts.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.CreateContactRequest{ // TODO: Fill request struct fields. @@ -55,13 +56,12 @@ func ExampleClient_CreateContact() { } func ExampleClient_UpdateContact() { - // import essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" - ctx := context.Background() c, err := essentialcontacts.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.UpdateContactRequest{ // TODO: Fill request struct fields. @@ -75,14 +75,12 @@ func ExampleClient_UpdateContact() { } func ExampleClient_ListContacts() { - // import essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" - // import "google.golang.org/api/iterator" - ctx := context.Background() c, err := essentialcontacts.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.ListContactsRequest{ // TODO: Fill request struct fields. @@ -102,13 +100,12 @@ func ExampleClient_ListContacts() { } func ExampleClient_GetContact() { - // import essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" - ctx := context.Background() c, err := essentialcontacts.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.GetContactRequest{ // TODO: Fill request struct fields. @@ -127,6 +124,7 @@ func ExampleClient_DeleteContact() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.DeleteContactRequest{ // TODO: Fill request struct fields. @@ -138,14 +136,12 @@ func ExampleClient_DeleteContact() { } func ExampleClient_ComputeContacts() { - // import essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" - // import "google.golang.org/api/iterator" - ctx := context.Background() c, err := essentialcontacts.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.ComputeContactsRequest{ // TODO: Fill request struct fields. @@ -170,6 +166,7 @@ func ExampleClient_SendTestMessage() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &essentialcontactspb.SendTestMessageRequest{ // TODO: Fill request struct fields. diff --git a/firestore/go.mod b/firestore/go.mod index eb33ebe91205..39cab699ba7e 100644 --- a/firestore/go.mod +++ b/firestore/go.mod @@ -8,6 +8,6 @@ require ( github.com/google/go-cmp v0.5.5 github.com/googleapis/gax-go/v2 v2.0.5 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 ) diff --git a/firestore/go.sum b/firestore/go.sum index 767e60b48686..7eea0183d319 100644 --- a/firestore/go.sum +++ b/firestore/go.sum @@ -439,8 +439,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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 2512c10c0aef..e730158b787f 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.6 golang.org/x/tools v0.1.1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 5143aca51051..e597ff3b4934 100644 --- a/go.sum +++ b/go.sum @@ -441,8 +441,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/gsuiteaddons/apiv1/doc.go b/gsuiteaddons/apiv1/doc.go index 6825ab71ecdf..1563a060df74 100644 --- a/gsuiteaddons/apiv1/doc.go +++ b/gsuiteaddons/apiv1/doc.go @@ -17,6 +17,8 @@ // Package gsuiteaddons is an auto-generated package for the // Google Workspace Add-ons API. // +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// // Use of Context // // The ctx passed to NewClient is used for authentication requests and @@ -26,7 +28,7 @@ // To close the open connection, use the Close() method. // // For information about setting deadlines, reusing contexts, and more -// please visit pkg.go.dev/cloud.google.com/go. +// please visit https://pkg.go.dev/cloud.google.com/go. package gsuiteaddons // import "cloud.google.com/go/gsuiteaddons/apiv1" import ( @@ -46,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210510" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/gsuiteaddons/apiv1/g_suite_add_ons_client.go b/gsuiteaddons/apiv1/g_suite_add_ons_client.go index 49254f814afd..621a3399a19c 100644 --- a/gsuiteaddons/apiv1/g_suite_add_ons_client.go +++ b/gsuiteaddons/apiv1/g_suite_add_ons_client.go @@ -50,7 +50,7 @@ type CallOptions struct { GetInstallStatus []gax.CallOption } -func defaultClientOptions() []option.ClientOption { +func defaultGRPCClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("gsuiteaddons.googleapis.com:443"), internaloption.WithDefaultMTLSEndpoint("gsuiteaddons.mtls.googleapis.com:443"), @@ -142,27 +142,154 @@ func defaultCallOptions() *CallOptions { } } +// internalClient is an interface that defines the methods availaible from Google Workspace Add-ons API. +type internalClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + GetAuthorization(context.Context, *gsuiteaddonspb.GetAuthorizationRequest, ...gax.CallOption) (*gsuiteaddonspb.Authorization, error) + CreateDeployment(context.Context, *gsuiteaddonspb.CreateDeploymentRequest, ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) + ReplaceDeployment(context.Context, *gsuiteaddonspb.ReplaceDeploymentRequest, ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) + GetDeployment(context.Context, *gsuiteaddonspb.GetDeploymentRequest, ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) + ListDeployments(context.Context, *gsuiteaddonspb.ListDeploymentsRequest, ...gax.CallOption) *DeploymentIterator + DeleteDeployment(context.Context, *gsuiteaddonspb.DeleteDeploymentRequest, ...gax.CallOption) error + InstallDeployment(context.Context, *gsuiteaddonspb.InstallDeploymentRequest, ...gax.CallOption) error + UninstallDeployment(context.Context, *gsuiteaddonspb.UninstallDeploymentRequest, ...gax.CallOption) error + GetInstallStatus(context.Context, *gsuiteaddonspb.GetInstallStatusRequest, ...gax.CallOption) (*gsuiteaddonspb.InstallStatus, error) +} + // Client is a client for interacting with Google Workspace Add-ons API. -// // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// A service for managing Google Workspace Add-ons deployments. +// +// A Google Workspace Add-on is a third-party embedded component that can be +// installed in Google Workspace Applications like Gmail, Calendar, Drive, and +// the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can +// display UI cards, receive contextual information from the host application, +// and perform actions in the host application (See: +// https://developers.google.com/gsuite/add-ons/overview (at https://developers.google.com/gsuite/add-ons/overview) for more information). +// +// A Google Workspace Add-on deployment resource specifies metadata about the +// add-on, including a specification of the entry points in the host application +// that trigger add-on executions (see: +// https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests (at https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests)). +// Add-on deployments defined via the Google Workspace Add-ons API define their +// entrypoints using HTTPS URLs (See: +// https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes (at https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes)), +// +// A Google Workspace Add-on deployment can be installed in developer mode, +// which allows an add-on developer to test the experience an end-user would see +// when installing and running the add-on in their G Suite applications. When +// running in developer mode, more detailed error messages are exposed in the +// add-on UI to aid in debugging. +// +// A Google Workspace Add-on deployment can be published to Google Workspace +// Marketplace, which allows other Google Workspace users to discover and +// install the add-on. See: +// https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview (at https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview) +// for details. type Client struct { + // The internal transport-dependent client. + internalClient internalClient + + // The call options for this service. + CallOptions *CallOptions +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// GetAuthorization gets the authorization information for deployments in a given project. +func (c *Client) GetAuthorization(ctx context.Context, req *gsuiteaddonspb.GetAuthorizationRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Authorization, error) { + return c.internalClient.GetAuthorization(ctx, req, opts...) +} + +// CreateDeployment creates a deployment with the specified name and configuration. +func (c *Client) CreateDeployment(ctx context.Context, req *gsuiteaddonspb.CreateDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { + return c.internalClient.CreateDeployment(ctx, req, opts...) +} + +// ReplaceDeployment creates or replaces a deployment with the specified name. +func (c *Client) ReplaceDeployment(ctx context.Context, req *gsuiteaddonspb.ReplaceDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { + return c.internalClient.ReplaceDeployment(ctx, req, opts...) +} + +// GetDeployment gets the deployment with the specified name. +func (c *Client) GetDeployment(ctx context.Context, req *gsuiteaddonspb.GetDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { + return c.internalClient.GetDeployment(ctx, req, opts...) +} + +// ListDeployments lists all deployments in a particular project. +func (c *Client) ListDeployments(ctx context.Context, req *gsuiteaddonspb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { + return c.internalClient.ListDeployments(ctx, req, opts...) +} + +// DeleteDeployment deletes the deployment with the given name. +func (c *Client) DeleteDeployment(ctx context.Context, req *gsuiteaddonspb.DeleteDeploymentRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteDeployment(ctx, req, opts...) +} + +// InstallDeployment installs a deployment in developer mode. +// See: +// https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons (at https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons). +func (c *Client) InstallDeployment(ctx context.Context, req *gsuiteaddonspb.InstallDeploymentRequest, opts ...gax.CallOption) error { + return c.internalClient.InstallDeployment(ctx, req, opts...) +} + +// UninstallDeployment uninstalls a developer mode deployment. +// See: +// https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons (at https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons). +func (c *Client) UninstallDeployment(ctx context.Context, req *gsuiteaddonspb.UninstallDeploymentRequest, opts ...gax.CallOption) error { + return c.internalClient.UninstallDeployment(ctx, req, opts...) +} + +// GetInstallStatus fetches the install status of a developer mode deployment. +func (c *Client) GetInstallStatus(ctx context.Context, req *gsuiteaddonspb.GetInstallStatusRequest, opts ...gax.CallOption) (*gsuiteaddonspb.InstallStatus, error) { + return c.internalClient.GetInstallStatus(ctx, req, opts...) +} + +// gRPCClient is a client for interacting with Google Workspace Add-ons API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type gRPCClient struct { // Connection pool of gRPC connections to the service. connPool gtransport.ConnPool // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE disableDeadlines bool + // Points back to the CallOptions field of the containing Client + CallOptions **CallOptions + // The gRPC API client. client gsuiteaddonspb.GSuiteAddOnsClient - // The call options for this service. - CallOptions *CallOptions - // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } -// NewClient creates a new g suite add ons client. +// NewClient creates a new g suite add ons client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. // // A service for managing Google Workspace Add-ons deployments. // @@ -193,8 +320,7 @@ type Client struct { // https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview (at https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview) // for details. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { - clientOpts := defaultClientOptions() - + clientOpts := defaultGRPCClientOptions() if newClientHook != nil { hookOpts, err := newClientHook(ctx, clientHookParams{}) if err != nil { @@ -212,42 +338,44 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error if err != nil { return nil, err } - c := &Client{ + client := Client{CallOptions: defaultCallOptions()} + + c := &gRPCClient{ connPool: connPool, disableDeadlines: disableDeadlines, - CallOptions: defaultCallOptions(), - - client: gsuiteaddonspb.NewGSuiteAddOnsClient(connPool), + client: gsuiteaddonspb.NewGSuiteAddOnsClient(connPool), + CallOptions: &client.CallOptions, } c.setGoogleClientInfo() - return c, nil + client.internalClient = c + + return &client, nil } // Connection returns a connection to the API service. // // Deprecated. -func (c *Client) Connection() *grpc.ClientConn { +func (c *gRPCClient) Connection() *grpc.ClientConn { return c.connPool.Conn() } -// Close closes the connection to the API service. The user should invoke this when -// the client is no longer required. -func (c *Client) Close() error { - return c.connPool.Close() -} - // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. -func (c *Client) setGoogleClientInfo(keyval ...string) { +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", versionGo()}, keyval...) kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) } -// GetAuthorization gets the authorization information for deployments in a given project. -func (c *Client) GetAuthorization(ctx context.Context, req *gsuiteaddonspb.GetAuthorizationRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Authorization, error) { +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *gRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *gRPCClient) GetAuthorization(ctx context.Context, req *gsuiteaddonspb.GetAuthorizationRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Authorization, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 120000*time.Millisecond) defer cancel() @@ -255,7 +383,7 @@ func (c *Client) GetAuthorization(ctx context.Context, req *gsuiteaddonspb.GetAu } 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.GetAuthorization[0:len(c.CallOptions.GetAuthorization):len(c.CallOptions.GetAuthorization)], opts...) + opts = append((*c.CallOptions).GetAuthorization[0:len((*c.CallOptions).GetAuthorization):len((*c.CallOptions).GetAuthorization)], opts...) var resp *gsuiteaddonspb.Authorization err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -268,8 +396,7 @@ func (c *Client) GetAuthorization(ctx context.Context, req *gsuiteaddonspb.GetAu return resp, nil } -// CreateDeployment creates a deployment with the specified name and configuration. -func (c *Client) CreateDeployment(ctx context.Context, req *gsuiteaddonspb.CreateDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { +func (c *gRPCClient) CreateDeployment(ctx context.Context, req *gsuiteaddonspb.CreateDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -277,7 +404,7 @@ func (c *Client) CreateDeployment(ctx context.Context, req *gsuiteaddonspb.Creat } 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.CreateDeployment[0:len(c.CallOptions.CreateDeployment):len(c.CallOptions.CreateDeployment)], opts...) + opts = append((*c.CallOptions).CreateDeployment[0:len((*c.CallOptions).CreateDeployment):len((*c.CallOptions).CreateDeployment)], opts...) var resp *gsuiteaddonspb.Deployment err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -290,8 +417,7 @@ func (c *Client) CreateDeployment(ctx context.Context, req *gsuiteaddonspb.Creat return resp, nil } -// ReplaceDeployment creates or replaces a deployment with the specified name. -func (c *Client) ReplaceDeployment(ctx context.Context, req *gsuiteaddonspb.ReplaceDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { +func (c *gRPCClient) ReplaceDeployment(ctx context.Context, req *gsuiteaddonspb.ReplaceDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -299,7 +425,7 @@ func (c *Client) ReplaceDeployment(ctx context.Context, req *gsuiteaddonspb.Repl } md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "deployment.name", url.QueryEscape(req.GetDeployment().GetName()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append(c.CallOptions.ReplaceDeployment[0:len(c.CallOptions.ReplaceDeployment):len(c.CallOptions.ReplaceDeployment)], opts...) + opts = append((*c.CallOptions).ReplaceDeployment[0:len((*c.CallOptions).ReplaceDeployment):len((*c.CallOptions).ReplaceDeployment)], opts...) var resp *gsuiteaddonspb.Deployment err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -312,8 +438,7 @@ func (c *Client) ReplaceDeployment(ctx context.Context, req *gsuiteaddonspb.Repl return resp, nil } -// GetDeployment gets the deployment with the specified name. -func (c *Client) GetDeployment(ctx context.Context, req *gsuiteaddonspb.GetDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { +func (c *gRPCClient) GetDeployment(ctx context.Context, req *gsuiteaddonspb.GetDeploymentRequest, opts ...gax.CallOption) (*gsuiteaddonspb.Deployment, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -321,7 +446,7 @@ func (c *Client) GetDeployment(ctx context.Context, req *gsuiteaddonspb.GetDeplo } 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.GetDeployment[0:len(c.CallOptions.GetDeployment):len(c.CallOptions.GetDeployment)], opts...) + opts = append((*c.CallOptions).GetDeployment[0:len((*c.CallOptions).GetDeployment):len((*c.CallOptions).GetDeployment)], opts...) var resp *gsuiteaddonspb.Deployment err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error @@ -334,11 +459,10 @@ func (c *Client) GetDeployment(ctx context.Context, req *gsuiteaddonspb.GetDeplo return resp, nil } -// ListDeployments lists all deployments in a particular project. -func (c *Client) ListDeployments(ctx context.Context, req *gsuiteaddonspb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { +func (c *gRPCClient) ListDeployments(ctx context.Context, req *gsuiteaddonspb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { 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.ListDeployments[0:len(c.CallOptions.ListDeployments):len(c.CallOptions.ListDeployments)], opts...) + opts = append((*c.CallOptions).ListDeployments[0:len((*c.CallOptions).ListDeployments):len((*c.CallOptions).ListDeployments)], opts...) it := &DeploymentIterator{} req = proto.Clone(req).(*gsuiteaddonspb.ListDeploymentsRequest) it.InternalFetch = func(pageSize int, pageToken string) ([]*gsuiteaddonspb.Deployment, string, error) { @@ -375,8 +499,7 @@ func (c *Client) ListDeployments(ctx context.Context, req *gsuiteaddonspb.ListDe return it } -// DeleteDeployment deletes the deployment with the given name. -func (c *Client) DeleteDeployment(ctx context.Context, req *gsuiteaddonspb.DeleteDeploymentRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteDeployment(ctx context.Context, req *gsuiteaddonspb.DeleteDeploymentRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -384,7 +507,7 @@ func (c *Client) DeleteDeployment(ctx context.Context, req *gsuiteaddonspb.Delet } 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.DeleteDeployment[0:len(c.CallOptions.DeleteDeployment):len(c.CallOptions.DeleteDeployment)], opts...) + opts = append((*c.CallOptions).DeleteDeployment[0:len((*c.CallOptions).DeleteDeployment):len((*c.CallOptions).DeleteDeployment)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = c.client.DeleteDeployment(ctx, req, settings.GRPC...) @@ -393,10 +516,7 @@ func (c *Client) DeleteDeployment(ctx context.Context, req *gsuiteaddonspb.Delet return err } -// InstallDeployment installs a deployment in developer mode. -// See: -// https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons (at https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons). -func (c *Client) InstallDeployment(ctx context.Context, req *gsuiteaddonspb.InstallDeploymentRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) InstallDeployment(ctx context.Context, req *gsuiteaddonspb.InstallDeploymentRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -404,7 +524,7 @@ func (c *Client) InstallDeployment(ctx context.Context, req *gsuiteaddonspb.Inst } 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.InstallDeployment[0:len(c.CallOptions.InstallDeployment):len(c.CallOptions.InstallDeployment)], opts...) + opts = append((*c.CallOptions).InstallDeployment[0:len((*c.CallOptions).InstallDeployment):len((*c.CallOptions).InstallDeployment)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = c.client.InstallDeployment(ctx, req, settings.GRPC...) @@ -413,10 +533,7 @@ func (c *Client) InstallDeployment(ctx context.Context, req *gsuiteaddonspb.Inst return err } -// UninstallDeployment uninstalls a developer mode deployment. -// See: -// https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons (at https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons). -func (c *Client) UninstallDeployment(ctx context.Context, req *gsuiteaddonspb.UninstallDeploymentRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) UninstallDeployment(ctx context.Context, req *gsuiteaddonspb.UninstallDeploymentRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -424,7 +541,7 @@ func (c *Client) UninstallDeployment(ctx context.Context, req *gsuiteaddonspb.Un } 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.UninstallDeployment[0:len(c.CallOptions.UninstallDeployment):len(c.CallOptions.UninstallDeployment)], opts...) + opts = append((*c.CallOptions).UninstallDeployment[0:len((*c.CallOptions).UninstallDeployment):len((*c.CallOptions).UninstallDeployment)], opts...) err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error _, err = c.client.UninstallDeployment(ctx, req, settings.GRPC...) @@ -433,8 +550,7 @@ func (c *Client) UninstallDeployment(ctx context.Context, req *gsuiteaddonspb.Un return err } -// GetInstallStatus fetches the install status of a developer mode deployment. -func (c *Client) GetInstallStatus(ctx context.Context, req *gsuiteaddonspb.GetInstallStatusRequest, opts ...gax.CallOption) (*gsuiteaddonspb.InstallStatus, error) { +func (c *gRPCClient) GetInstallStatus(ctx context.Context, req *gsuiteaddonspb.GetInstallStatusRequest, opts ...gax.CallOption) (*gsuiteaddonspb.InstallStatus, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 10000*time.Millisecond) defer cancel() @@ -442,7 +558,7 @@ func (c *Client) GetInstallStatus(ctx context.Context, req *gsuiteaddonspb.GetIn } 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.GetInstallStatus[0:len(c.CallOptions.GetInstallStatus):len(c.CallOptions.GetInstallStatus)], opts...) + opts = append((*c.CallOptions).GetInstallStatus[0:len((*c.CallOptions).GetInstallStatus):len((*c.CallOptions).GetInstallStatus)], opts...) var resp *gsuiteaddonspb.InstallStatus err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error diff --git a/gsuiteaddons/apiv1/g_suite_add_ons_client_example_test.go b/gsuiteaddons/apiv1/g_suite_add_ons_client_example_test.go index c903b757a0e0..b0f599f5ec4b 100644 --- a/gsuiteaddons/apiv1/g_suite_add_ons_client_example_test.go +++ b/gsuiteaddons/apiv1/g_suite_add_ons_client_example_test.go @@ -30,18 +30,19 @@ func ExampleNewClient() { if err != nil { // TODO: Handle error. } + defer c.Close() + // TODO: Use client. _ = c } func ExampleClient_GetAuthorization() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.GetAuthorizationRequest{ // TODO: Fill request struct fields. @@ -55,13 +56,12 @@ func ExampleClient_GetAuthorization() { } func ExampleClient_CreateDeployment() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.CreateDeploymentRequest{ // TODO: Fill request struct fields. @@ -75,13 +75,12 @@ func ExampleClient_CreateDeployment() { } func ExampleClient_ReplaceDeployment() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.ReplaceDeploymentRequest{ // TODO: Fill request struct fields. @@ -95,13 +94,12 @@ func ExampleClient_ReplaceDeployment() { } func ExampleClient_GetDeployment() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.GetDeploymentRequest{ // TODO: Fill request struct fields. @@ -115,14 +113,12 @@ func ExampleClient_GetDeployment() { } func ExampleClient_ListDeployments() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - // import "google.golang.org/api/iterator" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.ListDeploymentsRequest{ // TODO: Fill request struct fields. @@ -147,6 +143,7 @@ func ExampleClient_DeleteDeployment() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.DeleteDeploymentRequest{ // TODO: Fill request struct fields. @@ -163,6 +160,7 @@ func ExampleClient_InstallDeployment() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.InstallDeploymentRequest{ // TODO: Fill request struct fields. @@ -179,6 +177,7 @@ func ExampleClient_UninstallDeployment() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.UninstallDeploymentRequest{ // TODO: Fill request struct fields. @@ -190,13 +189,12 @@ func ExampleClient_UninstallDeployment() { } func ExampleClient_GetInstallStatus() { - // import gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" - ctx := context.Background() c, err := gsuiteaddons.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &gsuiteaddonspb.GetInstallStatusRequest{ // TODO: Fill request struct fields. diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 982d685ef5f3..fa85f8c258aa 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -571,7 +571,7 @@ "description": "Google Workspace Add-ons API", "language": "Go", "client_library_type": "generated", - "docs_url": "https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1", + "docs_url": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/latest/gsuiteaddons/apiv1", "release_level": "beta", "library_type": "" }, diff --git a/internal/examples/fake/go.mod b/internal/examples/fake/go.mod index ccadfbf94d88..a28b07053e37 100644 --- a/internal/examples/fake/go.mod +++ b/internal/examples/fake/go.mod @@ -5,6 +5,6 @@ go 1.15 require ( cloud.google.com/go v0.81.0 google.golang.org/api v0.46.0 - google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.37.1 ) diff --git a/internal/examples/fake/go.sum b/internal/examples/fake/go.sum index aa1072080168..d9ac81ca88b7 100644 --- a/internal/examples/fake/go.sum +++ b/internal/examples/fake/go.sum @@ -421,8 +421,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 h1:pl8qT5D+48655f14yDURpIZwSPvMWuuekfAP+gxtjvk= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/examples/mock/go.mod b/internal/examples/mock/go.mod index 7bf8cd504b61..1502350dc08a 100644 --- a/internal/examples/mock/go.mod +++ b/internal/examples/mock/go.mod @@ -4,5 +4,5 @@ go 1.15 require ( github.com/googleapis/gax-go/v2 v2.0.5 - google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 ) diff --git a/internal/examples/mock/go.sum b/internal/examples/mock/go.sum index f68e16ca74ac..9f22d276f257 100644 --- a/internal/examples/mock/go.sum +++ b/internal/examples/mock/go.sum @@ -94,8 +94,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 h1:pl8qT5D+48655f14yDURpIZwSPvMWuuekfAP+gxtjvk= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/gapicgen/go.mod b/internal/gapicgen/go.mod index 357160bcf8e9..332dcbe00451 100644 --- a/internal/gapicgen/go.mod +++ b/internal/gapicgen/go.mod @@ -11,7 +11,7 @@ require ( golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 - google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/protobuf v1.26.0 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/internal/gapicgen/go.sum b/internal/gapicgen/go.sum index aa371083178e..fab84cf5e606 100644 --- a/internal/gapicgen/go.sum +++ b/internal/gapicgen/go.sum @@ -491,8 +491,9 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a h1:VA0wtJaR+W1I11P2f535J7D/YxyvEFMTMvcmyeZ9FBE= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomDimension/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomDimension/main.go new file mode 100644 index 000000000000..1d7358d1fd07 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomDimension/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ArchiveCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + err = c.ArchiveCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomMetric/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomMetric/main.go new file mode 100644 index 000000000000..bb7e936ced27 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ArchiveCustomMetric/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ArchiveCustomMetricRequest{ + // TODO: Fill request struct fields. + } + err = c.ArchiveCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateConversionEvent/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateConversionEvent/main.go new file mode 100644 index 000000000000..903b2ad16392 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateConversionEvent/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateConversionEventRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomDimension/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomDimension/main.go new file mode 100644 index 000000000000..29881acee302 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomDimension/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomMetric/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomMetric/main.go new file mode 100644 index 000000000000..61ec76ce06b9 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateCustomMetric/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateMeasurementProtocolSecret/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateMeasurementProtocolSecret/main.go new file mode 100644 index 000000000000..f5b61524809a --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateMeasurementProtocolSecret/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteConversionEvent/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteConversionEvent/main.go new file mode 100644 index 000000000000..6c9e53658334 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteConversionEvent/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.DeleteConversionEventRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteMeasurementProtocolSecret/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteMeasurementProtocolSecret/main.go new file mode 100644 index 000000000000..642fea309eda --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteMeasurementProtocolSecret/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.DeleteMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetConversionEvent/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetConversionEvent/main.go new file mode 100644 index 000000000000..f39bedb812fe --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetConversionEvent/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetConversionEventRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConversionEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomDimension/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomDimension/main.go new file mode 100644 index 000000000000..607afb515b92 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomDimension/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomMetric/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomMetric/main.go new file mode 100644 index 000000000000..6e78a54d6147 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetCustomMetric/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetGoogleSignalsSettings/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetGoogleSignalsSettings/main.go new file mode 100644 index 000000000000..dfbdecaddf86 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetGoogleSignalsSettings/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetGoogleSignalsSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGoogleSignalsSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetMeasurementProtocolSecret/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetMeasurementProtocolSecret/main.go new file mode 100644 index 000000000000..ff02f73ed26e --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetMeasurementProtocolSecret/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListConversionEvents/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListConversionEvents/main.go new file mode 100644 index 000000000000..45d243457cf7 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListConversionEvents/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + "google.golang.org/api/iterator" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListConversionEventsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConversionEvents(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomDimensions/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomDimensions/main.go new file mode 100644 index 000000000000..1f9b88c9c7db --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomDimensions/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + "google.golang.org/api/iterator" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListCustomDimensionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCustomDimensions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomMetrics/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomMetrics/main.go new file mode 100644 index 000000000000..a9722a28c96a --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListCustomMetrics/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + "google.golang.org/api/iterator" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListCustomMetricsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCustomMetrics(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListMeasurementProtocolSecrets/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListMeasurementProtocolSecrets/main.go new file mode 100644 index 000000000000..a2146ae43e89 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListMeasurementProtocolSecrets/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + "google.golang.org/api/iterator" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListMeasurementProtocolSecretsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMeasurementProtocolSecrets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomDimension/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomDimension/main.go new file mode 100644 index 000000000000..e65a6a0837fb --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomDimension/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateCustomDimensionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCustomDimension(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomMetric/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomMetric/main.go new file mode 100644 index 000000000000..6706fa7c4a3e --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateCustomMetric/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateCustomMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCustomMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateGoogleSignalsSettings/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateGoogleSignalsSettings/main.go new file mode 100644 index 000000000000..9c4bb711d264 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateGoogleSignalsSettings/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateGoogleSignalsSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateGoogleSignalsSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateMeasurementProtocolSecret/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateMeasurementProtocolSecret/main.go new file mode 100644 index 000000000000..3a3f47407cb4 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateMeasurementProtocolSecret/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_sync] + +package main + +import ( + "context" + + admin "cloud.google.com/go/analytics/admin/apiv1alpha" + adminpb "google.golang.org/genproto/googleapis/analytics/admin/v1alpha" +) + +func main() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateMeasurementProtocolSecretRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateMeasurementProtocolSecret(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_sync] diff --git a/internal/generated/snippets/asset/apiv1/Client/ListAssets/main.go b/internal/generated/snippets/asset/apiv1/Client/ListAssets/main.go new file mode 100644 index 000000000000..578072f0a532 --- /dev/null +++ b/internal/generated/snippets/asset/apiv1/Client/ListAssets/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudasset_v1_generated_AssetService_ListAssets_sync] + +package main + +import ( + "context" + + asset "cloud.google.com/go/asset/apiv1" + "google.golang.org/api/iterator" + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1" +) + +func main() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &assetpb.ListAssetsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAssets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END cloudasset_v1_generated_AssetService_ListAssets_sync] diff --git a/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/ListContinuousTestResults/main.go b/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/ListContinuousTestResults/main.go new file mode 100644 index 000000000000..5b2d5317ffec --- /dev/null +++ b/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/ListContinuousTestResults/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START dialogflow_v3_generated_Environments_ListContinuousTestResults_sync] + +package main + +import ( + "context" + + cx "cloud.google.com/go/dialogflow/cx/apiv3" + "google.golang.org/api/iterator" + cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" +) + +func main() { + ctx := context.Background() + c, err := cx.NewEnvironmentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.ListContinuousTestResultsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListContinuousTestResults(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dialogflow_v3_generated_Environments_ListContinuousTestResults_sync] diff --git a/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/RunContinuousTest/main.go b/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/RunContinuousTest/main.go new file mode 100644 index 000000000000..c93758d4c30e --- /dev/null +++ b/internal/generated/snippets/dialogflow/cx/apiv3/EnvironmentsClient/RunContinuousTest/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START dialogflow_v3_generated_Environments_RunContinuousTest_sync] + +package main + +import ( + "context" + + cx "cloud.google.com/go/dialogflow/cx/apiv3" + cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" +) + +func main() { + ctx := context.Background() + c, err := cx.NewEnvironmentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &cxpb.RunContinuousTestRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RunContinuousTest(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dialogflow_v3_generated_Environments_RunContinuousTest_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/ComputeContacts/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/ComputeContacts/main.go new file mode 100644 index 000000000000..fb8e4a3659a0 --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/ComputeContacts/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + "google.golang.org/api/iterator" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.ComputeContactsRequest{ + // TODO: Fill request struct fields. + } + it := c.ComputeContacts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/CreateContact/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/CreateContact/main.go new file mode 100644 index 000000000000..0f96a935cea7 --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/CreateContact/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_CreateContact_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.CreateContactRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateContact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_CreateContact_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/DeleteContact/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/DeleteContact/main.go new file mode 100644 index 000000000000..558f93042c59 --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/DeleteContact/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.DeleteContactRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteContact(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/GetContact/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/GetContact/main.go new file mode 100644 index 000000000000..2d16c82d5e6f --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/GetContact/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_GetContact_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.GetContactRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetContact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_GetContact_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/ListContacts/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/ListContacts/main.go new file mode 100644 index 000000000000..7ac011901327 --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/ListContacts/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_ListContacts_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + "google.golang.org/api/iterator" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.ListContactsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListContacts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_ListContacts_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/SendTestMessage/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/SendTestMessage/main.go new file mode 100644 index 000000000000..b301fe18dd2b --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/SendTestMessage/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_SendTestMessage_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.SendTestMessageRequest{ + // TODO: Fill request struct fields. + } + err = c.SendTestMessage(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_SendTestMessage_sync] diff --git a/internal/generated/snippets/essentialcontacts/apiv1/Client/UpdateContact/main.go b/internal/generated/snippets/essentialcontacts/apiv1/Client/UpdateContact/main.go new file mode 100644 index 000000000000..3adb227a8ee4 --- /dev/null +++ b/internal/generated/snippets/essentialcontacts/apiv1/Client/UpdateContact/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START essentialcontacts_v1_generated_EssentialContactsService_UpdateContact_sync] + +package main + +import ( + "context" + + essentialcontacts "cloud.google.com/go/essentialcontacts/apiv1" + essentialcontactspb "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1" +) + +func main() { + ctx := context.Background() + c, err := essentialcontacts.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &essentialcontactspb.UpdateContactRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateContact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END essentialcontacts_v1_generated_EssentialContactsService_UpdateContact_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index f83411563526..e36ab490bf08 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -24,13 +24,13 @@ replace cloud.google.com/go/storage => ../../../storage require ( cloud.google.com/go v0.82.0 - cloud.google.com/go/bigquery v0.82.0 - cloud.google.com/go/datastore v0.82.0 - cloud.google.com/go/firestore v0.82.0 - cloud.google.com/go/logging v0.82.0 + cloud.google.com/go/bigquery v0.0.0-00010101000000-000000000000 + cloud.google.com/go/datastore v0.0.0-00010101000000-000000000000 + cloud.google.com/go/firestore v0.0.0-00010101000000-000000000000 + cloud.google.com/go/logging v0.0.0-00010101000000-000000000000 cloud.google.com/go/pubsub v1.9.1 cloud.google.com/go/pubsublite v0.0.0-00010101000000-000000000000 cloud.google.com/go/spanner v0.0.0-00010101000000-000000000000 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index 1fd80e6bc350..6954074c1784 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -141,8 +141,10 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210524171403-669157292da3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/gsuiteaddons/apiv1/Client/CreateDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/CreateDeployment/main.go new file mode 100644 index 000000000000..27ece093c187 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/CreateDeployment/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.CreateDeploymentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_CreateDeployment_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/DeleteDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/DeleteDeployment/main.go new file mode 100644 index 000000000000..a7cf747ae62b --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/DeleteDeployment/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.DeleteDeploymentRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_DeleteDeployment_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetAuthorization/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetAuthorization/main.go new file mode 100644 index 000000000000..ee3d9faf5ec3 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetAuthorization/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.GetAuthorizationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetAuthorization(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetAuthorization_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetDeployment/main.go new file mode 100644 index 000000000000..fd8316cb4592 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetDeployment/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.GetDeploymentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetDeployment_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetInstallStatus/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetInstallStatus/main.go new file mode 100644 index 000000000000..d570e9a26320 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/GetInstallStatus/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.GetInstallStatusRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInstallStatus(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_GetInstallStatus_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/InstallDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/InstallDeployment/main.go new file mode 100644 index 000000000000..ae8ef3d55cad --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/InstallDeployment/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.InstallDeploymentRequest{ + // TODO: Fill request struct fields. + } + err = c.InstallDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_InstallDeployment_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/ListDeployments/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/ListDeployments/main.go new file mode 100644 index 000000000000..2da9bbd5ff45 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/ListDeployments/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + "google.golang.org/api/iterator" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.ListDeploymentsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDeployments(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_ListDeployments_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/ReplaceDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/ReplaceDeployment/main.go new file mode 100644 index 000000000000..9321ca676212 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/ReplaceDeployment/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.ReplaceDeploymentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ReplaceDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_ReplaceDeployment_sync] diff --git a/internal/generated/snippets/gsuiteaddons/apiv1/Client/UninstallDeployment/main.go b/internal/generated/snippets/gsuiteaddons/apiv1/Client/UninstallDeployment/main.go new file mode 100644 index 000000000000..038c33ba3cf2 --- /dev/null +++ b/internal/generated/snippets/gsuiteaddons/apiv1/Client/UninstallDeployment/main.go @@ -0,0 +1,43 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_sync] + +package main + +import ( + "context" + + gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1" + gsuiteaddonspb "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1" +) + +func main() { + ctx := context.Background() + c, err := gsuiteaddons.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &gsuiteaddonspb.UninstallDeploymentRequest{ + // TODO: Fill request struct fields. + } + err = c.UninstallDeployment(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END gsuiteaddons_v1_generated_GSuiteAddOns_UninstallDeployment_sync] diff --git a/internal/generated/snippets/kms/apiv1/KeyManagementClient/GetIamPolicy/main.go b/internal/generated/snippets/kms/apiv1/KeyManagementClient/GetIamPolicy/main.go new file mode 100644 index 000000000000..7b23d8786634 --- /dev/null +++ b/internal/generated/snippets/kms/apiv1/KeyManagementClient/GetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudkms_v1_generated_KeyManagementService_GetIamPolicy_sync] + +package main + +import ( + "context" + + kms "cloud.google.com/go/kms/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudkms_v1_generated_KeyManagementService_GetIamPolicy_sync] diff --git a/internal/generated/snippets/kms/apiv1/KeyManagementClient/SetIamPolicy/main.go b/internal/generated/snippets/kms/apiv1/KeyManagementClient/SetIamPolicy/main.go new file mode 100644 index 000000000000..2de69916a45f --- /dev/null +++ b/internal/generated/snippets/kms/apiv1/KeyManagementClient/SetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudkms_v1_generated_KeyManagementService_SetIamPolicy_sync] + +package main + +import ( + "context" + + kms "cloud.google.com/go/kms/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudkms_v1_generated_KeyManagementService_SetIamPolicy_sync] diff --git a/internal/generated/snippets/kms/apiv1/KeyManagementClient/TestIamPermissions/main.go b/internal/generated/snippets/kms/apiv1/KeyManagementClient/TestIamPermissions/main.go new file mode 100644 index 000000000000..5ce06cf09cf3 --- /dev/null +++ b/internal/generated/snippets/kms/apiv1/KeyManagementClient/TestIamPermissions/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudkms_v1_generated_KeyManagementService_TestIamPermissions_sync] + +package main + +import ( + "context" + + kms "cloud.google.com/go/kms/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudkms_v1_generated_KeyManagementService_TestIamPermissions_sync] diff --git a/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchCatalogs/main.go b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchCatalogs/main.go new file mode 100644 index 000000000000..fff8557b52a8 --- /dev/null +++ b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchCatalogs/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchCatalogs_sync] + +package main + +import ( + "context" + + privatecatalog "cloud.google.com/go/privatecatalog/apiv1beta1" + "google.golang.org/api/iterator" + privatecatalogpb "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1" +) + +func main() { + ctx := context.Background() + c, err := privatecatalog.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &privatecatalogpb.SearchCatalogsRequest{ + // TODO: Fill request struct fields. + } + it := c.SearchCatalogs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchCatalogs_sync] diff --git a/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchProducts/main.go b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchProducts/main.go new file mode 100644 index 000000000000..73620964a140 --- /dev/null +++ b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchProducts/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchProducts_sync] + +package main + +import ( + "context" + + privatecatalog "cloud.google.com/go/privatecatalog/apiv1beta1" + "google.golang.org/api/iterator" + privatecatalogpb "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1" +) + +func main() { + ctx := context.Background() + c, err := privatecatalog.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &privatecatalogpb.SearchProductsRequest{ + // TODO: Fill request struct fields. + } + it := c.SearchProducts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchProducts_sync] diff --git a/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchVersions/main.go b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchVersions/main.go new file mode 100644 index 000000000000..f64db43eab8e --- /dev/null +++ b/internal/generated/snippets/privatecatalog/apiv1beta1/Client/SearchVersions/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchVersions_sync] + +package main + +import ( + "context" + + privatecatalog "cloud.google.com/go/privatecatalog/apiv1beta1" + "google.golang.org/api/iterator" + privatecatalogpb "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1" +) + +func main() { + ctx := context.Background() + c, err := privatecatalog.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &privatecatalogpb.SearchVersionsRequest{ + // TODO: Fill request struct fields. + } + it := c.SearchVersions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchVersions_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/PublisherClient/GetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/PublisherClient/GetIamPolicy/main.go new file mode 100644 index 000000000000..72235b19fc61 --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/PublisherClient/GetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Publisher_GetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Publisher_GetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/PublisherClient/SetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/PublisherClient/SetIamPolicy/main.go new file mode 100644 index 000000000000..43e8af6d614c --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/PublisherClient/SetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Publisher_SetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Publisher_SetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/PublisherClient/TestIamPermissions/main.go b/internal/generated/snippets/pubsub/apiv1/PublisherClient/TestIamPermissions/main.go new file mode 100644 index 000000000000..3bb791b9d573 --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/PublisherClient/TestIamPermissions/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Publisher_TestIamPermissions_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Publisher_TestIamPermissions_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SchemaClient/GetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/SchemaClient/GetIamPolicy/main.go new file mode 100644 index 000000000000..93cb23eabdee --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SchemaClient/GetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_SchemaService_GetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_SchemaService_GetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SchemaClient/SetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/SchemaClient/SetIamPolicy/main.go new file mode 100644 index 000000000000..162e57396613 --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SchemaClient/SetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_SchemaService_SetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_SchemaService_SetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SchemaClient/TestIamPermissions/main.go b/internal/generated/snippets/pubsub/apiv1/SchemaClient/TestIamPermissions/main.go new file mode 100644 index 000000000000..26bb819e97f1 --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SchemaClient/TestIamPermissions/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_SchemaService_TestIamPermissions_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_SchemaService_TestIamPermissions_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SubscriberClient/GetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/GetIamPolicy/main.go new file mode 100644 index 000000000000..83c1479dea7e --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/GetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Subscriber_GetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Subscriber_GetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SubscriberClient/SetIamPolicy/main.go b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/SetIamPolicy/main.go new file mode 100644 index 000000000000..f2a3947dea9d --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/SetIamPolicy/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Subscriber_SetIamPolicy_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Subscriber_SetIamPolicy_sync] diff --git a/internal/generated/snippets/pubsub/apiv1/SubscriberClient/TestIamPermissions/main.go b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/TestIamPermissions/main.go new file mode 100644 index 000000000000..827567accf67 --- /dev/null +++ b/internal/generated/snippets/pubsub/apiv1/SubscriberClient/TestIamPermissions/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START pubsub_v1_generated_Subscriber_TestIamPermissions_sync] + +package main + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func main() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END pubsub_v1_generated_Subscriber_TestIamPermissions_sync] diff --git a/internal/generated/snippets/shell/apiv1/CloudShellClient/AddPublicKey/main.go b/internal/generated/snippets/shell/apiv1/CloudShellClient/AddPublicKey/main.go new file mode 100644 index 000000000000..82659bdd4270 --- /dev/null +++ b/internal/generated/snippets/shell/apiv1/CloudShellClient/AddPublicKey/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudshell_v1_generated_CloudShellService_AddPublicKey_sync] + +package main + +import ( + "context" + + shell "cloud.google.com/go/shell/apiv1" + shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1" +) + +func main() { + ctx := context.Background() + c, err := shell.NewCloudShellClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &shellpb.AddPublicKeyRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AddPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudshell_v1_generated_CloudShellService_AddPublicKey_sync] diff --git a/internal/generated/snippets/shell/apiv1/CloudShellClient/AuthorizeEnvironment/main.go b/internal/generated/snippets/shell/apiv1/CloudShellClient/AuthorizeEnvironment/main.go new file mode 100644 index 000000000000..9efc5a99f0f9 --- /dev/null +++ b/internal/generated/snippets/shell/apiv1/CloudShellClient/AuthorizeEnvironment/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudshell_v1_generated_CloudShellService_AuthorizeEnvironment_sync] + +package main + +import ( + "context" + + shell "cloud.google.com/go/shell/apiv1" + shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1" +) + +func main() { + ctx := context.Background() + c, err := shell.NewCloudShellClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &shellpb.AuthorizeEnvironmentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AuthorizeEnvironment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudshell_v1_generated_CloudShellService_AuthorizeEnvironment_sync] diff --git a/internal/generated/snippets/shell/apiv1/CloudShellClient/GetEnvironment/main.go b/internal/generated/snippets/shell/apiv1/CloudShellClient/GetEnvironment/main.go new file mode 100644 index 000000000000..e01e4fbd07a0 --- /dev/null +++ b/internal/generated/snippets/shell/apiv1/CloudShellClient/GetEnvironment/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudshell_v1_generated_CloudShellService_GetEnvironment_sync] + +package main + +import ( + "context" + + shell "cloud.google.com/go/shell/apiv1" + shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1" +) + +func main() { + ctx := context.Background() + c, err := shell.NewCloudShellClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &shellpb.GetEnvironmentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetEnvironment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudshell_v1_generated_CloudShellService_GetEnvironment_sync] diff --git a/internal/generated/snippets/shell/apiv1/CloudShellClient/RemovePublicKey/main.go b/internal/generated/snippets/shell/apiv1/CloudShellClient/RemovePublicKey/main.go new file mode 100644 index 000000000000..8896a883e2ec --- /dev/null +++ b/internal/generated/snippets/shell/apiv1/CloudShellClient/RemovePublicKey/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudshell_v1_generated_CloudShellService_RemovePublicKey_sync] + +package main + +import ( + "context" + + shell "cloud.google.com/go/shell/apiv1" + shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1" +) + +func main() { + ctx := context.Background() + c, err := shell.NewCloudShellClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &shellpb.RemovePublicKeyRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RemovePublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudshell_v1_generated_CloudShellService_RemovePublicKey_sync] diff --git a/internal/generated/snippets/shell/apiv1/CloudShellClient/StartEnvironment/main.go b/internal/generated/snippets/shell/apiv1/CloudShellClient/StartEnvironment/main.go new file mode 100644 index 000000000000..827fe9153562 --- /dev/null +++ b/internal/generated/snippets/shell/apiv1/CloudShellClient/StartEnvironment/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START cloudshell_v1_generated_CloudShellService_StartEnvironment_sync] + +package main + +import ( + "context" + + shell "cloud.google.com/go/shell/apiv1" + shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1" +) + +func main() { + ctx := context.Background() + c, err := shell.NewCloudShellClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &shellpb.StartEnvironmentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.StartEnvironment(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudshell_v1_generated_CloudShellService_StartEnvironment_sync] diff --git a/internal/generated/snippets/vpcaccess/apiv1/Client/CreateConnector/main.go b/internal/generated/snippets/vpcaccess/apiv1/Client/CreateConnector/main.go new file mode 100644 index 000000000000..e53fbd7f5c49 --- /dev/null +++ b/internal/generated/snippets/vpcaccess/apiv1/Client/CreateConnector/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START vpcaccess_v1_generated_VpcAccessService_CreateConnector_sync] + +package main + +import ( + "context" + + vpcaccess "cloud.google.com/go/vpcaccess/apiv1" + vpcaccesspb "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1" +) + +func main() { + ctx := context.Background() + c, err := vpcaccess.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &vpcaccesspb.CreateConnectorRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateConnector(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END vpcaccess_v1_generated_VpcAccessService_CreateConnector_sync] diff --git a/internal/generated/snippets/vpcaccess/apiv1/Client/DeleteConnector/main.go b/internal/generated/snippets/vpcaccess/apiv1/Client/DeleteConnector/main.go new file mode 100644 index 000000000000..f2b160b5aa98 --- /dev/null +++ b/internal/generated/snippets/vpcaccess/apiv1/Client/DeleteConnector/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. + +// [START vpcaccess_v1_generated_VpcAccessService_DeleteConnector_sync] + +package main + +import ( + "context" + + vpcaccess "cloud.google.com/go/vpcaccess/apiv1" + vpcaccesspb "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1" +) + +func main() { + ctx := context.Background() + c, err := vpcaccess.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &vpcaccesspb.DeleteConnectorRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteConnector(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END vpcaccess_v1_generated_VpcAccessService_DeleteConnector_sync] diff --git a/internal/generated/snippets/vpcaccess/apiv1/Client/GetConnector/main.go b/internal/generated/snippets/vpcaccess/apiv1/Client/GetConnector/main.go new file mode 100644 index 000000000000..6f542e07320f --- /dev/null +++ b/internal/generated/snippets/vpcaccess/apiv1/Client/GetConnector/main.go @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START vpcaccess_v1_generated_VpcAccessService_GetConnector_sync] + +package main + +import ( + "context" + + vpcaccess "cloud.google.com/go/vpcaccess/apiv1" + vpcaccesspb "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1" +) + +func main() { + ctx := context.Background() + c, err := vpcaccess.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &vpcaccesspb.GetConnectorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetConnector(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END vpcaccess_v1_generated_VpcAccessService_GetConnector_sync] diff --git a/internal/generated/snippets/vpcaccess/apiv1/Client/ListConnectors/main.go b/internal/generated/snippets/vpcaccess/apiv1/Client/ListConnectors/main.go new file mode 100644 index 000000000000..a5effd0de3a4 --- /dev/null +++ b/internal/generated/snippets/vpcaccess/apiv1/Client/ListConnectors/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START vpcaccess_v1_generated_VpcAccessService_ListConnectors_sync] + +package main + +import ( + "context" + + vpcaccess "cloud.google.com/go/vpcaccess/apiv1" + "google.golang.org/api/iterator" + vpcaccesspb "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1" +) + +func main() { + ctx := context.Background() + c, err := vpcaccess.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &vpcaccesspb.ListConnectorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListConnectors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END vpcaccess_v1_generated_VpcAccessService_ListConnectors_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 3c2b0a4b69ab..a8ad0cb41757 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -304,8 +304,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200827165113-ac2560b5e952/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210521181308-5ccab8a35a9a h1:FaCiYXNZoBH/gnmVjMAHgOgdmpVVROBYOA+qCOHh6Hc= -google.golang.org/genproto v0.0.0-20210521181308-5ccab8a35a9a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/kms/apiv1/doc.go b/kms/apiv1/doc.go index 6cf2edd958bd..4fea9e3a4089 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/kms/apiv1/gapic_metadata.json b/kms/apiv1/gapic_metadata.json index c6de93860b24..37d3fd6d5498 100644 --- a/kms/apiv1/gapic_metadata.json +++ b/kms/apiv1/gapic_metadata.json @@ -65,6 +65,11 @@ "GetCryptoKeyVersion" ] }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, "GetImportJob": { "methods": [ "GetImportJob" @@ -110,6 +115,16 @@ "RestoreCryptoKeyVersion" ] }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, "UpdateCryptoKey": { "methods": [ "UpdateCryptoKey" diff --git a/kms/apiv1/key_management_client.go b/kms/apiv1/key_management_client.go index bb78c6e702f2..fa5b57f23806 100644 --- a/kms/apiv1/key_management_client.go +++ b/kms/apiv1/key_management_client.go @@ -30,6 +30,7 @@ import ( "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -62,6 +63,9 @@ type KeyManagementCallOptions struct { UpdateCryptoKeyPrimaryVersion []gax.CallOption DestroyCryptoKeyVersion []gax.CallOption RestoreCryptoKeyVersion []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption } func defaultKeyManagementGRPCClientOptions() []option.ClientOption { @@ -332,6 +336,9 @@ func defaultKeyManagementCallOptions() *KeyManagementCallOptions { }) }), }, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -363,6 +370,9 @@ type internalKeyManagementClient interface { UpdateCryptoKeyPrimaryVersion(context.Context, *kmspb.UpdateCryptoKeyPrimaryVersionRequest, ...gax.CallOption) (*kmspb.CryptoKey, error) DestroyCryptoKeyVersion(context.Context, *kmspb.DestroyCryptoKeyVersionRequest, ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) RestoreCryptoKeyVersion(context.Context, *kmspb.RestoreCryptoKeyVersionRequest, ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) + GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) } // KeyManagementClient is a client for interacting with Cloud Key Management Service (KMS) API. @@ -578,6 +588,32 @@ func (c *KeyManagementClient) RestoreCryptoKeyVersion(ctx context.Context, req * return c.internalClient.RestoreCryptoKeyVersion(ctx, req, opts...) } +// GetIamPolicy gets the access control policy for a resource. Returns an empty policy +// if the resource exists and does not have a policy set. +func (c *KeyManagementClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces +// any existing policy. +// +// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED +// errors. +func (c *KeyManagementClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. If the +// resource does not exist, this will return an empty set of +// permissions, not a NOT_FOUND error. +// +// Note: This operation is designed to be used for building +// permission-aware UIs and command-line tools, not for authorization +// checking. This operation may “fail open” without warning. +func (c *KeyManagementClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + // keyManagementGRPCClient is a client for interacting with Cloud Key Management Service (KMS) API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -594,6 +630,8 @@ type keyManagementGRPCClient struct { // The gRPC API client. keyManagementClient kmspb.KeyManagementServiceClient + iamPolicyClient iampb.IAMPolicyClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -642,6 +680,7 @@ func NewKeyManagementClient(ctx context.Context, opts ...option.ClientOption) (* disableDeadlines: disableDeadlines, keyManagementClient: kmspb.NewKeyManagementServiceClient(connPool), CallOptions: &client.CallOptions, + iamPolicyClient: iampb.NewIAMPolicyClient(connPool), } c.setGoogleClientInfo() @@ -1231,6 +1270,51 @@ func (c *keyManagementGRPCClient) RestoreCryptoKeyVersion(ctx context.Context, r return resp, nil } +func (c *keyManagementGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *keyManagementGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *keyManagementGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // CryptoKeyIterator manages a stream of *kmspb.CryptoKey. type CryptoKeyIterator struct { items []*kmspb.CryptoKey diff --git a/kms/apiv1/key_management_client_example_test.go b/kms/apiv1/key_management_client_example_test.go index 1de678f4c802..66afc3158420 100644 --- a/kms/apiv1/key_management_client_example_test.go +++ b/kms/apiv1/key_management_client_example_test.go @@ -22,6 +22,7 @@ import ( kms "cloud.google.com/go/kms/apiv1" "google.golang.org/api/iterator" kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" ) func ExampleNewKeyManagementClient() { @@ -496,3 +497,60 @@ func ExampleKeyManagementClient_RestoreCryptoKeyVersion() { // TODO: Use resp. _ = resp } + +func ExampleKeyManagementClient_GetIamPolicy() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_SetIamPolicy() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_TestIamPermissions() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 3acf756a126e..0cfc72a73c5f 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index f6b38d7d3c43..224a189f2613 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -15,11 +15,11 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. // Package language is an auto-generated package for the -// Cloud Natural Language API. +// Google Cloud Natural Language API. // -// Provides natural language understanding technologies, such as sentiment -// analysis, entity recognition, entity sentiment analysis, and other text -// annotations, to developers. +// Google Cloud Natural Language API provides natural language understanding +// technologies to developers. Examples include sentiment analysis, entity +// recognition, and text annotations. // // NOTE: This package is in beta. It is not stable, and may be subject to changes. // @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/language/apiv1beta2/language_client.go b/language/apiv1beta2/language_client.go index c96729d48de6..4cec1c63fb15 100644 --- a/language/apiv1beta2/language_client.go +++ b/language/apiv1beta2/language_client.go @@ -132,7 +132,7 @@ func defaultCallOptions() *CallOptions { } } -// internalClient is an interface that defines the methods availaible from Cloud Natural Language API. +// internalClient is an interface that defines the methods availaible from Google Cloud Natural Language API. type internalClient interface { Close() error setGoogleClientInfo(...string) @@ -145,7 +145,7 @@ type internalClient interface { AnnotateText(context.Context, *languagepb.AnnotateTextRequest, ...gax.CallOption) (*languagepb.AnnotateTextResponse, error) } -// Client is a client for interacting with Cloud Natural Language API. +// Client is a client for interacting with Google Cloud Natural Language API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // // Provides text analysis operations such as sentiment analysis and entity @@ -216,7 +216,7 @@ func (c *Client) AnnotateText(ctx context.Context, req *languagepb.AnnotateTextR return c.internalClient.AnnotateText(ctx, req, opts...) } -// gRPCClient is a client for interacting with Cloud Natural Language API over gRPC transport. +// gRPCClient is a client for interacting with Google Cloud Natural Language API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. type gRPCClient struct { diff --git a/logging/go.mod b/logging/go.mod index c46c9dabb2b8..8410c4a30bab 100644 --- a/logging/go.mod +++ b/logging/go.mod @@ -11,6 +11,6 @@ require ( go.opencensus.io v0.23.0 golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 ) diff --git a/logging/go.sum b/logging/go.sum index 2f0b60ea23b8..c30b8a1432a7 100644 --- a/logging/go.sum +++ b/logging/go.sum @@ -443,8 +443,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/privatecatalog/apiv1beta1/doc.go b/privatecatalog/apiv1beta1/doc.go index e12dfedeb32c..daa381f2a7d6 100644 --- a/privatecatalog/apiv1beta1/doc.go +++ b/privatecatalog/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210526" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index 0ba97a192d1b..b7d53673fe33 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsub/apiv1/gapic_metadata.json b/pubsub/apiv1/gapic_metadata.json index d72116ab09c8..64b2999668a6 100644 --- a/pubsub/apiv1/gapic_metadata.json +++ b/pubsub/apiv1/gapic_metadata.json @@ -25,6 +25,11 @@ "DetachSubscription" ] }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, "GetTopic": { "methods": [ "GetTopic" @@ -50,6 +55,16 @@ "Publish" ] }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, "UpdateTopic": { "methods": [ "UpdateTopic" @@ -74,6 +89,11 @@ "DeleteSchema" ] }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, "GetSchema": { "methods": [ "GetSchema" @@ -84,6 +104,16 @@ "ListSchemas" ] }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, "ValidateMessage": { "methods": [ "ValidateMessage" @@ -128,6 +158,11 @@ "DeleteSubscription" ] }, + "GetIamPolicy": { + "methods": [ + "GetIamPolicy" + ] + }, "GetSnapshot": { "methods": [ "GetSnapshot" @@ -168,11 +203,21 @@ "Seek" ] }, + "SetIamPolicy": { + "methods": [ + "SetIamPolicy" + ] + }, "StreamingPull": { "methods": [ "StreamingPull" ] }, + "TestIamPermissions": { + "methods": [ + "TestIamPermissions" + ] + }, "UpdateSnapshot": { "methods": [ "UpdateSnapshot" diff --git a/pubsub/apiv1/publisher_client.go b/pubsub/apiv1/publisher_client.go index 254e41196eb6..8eb7a8cc6ce1 100644 --- a/pubsub/apiv1/publisher_client.go +++ b/pubsub/apiv1/publisher_client.go @@ -29,6 +29,7 @@ import ( "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -48,6 +49,9 @@ type PublisherCallOptions struct { ListTopicSnapshots []gax.CallOption DeleteTopic []gax.CallOption DetachSubscription []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption } func defaultPublisherGRPCClientOptions() []option.ClientOption { @@ -177,6 +181,9 @@ func defaultPublisherCallOptions() *PublisherCallOptions { }) }), }, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -194,6 +201,9 @@ type internalPublisherClient interface { ListTopicSnapshots(context.Context, *pubsubpb.ListTopicSnapshotsRequest, ...gax.CallOption) *StringIterator DeleteTopic(context.Context, *pubsubpb.DeleteTopicRequest, ...gax.CallOption) error DetachSubscription(context.Context, *pubsubpb.DetachSubscriptionRequest, ...gax.CallOption) (*pubsubpb.DetachSubscriptionResponse, error) + GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) } // PublisherClient is a client for interacting with Cloud Pub/Sub API. @@ -290,6 +300,32 @@ func (c *PublisherClient) DetachSubscription(ctx context.Context, req *pubsubpb. return c.internalClient.DetachSubscription(ctx, req, opts...) } +// GetIamPolicy gets the access control policy for a resource. Returns an empty policy +// if the resource exists and does not have a policy set. +func (c *PublisherClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces +// any existing policy. +// +// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED +// errors. +func (c *PublisherClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. If the +// resource does not exist, this will return an empty set of +// permissions, not a NOT_FOUND error. +// +// Note: This operation is designed to be used for building +// permission-aware UIs and command-line tools, not for authorization +// checking. This operation may “fail open” without warning. +func (c *PublisherClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + // publisherGRPCClient is a client for interacting with Cloud Pub/Sub API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -306,6 +342,8 @@ type publisherGRPCClient struct { // The gRPC API client. publisherClient pubsubpb.PublisherClient + iamPolicyClient iampb.IAMPolicyClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -341,6 +379,7 @@ func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*Publ disableDeadlines: disableDeadlines, publisherClient: pubsubpb.NewPublisherClient(connPool), CallOptions: &client.CallOptions, + iamPolicyClient: iampb.NewIAMPolicyClient(connPool), } c.setGoogleClientInfo() @@ -613,6 +652,51 @@ func (c *publisherGRPCClient) DetachSubscription(ctx context.Context, req *pubsu return resp, nil } +func (c *publisherGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *publisherGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *publisherGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // StringIterator manages a stream of string. type StringIterator struct { items []string diff --git a/pubsub/apiv1/publisher_client_example_test.go b/pubsub/apiv1/publisher_client_example_test.go index edd64d79a3e8..678eeb13bcef 100644 --- a/pubsub/apiv1/publisher_client_example_test.go +++ b/pubsub/apiv1/publisher_client_example_test.go @@ -21,6 +21,7 @@ import ( pubsub "cloud.google.com/go/pubsub/apiv1" "google.golang.org/api/iterator" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" ) @@ -222,3 +223,60 @@ func ExamplePublisherClient_DetachSubscription() { // TODO: Use resp. _ = resp } + +func ExamplePublisherClient_GetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_SetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_TestIamPermissions() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/pubsub/apiv1/schema_client.go b/pubsub/apiv1/schema_client.go index 0851303ebfdf..cc77f14ff8bc 100644 --- a/pubsub/apiv1/schema_client.go +++ b/pubsub/apiv1/schema_client.go @@ -28,6 +28,7 @@ import ( "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -37,12 +38,15 @@ var newSchemaClientHook clientHook // SchemaCallOptions contains the retry settings for each method of SchemaClient. type SchemaCallOptions struct { - CreateSchema []gax.CallOption - GetSchema []gax.CallOption - ListSchemas []gax.CallOption - DeleteSchema []gax.CallOption - ValidateSchema []gax.CallOption - ValidateMessage []gax.CallOption + CreateSchema []gax.CallOption + GetSchema []gax.CallOption + ListSchemas []gax.CallOption + DeleteSchema []gax.CallOption + ValidateSchema []gax.CallOption + ValidateMessage []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption } func defaultSchemaGRPCClientOptions() []option.ClientOption { @@ -59,12 +63,15 @@ func defaultSchemaGRPCClientOptions() []option.ClientOption { func defaultSchemaCallOptions() *SchemaCallOptions { return &SchemaCallOptions{ - CreateSchema: []gax.CallOption{}, - GetSchema: []gax.CallOption{}, - ListSchemas: []gax.CallOption{}, - DeleteSchema: []gax.CallOption{}, - ValidateSchema: []gax.CallOption{}, - ValidateMessage: []gax.CallOption{}, + CreateSchema: []gax.CallOption{}, + GetSchema: []gax.CallOption{}, + ListSchemas: []gax.CallOption{}, + DeleteSchema: []gax.CallOption{}, + ValidateSchema: []gax.CallOption{}, + ValidateMessage: []gax.CallOption{}, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -79,6 +86,9 @@ type internalSchemaClient interface { DeleteSchema(context.Context, *pubsubpb.DeleteSchemaRequest, ...gax.CallOption) error ValidateSchema(context.Context, *pubsubpb.ValidateSchemaRequest, ...gax.CallOption) (*pubsubpb.ValidateSchemaResponse, error) ValidateMessage(context.Context, *pubsubpb.ValidateMessageRequest, ...gax.CallOption) (*pubsubpb.ValidateMessageResponse, error) + GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) } // SchemaClient is a client for interacting with Cloud Pub/Sub API. @@ -145,6 +155,32 @@ func (c *SchemaClient) ValidateMessage(ctx context.Context, req *pubsubpb.Valida return c.internalClient.ValidateMessage(ctx, req, opts...) } +// GetIamPolicy gets the access control policy for a resource. Returns an empty policy +// if the resource exists and does not have a policy set. +func (c *SchemaClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces +// any existing policy. +// +// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED +// errors. +func (c *SchemaClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. If the +// resource does not exist, this will return an empty set of +// permissions, not a NOT_FOUND error. +// +// Note: This operation is designed to be used for building +// permission-aware UIs and command-line tools, not for authorization +// checking. This operation may “fail open” without warning. +func (c *SchemaClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + // schemaGRPCClient is a client for interacting with Cloud Pub/Sub API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -161,6 +197,8 @@ type schemaGRPCClient struct { // The gRPC API client. schemaClient pubsubpb.SchemaServiceClient + iamPolicyClient iampb.IAMPolicyClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -195,6 +233,7 @@ func NewSchemaClient(ctx context.Context, opts ...option.ClientOption) (*SchemaC disableDeadlines: disableDeadlines, schemaClient: pubsubpb.NewSchemaServiceClient(connPool), CallOptions: &client.CallOptions, + iamPolicyClient: iampb.NewIAMPolicyClient(connPool), } c.setGoogleClientInfo() @@ -341,6 +380,51 @@ func (c *schemaGRPCClient) ValidateMessage(ctx context.Context, req *pubsubpb.Va return resp, nil } +func (c *schemaGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *schemaGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *schemaGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // SchemaIterator manages a stream of *pubsubpb.Schema. type SchemaIterator struct { items []*pubsubpb.Schema diff --git a/pubsub/apiv1/schema_client_example_test.go b/pubsub/apiv1/schema_client_example_test.go index 71fecd041af3..3c7560052259 100644 --- a/pubsub/apiv1/schema_client_example_test.go +++ b/pubsub/apiv1/schema_client_example_test.go @@ -21,6 +21,7 @@ import ( pubsub "cloud.google.com/go/pubsub/apiv1" "google.golang.org/api/iterator" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" ) @@ -153,3 +154,60 @@ func ExampleSchemaClient_ValidateMessage() { // TODO: Use resp. _ = resp } + +func ExampleSchemaClient_GetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSchemaClient_SetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSchemaClient_TestIamPermissions() { + ctx := context.Background() + c, err := pubsub.NewSchemaClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/pubsub/apiv1/subscriber_client.go b/pubsub/apiv1/subscriber_client.go index 58c0c2154362..136462f47727 100644 --- a/pubsub/apiv1/subscriber_client.go +++ b/pubsub/apiv1/subscriber_client.go @@ -29,6 +29,7 @@ import ( "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -55,6 +56,9 @@ type SubscriberCallOptions struct { UpdateSnapshot []gax.CallOption DeleteSnapshot []gax.CallOption Seek []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption } func defaultSubscriberGRPCClientOptions() []option.ClientOption { @@ -265,6 +269,9 @@ func defaultSubscriberCallOptions() *SubscriberCallOptions { }) }), }, + GetIamPolicy: []gax.CallOption{}, + SetIamPolicy: []gax.CallOption{}, + TestIamPermissions: []gax.CallOption{}, } } @@ -289,6 +296,9 @@ type internalSubscriberClient interface { UpdateSnapshot(context.Context, *pubsubpb.UpdateSnapshotRequest, ...gax.CallOption) (*pubsubpb.Snapshot, error) DeleteSnapshot(context.Context, *pubsubpb.DeleteSnapshotRequest, ...gax.CallOption) error Seek(context.Context, *pubsubpb.SeekRequest, ...gax.CallOption) (*pubsubpb.SeekResponse, error) + GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) + TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) } // SubscriberClient is a client for interacting with Cloud Pub/Sub API. @@ -486,6 +496,32 @@ func (c *SubscriberClient) Seek(ctx context.Context, req *pubsubpb.SeekRequest, return c.internalClient.Seek(ctx, req, opts...) } +// GetIamPolicy gets the access control policy for a resource. Returns an empty policy +// if the resource exists and does not have a policy set. +func (c *SubscriberClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetIamPolicy(ctx, req, opts...) +} + +// SetIamPolicy sets the access control policy on the specified resource. Replaces +// any existing policy. +// +// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED +// errors. +func (c *SubscriberClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetIamPolicy(ctx, req, opts...) +} + +// TestIamPermissions returns permissions that a caller has on the specified resource. If the +// resource does not exist, this will return an empty set of +// permissions, not a NOT_FOUND error. +// +// Note: This operation is designed to be used for building +// permission-aware UIs and command-line tools, not for authorization +// checking. This operation may “fail open” without warning. +func (c *SubscriberClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestIamPermissions(ctx, req, opts...) +} + // subscriberGRPCClient is a client for interacting with Cloud Pub/Sub API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -502,6 +538,8 @@ type subscriberGRPCClient struct { // The gRPC API client. subscriberClient pubsubpb.SubscriberClient + iamPolicyClient iampb.IAMPolicyClient + // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } @@ -538,6 +576,7 @@ func NewSubscriberClient(ctx context.Context, opts ...option.ClientOption) (*Sub disableDeadlines: disableDeadlines, subscriberClient: pubsubpb.NewSubscriberClient(connPool), CallOptions: &client.CallOptions, + iamPolicyClient: iampb.NewIAMPolicyClient(connPool), } c.setGoogleClientInfo() @@ -916,6 +955,51 @@ func (c *subscriberGRPCClient) Seek(ctx context.Context, req *pubsubpb.SeekReque return resp, nil } +func (c *subscriberGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *subscriberGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *subscriberGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamPolicyClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // SnapshotIterator manages a stream of *pubsubpb.Snapshot. type SnapshotIterator struct { items []*pubsubpb.Snapshot diff --git a/pubsub/apiv1/subscriber_client_example_test.go b/pubsub/apiv1/subscriber_client_example_test.go index 878f14019f21..9737fc593e2c 100644 --- a/pubsub/apiv1/subscriber_client_example_test.go +++ b/pubsub/apiv1/subscriber_client_example_test.go @@ -22,6 +22,7 @@ import ( pubsub "cloud.google.com/go/pubsub/apiv1" "google.golang.org/api/iterator" + iampb "google.golang.org/genproto/googleapis/iam/v1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" ) @@ -358,3 +359,60 @@ func ExampleSubscriberClient_Seek() { // TODO: Use resp. _ = resp } + +func ExampleSubscriberClient_GetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_SetIamPolicy() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_TestIamPermissions() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/pubsub/go.mod b/pubsub/go.mod index b001859e22a0..34402bb85d42 100644 --- a/pubsub/go.mod +++ b/pubsub/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/pubsub/go.sum b/pubsub/go.sum index 52e60208d052..09e8d245cdd8 100644 --- a/pubsub/go.sum +++ b/pubsub/go.sum @@ -442,8 +442,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 7610a6e18a9e..8f7492d9be56 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/pubsublite/go.mod b/pubsublite/go.mod index a70245073dd7..fb8d6f2c5e5b 100644 --- a/pubsublite/go.mod +++ b/pubsublite/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/pubsublite/go.sum b/pubsublite/go.sum index d7e6ebb74957..5580ee795241 100644 --- a/pubsublite/go.sum +++ b/pubsublite/go.sum @@ -450,8 +450,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index f9554912d9c1..a21837b19fa0 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/serviceusage/apiv1/doc.go b/serviceusage/apiv1/doc.go index a7e28f9010f5..b0e70dcc2e26 100644 --- a/serviceusage/apiv1/doc.go +++ b/serviceusage/apiv1/doc.go @@ -52,7 +52,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210524" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/spanner/go.mod b/spanner/go.mod index 9bbe0b8bfb76..5416864d6784 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -10,7 +10,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/spanner/go.sum b/spanner/go.sum index 767e60b48686..7eea0183d319 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -439,8 +439,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/storage/go.mod b/storage/go.mod index af89cb2795e3..16e14b78814a 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.47.0 - google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 + google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 google.golang.org/grpc v1.38.0 ) diff --git a/storage/go.sum b/storage/go.sum index f8cbf1917a64..a139c6fd6956 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -441,8 +441,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83 h1:1RnejfrmpVDN9Cq4r1SXBxk74lYLP/w6wOu6NbETf0Y= -google.golang.org/genproto v0.0.0-20210524142926-3e3a6030be83/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6 h1:zWmI+1Z2ZiKs1ceiAn4gjBd1v/d/AuWf/b+bLPe9aNw= +google.golang.org/genproto v0.0.0-20210601144548-a796c710e9b6/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= 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/vpcaccess/apiv1/doc.go b/vpcaccess/apiv1/doc.go index 60fec5601d4d..30614c735b40 100644 --- a/vpcaccess/apiv1/doc.go +++ b/vpcaccess/apiv1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210526" +const versionClient = "20210601" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)