diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index 7b7fe74a089..3bb625bf101 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index da3a808f36b..8ec6f94a369 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/data_catalog_client.go b/datacatalog/apiv1/data_catalog_client.go index 567e84f10fa..6740795d947 100644 --- a/datacatalog/apiv1/data_catalog_client.go +++ b/datacatalog/apiv1/data_catalog_client.go @@ -234,8 +234,8 @@ type internalClient interface { // Client is a client for interacting with Google Cloud Data Catalog API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Data Catalog API service allows clients to discover, understand, and manage -// their data. +// Data Catalog API service allows you to discover, understand, and manage +// your data. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -266,68 +266,79 @@ func (c *Client) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// SearchCatalog searches Data Catalog for multiple resources like entries, tags that +// SearchCatalog searches Data Catalog for multiple resources like entries and tags that // match a query. // -// This is a custom method -// (https://cloud.google.com/apis/design/custom_methods (at https://cloud.google.com/apis/design/custom_methods)) and does not return -// the complete resource, only the resource identifier and high level -// fields. Clients can subsequently call Get methods. +// This is a [Custom Method] +// (https://cloud.google.com/apis/design/custom_methods (at https://cloud.google.com/apis/design/custom_methods)) that doesn’t return +// all information on a resource, only its ID and high level fields. To get +// more information, you can subsequently call specific get methods. // -// Note that Data Catalog search queries do not guarantee full recall. Query -// results that match your query may not be returned, even in subsequent -// result pages. Also note that results returned (and not returned) can vary -// across repeated search queries. +// Note: Data Catalog search queries don’t guarantee full recall. Results +// that match your query might not be returned, even in subsequent +// result pages. Additionally, returned (and not returned) results can vary +// if you repeat search queries. // -// See Data Catalog Search -// Syntax (at https://cloud.google.com/data-catalog/docs/how-to/search-reference) -// for more information. +// For more information, see [Data Catalog search syntax] +// (https://cloud.google.com/data-catalog/docs/how-to/search-reference (at https://cloud.google.com/data-catalog/docs/how-to/search-reference)). func (c *Client) SearchCatalog(ctx context.Context, req *datacatalogpb.SearchCatalogRequest, opts ...gax.CallOption) *SearchCatalogResultIterator { return c.internalClient.SearchCatalog(ctx, req, opts...) } -// CreateEntryGroup creates an EntryGroup. +// CreateEntryGroup creates an entry group. // // An entry group contains logically related entries together with Cloud -// Identity and Access Management policies that specify the users who can -// create, edit, and view entries within the entry group. +// Identity and Access Management (at /data-catalog/docs/concepts/iam) policies. +// These policies specify users who can create, edit, and view entries +// within entry groups. // -// Data Catalog automatically creates an entry group for BigQuery entries -// (“@bigquery”) and Pub/Sub topics ("@pubsub"). Users create their own entry -// group to contain Cloud Storage fileset entries or custom type entries, -// and the IAM policies associated with those entries. Entry groups, like -// entries, can be searched. +// Data Catalog automatically creates entry groups with names that start with +// the @ symbol for the following resources: +// +// BigQuery entries (@bigquery) +// +// Pub/Sub topics (@pubsub) +// +// Dataproc Metastore services (@dataproc_metastore_{SERVICE_NAME_HASH}) +// +// You can create your own entry groups for Cloud Storage fileset entries +// and custom entries together with the corresponding IAM policies. +// User-created entry groups can’t contain the @ symbol, it is reserved +// for automatically created groups. +// +// Entry groups, like entries, can be searched. // // A maximum of 10,000 entry groups may be created per organization across all // locations. // -// Users should enable the Data Catalog API in the project identified by -// the parent parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// You must enable the Data Catalog API in the project identified by +// the parent parameter. For more information, see Data Catalog resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) CreateEntryGroup(ctx context.Context, req *datacatalogpb.CreateEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) { return c.internalClient.CreateEntryGroup(ctx, req, opts...) } -// GetEntryGroup gets an EntryGroup. +// GetEntryGroup gets an entry group. func (c *Client) GetEntryGroup(ctx context.Context, req *datacatalogpb.GetEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) { return c.internalClient.GetEntryGroup(ctx, req, opts...) } -// UpdateEntryGroup updates an EntryGroup. The user should enable the Data Catalog API in the -// project identified by the entry_group.name parameter (see [Data Catalog -// Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// UpdateEntryGroup updates an entry group. +// +// You must enable the Data Catalog API in the project identified by +// the entry_group.name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) UpdateEntryGroup(ctx context.Context, req *datacatalogpb.UpdateEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) { return c.internalClient.UpdateEntryGroup(ctx, req, opts...) } -// DeleteEntryGroup deletes an EntryGroup. Only entry groups that do not contain entries can be -// deleted. Users should enable the Data Catalog API in the project -// identified by the name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// DeleteEntryGroup deletes an entry group. +// +// You must enable the Data Catalog API in the project +// identified by the name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) DeleteEntryGroup(ctx context.Context, req *datacatalogpb.DeleteEntryGroupRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteEntryGroup(ctx, req, opts...) } @@ -337,35 +348,41 @@ func (c *Client) ListEntryGroups(ctx context.Context, req *datacatalogpb.ListEnt return c.internalClient.ListEntryGroups(ctx, req, opts...) } -// CreateEntry creates an entry. Only entries of types ‘FILESET’, ‘CLUSTER’, ‘DATA_STREAM’ -// or with a user-specified type can be created. +// CreateEntry creates an entry. +// +// You can create entries only with ‘FILESET’, ‘CLUSTER’, ‘DATA_STREAM’, +// or custom types. Data Catalog automatically creates entries with other +// types during metadata ingestion from integrated systems. // -// Users should enable the Data Catalog API in the project identified by -// the parent parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// You must enable the Data Catalog API in the project identified by +// the parent parameter. For more information, see Data Catalog resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). // -// A maximum of 100,000 entries may be created per entry group. +// An entry group can have a maximum of 100,000 entries. func (c *Client) CreateEntry(ctx context.Context, req *datacatalogpb.CreateEntryRequest, opts ...gax.CallOption) (*datacatalogpb.Entry, error) { return c.internalClient.CreateEntry(ctx, req, opts...) } // UpdateEntry updates an existing entry. -// Users should enable the Data Catalog API in the project identified by -// the entry.name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// +// You must enable the Data Catalog API in the project identified by +// the entry.name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) UpdateEntry(ctx context.Context, req *datacatalogpb.UpdateEntryRequest, opts ...gax.CallOption) (*datacatalogpb.Entry, error) { return c.internalClient.UpdateEntry(ctx, req, opts...) } -// DeleteEntry deletes an existing entry. Only entries created through +// DeleteEntry deletes an existing entry. +// +// You can delete only the entries created by the // CreateEntry -// method can be deleted. -// Users should enable the Data Catalog API in the project identified by -// the name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// method. +// +// You must enable the Data Catalog API in the project identified by +// the name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) DeleteEntry(ctx context.Context, req *datacatalogpb.DeleteEntryRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteEntry(ctx, req, opts...) } @@ -375,9 +392,9 @@ func (c *Client) GetEntry(ctx context.Context, req *datacatalogpb.GetEntryReques return c.internalClient.GetEntry(ctx, req, opts...) } -// LookupEntry get an entry by target resource name. This method allows clients to use -// the resource name from the source Google Cloud Platform service to get the -// Data Catalog Entry. +// LookupEntry gets an entry by its target resource name. +// +// The resource name comes from the source Google Cloud Platform service. func (c *Client) LookupEntry(ctx context.Context, req *datacatalogpb.LookupEntryRequest, opts ...gax.CallOption) (*datacatalogpb.Entry, error) { return c.internalClient.LookupEntry(ctx, req, opts...) } @@ -387,11 +404,12 @@ func (c *Client) ListEntries(ctx context.Context, req *datacatalogpb.ListEntries return c.internalClient.ListEntries(ctx, req, opts...) } -// CreateTagTemplate creates a tag template. The user should enable the Data Catalog API in -// the project identified by the parent parameter (see Data Catalog -// Resource -// Project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project) -// for more information). +// CreateTagTemplate creates a tag template. +// +// You must enable the Data Catalog API in the project identified by the +// parent parameter. +// For more information, see [Data Catalog resource project] +// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)). func (c *Client) CreateTagTemplate(ctx context.Context, req *datacatalogpb.CreateTagTemplateRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplate, error) { return c.internalClient.CreateTagTemplate(ctx, req, opts...) } @@ -401,75 +419,88 @@ func (c *Client) GetTagTemplate(ctx context.Context, req *datacatalogpb.GetTagTe return c.internalClient.GetTagTemplate(ctx, req, opts...) } -// UpdateTagTemplate updates a tag template. This method cannot be used to update the fields of -// a template. The tag template fields are represented as separate resources -// and should be updated using their own create/update/delete methods. -// Users should enable the Data Catalog API in the project identified by -// the tag_template.name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// UpdateTagTemplate updates a tag template. +// +// You can’t update template fields with this method. These fields are +// separate resources with their own create, update, and delete methods. +// +// You must enable the Data Catalog API in the project identified by +// the tag_template.name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) UpdateTagTemplate(ctx context.Context, req *datacatalogpb.UpdateTagTemplateRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplate, error) { return c.internalClient.UpdateTagTemplate(ctx, req, opts...) } -// DeleteTagTemplate deletes a tag template and all tags using the template. -// Users should enable the Data Catalog API in the project identified by -// the name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// DeleteTagTemplate deletes a tag template and all tags that use it. +// +// You must enable the Data Catalog API in the project identified by +// the name parameter. For more information, see Data Catalog resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) DeleteTagTemplate(ctx context.Context, req *datacatalogpb.DeleteTagTemplateRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteTagTemplate(ctx, req, opts...) } -// CreateTagTemplateField creates a field in a tag template. The user should enable the Data Catalog -// API in the project identified by the parent parameter (see -// Data Catalog Resource -// Project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project) -// for more information). +// CreateTagTemplateField creates a field in a tag template. +// +// You must enable the Data Catalog API in the project identified by +// the parent parameter. For more information, see Data Catalog resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) CreateTagTemplateField(ctx context.Context, req *datacatalogpb.CreateTagTemplateFieldRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplateField, error) { return c.internalClient.CreateTagTemplateField(ctx, req, opts...) } -// UpdateTagTemplateField updates a field in a tag template. This method cannot be used to update the -// field type. Users should enable the Data Catalog API in the project -// identified by the name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// UpdateTagTemplateField updates a field in a tag template. +// +// You can’t update the field type with this method. +// +// You must enable the Data Catalog API in the project +// identified by the name parameter. For more information, see Data Catalog +// resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) UpdateTagTemplateField(ctx context.Context, req *datacatalogpb.UpdateTagTemplateFieldRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplateField, error) { return c.internalClient.UpdateTagTemplateField(ctx, req, opts...) } -// RenameTagTemplateField renames a field in a tag template. The user should enable the Data Catalog -// API in the project identified by the name parameter (see Data Catalog -// Resource -// Project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project) -// for more information). +// RenameTagTemplateField renames a field in a tag template. +// +// You must enable the Data Catalog API in the project identified by the +// name parameter. For more information, see [Data Catalog resource project] +// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)). func (c *Client) RenameTagTemplateField(ctx context.Context, req *datacatalogpb.RenameTagTemplateFieldRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplateField, error) { return c.internalClient.RenameTagTemplateField(ctx, req, opts...) } -// RenameTagTemplateFieldEnumValue renames an enum value in a tag template. The enum values have to be unique -// within one enum field. +// RenameTagTemplateFieldEnumValue renames an enum value in a tag template. +// +// Within a single enum field, enum values must be unique. func (c *Client) RenameTagTemplateFieldEnumValue(ctx context.Context, req *datacatalogpb.RenameTagTemplateFieldEnumValueRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplateField, error) { return c.internalClient.RenameTagTemplateFieldEnumValue(ctx, req, opts...) } -// DeleteTagTemplateField deletes a field in a tag template and all uses of that field. -// Users should enable the Data Catalog API in the project identified by -// the name parameter (see [Data Catalog Resource Project] -// (https://cloud.google.com/data-catalog/docs/concepts/resource-project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project)) for -// more information). +// DeleteTagTemplateField deletes a field in a tag template and all uses of this field from the tags +// based on this template. +// +// You must enable the Data Catalog API in the project identified by +// the name parameter. For more information, see Data Catalog resource +// project (at https://cloud.google.com/data-catalog/docs/concepts/resource-project). func (c *Client) DeleteTagTemplateField(ctx context.Context, req *datacatalogpb.DeleteTagTemplateFieldRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteTagTemplateField(ctx, req, opts...) } -// CreateTag creates a tag on an Entry. -// Note: The project identified by the parent parameter for the -// tag (at https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters) -// and the -// tag -// template (at https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters) -// used to create the tag must be from the same organization. +// CreateTag creates a tag and assigns it to: +// +// An Entry if the method name is +// projects.locations.entryGroups.entries.tags.create. +// +// Or EntryGroupif the method +// name is projects.locations.entryGroups.tags.create. +// +// Note: The project identified by the parent parameter for the [tag] +// (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters (at https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters)) +// and the [tag template] +// (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters (at https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters)) +// used to create the tag must be in the same organization. func (c *Client) CreateTag(ctx context.Context, req *datacatalogpb.CreateTagRequest, opts ...gax.CallOption) (*datacatalogpb.Tag, error) { return c.internalClient.CreateTag(ctx, req, opts...) } @@ -484,77 +515,77 @@ func (c *Client) DeleteTag(ctx context.Context, req *datacatalogpb.DeleteTagRequ return c.internalClient.DeleteTag(ctx, req, opts...) } -// ListTags lists the tags on an Entry. +// ListTags lists tags assigned to an Entry. func (c *Client) ListTags(ctx context.Context, req *datacatalogpb.ListTagsRequest, opts ...gax.CallOption) *TagIterator { return c.internalClient.ListTags(ctx, req, opts...) } -// SetIamPolicy sets the access control policy for a resource. Replaces any existing +// SetIamPolicy sets an access control policy for a resource. Replaces any existing // policy. +// // Supported resources are: // -// Tag templates. +// Tag templates // -// Entries. +// Entry groups // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Note: This method sets policies only within Data Catalog and can’t be +// used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any +// external Google Cloud Platform resources synced with the Data Catalog. // -// Callers must have following Google IAM permission +// To call this method, you must have the following Google IAM permissions: // // datacatalog.tagTemplates.setIamPolicy to set policies on tag // templates. // -// datacatalog.entries.setIamPolicy to set policies on entries. -// // datacatalog.entryGroups.setIamPolicy to set policies on entry groups. func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } -// GetIamPolicy gets the access control policy for a resource. A NOT_FOUND error -// is returned if the resource does not exist. An empty policy is returned -// if the resource exists but does not have a policy set on it. +// GetIamPolicy gets the access control policy for a resource. +// +// May return: +// +// ANOT_FOUND error if the resource doesn’t exist or you don’t have the +// permission to view it. +// +// An empty policy if the resource exists but doesn’t have a set policy. // // Supported resources are: // -// Tag templates. +// Tag templates // -// Entries. +// Entry groups // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Note: This method doesn’t get policies from Google Cloud Platform +// resources ingested into Data Catalog. // -// Callers must have following Google IAM permission +// To call this method, you must have the following Google IAM permissions: // // datacatalog.tagTemplates.getIamPolicy to get policies on tag // templates. // -// datacatalog.entries.getIamPolicy to get policies on entries. -// // datacatalog.entryGroups.getIamPolicy to get policies on entry groups. func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } -// TestIamPermissions returns the caller’s permissions on a resource. -// If the resource does not exist, an empty set of permissions is returned -// (We don’t return a NOT_FOUND error). +// TestIamPermissions gets your permissions on a resource. +// +// Returns an empty set of permissions if the resource doesn’t exist. // // Supported resources are: // -// Tag templates. +// Tag templates // -// Entries. +// Entry groups // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Note: This method gets policies only within Data Catalog and can’t be +// used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any +// external Google Cloud Platform resources ingested into Data Catalog. // -// A caller is not required to have Google IAM permission to make this -// request. +// No Google IAM permissions are required to call this method. func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { return c.internalClient.TestIamPermissions(ctx, req, opts...) } @@ -582,8 +613,8 @@ type gRPCClient struct { // NewClient creates a new data catalog client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Data Catalog API service allows clients to discover, understand, and manage -// their data. +// Data Catalog API service allows you to discover, understand, and manage +// your data. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index c8116b8600c..214446bac57 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datacatalog/apiv1/gapic_metadata.json b/datacatalog/apiv1/gapic_metadata.json index 0af97677409..8adce2865e1 100644 --- a/datacatalog/apiv1/gapic_metadata.json +++ b/datacatalog/apiv1/gapic_metadata.json @@ -242,6 +242,11 @@ "methods": [ "ImportTaxonomies" ] + }, + "ReplaceTaxonomy": { + "methods": [ + "ReplaceTaxonomy" + ] } } } diff --git a/datacatalog/apiv1/policy_tag_manager_client.go b/datacatalog/apiv1/policy_tag_manager_client.go index 09e41c757c5..9ad845874ff 100644 --- a/datacatalog/apiv1/policy_tag_manager_client.go +++ b/datacatalog/apiv1/policy_tag_manager_client.go @@ -108,7 +108,7 @@ type internalPolicyTagManagerClient interface { // PolicyTagManagerClient is a client for interacting with Google Cloud Data Catalog API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Policy Tag Manager API service allows clients to manage their policy tags and +// Policy Tag Manager API service allows you to manage your policy tags and // taxonomies. // // Policy tags are used to tag BigQuery columns and apply additional access @@ -144,27 +144,28 @@ func (c *PolicyTagManagerClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// CreateTaxonomy creates a taxonomy in a specified project. The taxonomy is initially empty, -// i.e., does not contain policy tags. +// CreateTaxonomy creates a taxonomy in a specified project. +// +// The taxonomy is initially empty, that is, it doesn’t contain policy tags. func (c *PolicyTagManagerClient) CreateTaxonomy(ctx context.Context, req *datacatalogpb.CreateTaxonomyRequest, opts ...gax.CallOption) (*datacatalogpb.Taxonomy, error) { return c.internalClient.CreateTaxonomy(ctx, req, opts...) } -// DeleteTaxonomy deletes a taxonomy. This method will also delete all policy tags in this +// DeleteTaxonomy deletes a taxonomy, including all policy tags in this // taxonomy, their associated policies, and the policy tags references from // BigQuery columns. func (c *PolicyTagManagerClient) DeleteTaxonomy(ctx context.Context, req *datacatalogpb.DeleteTaxonomyRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteTaxonomy(ctx, req, opts...) } -// UpdateTaxonomy updates a taxonomy. This method can update the taxonomy’s display name, +// UpdateTaxonomy updates a taxonomy, including its display name, // description, and activated policy types. func (c *PolicyTagManagerClient) UpdateTaxonomy(ctx context.Context, req *datacatalogpb.UpdateTaxonomyRequest, opts ...gax.CallOption) (*datacatalogpb.Taxonomy, error) { return c.internalClient.UpdateTaxonomy(ctx, req, opts...) } -// ListTaxonomies lists all taxonomies in a project in a particular location that the caller -// has permission to view. +// ListTaxonomies lists all taxonomies in a project in a particular location that you +// have a permission to view. func (c *PolicyTagManagerClient) ListTaxonomies(ctx context.Context, req *datacatalogpb.ListTaxonomiesRequest, opts ...gax.CallOption) *TaxonomyIterator { return c.internalClient.ListTaxonomies(ctx, req, opts...) } @@ -179,19 +180,19 @@ func (c *PolicyTagManagerClient) CreatePolicyTag(ctx context.Context, req *datac return c.internalClient.CreatePolicyTag(ctx, req, opts...) } -// DeletePolicyTag deletes a policy tag. This method also deletes: +// DeletePolicyTag deletes a policy tag together with the following: // -// all of its descendant policy tags, if any +// All of its descendant policy tags, if any // -// the policies associated with the policy tag and its descendants +// Policies associated with the policy tag and its descendants // -// references from BigQuery table schema of the policy tag and its -// descendants. +// References from BigQuery table schema of the policy tag and its +// descendants func (c *PolicyTagManagerClient) DeletePolicyTag(ctx context.Context, req *datacatalogpb.DeletePolicyTagRequest, opts ...gax.CallOption) error { return c.internalClient.DeletePolicyTag(ctx, req, opts...) } -// UpdatePolicyTag updates a policy tag. This method can update the policy tag’s display +// UpdatePolicyTag updates a policy tag, including its display // name, description, and parent policy tag. func (c *PolicyTagManagerClient) UpdatePolicyTag(ctx context.Context, req *datacatalogpb.UpdatePolicyTagRequest, opts ...gax.CallOption) (*datacatalogpb.PolicyTag, error) { return c.internalClient.UpdatePolicyTag(ctx, req, opts...) @@ -217,7 +218,7 @@ func (c *PolicyTagManagerClient) SetIamPolicy(ctx context.Context, req *iampb.Se return c.internalClient.SetIamPolicy(ctx, req, opts...) } -// TestIamPermissions returns the permissions that a caller has on a specified policy tag or +// TestIamPermissions returns your permissions on a specified policy tag or // taxonomy. func (c *PolicyTagManagerClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { return c.internalClient.TestIamPermissions(ctx, req, opts...) @@ -246,7 +247,7 @@ type policyTagManagerGRPCClient struct { // NewPolicyTagManagerClient creates a new policy tag manager client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Policy Tag Manager API service allows clients to manage their policy tags and +// Policy Tag Manager API service allows you to manage your policy tags and // taxonomies. // // Policy tags are used to tag BigQuery columns and apply additional access diff --git a/datacatalog/apiv1/policy_tag_manager_serialization_client.go b/datacatalog/apiv1/policy_tag_manager_serialization_client.go index cea7c6579c5..e9af0fac893 100644 --- a/datacatalog/apiv1/policy_tag_manager_serialization_client.go +++ b/datacatalog/apiv1/policy_tag_manager_serialization_client.go @@ -36,6 +36,7 @@ var newPolicyTagManagerSerializationClientHook clientHook // PolicyTagManagerSerializationCallOptions contains the retry settings for each method of PolicyTagManagerSerializationClient. type PolicyTagManagerSerializationCallOptions struct { + ReplaceTaxonomy []gax.CallOption ImportTaxonomies []gax.CallOption ExportTaxonomies []gax.CallOption } @@ -55,6 +56,7 @@ func defaultPolicyTagManagerSerializationGRPCClientOptions() []option.ClientOpti func defaultPolicyTagManagerSerializationCallOptions() *PolicyTagManagerSerializationCallOptions { return &PolicyTagManagerSerializationCallOptions{ + ReplaceTaxonomy: []gax.CallOption{}, ImportTaxonomies: []gax.CallOption{}, ExportTaxonomies: []gax.CallOption{}, } @@ -65,6 +67,7 @@ type internalPolicyTagManagerSerializationClient interface { Close() error setGoogleClientInfo(...string) Connection() *grpc.ClientConn + ReplaceTaxonomy(context.Context, *datacatalogpb.ReplaceTaxonomyRequest, ...gax.CallOption) (*datacatalogpb.Taxonomy, error) ImportTaxonomies(context.Context, *datacatalogpb.ImportTaxonomiesRequest, ...gax.CallOption) (*datacatalogpb.ImportTaxonomiesResponse, error) ExportTaxonomies(context.Context, *datacatalogpb.ExportTaxonomiesRequest, ...gax.CallOption) (*datacatalogpb.ExportTaxonomiesResponse, error) } @@ -72,9 +75,10 @@ type internalPolicyTagManagerSerializationClient interface { // PolicyTagManagerSerializationClient is a client for interacting with Google Cloud Data Catalog API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Policy Tag Manager serialization API service allows clients to manipulate -// their policy tags and taxonomies in serialized format, where taxonomy is a -// hierarchical group of policy tags. +// Policy Tag Manager Serialization API service allows you to manipulate +// your policy tags and taxonomies in a serialized format. +// +// Taxonomy is a hierarchical group of policy tags. type PolicyTagManagerSerializationClient struct { // The internal transport-dependent client. internalClient internalPolicyTagManagerSerializationClient @@ -105,25 +109,43 @@ func (c *PolicyTagManagerSerializationClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } -// ImportTaxonomies creates new taxonomies (including their policy tags) by importing from -// inlined source or cross-regional source. New taxonomies will be created in -// a given parent project. +// ReplaceTaxonomy replaces (updates) a taxonomy and all its policy tags. +// +// The taxonomy and its entire hierarchy of policy tags must be +// represented literally by SerializedTaxonomy and the nested +// SerializedPolicyTag messages. +// +// This operation automatically does the following: +// +// Deletes the existing policy tags that are missing from the +// SerializedPolicyTag. // -// If using the cross-regional source, a new taxonomy is created by copying +// Creates policy tags that don’t have resource names. They are considered +// new. +// +// Updates policy tags with valid resources names accordingly. +func (c *PolicyTagManagerSerializationClient) ReplaceTaxonomy(ctx context.Context, req *datacatalogpb.ReplaceTaxonomyRequest, opts ...gax.CallOption) (*datacatalogpb.Taxonomy, error) { + return c.internalClient.ReplaceTaxonomy(ctx, req, opts...) +} + +// ImportTaxonomies creates new taxonomies (including their policy tags) in a given project +// by importing from inlined or cross-regional sources. +// +// For a cross-regional source, new taxonomies are created by copying // from a source in another region. // -// If using the inlined source, this method provides a way to bulk create -// taxonomies and policy tags using nested proto structure. +// For an inlined source, taxonomies and policy tags are created in bulk using +// nested protocol buffer structures. func (c *PolicyTagManagerSerializationClient) ImportTaxonomies(ctx context.Context, req *datacatalogpb.ImportTaxonomiesRequest, opts ...gax.CallOption) (*datacatalogpb.ImportTaxonomiesResponse, error) { return c.internalClient.ImportTaxonomies(ctx, req, opts...) } -// ExportTaxonomies exports taxonomies as the requested type and returns the taxonomies -// including their policy tags. The requested taxonomies must belong to one -// project. +// ExportTaxonomies exports taxonomies in the requested type and returns them, +// including their policy tags. The requested taxonomies must belong to the +// same project. // -// SerializedTaxonomy protos with nested policy tags that are generated by -// this method can be used as input for future ImportTaxonomies calls. +// This method generates SerializedTaxonomy protocol buffers with nested +// policy tags that can be used as input for ImportTaxonomies calls. func (c *PolicyTagManagerSerializationClient) ExportTaxonomies(ctx context.Context, req *datacatalogpb.ExportTaxonomiesRequest, opts ...gax.CallOption) (*datacatalogpb.ExportTaxonomiesResponse, error) { return c.internalClient.ExportTaxonomies(ctx, req, opts...) } @@ -151,9 +173,10 @@ type policyTagManagerSerializationGRPCClient struct { // NewPolicyTagManagerSerializationClient creates a new policy tag manager serialization client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Policy Tag Manager serialization API service allows clients to manipulate -// their policy tags and taxonomies in serialized format, where taxonomy is a -// hierarchical group of policy tags. +// Policy Tag Manager Serialization API service allows you to manipulate +// your policy tags and taxonomies in a serialized format. +// +// Taxonomy is a hierarchical group of policy tags. func NewPolicyTagManagerSerializationClient(ctx context.Context, opts ...option.ClientOption) (*PolicyTagManagerSerializationClient, error) { clientOpts := defaultPolicyTagManagerSerializationGRPCClientOptions() if newPolicyTagManagerSerializationClientHook != nil { @@ -210,6 +233,27 @@ func (c *policyTagManagerSerializationGRPCClient) Close() error { return c.connPool.Close() } +func (c *policyTagManagerSerializationGRPCClient) ReplaceTaxonomy(ctx context.Context, req *datacatalogpb.ReplaceTaxonomyRequest, opts ...gax.CallOption) (*datacatalogpb.Taxonomy, 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).ReplaceTaxonomy[0:len((*c.CallOptions).ReplaceTaxonomy):len((*c.CallOptions).ReplaceTaxonomy)], opts...) + var resp *datacatalogpb.Taxonomy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.policyTagManagerSerializationClient.ReplaceTaxonomy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *policyTagManagerSerializationGRPCClient) ImportTaxonomies(ctx context.Context, req *datacatalogpb.ImportTaxonomiesRequest, opts ...gax.CallOption) (*datacatalogpb.ImportTaxonomiesResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) diff --git a/datacatalog/apiv1/policy_tag_manager_serialization_client_example_test.go b/datacatalog/apiv1/policy_tag_manager_serialization_client_example_test.go index 33866bca592..4881f60b4e3 100644 --- a/datacatalog/apiv1/policy_tag_manager_serialization_client_example_test.go +++ b/datacatalog/apiv1/policy_tag_manager_serialization_client_example_test.go @@ -35,6 +35,25 @@ func ExampleNewPolicyTagManagerSerializationClient() { _ = c } +func ExamplePolicyTagManagerSerializationClient_ReplaceTaxonomy() { + ctx := context.Background() + c, err := datacatalog.NewPolicyTagManagerSerializationClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datacatalogpb.ReplaceTaxonomyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ReplaceTaxonomy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExamplePolicyTagManagerSerializationClient_ImportTaxonomies() { ctx := context.Background() c, err := datacatalog.NewPolicyTagManagerSerializationClient(ctx) diff --git a/go.mod b/go.mod index ca38f3350bb..4733e1c6527 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.5 google.golang.org/api v0.51.0 - google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0 + google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f google.golang.org/grpc v1.39.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index fbfa24c3c05..cfa577c1060 100644 --- a/go.sum +++ b/go.sum @@ -473,8 +473,8 @@ google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0 h1:VpRFBmFg/ol+rqJnkKLPjVebPNFbSxuj17B7bH1xMc8= -google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f h1:4m1jFN3fHeKo0UvpraW2ipO2O0rgp5w2ugXeggtecAk= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= 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/datacatalog/apiv1/PolicyTagManagerSerializationClient/ReplaceTaxonomy/main.go b/internal/generated/snippets/datacatalog/apiv1/PolicyTagManagerSerializationClient/ReplaceTaxonomy/main.go new file mode 100644 index 00000000000..bfef59b49f6 --- /dev/null +++ b/internal/generated/snippets/datacatalog/apiv1/PolicyTagManagerSerializationClient/ReplaceTaxonomy/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START datacatalog_v1_generated_PolicyTagManagerSerialization_ReplaceTaxonomy_sync] + +package main + +import ( + "context" + + datacatalog "cloud.google.com/go/datacatalog/apiv1" + datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1" +) + +func main() { + ctx := context.Background() + c, err := datacatalog.NewPolicyTagManagerSerializationClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &datacatalogpb.ReplaceTaxonomyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ReplaceTaxonomy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END datacatalog_v1_generated_PolicyTagManagerSerialization_ReplaceTaxonomy_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index d0d7b970bf3..961de0eacca 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -32,5 +32,5 @@ require ( cloud.google.com/go/pubsublite v0.88.0 cloud.google.com/go/spanner v0.88.0 google.golang.org/api v0.51.0 - google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0 + google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0 ) diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index ac2695b9b6d..87a379aab52 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -146,8 +146,9 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0 h1:tcs4DyF9LYv8cynRAbX8JeBpuezJLaK6RfiATAsGwnY= google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0 h1:VpRFBmFg/ol+rqJnkKLPjVebPNFbSxuj17B7bH1xMc8= +google.golang.org/genproto v0.0.0-20210726200206-e7812ac95cc0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= 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/retail/apiv2/CatalogClient/GetDefaultBranch/main.go b/internal/generated/snippets/retail/apiv2/CatalogClient/GetDefaultBranch/main.go new file mode 100644 index 00000000000..b54491439fa --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/CatalogClient/GetDefaultBranch/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_CatalogService_GetDefaultBranch_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewCatalogClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.GetDefaultBranchRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDefaultBranch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_CatalogService_GetDefaultBranch_sync] diff --git a/internal/generated/snippets/retail/apiv2/CatalogClient/SetDefaultBranch/main.go b/internal/generated/snippets/retail/apiv2/CatalogClient/SetDefaultBranch/main.go new file mode 100644 index 00000000000..b0cf9806b5a --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/CatalogClient/SetDefaultBranch/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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_CatalogService_SetDefaultBranch_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewCatalogClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SetDefaultBranchRequest{ + // TODO: Fill request struct fields. + } + err = c.SetDefaultBranch(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END retail_v2_generated_CatalogService_SetDefaultBranch_sync] diff --git a/internal/generated/snippets/retail/apiv2/CompletionClient/CompleteQuery/main.go b/internal/generated/snippets/retail/apiv2/CompletionClient/CompleteQuery/main.go new file mode 100644 index 00000000000..35a9b73c4ba --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/CompletionClient/CompleteQuery/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_CompletionService_CompleteQuery_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewCompletionClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.CompleteQueryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CompleteQuery(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_CompletionService_CompleteQuery_sync] diff --git a/internal/generated/snippets/retail/apiv2/CompletionClient/ImportCompletionData/main.go b/internal/generated/snippets/retail/apiv2/CompletionClient/ImportCompletionData/main.go new file mode 100644 index 00000000000..4b2b2de30b1 --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/CompletionClient/ImportCompletionData/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_CompletionService_ImportCompletionData_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewCompletionClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.ImportCompletionDataRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ImportCompletionData(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_CompletionService_ImportCompletionData_sync] diff --git a/internal/generated/snippets/retail/apiv2/ProductClient/AddFulfillmentPlaces/main.go b/internal/generated/snippets/retail/apiv2/ProductClient/AddFulfillmentPlaces/main.go new file mode 100644 index 00000000000..8267011cbdf --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/ProductClient/AddFulfillmentPlaces/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.AddFulfillmentPlacesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AddFulfillmentPlaces(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] diff --git a/internal/generated/snippets/retail/apiv2/ProductClient/ListProducts/main.go b/internal/generated/snippets/retail/apiv2/ProductClient/ListProducts/main.go new file mode 100644 index 00000000000..7830c692d4f --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/ProductClient/ListProducts/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_ProductService_ListProducts_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + "google.golang.org/api/iterator" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.ListProductsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListProducts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END retail_v2_generated_ProductService_ListProducts_sync] diff --git a/internal/generated/snippets/retail/apiv2/ProductClient/RemoveFulfillmentPlaces/main.go b/internal/generated/snippets/retail/apiv2/ProductClient/RemoveFulfillmentPlaces/main.go new file mode 100644 index 00000000000..1bb6bacc97a --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/ProductClient/RemoveFulfillmentPlaces/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.RemoveFulfillmentPlacesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RemoveFulfillmentPlaces(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] diff --git a/internal/generated/snippets/retail/apiv2/ProductClient/SetInventory/main.go b/internal/generated/snippets/retail/apiv2/ProductClient/SetInventory/main.go new file mode 100644 index 00000000000..86117ed0e05 --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/ProductClient/SetInventory/main.go @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_ProductService_SetInventory_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SetInventoryRequest{ + // TODO: Fill request struct fields. + } + op, err := c.SetInventory(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END retail_v2_generated_ProductService_SetInventory_sync] diff --git a/internal/generated/snippets/retail/apiv2/SearchClient/Search/main.go b/internal/generated/snippets/retail/apiv2/SearchClient/Search/main.go new file mode 100644 index 00000000000..45d3d76a6c0 --- /dev/null +++ b/internal/generated/snippets/retail/apiv2/SearchClient/Search/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START retail_v2_generated_SearchService_Search_sync] + +package main + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + "google.golang.org/api/iterator" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func main() { + ctx := context.Background() + c, err := retail.NewSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SearchRequest{ + // TODO: Fill request struct fields. + } + it := c.Search(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END retail_v2_generated_SearchService_Search_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/CreateTransferJob/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/CreateTransferJob/main.go new file mode 100644 index 00000000000..d332d7849f1 --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/CreateTransferJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.CreateTransferJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateTransferJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END storagetransfer_v1_generated_StorageTransferService_CreateTransferJob_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/GetGoogleServiceAccount/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/GetGoogleServiceAccount/main.go new file mode 100644 index 00000000000..3568ed3a85f --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/GetGoogleServiceAccount/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.GetGoogleServiceAccountRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGoogleServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END storagetransfer_v1_generated_StorageTransferService_GetGoogleServiceAccount_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/GetTransferJob/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/GetTransferJob/main.go new file mode 100644 index 00000000000..c82b88833d0 --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/GetTransferJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_GetTransferJob_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.GetTransferJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTransferJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END storagetransfer_v1_generated_StorageTransferService_GetTransferJob_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/ListTransferJobs/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/ListTransferJobs/main.go new file mode 100644 index 00000000000..f6e1661a83c --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/ListTransferJobs/main.go @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + "google.golang.org/api/iterator" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.ListTransferJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTransferJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END storagetransfer_v1_generated_StorageTransferService_ListTransferJobs_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/PauseTransferOperation/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/PauseTransferOperation/main.go new file mode 100644 index 00000000000..e2b5492995f --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/PauseTransferOperation/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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.PauseTransferOperationRequest{ + // TODO: Fill request struct fields. + } + err = c.PauseTransferOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END storagetransfer_v1_generated_StorageTransferService_PauseTransferOperation_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/ResumeTransferOperation/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/ResumeTransferOperation/main.go new file mode 100644 index 00000000000..dbe77a769f9 --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/ResumeTransferOperation/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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.ResumeTransferOperationRequest{ + // TODO: Fill request struct fields. + } + err = c.ResumeTransferOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END storagetransfer_v1_generated_StorageTransferService_ResumeTransferOperation_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/RunTransferJob/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/RunTransferJob/main.go new file mode 100644 index 00000000000..daaeb94bc16 --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/RunTransferJob/main.go @@ -0,0 +1,50 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_RunTransferJob_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.RunTransferJobRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RunTransferJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END storagetransfer_v1_generated_StorageTransferService_RunTransferJob_sync] diff --git a/internal/generated/snippets/storagetransfer/apiv1/Client/UpdateTransferJob/main.go b/internal/generated/snippets/storagetransfer/apiv1/Client/UpdateTransferJob/main.go new file mode 100644 index 00000000000..53a3e5f3f42 --- /dev/null +++ b/internal/generated/snippets/storagetransfer/apiv1/Client/UpdateTransferJob/main.go @@ -0,0 +1,47 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_sync] + +package main + +import ( + "context" + + storagetransfer "cloud.google.com/go/storagetransfer/apiv1" + storagetransferpb "google.golang.org/genproto/googleapis/storagetransfer/v1" +) + +func main() { + ctx := context.Background() + c, err := storagetransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &storagetransferpb.UpdateTransferJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateTransferJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END storagetransfer_v1_generated_StorageTransferService_UpdateTransferJob_sync] diff --git a/networkconnectivity/apiv1alpha1/doc.go b/networkconnectivity/apiv1alpha1/doc.go index 38554912f62..7db47958f78 100644 --- a/networkconnectivity/apiv1alpha1/doc.go +++ b/networkconnectivity/apiv1alpha1/doc.go @@ -51,7 +51,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/retail/apiv2/catalog_client.go b/retail/apiv2/catalog_client.go index 9dcf9fa8f79..3e3f2018310 100644 --- a/retail/apiv2/catalog_client.go +++ b/retail/apiv2/catalog_client.go @@ -39,8 +39,10 @@ var newCatalogClientHook clientHook // CatalogCallOptions contains the retry settings for each method of CatalogClient. type CatalogCallOptions struct { - ListCatalogs []gax.CallOption - UpdateCatalog []gax.CallOption + ListCatalogs []gax.CallOption + UpdateCatalog []gax.CallOption + SetDefaultBranch []gax.CallOption + GetDefaultBranch []gax.CallOption } func defaultCatalogGRPCClientOptions() []option.ClientOption { @@ -82,6 +84,30 @@ func defaultCatalogCallOptions() *CatalogCallOptions { }) }), }, + SetDefaultBranch: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + GetDefaultBranch: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -92,6 +118,8 @@ type internalCatalogClient interface { Connection() *grpc.ClientConn ListCatalogs(context.Context, *retailpb.ListCatalogsRequest, ...gax.CallOption) *CatalogIterator UpdateCatalog(context.Context, *retailpb.UpdateCatalogRequest, ...gax.CallOption) (*retailpb.Catalog, error) + SetDefaultBranch(context.Context, *retailpb.SetDefaultBranchRequest, ...gax.CallOption) error + GetDefaultBranch(context.Context, *retailpb.GetDefaultBranchRequest, ...gax.CallOption) (*retailpb.GetDefaultBranchResponse, error) } // CatalogClient is a client for interacting with Retail API. @@ -139,6 +167,60 @@ func (c *CatalogClient) UpdateCatalog(ctx context.Context, req *retailpb.UpdateC return c.internalClient.UpdateCatalog(ctx, req, opts...) } +// SetDefaultBranch set a specified branch id as default branch. API methods such as +// SearchService.Search, +// ProductService.GetProduct, +// ProductService.ListProducts +// will treat requests using “default_branch” to the actual branch id set as +// default. +// +// For example, if projects/*/locations/*/catalogs/*/branches/1 is set as +// default, setting +// SearchRequest.branch to +// projects/*/locations/*/catalogs/*/branches/default_branch is equivalent +// to setting +// SearchRequest.branch to +// projects/*/locations/*/catalogs/*/branches/1. +// +// Using multiple branches can be useful when developers would like +// to have a staging branch to test and verify for future usage. When it +// becomes ready, developers switch on the staging branch using this API while +// keeping using projects/*/locations/*/catalogs/*/branches/default_branch +// as SearchRequest.branch to +// route the traffic to this staging branch. +// +// CAUTION: If you have live predict/search traffic, switching the default +// branch could potentially cause outages if the ID space of the new branch is +// very different from the old one. +// +// More specifically: +// +// PredictionService will only return product IDs from branch {newBranch}. +// +// SearchService will only return product IDs from branch {newBranch} +// (if branch is not explicitly set). +// +// UserEventService will only join events with products from branch +// {newBranch}. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *CatalogClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, opts ...gax.CallOption) error { + return c.internalClient.SetDefaultBranch(ctx, req, opts...) +} + +// GetDefaultBranch get which branch is currently default branch set by +// CatalogService.SetDefaultBranch +// method under a specified parent catalog. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *CatalogClient) GetDefaultBranch(ctx context.Context, req *retailpb.GetDefaultBranchRequest, opts ...gax.CallOption) (*retailpb.GetDefaultBranchResponse, error) { + return c.internalClient.GetDefaultBranch(ctx, req, opts...) +} + // catalogGRPCClient is a client for interacting with Retail API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -280,6 +362,44 @@ func (c *catalogGRPCClient) UpdateCatalog(ctx context.Context, req *retailpb.Upd return resp, nil } +func (c *catalogGRPCClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, 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", "catalog", url.QueryEscape(req.GetCatalog()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).SetDefaultBranch[0:len((*c.CallOptions).SetDefaultBranch):len((*c.CallOptions).SetDefaultBranch)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.catalogClient.SetDefaultBranch(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +func (c *catalogGRPCClient) GetDefaultBranch(ctx context.Context, req *retailpb.GetDefaultBranchRequest, opts ...gax.CallOption) (*retailpb.GetDefaultBranchResponse, 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", "catalog", url.QueryEscape(req.GetCatalog()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetDefaultBranch[0:len((*c.CallOptions).GetDefaultBranch):len((*c.CallOptions).GetDefaultBranch)], opts...) + var resp *retailpb.GetDefaultBranchResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.catalogClient.GetDefaultBranch(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + // CatalogIterator manages a stream of *retailpb.Catalog. type CatalogIterator struct { items []*retailpb.Catalog diff --git a/retail/apiv2/catalog_client_example_test.go b/retail/apiv2/catalog_client_example_test.go index 4d6213f757d..5561c60d800 100644 --- a/retail/apiv2/catalog_client_example_test.go +++ b/retail/apiv2/catalog_client_example_test.go @@ -79,3 +79,39 @@ func ExampleCatalogClient_UpdateCatalog() { // TODO: Use resp. _ = resp } + +func ExampleCatalogClient_SetDefaultBranch() { + ctx := context.Background() + c, err := retail.NewCatalogClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SetDefaultBranchRequest{ + // TODO: Fill request struct fields. + } + err = c.SetDefaultBranch(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleCatalogClient_GetDefaultBranch() { + ctx := context.Background() + c, err := retail.NewCatalogClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.GetDefaultBranchRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDefaultBranch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/retail/apiv2/completion_client.go b/retail/apiv2/completion_client.go new file mode 100644 index 00000000000..7c2ae370d9d --- /dev/null +++ b/retail/apiv2/completion_client.go @@ -0,0 +1,379 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package retail + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +var newCompletionClientHook clientHook + +// CompletionCallOptions contains the retry settings for each method of CompletionClient. +type CompletionCallOptions struct { + CompleteQuery []gax.CallOption + ImportCompletionData []gax.CallOption +} + +func defaultCompletionGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("retail.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://retail.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCompletionCallOptions() *CompletionCallOptions { + return &CompletionCallOptions{ + CompleteQuery: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + ImportCompletionData: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// internalCompletionClient is an interface that defines the methods availaible from Retail API. +type internalCompletionClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CompleteQuery(context.Context, *retailpb.CompleteQueryRequest, ...gax.CallOption) (*retailpb.CompleteQueryResponse, error) + ImportCompletionData(context.Context, *retailpb.ImportCompletionDataRequest, ...gax.CallOption) (*ImportCompletionDataOperation, error) + ImportCompletionDataOperation(name string) *ImportCompletionDataOperation +} + +// CompletionClient is a client for interacting with Retail API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Auto-completion service for retail. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +type CompletionClient struct { + // The internal transport-dependent client. + internalClient internalCompletionClient + + // The call options for this service. + CallOptions *CompletionCallOptions + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient +} + +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *CompletionClient) 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 *CompletionClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *CompletionClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CompleteQuery completes the specified prefix with keyword suggestions. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *CompletionClient) CompleteQuery(ctx context.Context, req *retailpb.CompleteQueryRequest, opts ...gax.CallOption) (*retailpb.CompleteQueryResponse, error) { + return c.internalClient.CompleteQuery(ctx, req, opts...) +} + +// ImportCompletionData bulk import of processed completion dataset. +// +// Request processing may be synchronous. Partial updating is not supported. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *CompletionClient) ImportCompletionData(ctx context.Context, req *retailpb.ImportCompletionDataRequest, opts ...gax.CallOption) (*ImportCompletionDataOperation, error) { + return c.internalClient.ImportCompletionData(ctx, req, opts...) +} + +// ImportCompletionDataOperation returns a new ImportCompletionDataOperation from a given name. +// The name must be that of a previously created ImportCompletionDataOperation, possibly from a different process. +func (c *CompletionClient) ImportCompletionDataOperation(name string) *ImportCompletionDataOperation { + return c.internalClient.ImportCompletionDataOperation(name) +} + +// completionGRPCClient is a client for interacting with Retail API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type completionGRPCClient 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 CompletionClient + CallOptions **CompletionCallOptions + + // The gRPC API client. + completionClient retailpb.CompletionServiceClient + + // LROClient is used internally to handle long-running operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient **lroauto.OperationsClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewCompletionClient creates a new completion service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Auto-completion service for retail. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func NewCompletionClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error) { + clientOpts := defaultCompletionGRPCClientOptions() + if newCompletionClientHook != nil { + hookOpts, err := newCompletionClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := CompletionClient{CallOptions: defaultCompletionCallOptions()} + + c := &completionGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + completionClient: retailpb.NewCompletionServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + c.LROClient = &client.LROClient + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *completionGRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *completionGRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *completionGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *completionGRPCClient) CompleteQuery(ctx context.Context, req *retailpb.CompleteQueryRequest, opts ...gax.CallOption) (*retailpb.CompleteQueryResponse, 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", "catalog", url.QueryEscape(req.GetCatalog()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CompleteQuery[0:len((*c.CallOptions).CompleteQuery):len((*c.CallOptions).CompleteQuery)], opts...) + var resp *retailpb.CompleteQueryResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.completionClient.CompleteQuery(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *completionGRPCClient) ImportCompletionData(ctx context.Context, req *retailpb.ImportCompletionDataRequest, opts ...gax.CallOption) (*ImportCompletionDataOperation, 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).ImportCompletionData[0:len((*c.CallOptions).ImportCompletionData):len((*c.CallOptions).ImportCompletionData)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.completionClient.ImportCompletionData(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ImportCompletionDataOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +// ImportCompletionDataOperation manages a long-running operation from ImportCompletionData. +type ImportCompletionDataOperation struct { + lro *longrunning.Operation +} + +// ImportCompletionDataOperation returns a new ImportCompletionDataOperation from a given name. +// The name must be that of a previously created ImportCompletionDataOperation, possibly from a different process. +func (c *completionGRPCClient) ImportCompletionDataOperation(name string) *ImportCompletionDataOperation { + return &ImportCompletionDataOperation{ + 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 *ImportCompletionDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportCompletionDataResponse, error) { + var resp retailpb.ImportCompletionDataResponse + 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 *ImportCompletionDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.ImportCompletionDataResponse, error) { + var resp retailpb.ImportCompletionDataResponse + 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 *ImportCompletionDataOperation) Metadata() (*retailpb.ImportMetadata, error) { + var meta retailpb.ImportMetadata + 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 *ImportCompletionDataOperation) 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 *ImportCompletionDataOperation) Name() string { + return op.lro.Name() +} diff --git a/retail/apiv2/completion_client_example_test.go b/retail/apiv2/completion_client_example_test.go new file mode 100644 index 00000000000..af5e05daa3d --- /dev/null +++ b/retail/apiv2/completion_client_example_test.go @@ -0,0 +1,79 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package retail_test + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func ExampleNewCompletionClient() { + ctx := context.Background() + c, err := retail.NewCompletionClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleCompletionClient_CompleteQuery() { + ctx := context.Background() + c, err := retail.NewCompletionClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.CompleteQueryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CompleteQuery(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCompletionClient_ImportCompletionData() { + ctx := context.Background() + c, err := retail.NewCompletionClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.ImportCompletionDataRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ImportCompletionData(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/retail/apiv2/doc.go b/retail/apiv2/doc.go index d465d73a669..a204f1cbca9 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/retail/apiv2/gapic_metadata.json b/retail/apiv2/gapic_metadata.json index 946693b2fc6..244d44dc550 100644 --- a/retail/apiv2/gapic_metadata.json +++ b/retail/apiv2/gapic_metadata.json @@ -10,11 +10,21 @@ "grpc": { "libraryClient": "CatalogClient", "rpcs": { + "GetDefaultBranch": { + "methods": [ + "GetDefaultBranch" + ] + }, "ListCatalogs": { "methods": [ "ListCatalogs" ] }, + "SetDefaultBranch": { + "methods": [ + "SetDefaultBranch" + ] + }, "UpdateCatalog": { "methods": [ "UpdateCatalog" @@ -24,6 +34,25 @@ } } }, + "CompletionService": { + "clients": { + "grpc": { + "libraryClient": "CompletionClient", + "rpcs": { + "CompleteQuery": { + "methods": [ + "CompleteQuery" + ] + }, + "ImportCompletionData": { + "methods": [ + "ImportCompletionData" + ] + } + } + } + } + }, "PredictionService": { "clients": { "grpc": { @@ -43,6 +72,11 @@ "grpc": { "libraryClient": "ProductClient", "rpcs": { + "AddFulfillmentPlaces": { + "methods": [ + "AddFulfillmentPlaces" + ] + }, "CreateProduct": { "methods": [ "CreateProduct" @@ -63,6 +97,21 @@ "ImportProducts" ] }, + "ListProducts": { + "methods": [ + "ListProducts" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "RemoveFulfillmentPlaces" + ] + }, + "SetInventory": { + "methods": [ + "SetInventory" + ] + }, "UpdateProduct": { "methods": [ "UpdateProduct" @@ -72,6 +121,20 @@ } } }, + "SearchService": { + "clients": { + "grpc": { + "libraryClient": "SearchClient", + "rpcs": { + "Search": { + "methods": [ + "Search" + ] + } + } + } + } + }, "UserEventService": { "clients": { "grpc": { diff --git a/retail/apiv2/product_client.go b/retail/apiv2/product_client.go index 44cb5bbc0ea..09f16161909 100644 --- a/retail/apiv2/product_client.go +++ b/retail/apiv2/product_client.go @@ -26,6 +26,7 @@ import ( "cloud.google.com/go/longrunning" lroauto "cloud.google.com/go/longrunning/autogen" gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" "google.golang.org/api/option" "google.golang.org/api/option/internaloption" gtransport "google.golang.org/api/transport/grpc" @@ -34,17 +35,22 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" ) var newProductClientHook clientHook // ProductCallOptions contains the retry settings for each method of ProductClient. type ProductCallOptions struct { - CreateProduct []gax.CallOption - GetProduct []gax.CallOption - UpdateProduct []gax.CallOption - DeleteProduct []gax.CallOption - ImportProducts []gax.CallOption + CreateProduct []gax.CallOption + GetProduct []gax.CallOption + ListProducts []gax.CallOption + UpdateProduct []gax.CallOption + DeleteProduct []gax.CallOption + ImportProducts []gax.CallOption + SetInventory []gax.CallOption + AddFulfillmentPlaces []gax.CallOption + RemoveFulfillmentPlaces []gax.CallOption } func defaultProductGRPCClientOptions() []option.ClientOption { @@ -86,6 +92,18 @@ func defaultProductCallOptions() *ProductCallOptions { }) }), }, + ListProducts: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, UpdateProduct: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -122,6 +140,42 @@ func defaultProductCallOptions() *ProductCallOptions { }) }), }, + SetInventory: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + AddFulfillmentPlaces: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + RemoveFulfillmentPlaces: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, } } @@ -132,10 +186,17 @@ type internalProductClient interface { Connection() *grpc.ClientConn CreateProduct(context.Context, *retailpb.CreateProductRequest, ...gax.CallOption) (*retailpb.Product, error) GetProduct(context.Context, *retailpb.GetProductRequest, ...gax.CallOption) (*retailpb.Product, error) + ListProducts(context.Context, *retailpb.ListProductsRequest, ...gax.CallOption) *ProductIterator UpdateProduct(context.Context, *retailpb.UpdateProductRequest, ...gax.CallOption) (*retailpb.Product, error) DeleteProduct(context.Context, *retailpb.DeleteProductRequest, ...gax.CallOption) error ImportProducts(context.Context, *retailpb.ImportProductsRequest, ...gax.CallOption) (*ImportProductsOperation, error) ImportProductsOperation(name string) *ImportProductsOperation + SetInventory(context.Context, *retailpb.SetInventoryRequest, ...gax.CallOption) (*SetInventoryOperation, error) + SetInventoryOperation(name string) *SetInventoryOperation + AddFulfillmentPlaces(context.Context, *retailpb.AddFulfillmentPlacesRequest, ...gax.CallOption) (*AddFulfillmentPlacesOperation, error) + AddFulfillmentPlacesOperation(name string) *AddFulfillmentPlacesOperation + RemoveFulfillmentPlaces(context.Context, *retailpb.RemoveFulfillmentPlacesRequest, ...gax.CallOption) (*RemoveFulfillmentPlacesOperation, error) + RemoveFulfillmentPlacesOperation(name string) *RemoveFulfillmentPlacesOperation } // ProductClient is a client for interacting with Retail API. @@ -188,6 +249,11 @@ func (c *ProductClient) GetProduct(ctx context.Context, req *retailpb.GetProduct return c.internalClient.GetProduct(ctx, req, opts...) } +// ListProducts gets a list of Products. +func (c *ProductClient) ListProducts(ctx context.Context, req *retailpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { + return c.internalClient.ListProducts(ctx, req, opts...) +} + // UpdateProduct updates a Product. func (c *ProductClient) UpdateProduct(ctx context.Context, req *retailpb.UpdateProductRequest, opts ...gax.CallOption) (*retailpb.Product, error) { return c.internalClient.UpdateProduct(ctx, req, opts...) @@ -215,6 +281,106 @@ func (c *ProductClient) ImportProductsOperation(name string) *ImportProductsOper return c.internalClient.ImportProductsOperation(name) } +// SetInventory updates inventory information for a +// Product while respecting the last update +// timestamps of each inventory field. +// +// This process is asynchronous and does not require the +// Product to exist before updating +// fulfillment information. If the request is valid, the update will be +// enqueued and processed downstream. As a consequence, when a response is +// returned, updates are not immediately manifested in the +// Product queried by +// GetProduct or +// ListProducts. +// +// When inventory is updated with +// CreateProduct and +// UpdateProduct, the +// specified inventory field value(s) will overwrite any existing value(s) +// while ignoring the last update time for this field. Furthermore, the last +// update time for the specified inventory fields will be overwritten to the +// time of the +// CreateProduct or +// UpdateProduct +// request. +// +// If no inventory fields are set in +// CreateProductRequest.product, +// then any pre-existing inventory information for this product will be used. +// +// If no inventory fields are set in UpdateProductRequest.set_mask, +// then any existing inventory information will be preserved. +// +// Pre-existing inventory information can only be updated with +// SetInventory, +// AddFulfillmentPlaces, +// and +// RemoveFulfillmentPlaces. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *ProductClient) SetInventory(ctx context.Context, req *retailpb.SetInventoryRequest, opts ...gax.CallOption) (*SetInventoryOperation, error) { + return c.internalClient.SetInventory(ctx, req, opts...) +} + +// SetInventoryOperation returns a new SetInventoryOperation from a given name. +// The name must be that of a previously created SetInventoryOperation, possibly from a different process. +func (c *ProductClient) SetInventoryOperation(name string) *SetInventoryOperation { + return c.internalClient.SetInventoryOperation(name) +} + +// AddFulfillmentPlaces incrementally adds place IDs to +// Product.fulfillment_info.place_ids. +// +// This process is asynchronous and does not require the +// Product to exist before updating +// fulfillment information. If the request is valid, the update will be +// enqueued and processed downstream. As a consequence, when a response is +// returned, the added place IDs are not immediately manifested in the +// Product queried by +// GetProduct or +// ListProducts. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *ProductClient) AddFulfillmentPlaces(ctx context.Context, req *retailpb.AddFulfillmentPlacesRequest, opts ...gax.CallOption) (*AddFulfillmentPlacesOperation, error) { + return c.internalClient.AddFulfillmentPlaces(ctx, req, opts...) +} + +// AddFulfillmentPlacesOperation returns a new AddFulfillmentPlacesOperation from a given name. +// The name must be that of a previously created AddFulfillmentPlacesOperation, possibly from a different process. +func (c *ProductClient) AddFulfillmentPlacesOperation(name string) *AddFulfillmentPlacesOperation { + return c.internalClient.AddFulfillmentPlacesOperation(name) +} + +// RemoveFulfillmentPlaces incrementally removes place IDs from a +// Product.fulfillment_info.place_ids. +// +// This process is asynchronous and does not require the +// Product to exist before updating +// fulfillment information. If the request is valid, the update will be +// enqueued and processed downstream. As a consequence, when a response is +// returned, the removed place IDs are not immediately manifested in the +// Product queried by +// GetProduct or +// ListProducts. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *ProductClient) RemoveFulfillmentPlaces(ctx context.Context, req *retailpb.RemoveFulfillmentPlacesRequest, opts ...gax.CallOption) (*RemoveFulfillmentPlacesOperation, error) { + return c.internalClient.RemoveFulfillmentPlaces(ctx, req, opts...) +} + +// RemoveFulfillmentPlacesOperation returns a new RemoveFulfillmentPlacesOperation from a given name. +// The name must be that of a previously created RemoveFulfillmentPlacesOperation, possibly from a different process. +func (c *ProductClient) RemoveFulfillmentPlacesOperation(name string) *RemoveFulfillmentPlacesOperation { + return c.internalClient.RemoveFulfillmentPlacesOperation(name) +} + // productGRPCClient is a client for interacting with Retail API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. @@ -354,6 +520,46 @@ func (c *productGRPCClient) GetProduct(ctx context.Context, req *retailpb.GetPro return resp, nil } +func (c *productGRPCClient) ListProducts(ctx context.Context, req *retailpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { + 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).ListProducts[0:len((*c.CallOptions).ListProducts):len((*c.CallOptions).ListProducts)], opts...) + it := &ProductIterator{} + req = proto.Clone(req).(*retailpb.ListProductsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*retailpb.Product, string, error) { + var resp *retailpb.ListProductsResponse + 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.productClient.ListProducts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetProducts(), 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 *productGRPCClient) UpdateProduct(ctx context.Context, req *retailpb.UpdateProductRequest, opts ...gax.CallOption) (*retailpb.Product, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) @@ -415,6 +621,144 @@ func (c *productGRPCClient) ImportProducts(ctx context.Context, req *retailpb.Im }, nil } +func (c *productGRPCClient) SetInventory(ctx context.Context, req *retailpb.SetInventoryRequest, opts ...gax.CallOption) (*SetInventoryOperation, 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", "inventory.name", url.QueryEscape(req.GetInventory().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).SetInventory[0:len((*c.CallOptions).SetInventory):len((*c.CallOptions).SetInventory)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productClient.SetInventory(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &SetInventoryOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *productGRPCClient) AddFulfillmentPlaces(ctx context.Context, req *retailpb.AddFulfillmentPlacesRequest, opts ...gax.CallOption) (*AddFulfillmentPlacesOperation, 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", "product", url.QueryEscape(req.GetProduct()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).AddFulfillmentPlaces[0:len((*c.CallOptions).AddFulfillmentPlaces):len((*c.CallOptions).AddFulfillmentPlaces)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productClient.AddFulfillmentPlaces(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &AddFulfillmentPlacesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *productGRPCClient) RemoveFulfillmentPlaces(ctx context.Context, req *retailpb.RemoveFulfillmentPlacesRequest, opts ...gax.CallOption) (*RemoveFulfillmentPlacesOperation, 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", "product", url.QueryEscape(req.GetProduct()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).RemoveFulfillmentPlaces[0:len((*c.CallOptions).RemoveFulfillmentPlaces):len((*c.CallOptions).RemoveFulfillmentPlaces)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productClient.RemoveFulfillmentPlaces(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RemoveFulfillmentPlacesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +// AddFulfillmentPlacesOperation manages a long-running operation from AddFulfillmentPlaces. +type AddFulfillmentPlacesOperation struct { + lro *longrunning.Operation +} + +// AddFulfillmentPlacesOperation returns a new AddFulfillmentPlacesOperation from a given name. +// The name must be that of a previously created AddFulfillmentPlacesOperation, possibly from a different process. +func (c *productGRPCClient) AddFulfillmentPlacesOperation(name string) *AddFulfillmentPlacesOperation { + return &AddFulfillmentPlacesOperation{ + 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 *AddFulfillmentPlacesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddFulfillmentPlacesResponse, error) { + var resp retailpb.AddFulfillmentPlacesResponse + 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 *AddFulfillmentPlacesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.AddFulfillmentPlacesResponse, error) { + var resp retailpb.AddFulfillmentPlacesResponse + 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 *AddFulfillmentPlacesOperation) Metadata() (*retailpb.AddFulfillmentPlacesMetadata, error) { + var meta retailpb.AddFulfillmentPlacesMetadata + 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 *AddFulfillmentPlacesOperation) 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 *AddFulfillmentPlacesOperation) Name() string { + return op.lro.Name() +} + // ImportProductsOperation manages a long-running operation from ImportProducts. type ImportProductsOperation struct { lro *longrunning.Operation @@ -483,3 +827,188 @@ func (op *ImportProductsOperation) Done() bool { func (op *ImportProductsOperation) Name() string { return op.lro.Name() } + +// RemoveFulfillmentPlacesOperation manages a long-running operation from RemoveFulfillmentPlaces. +type RemoveFulfillmentPlacesOperation struct { + lro *longrunning.Operation +} + +// RemoveFulfillmentPlacesOperation returns a new RemoveFulfillmentPlacesOperation from a given name. +// The name must be that of a previously created RemoveFulfillmentPlacesOperation, possibly from a different process. +func (c *productGRPCClient) RemoveFulfillmentPlacesOperation(name string) *RemoveFulfillmentPlacesOperation { + return &RemoveFulfillmentPlacesOperation{ + 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 *RemoveFulfillmentPlacesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveFulfillmentPlacesResponse, error) { + var resp retailpb.RemoveFulfillmentPlacesResponse + 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 *RemoveFulfillmentPlacesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.RemoveFulfillmentPlacesResponse, error) { + var resp retailpb.RemoveFulfillmentPlacesResponse + 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 *RemoveFulfillmentPlacesOperation) Metadata() (*retailpb.RemoveFulfillmentPlacesMetadata, error) { + var meta retailpb.RemoveFulfillmentPlacesMetadata + 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 *RemoveFulfillmentPlacesOperation) 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 *RemoveFulfillmentPlacesOperation) Name() string { + return op.lro.Name() +} + +// SetInventoryOperation manages a long-running operation from SetInventory. +type SetInventoryOperation struct { + lro *longrunning.Operation +} + +// SetInventoryOperation returns a new SetInventoryOperation from a given name. +// The name must be that of a previously created SetInventoryOperation, possibly from a different process. +func (c *productGRPCClient) SetInventoryOperation(name string) *SetInventoryOperation { + return &SetInventoryOperation{ + 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 *SetInventoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*retailpb.SetInventoryResponse, error) { + var resp retailpb.SetInventoryResponse + 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 *SetInventoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*retailpb.SetInventoryResponse, error) { + var resp retailpb.SetInventoryResponse + 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 *SetInventoryOperation) Metadata() (*retailpb.SetInventoryMetadata, error) { + var meta retailpb.SetInventoryMetadata + 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 *SetInventoryOperation) 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 *SetInventoryOperation) Name() string { + return op.lro.Name() +} + +// ProductIterator manages a stream of *retailpb.Product. +type ProductIterator struct { + items []*retailpb.Product + 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 []*retailpb.Product, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ProductIterator) 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 *ProductIterator) Next() (*retailpb.Product, error) { + var item *retailpb.Product + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ProductIterator) bufLen() int { + return len(it.items) +} + +func (it *ProductIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/retail/apiv2/product_client_example_test.go b/retail/apiv2/product_client_example_test.go index f273a836253..3bfc3cf9c9c 100644 --- a/retail/apiv2/product_client_example_test.go +++ b/retail/apiv2/product_client_example_test.go @@ -20,6 +20,7 @@ import ( "context" retail "cloud.google.com/go/retail/apiv2" + "google.golang.org/api/iterator" retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" ) @@ -73,6 +74,31 @@ func ExampleProductClient_GetProduct() { _ = resp } +func ExampleProductClient_ListProducts() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.ListProductsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListProducts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + func ExampleProductClient_UpdateProduct() { ctx := context.Background() c, err := retail.NewProductClient(ctx) @@ -132,3 +158,75 @@ func ExampleProductClient_ImportProducts() { // TODO: Use resp. _ = resp } + +func ExampleProductClient_SetInventory() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SetInventoryRequest{ + // TODO: Fill request struct fields. + } + op, err := c.SetInventory(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductClient_AddFulfillmentPlaces() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.AddFulfillmentPlacesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AddFulfillmentPlaces(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductClient_RemoveFulfillmentPlaces() { + ctx := context.Background() + c, err := retail.NewProductClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.RemoveFulfillmentPlacesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RemoveFulfillmentPlaces(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/retail/apiv2/search_client.go b/retail/apiv2/search_client.go new file mode 100644 index 00000000000..f9d5690f8eb --- /dev/null +++ b/retail/apiv2/search_client.go @@ -0,0 +1,299 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package retail + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newSearchClientHook clientHook + +// SearchCallOptions contains the retry settings for each method of SearchClient. +type SearchCallOptions struct { + Search []gax.CallOption +} + +func defaultSearchGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("retail.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("retail.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://retail.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultSearchCallOptions() *SearchCallOptions { + return &SearchCallOptions{ + Search: []gax.CallOption{ + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + codes.DeadlineExceeded, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.30, + }) + }), + }, + } +} + +// internalSearchClient is an interface that defines the methods availaible from Retail API. +type internalSearchClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + Search(context.Context, *retailpb.SearchRequest, ...gax.CallOption) *SearchResponse_SearchResultIterator +} + +// SearchClient is a client for interacting with Retail API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Service for search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +type SearchClient struct { + // The internal transport-dependent client. + internalClient internalSearchClient + + // The call options for this service. + CallOptions *SearchCallOptions +} + +// 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 *SearchClient) 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 *SearchClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *SearchClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// Search performs a search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func (c *SearchClient) Search(ctx context.Context, req *retailpb.SearchRequest, opts ...gax.CallOption) *SearchResponse_SearchResultIterator { + return c.internalClient.Search(ctx, req, opts...) +} + +// searchGRPCClient is a client for interacting with Retail API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type searchGRPCClient 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 SearchClient + CallOptions **SearchCallOptions + + // The gRPC API client. + searchClient retailpb.SearchServiceClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSearchClient creates a new search service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// Service for search. +// +// This feature is only available for users who have Retail Search enabled. +// Contact Retail Support (retail-search-support@google.com (at http://google.com)) if you are +// interested in using Retail Search. +func NewSearchClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error) { + clientOpts := defaultSearchGRPCClientOptions() + if newSearchClientHook != nil { + hookOpts, err := newSearchClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + client := SearchClient{CallOptions: defaultSearchCallOptions()} + + c := &searchGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + searchClient: retailpb.NewSearchServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *searchGRPCClient) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *searchGRPCClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *searchGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *searchGRPCClient) Search(ctx context.Context, req *retailpb.SearchRequest, opts ...gax.CallOption) *SearchResponse_SearchResultIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "placement", url.QueryEscape(req.GetPlacement()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).Search[0:len((*c.CallOptions).Search):len((*c.CallOptions).Search)], opts...) + it := &SearchResponse_SearchResultIterator{} + req = proto.Clone(req).(*retailpb.SearchRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*retailpb.SearchResponse_SearchResult, string, error) { + var resp *retailpb.SearchResponse + 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.searchClient.Search(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetResults(), 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 +} + +// SearchResponse_SearchResultIterator manages a stream of *retailpb.SearchResponse_SearchResult. +type SearchResponse_SearchResultIterator struct { + items []*retailpb.SearchResponse_SearchResult + 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 []*retailpb.SearchResponse_SearchResult, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SearchResponse_SearchResultIterator) 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 *SearchResponse_SearchResultIterator) Next() (*retailpb.SearchResponse_SearchResult, error) { + var item *retailpb.SearchResponse_SearchResult + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SearchResponse_SearchResultIterator) bufLen() int { + return len(it.items) +} + +func (it *SearchResponse_SearchResultIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/retail/apiv2/search_client_example_test.go b/retail/apiv2/search_client_example_test.go new file mode 100644 index 00000000000..9641981aeb4 --- /dev/null +++ b/retail/apiv2/search_client_example_test.go @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package retail_test + +import ( + "context" + + retail "cloud.google.com/go/retail/apiv2" + "google.golang.org/api/iterator" + retailpb "google.golang.org/genproto/googleapis/cloud/retail/v2" +) + +func ExampleNewSearchClient() { + ctx := context.Background() + c, err := retail.NewSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleSearchClient_Search() { + ctx := context.Background() + c, err := retail.NewSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &retailpb.SearchRequest{ + // TODO: Fill request struct fields. + } + it := c.Search(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/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index 550ec1caddf..0eb8e3a46cf 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index ec901ed6100..5893feef377 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -49,7 +49,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index 17c482119b1..e5e689ad5e8 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/storage/go.mod b/storage/go.mod index 04d4e2c1455..1452fcd52c7 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -10,6 +10,6 @@ require ( golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.51.0 - google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0 + google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f google.golang.org/grpc v1.39.0 ) diff --git a/storage/go.sum b/storage/go.sum index c11044f5d99..db39804b314 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -472,8 +472,8 @@ google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+n google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0 h1:tcs4DyF9LYv8cynRAbX8JeBpuezJLaK6RfiATAsGwnY= -google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f h1:4m1jFN3fHeKo0UvpraW2ipO2O0rgp5w2ugXeggtecAk= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/storage/internal/apiv2/doc.go b/storage/internal/apiv2/doc.go index 686f912731f..3f9270e5a42 100644 --- a/storage/internal/apiv2/doc.go +++ b/storage/internal/apiv2/doc.go @@ -50,7 +50,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210723" +const versionClient = "20210728" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)