From 5f2189704d81eb6f51686dd7e137afd2eea8a2e9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 21 Dec 2021 19:44:48 +0000 Subject: [PATCH] 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/732 Changes: feat(bigquery/reservation): increase the logical timeout (retry deadline) to 5 minutes PiperOrigin-RevId: 417448084 Source-Link: https://github.com/googleapis/googleapis/commit/489719aa33e8548612cd2ab1018b42d926afa409 feat(dialogflow): added export documentation method feat: added filter in list documentations request feat: added option to import custom metadata from Google Cloud Storage in reload document request feat: added option to apply partial update to the smart messaging allowlist in reload document request feat: added filter in list knowledge bases request PiperOrigin-RevId: 417030293 Source-Link: https://github.com/googleapis/googleapis/commit/ebef8e6c5ad95fcaa306935565086bed4ffbf663 feat(analytics/admin): add the `AcknowledgeUserDataCollection` operation which acknowledges the terms of user data collection for the specified property feat: add the new resource type `DataStream`, which is planned to eventually replace `WebDataStream`, `IosAppDataStream`, `AndroidAppDataStream` resources fix!: remove `GetEnhancedMeasurementSettings`, `UpdateEnhancedMeasurementSettingsRequest`, `UpdateEnhancedMeasurementSettingsRequest` operations from the API feat: add `CreateDataStream`, `DeleteDataStream`, `UpdateDataStream`, `ListDataStreams` operations to support the new `DataStream` resource feat: add `DISPLAY_VIDEO_360_ADVERTISER_LINK`, `DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL` fields to `ChangeHistoryResourceType` enum feat: add the `account` field to the `Property` type docs: update the documentation with a new list of valid values for `UserLink.direct_roles` field PiperOrigin-RevId: 416888961 Source-Link: https://github.com/googleapis/googleapis/commit/54861b49348afd2ae7dada7b857bacdcb6f22fe3 fix(artifactregistry): fix resource pattern ID segment name PiperOrigin-RevId: 416140747 Source-Link: https://github.com/googleapis/googleapis/commit/429d35c835fd8509302ca0e8031eab35a99e767e feat(dialogflow): removed OPTIONAL for speech model variant docs: added more docs for speech model variant and improved docs format for participant PiperOrigin-RevId: 416079722 Source-Link: https://github.com/googleapis/googleapis/commit/14b7a25d42566b5b534f23a118c0ada5555e3d55 feat(assuredworkloads): EU Regions and Support With Sovereign Controls Committer: @guisin PiperOrigin-RevId: 415069787 Source-Link: https://github.com/googleapis/googleapis/commit/85ffeed56bf1463c2cf3428a591208065bdd6edd fix(compute): add parameter in compute bazel rules (#692) Source-Link: https://github.com/googleapis/googleapis/commit/253807f227024c0bf8090c2a84168587f27306f2 --- .../apiv1alpha/analytics_admin_client.go | 409 ++++++++++++++---- .../analytics_admin_client_example_test.go | 164 +++++-- analytics/admin/apiv1alpha/doc.go | 2 +- .../admin/apiv1alpha/gapic_metadata.json | 38 +- artifactregistry/apiv1beta2/doc.go | 2 +- assuredworkloads/apiv1beta1/doc.go | 2 +- bigquery/reservation/apiv1/doc.go | 2 +- .../reservation/apiv1/reservation_client.go | 12 +- compute/apiv1/doc.go | 2 +- dialogflow/apiv2/doc.go | 2 +- dialogflow/apiv2/documents_client.go | 126 ++++++ .../apiv2/documents_client_example_test.go | 25 ++ dialogflow/apiv2/gapic_metadata.json | 5 + .../AcknowledgeUserDataCollection/main.go | 48 ++ .../CreateDataStream/main.go | 48 ++ .../DeleteDataStream/main.go | 46 ++ .../GetDataStream/main.go | 48 ++ .../ListDataStreams/main.go | 55 +++ .../UpdateDataStream/main.go | 48 ++ .../DocumentsClient/ExportDocument/main.go | 53 +++ 20 files changed, 995 insertions(+), 142 deletions(-) create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/AcknowledgeUserDataCollection/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateDataStream/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteDataStream/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetDataStream/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListDataStreams/main.go create mode 100644 internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateDataStream/main.go create mode 100644 internal/generated/snippets/dialogflow/apiv2/DocumentsClient/ExportDocument/main.go diff --git a/analytics/admin/apiv1alpha/analytics_admin_client.go b/analytics/admin/apiv1alpha/analytics_admin_client.go index 4e1ee2ba62b1..f6e2d43e51ec 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client.go @@ -73,8 +73,6 @@ type AnalyticsAdminCallOptions struct { DeleteAndroidAppDataStream []gax.CallOption UpdateAndroidAppDataStream []gax.CallOption ListAndroidAppDataStreams []gax.CallOption - GetEnhancedMeasurementSettings []gax.CallOption - UpdateEnhancedMeasurementSettings []gax.CallOption CreateFirebaseLink []gax.CallOption DeleteFirebaseLink []gax.CallOption ListFirebaseLinks []gax.CallOption @@ -89,6 +87,7 @@ type AnalyticsAdminCallOptions struct { CreateMeasurementProtocolSecret []gax.CallOption DeleteMeasurementProtocolSecret []gax.CallOption UpdateMeasurementProtocolSecret []gax.CallOption + AcknowledgeUserDataCollection []gax.CallOption SearchChangeHistoryEvents []gax.CallOption GetGoogleSignalsSettings []gax.CallOption UpdateGoogleSignalsSettings []gax.CallOption @@ -119,6 +118,11 @@ type AnalyticsAdminCallOptions struct { GetCustomMetric []gax.CallOption GetDataRetentionSettings []gax.CallOption UpdateDataRetentionSettings []gax.CallOption + CreateDataStream []gax.CallOption + DeleteDataStream []gax.CallOption + UpdateDataStream []gax.CallOption + ListDataStreams []gax.CallOption + GetDataStream []gax.CallOption } func defaultAnalyticsAdminGRPCClientOptions() []option.ClientOption { @@ -180,27 +184,25 @@ func defaultAnalyticsAdminCallOptions() *AnalyticsAdminCallOptions { }) }), }, - UpdateWebDataStream: []gax.CallOption{}, - CreateWebDataStream: []gax.CallOption{}, - ListWebDataStreams: []gax.CallOption{}, - GetIosAppDataStream: []gax.CallOption{}, - DeleteIosAppDataStream: []gax.CallOption{}, - UpdateIosAppDataStream: []gax.CallOption{}, - ListIosAppDataStreams: []gax.CallOption{}, - GetAndroidAppDataStream: []gax.CallOption{}, - DeleteAndroidAppDataStream: []gax.CallOption{}, - UpdateAndroidAppDataStream: []gax.CallOption{}, - ListAndroidAppDataStreams: []gax.CallOption{}, - GetEnhancedMeasurementSettings: []gax.CallOption{}, - UpdateEnhancedMeasurementSettings: []gax.CallOption{}, - CreateFirebaseLink: []gax.CallOption{}, - DeleteFirebaseLink: []gax.CallOption{}, - ListFirebaseLinks: []gax.CallOption{}, - GetGlobalSiteTag: []gax.CallOption{}, - CreateGoogleAdsLink: []gax.CallOption{}, - UpdateGoogleAdsLink: []gax.CallOption{}, - DeleteGoogleAdsLink: []gax.CallOption{}, - ListGoogleAdsLinks: []gax.CallOption{}, + UpdateWebDataStream: []gax.CallOption{}, + CreateWebDataStream: []gax.CallOption{}, + ListWebDataStreams: []gax.CallOption{}, + GetIosAppDataStream: []gax.CallOption{}, + DeleteIosAppDataStream: []gax.CallOption{}, + UpdateIosAppDataStream: []gax.CallOption{}, + ListIosAppDataStreams: []gax.CallOption{}, + GetAndroidAppDataStream: []gax.CallOption{}, + DeleteAndroidAppDataStream: []gax.CallOption{}, + UpdateAndroidAppDataStream: []gax.CallOption{}, + ListAndroidAppDataStreams: []gax.CallOption{}, + CreateFirebaseLink: []gax.CallOption{}, + DeleteFirebaseLink: []gax.CallOption{}, + ListFirebaseLinks: []gax.CallOption{}, + GetGlobalSiteTag: []gax.CallOption{}, + CreateGoogleAdsLink: []gax.CallOption{}, + UpdateGoogleAdsLink: []gax.CallOption{}, + DeleteGoogleAdsLink: []gax.CallOption{}, + ListGoogleAdsLinks: []gax.CallOption{}, GetDataSharingSettings: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -273,6 +275,18 @@ func defaultAnalyticsAdminCallOptions() *AnalyticsAdminCallOptions { }) }), }, + AcknowledgeUserDataCollection: []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{ @@ -633,6 +647,66 @@ func defaultAnalyticsAdminCallOptions() *AnalyticsAdminCallOptions { }) }), }, + CreateDataStream: []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, + }) + }), + }, + DeleteDataStream: []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, + }) + }), + }, + UpdateDataStream: []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, + }) + }), + }, + ListDataStreams: []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, + }) + }), + }, + GetDataStream: []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, + }) + }), + }, } } @@ -675,8 +749,6 @@ type internalAnalyticsAdminClient interface { DeleteAndroidAppDataStream(context.Context, *adminpb.DeleteAndroidAppDataStreamRequest, ...gax.CallOption) error UpdateAndroidAppDataStream(context.Context, *adminpb.UpdateAndroidAppDataStreamRequest, ...gax.CallOption) (*adminpb.AndroidAppDataStream, error) ListAndroidAppDataStreams(context.Context, *adminpb.ListAndroidAppDataStreamsRequest, ...gax.CallOption) *AndroidAppDataStreamIterator - GetEnhancedMeasurementSettings(context.Context, *adminpb.GetEnhancedMeasurementSettingsRequest, ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, error) - UpdateEnhancedMeasurementSettings(context.Context, *adminpb.UpdateEnhancedMeasurementSettingsRequest, ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, error) CreateFirebaseLink(context.Context, *adminpb.CreateFirebaseLinkRequest, ...gax.CallOption) (*adminpb.FirebaseLink, error) DeleteFirebaseLink(context.Context, *adminpb.DeleteFirebaseLinkRequest, ...gax.CallOption) error ListFirebaseLinks(context.Context, *adminpb.ListFirebaseLinksRequest, ...gax.CallOption) *FirebaseLinkIterator @@ -691,6 +763,7 @@ type internalAnalyticsAdminClient interface { 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) + AcknowledgeUserDataCollection(context.Context, *adminpb.AcknowledgeUserDataCollectionRequest, ...gax.CallOption) (*adminpb.AcknowledgeUserDataCollectionResponse, 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) @@ -721,6 +794,11 @@ type internalAnalyticsAdminClient interface { GetCustomMetric(context.Context, *adminpb.GetCustomMetricRequest, ...gax.CallOption) (*adminpb.CustomMetric, error) GetDataRetentionSettings(context.Context, *adminpb.GetDataRetentionSettingsRequest, ...gax.CallOption) (*adminpb.DataRetentionSettings, error) UpdateDataRetentionSettings(context.Context, *adminpb.UpdateDataRetentionSettingsRequest, ...gax.CallOption) (*adminpb.DataRetentionSettings, error) + CreateDataStream(context.Context, *adminpb.CreateDataStreamRequest, ...gax.CallOption) (*adminpb.DataStream, error) + DeleteDataStream(context.Context, *adminpb.DeleteDataStreamRequest, ...gax.CallOption) error + UpdateDataStream(context.Context, *adminpb.UpdateDataStreamRequest, ...gax.CallOption) (*adminpb.DataStream, error) + ListDataStreams(context.Context, *adminpb.ListDataStreamsRequest, ...gax.CallOption) *DataStreamIterator + GetDataStream(context.Context, *adminpb.GetDataStreamRequest, ...gax.CallOption) (*adminpb.DataStream, error) } // AnalyticsAdminClient is a client for interacting with Google Analytics Admin API. @@ -980,20 +1058,6 @@ func (c *AnalyticsAdminClient) ListAndroidAppDataStreams(ctx context.Context, re return c.internalClient.ListAndroidAppDataStreams(ctx, req, opts...) } -// GetEnhancedMeasurementSettings returns the singleton enhanced measurement settings for this web stream. -// Note that the stream must enable enhanced measurement for these settings to -// take effect. -func (c *AnalyticsAdminClient) GetEnhancedMeasurementSettings(ctx context.Context, req *adminpb.GetEnhancedMeasurementSettingsRequest, opts ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, error) { - return c.internalClient.GetEnhancedMeasurementSettings(ctx, req, opts...) -} - -// UpdateEnhancedMeasurementSettings updates the singleton enhanced measurement settings for this web stream. -// Note that the stream must enable enhanced measurement for these settings to -// take effect. -func (c *AnalyticsAdminClient) UpdateEnhancedMeasurementSettings(ctx context.Context, req *adminpb.UpdateEnhancedMeasurementSettingsRequest, opts ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, error) { - return c.internalClient.UpdateEnhancedMeasurementSettings(ctx, req, opts...) -} - // CreateFirebaseLink creates a FirebaseLink. // // Properties can have at most one FirebaseLink. @@ -1070,6 +1134,14 @@ func (c *AnalyticsAdminClient) UpdateMeasurementProtocolSecret(ctx context.Conte return c.internalClient.UpdateMeasurementProtocolSecret(ctx, req, opts...) } +// AcknowledgeUserDataCollection acknowledges the terms of user data collection for the specified property. +// +// This acknowledgement must be completed (either in the Google Analytics UI +// or via this API) before MeasurementProtocolSecret resources may be created. +func (c *AnalyticsAdminClient) AcknowledgeUserDataCollection(ctx context.Context, req *adminpb.AcknowledgeUserDataCollectionRequest, opts ...gax.CallOption) (*adminpb.AcknowledgeUserDataCollectionResponse, error) { + return c.internalClient.AcknowledgeUserDataCollection(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 { @@ -1236,6 +1308,31 @@ func (c *AnalyticsAdminClient) UpdateDataRetentionSettings(ctx context.Context, return c.internalClient.UpdateDataRetentionSettings(ctx, req, opts...) } +// CreateDataStream creates a DataStream. +func (c *AnalyticsAdminClient) CreateDataStream(ctx context.Context, req *adminpb.CreateDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, error) { + return c.internalClient.CreateDataStream(ctx, req, opts...) +} + +// DeleteDataStream deletes a DataStream on a property. +func (c *AnalyticsAdminClient) DeleteDataStream(ctx context.Context, req *adminpb.DeleteDataStreamRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteDataStream(ctx, req, opts...) +} + +// UpdateDataStream updates a DataStream on a property. +func (c *AnalyticsAdminClient) UpdateDataStream(ctx context.Context, req *adminpb.UpdateDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, error) { + return c.internalClient.UpdateDataStream(ctx, req, opts...) +} + +// ListDataStreams lists DataStreams on a property. +func (c *AnalyticsAdminClient) ListDataStreams(ctx context.Context, req *adminpb.ListDataStreamsRequest, opts ...gax.CallOption) *DataStreamIterator { + return c.internalClient.ListDataStreams(ctx, req, opts...) +} + +// GetDataStream lookup for a single DataStream. +func (c *AnalyticsAdminClient) GetDataStream(ctx context.Context, req *adminpb.GetDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, error) { + return c.internalClient.GetDataStream(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. @@ -2185,48 +2282,6 @@ func (c *analyticsAdminGRPCClient) ListAndroidAppDataStreams(ctx context.Context return it } -func (c *analyticsAdminGRPCClient) GetEnhancedMeasurementSettings(ctx context.Context, req *adminpb.GetEnhancedMeasurementSettingsRequest, opts ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, 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).GetEnhancedMeasurementSettings[0:len((*c.CallOptions).GetEnhancedMeasurementSettings):len((*c.CallOptions).GetEnhancedMeasurementSettings)], opts...) - var resp *adminpb.EnhancedMeasurementSettings - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.analyticsAdminClient.GetEnhancedMeasurementSettings(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *analyticsAdminGRPCClient) UpdateEnhancedMeasurementSettings(ctx context.Context, req *adminpb.UpdateEnhancedMeasurementSettingsRequest, opts ...gax.CallOption) (*adminpb.EnhancedMeasurementSettings, 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", "enhanced_measurement_settings.name", url.QueryEscape(req.GetEnhancedMeasurementSettings().GetName()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).UpdateEnhancedMeasurementSettings[0:len((*c.CallOptions).UpdateEnhancedMeasurementSettings):len((*c.CallOptions).UpdateEnhancedMeasurementSettings)], opts...) - var resp *adminpb.EnhancedMeasurementSettings - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.analyticsAdminClient.UpdateEnhancedMeasurementSettings(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - func (c *analyticsAdminGRPCClient) CreateFirebaseLink(ctx context.Context, req *adminpb.CreateFirebaseLinkRequest, opts ...gax.CallOption) (*adminpb.FirebaseLink, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -2578,6 +2633,27 @@ func (c *analyticsAdminGRPCClient) UpdateMeasurementProtocolSecret(ctx context.C return resp, nil } +func (c *analyticsAdminGRPCClient) AcknowledgeUserDataCollection(ctx context.Context, req *adminpb.AcknowledgeUserDataCollectionRequest, opts ...gax.CallOption) (*adminpb.AcknowledgeUserDataCollectionResponse, 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", "property", url.QueryEscape(req.GetProperty()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).AcknowledgeUserDataCollection[0:len((*c.CallOptions).AcknowledgeUserDataCollection):len((*c.CallOptions).AcknowledgeUserDataCollection)], opts...) + var resp *adminpb.AcknowledgeUserDataCollectionResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.AcknowledgeUserDataCollection(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) @@ -3326,6 +3402,130 @@ func (c *analyticsAdminGRPCClient) UpdateDataRetentionSettings(ctx context.Conte return resp, nil } +func (c *analyticsAdminGRPCClient) CreateDataStream(ctx context.Context, req *adminpb.CreateDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, 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).CreateDataStream[0:len((*c.CallOptions).CreateDataStream):len((*c.CallOptions).CreateDataStream)], opts...) + var resp *adminpb.DataStream + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.CreateDataStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) DeleteDataStream(ctx context.Context, req *adminpb.DeleteDataStreamRequest, 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).DeleteDataStream[0:len((*c.CallOptions).DeleteDataStream):len((*c.CallOptions).DeleteDataStream)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.analyticsAdminClient.DeleteDataStream(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *analyticsAdminGRPCClient) UpdateDataStream(ctx context.Context, req *adminpb.UpdateDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, 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", "data_stream.name", url.QueryEscape(req.GetDataStream().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateDataStream[0:len((*c.CallOptions).UpdateDataStream):len((*c.CallOptions).UpdateDataStream)], opts...) + var resp *adminpb.DataStream + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.UpdateDataStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *analyticsAdminGRPCClient) ListDataStreams(ctx context.Context, req *adminpb.ListDataStreamsRequest, opts ...gax.CallOption) *DataStreamIterator { + 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).ListDataStreams[0:len((*c.CallOptions).ListDataStreams):len((*c.CallOptions).ListDataStreams)], opts...) + it := &DataStreamIterator{} + req = proto.Clone(req).(*adminpb.ListDataStreamsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.DataStream, string, error) { + resp := &adminpb.ListDataStreamsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.ListDataStreams(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetDataStreams(), 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) GetDataStream(ctx context.Context, req *adminpb.GetDataStreamRequest, opts ...gax.CallOption) (*adminpb.DataStream, 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).GetDataStream[0:len((*c.CallOptions).GetDataStream):len((*c.CallOptions).GetDataStream)], opts...) + var resp *adminpb.DataStream + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.analyticsAdminClient.GetDataStream(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // AccountIterator manages a stream of *adminpb.Account. type AccountIterator struct { items []*adminpb.Account @@ -3702,6 +3902,53 @@ func (it *CustomMetricIterator) takeBuf() interface{} { return b } +// DataStreamIterator manages a stream of *adminpb.DataStream. +type DataStreamIterator struct { + items []*adminpb.DataStream + 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.DataStream, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DataStreamIterator) 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 *DataStreamIterator) Next() (*adminpb.DataStream, error) { + var item *adminpb.DataStream + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DataStreamIterator) bufLen() int { + return len(it.items) +} + +func (it *DataStreamIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + // DisplayVideo360AdvertiserLinkIterator manages a stream of *adminpb.DisplayVideo360AdvertiserLink. type DisplayVideo360AdvertiserLinkIterator struct { items []*adminpb.DisplayVideo360AdvertiserLink diff --git a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go index ab2277432064..c2a66e9fd7e8 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client_example_test.go @@ -752,46 +752,6 @@ func ExampleAnalyticsAdminClient_ListAndroidAppDataStreams() { } } -func ExampleAnalyticsAdminClient_GetEnhancedMeasurementSettings() { - ctx := context.Background() - c, err := admin.NewAnalyticsAdminClient(ctx) - if err != nil { - // TODO: Handle error. - } - defer c.Close() - - req := &adminpb.GetEnhancedMeasurementSettingsRequest{ - // TODO: Fill request struct fields. - // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#GetEnhancedMeasurementSettingsRequest. - } - resp, err := c.GetEnhancedMeasurementSettings(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -func ExampleAnalyticsAdminClient_UpdateEnhancedMeasurementSettings() { - ctx := context.Background() - c, err := admin.NewAnalyticsAdminClient(ctx) - if err != nil { - // TODO: Handle error. - } - defer c.Close() - - req := &adminpb.UpdateEnhancedMeasurementSettingsRequest{ - // TODO: Fill request struct fields. - // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#UpdateEnhancedMeasurementSettingsRequest. - } - resp, err := c.UpdateEnhancedMeasurementSettings(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - func ExampleAnalyticsAdminClient_CreateFirebaseLink() { ctx := context.Background() c, err := admin.NewAnalyticsAdminClient(ctx) @@ -1084,6 +1044,26 @@ func ExampleAnalyticsAdminClient_UpdateMeasurementProtocolSecret() { _ = resp } +func ExampleAnalyticsAdminClient_AcknowledgeUserDataCollection() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.AcknowledgeUserDataCollectionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#AcknowledgeUserDataCollectionRequest. + } + resp, err := c.AcknowledgeUserDataCollection(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleAnalyticsAdminClient_SearchChangeHistoryEvents() { ctx := context.Background() c, err := admin.NewAnalyticsAdminClient(ctx) @@ -1709,3 +1689,107 @@ func ExampleAnalyticsAdminClient_UpdateDataRetentionSettings() { // TODO: Use resp. _ = resp } + +func ExampleAnalyticsAdminClient_CreateDataStream() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.CreateDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#CreateDataStreamRequest. + } + resp, err := c.CreateDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_DeleteDataStream() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.DeleteDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#DeleteDataStreamRequest. + } + err = c.DeleteDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAnalyticsAdminClient_UpdateDataStream() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.UpdateDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#UpdateDataStreamRequest. + } + resp, err := c.UpdateDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAnalyticsAdminClient_ListDataStreams() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.ListDataStreamsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#ListDataStreamsRequest. + } + it := c.ListDataStreams(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAnalyticsAdminClient_GetDataStream() { + ctx := context.Background() + c, err := admin.NewAnalyticsAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &adminpb.GetDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#GetDataStreamRequest. + } + resp, err := c.GetDataStream(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 ff203d275747..38e07218d81e 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" 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 f799576467de..7585fb2f8cb4 100644 --- a/analytics/admin/apiv1alpha/gapic_metadata.json +++ b/analytics/admin/apiv1alpha/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "AnalyticsAdminClient", "rpcs": { + "AcknowledgeUserDataCollection": { + "methods": [ + "AcknowledgeUserDataCollection" + ] + }, "ApproveDisplayVideo360AdvertiserLinkProposal": { "methods": [ "ApproveDisplayVideo360AdvertiserLinkProposal" @@ -70,6 +75,11 @@ "CreateCustomMetric" ] }, + "CreateDataStream": { + "methods": [ + "CreateDataStream" + ] + }, "CreateDisplayVideo360AdvertiserLink": { "methods": [ "CreateDisplayVideo360AdvertiserLink" @@ -125,6 +135,11 @@ "DeleteConversionEvent" ] }, + "DeleteDataStream": { + "methods": [ + "DeleteDataStream" + ] + }, "DeleteDisplayVideo360AdvertiserLink": { "methods": [ "DeleteDisplayVideo360AdvertiserLink" @@ -205,6 +220,11 @@ "GetDataSharingSettings" ] }, + "GetDataStream": { + "methods": [ + "GetDataStream" + ] + }, "GetDisplayVideo360AdvertiserLink": { "methods": [ "GetDisplayVideo360AdvertiserLink" @@ -215,11 +235,6 @@ "GetDisplayVideo360AdvertiserLinkProposal" ] }, - "GetEnhancedMeasurementSettings": { - "methods": [ - "GetEnhancedMeasurementSettings" - ] - }, "GetGlobalSiteTag": { "methods": [ "GetGlobalSiteTag" @@ -285,6 +300,11 @@ "ListCustomMetrics" ] }, + "ListDataStreams": { + "methods": [ + "ListDataStreams" + ] + }, "ListDisplayVideo360AdvertiserLinkProposals": { "methods": [ "ListDisplayVideo360AdvertiserLinkProposals" @@ -365,14 +385,14 @@ "UpdateDataRetentionSettings" ] }, - "UpdateDisplayVideo360AdvertiserLink": { + "UpdateDataStream": { "methods": [ - "UpdateDisplayVideo360AdvertiserLink" + "UpdateDataStream" ] }, - "UpdateEnhancedMeasurementSettings": { + "UpdateDisplayVideo360AdvertiserLink": { "methods": [ - "UpdateEnhancedMeasurementSettings" + "UpdateDisplayVideo360AdvertiserLink" ] }, "UpdateGoogleAdsLink": { diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index 7d8495797771..bd5e8516fea2 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -91,7 +91,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index ce763a1ec0e5..e2b2087cf981 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -89,7 +89,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index cde6143ebcfa..c4cb79e8fb4b 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/bigquery/reservation/apiv1/reservation_client.go b/bigquery/reservation/apiv1/reservation_client.go index 9fc1053dfdc5..dd79539a4fb6 100644 --- a/bigquery/reservation/apiv1/reservation_client.go +++ b/bigquery/reservation/apiv1/reservation_client.go @@ -702,7 +702,7 @@ func (c *gRPCClient) ListReservations(ctx context.Context, req *reservationpb.Li func (c *gRPCClient) GetReservation(ctx context.Context, req *reservationpb.GetReservationRequest, opts ...gax.CallOption) (*reservationpb.Reservation, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } @@ -723,7 +723,7 @@ func (c *gRPCClient) GetReservation(ctx context.Context, req *reservationpb.GetR func (c *gRPCClient) DeleteReservation(ctx context.Context, req *reservationpb.DeleteReservationRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } @@ -826,7 +826,7 @@ func (c *gRPCClient) ListCapacityCommitments(ctx context.Context, req *reservati func (c *gRPCClient) GetCapacityCommitment(ctx context.Context, req *reservationpb.GetCapacityCommitmentRequest, opts ...gax.CallOption) (*reservationpb.CapacityCommitment, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } @@ -847,7 +847,7 @@ func (c *gRPCClient) GetCapacityCommitment(ctx context.Context, req *reservation func (c *gRPCClient) DeleteCapacityCommitment(ctx context.Context, req *reservationpb.DeleteCapacityCommitmentRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } @@ -992,7 +992,7 @@ func (c *gRPCClient) ListAssignments(ctx context.Context, req *reservationpb.Lis func (c *gRPCClient) DeleteAssignment(ctx context.Context, req *reservationpb.DeleteAssignmentRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } @@ -1118,7 +1118,7 @@ func (c *gRPCClient) MoveAssignment(ctx context.Context, req *reservationpb.Move func (c *gRPCClient) GetBiReservation(ctx context.Context, req *reservationpb.GetBiReservationRequest, opts ...gax.CallOption) (*reservationpb.BiReservation, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) + cctx, cancel := context.WithTimeout(ctx, 300000*time.Millisecond) defer cancel() ctx = cctx } diff --git a/compute/apiv1/doc.go b/compute/apiv1/doc.go index bc7e37b97735..b774fb56955a 100644 --- a/compute/apiv1/doc.go +++ b/compute/apiv1/doc.go @@ -91,7 +91,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index c428438998e3..e2de94147c6b 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -85,7 +85,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211208" +const versionClient = "20211221" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dialogflow/apiv2/documents_client.go b/dialogflow/apiv2/documents_client.go index ea1d051068fc..5d9cbb1bcde6 100644 --- a/dialogflow/apiv2/documents_client.go +++ b/dialogflow/apiv2/documents_client.go @@ -48,6 +48,7 @@ type DocumentsCallOptions struct { DeleteDocument []gax.CallOption UpdateDocument []gax.CallOption ReloadDocument []gax.CallOption + ExportDocument []gax.CallOption } func defaultDocumentsGRPCClientOptions() []option.ClientOption { @@ -130,6 +131,17 @@ func defaultDocumentsCallOptions() *DocumentsCallOptions { }) }), }, + ExportDocument: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -148,6 +160,8 @@ type internalDocumentsClient interface { UpdateDocumentOperation(name string) *UpdateDocumentOperation ReloadDocument(context.Context, *dialogflowpb.ReloadDocumentRequest, ...gax.CallOption) (*ReloadDocumentOperation, error) ReloadDocumentOperation(name string) *ReloadDocumentOperation + ExportDocument(context.Context, *dialogflowpb.ExportDocumentRequest, ...gax.CallOption) (*ExportDocumentOperation, error) + ExportDocumentOperation(name string) *ExportDocumentOperation } // DocumentsClient is a client for interacting with Dialogflow API. @@ -282,6 +296,26 @@ func (c *DocumentsClient) ReloadDocumentOperation(name string) *ReloadDocumentOp return c.internalClient.ReloadDocumentOperation(name) } +// ExportDocument exports a smart messaging candidate document into the specified +// destination. +// +// This method is a long-running +// operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). +// The returned Operation type has the following method-specific fields: +// +// metadata: KnowledgeOperationMetadata +// +// response: Document +func (c *DocumentsClient) ExportDocument(ctx context.Context, req *dialogflowpb.ExportDocumentRequest, opts ...gax.CallOption) (*ExportDocumentOperation, error) { + return c.internalClient.ExportDocument(ctx, req, opts...) +} + +// ExportDocumentOperation returns a new ExportDocumentOperation from a given name. +// The name must be that of a previously created ExportDocumentOperation, possibly from a different process. +func (c *DocumentsClient) ExportDocumentOperation(name string) *ExportDocumentOperation { + return c.internalClient.ExportDocumentOperation(name) +} + // documentsGRPCClient 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. @@ -535,6 +569,29 @@ func (c *documentsGRPCClient) ReloadDocument(ctx context.Context, req *dialogflo }, nil } +func (c *documentsGRPCClient) ExportDocument(ctx context.Context, req *dialogflowpb.ExportDocumentRequest, opts ...gax.CallOption) (*ExportDocumentOperation, 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).ExportDocument[0:len((*c.CallOptions).ExportDocument):len((*c.CallOptions).ExportDocument)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.documentsClient.ExportDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportDocumentOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + // CreateDocumentOperation manages a long-running operation from CreateDocument. type CreateDocumentOperation struct { lro *longrunning.Operation @@ -662,6 +719,75 @@ func (op *DeleteDocumentOperation) Name() string { return op.lro.Name() } +// ExportDocumentOperation manages a long-running operation from ExportDocument. +type ExportDocumentOperation struct { + lro *longrunning.Operation +} + +// ExportDocumentOperation returns a new ExportDocumentOperation from a given name. +// The name must be that of a previously created ExportDocumentOperation, possibly from a different process. +func (c *documentsGRPCClient) ExportDocumentOperation(name string) *ExportDocumentOperation { + return &ExportDocumentOperation{ + 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 *ExportDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + 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 *ExportDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, error) { + var resp dialogflowpb.Document + 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 *ExportDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, error) { + var meta dialogflowpb.KnowledgeOperationMetadata + 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 *ExportDocumentOperation) 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 *ExportDocumentOperation) Name() string { + return op.lro.Name() +} + // ReloadDocumentOperation manages a long-running operation from ReloadDocument. type ReloadDocumentOperation struct { lro *longrunning.Operation diff --git a/dialogflow/apiv2/documents_client_example_test.go b/dialogflow/apiv2/documents_client_example_test.go index 87fa7014c51d..55324dcd39db 100644 --- a/dialogflow/apiv2/documents_client_example_test.go +++ b/dialogflow/apiv2/documents_client_example_test.go @@ -179,3 +179,28 @@ func ExampleDocumentsClient_ReloadDocument() { // TODO: Use resp. _ = resp } + +func ExampleDocumentsClient_ExportDocument() { + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dialogflowpb.ExportDocumentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/v2#ExportDocumentRequest. + } + op, err := c.ExportDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/dialogflow/apiv2/gapic_metadata.json b/dialogflow/apiv2/gapic_metadata.json index d7b1922072c6..8748e8562610 100644 --- a/dialogflow/apiv2/gapic_metadata.json +++ b/dialogflow/apiv2/gapic_metadata.json @@ -200,6 +200,11 @@ "DeleteDocument" ] }, + "ExportDocument": { + "methods": [ + "ExportDocument" + ] + }, "GetDocument": { "methods": [ "GetDocument" diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/AcknowledgeUserDataCollection/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/AcknowledgeUserDataCollection/main.go new file mode 100644 index 000000000000..bf3d23d3c068 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/AcknowledgeUserDataCollection/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_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.AcknowledgeUserDataCollectionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#AcknowledgeUserDataCollectionRequest. + } + resp, err := c.AcknowledgeUserDataCollection(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateDataStream/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateDataStream/main.go new file mode 100644 index 000000000000..88fa7e7d439c --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/CreateDataStream/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_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.CreateDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#CreateDataStreamRequest. + } + resp, err := c.CreateDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteDataStream/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteDataStream/main.go new file mode 100644 index 000000000000..6e7e158f82d5 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/DeleteDataStream/main.go @@ -0,0 +1,46 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_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.DeleteDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#DeleteDataStreamRequest. + } + err = c.DeleteDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetDataStream/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetDataStream/main.go new file mode 100644 index 000000000000..a92e4b83387c --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/GetDataStream/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_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.GetDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#GetDataStreamRequest. + } + resp, err := c.GetDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListDataStreams/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListDataStreams/main.go new file mode 100644 index 000000000000..857a41dc8e54 --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/ListDataStreams/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_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.ListDataStreamsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#ListDataStreamsRequest. + } + it := c.ListDataStreams(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_ListDataStreams_sync] diff --git a/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateDataStream/main.go b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateDataStream/main.go new file mode 100644 index 000000000000..719d97bdae3c --- /dev/null +++ b/internal/generated/snippets/analytics/admin/apiv1alpha/AnalyticsAdminClient/UpdateDataStream/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_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.UpdateDataStreamRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#UpdateDataStreamRequest. + } + resp, err := c.UpdateDataStream(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_sync] diff --git a/internal/generated/snippets/dialogflow/apiv2/DocumentsClient/ExportDocument/main.go b/internal/generated/snippets/dialogflow/apiv2/DocumentsClient/ExportDocument/main.go new file mode 100644 index 000000000000..0a950c34ee22 --- /dev/null +++ b/internal/generated/snippets/dialogflow/apiv2/DocumentsClient/ExportDocument/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dialogflow_v2_generated_Documents_ExportDocument_sync] + +package main + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func main() { + ctx := context.Background() + c, err := dialogflow.NewDocumentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dialogflowpb.ExportDocumentRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/v2#ExportDocumentRequest. + } + op, err := c.ExportDocument(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_v2_generated_Documents_ExportDocument_sync]