diff --git a/accesscontextmanager/apiv1/doc.go b/accesscontextmanager/apiv1/doc.go index 0898c00b0f4..645e37dc1c7 100644 --- a/accesscontextmanager/apiv1/doc.go +++ b/accesscontextmanager/apiv1/doc.go @@ -93,7 +93,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210924" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/accesscontextmanager/go.mod b/accesscontextmanager/go.mod index 31359c22221..7ac09ec33f4 100644 --- a/accesscontextmanager/go.mod +++ b/accesscontextmanager/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.97.0 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/accesscontextmanager/go.sum b/accesscontextmanager/go.sum index 3fd8b5ffab7..0607e65bf9d 100644 --- a/accesscontextmanager/go.sum +++ b/accesscontextmanager/go.sum @@ -492,8 +492,9 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/aiplatform/apiv1/doc.go b/aiplatform/apiv1/doc.go index 3771c6437f0..6fab710ca5e 100644 --- a/aiplatform/apiv1/doc.go +++ b/aiplatform/apiv1/doc.go @@ -90,7 +90,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210930" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/aiplatform/apiv1/featurestore_client.go b/aiplatform/apiv1/featurestore_client.go new file mode 100644 index 00000000000..8347e66a4ad --- /dev/null +++ b/aiplatform/apiv1/featurestore_client.go @@ -0,0 +1,1790 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 aiplatform + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newFeaturestoreClientHook clientHook + +// FeaturestoreCallOptions contains the retry settings for each method of FeaturestoreClient. +type FeaturestoreCallOptions struct { + CreateFeaturestore []gax.CallOption + GetFeaturestore []gax.CallOption + ListFeaturestores []gax.CallOption + UpdateFeaturestore []gax.CallOption + DeleteFeaturestore []gax.CallOption + CreateEntityType []gax.CallOption + GetEntityType []gax.CallOption + ListEntityTypes []gax.CallOption + UpdateEntityType []gax.CallOption + DeleteEntityType []gax.CallOption + CreateFeature []gax.CallOption + BatchCreateFeatures []gax.CallOption + GetFeature []gax.CallOption + ListFeatures []gax.CallOption + UpdateFeature []gax.CallOption + DeleteFeature []gax.CallOption + ImportFeatureValues []gax.CallOption + BatchReadFeatureValues []gax.CallOption + ExportFeatureValues []gax.CallOption + SearchFeatures []gax.CallOption +} + +func defaultFeaturestoreGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultFeaturestoreCallOptions() *FeaturestoreCallOptions { + return &FeaturestoreCallOptions{ + CreateFeaturestore: []gax.CallOption{}, + GetFeaturestore: []gax.CallOption{}, + ListFeaturestores: []gax.CallOption{}, + UpdateFeaturestore: []gax.CallOption{}, + DeleteFeaturestore: []gax.CallOption{}, + CreateEntityType: []gax.CallOption{}, + GetEntityType: []gax.CallOption{}, + ListEntityTypes: []gax.CallOption{}, + UpdateEntityType: []gax.CallOption{}, + DeleteEntityType: []gax.CallOption{}, + CreateFeature: []gax.CallOption{}, + BatchCreateFeatures: []gax.CallOption{}, + GetFeature: []gax.CallOption{}, + ListFeatures: []gax.CallOption{}, + UpdateFeature: []gax.CallOption{}, + DeleteFeature: []gax.CallOption{}, + ImportFeatureValues: []gax.CallOption{}, + BatchReadFeatureValues: []gax.CallOption{}, + ExportFeatureValues: []gax.CallOption{}, + SearchFeatures: []gax.CallOption{}, + } +} + +// internalFeaturestoreClient is an interface that defines the methods availaible from Vertex AI API. +type internalFeaturestoreClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateFeaturestore(context.Context, *aiplatformpb.CreateFeaturestoreRequest, ...gax.CallOption) (*CreateFeaturestoreOperation, error) + CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation + GetFeaturestore(context.Context, *aiplatformpb.GetFeaturestoreRequest, ...gax.CallOption) (*aiplatformpb.Featurestore, error) + ListFeaturestores(context.Context, *aiplatformpb.ListFeaturestoresRequest, ...gax.CallOption) *FeaturestoreIterator + UpdateFeaturestore(context.Context, *aiplatformpb.UpdateFeaturestoreRequest, ...gax.CallOption) (*UpdateFeaturestoreOperation, error) + UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation + DeleteFeaturestore(context.Context, *aiplatformpb.DeleteFeaturestoreRequest, ...gax.CallOption) (*DeleteFeaturestoreOperation, error) + DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation + CreateEntityType(context.Context, *aiplatformpb.CreateEntityTypeRequest, ...gax.CallOption) (*CreateEntityTypeOperation, error) + CreateEntityTypeOperation(name string) *CreateEntityTypeOperation + GetEntityType(context.Context, *aiplatformpb.GetEntityTypeRequest, ...gax.CallOption) (*aiplatformpb.EntityType, error) + ListEntityTypes(context.Context, *aiplatformpb.ListEntityTypesRequest, ...gax.CallOption) *EntityTypeIterator + UpdateEntityType(context.Context, *aiplatformpb.UpdateEntityTypeRequest, ...gax.CallOption) (*aiplatformpb.EntityType, error) + DeleteEntityType(context.Context, *aiplatformpb.DeleteEntityTypeRequest, ...gax.CallOption) (*DeleteEntityTypeOperation, error) + DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation + CreateFeature(context.Context, *aiplatformpb.CreateFeatureRequest, ...gax.CallOption) (*CreateFeatureOperation, error) + CreateFeatureOperation(name string) *CreateFeatureOperation + BatchCreateFeatures(context.Context, *aiplatformpb.BatchCreateFeaturesRequest, ...gax.CallOption) (*BatchCreateFeaturesOperation, error) + BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation + GetFeature(context.Context, *aiplatformpb.GetFeatureRequest, ...gax.CallOption) (*aiplatformpb.Feature, error) + ListFeatures(context.Context, *aiplatformpb.ListFeaturesRequest, ...gax.CallOption) *FeatureIterator + UpdateFeature(context.Context, *aiplatformpb.UpdateFeatureRequest, ...gax.CallOption) (*aiplatformpb.Feature, error) + DeleteFeature(context.Context, *aiplatformpb.DeleteFeatureRequest, ...gax.CallOption) (*DeleteFeatureOperation, error) + DeleteFeatureOperation(name string) *DeleteFeatureOperation + ImportFeatureValues(context.Context, *aiplatformpb.ImportFeatureValuesRequest, ...gax.CallOption) (*ImportFeatureValuesOperation, error) + ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation + BatchReadFeatureValues(context.Context, *aiplatformpb.BatchReadFeatureValuesRequest, ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) + BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation + ExportFeatureValues(context.Context, *aiplatformpb.ExportFeatureValuesRequest, ...gax.CallOption) (*ExportFeatureValuesOperation, error) + ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation + SearchFeatures(context.Context, *aiplatformpb.SearchFeaturesRequest, ...gax.CallOption) *FeatureIterator +} + +// FeaturestoreClient is a client for interacting with Vertex AI API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The service that handles CRUD and List for resources for Featurestore. +type FeaturestoreClient struct { + // The internal transport-dependent client. + internalClient internalFeaturestoreClient + + // The call options for this service. + CallOptions *FeaturestoreCallOptions + + // 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 *FeaturestoreClient) 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 *FeaturestoreClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FeaturestoreClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateFeaturestore creates a new Featurestore in a given project and location. +func (c *FeaturestoreClient) CreateFeaturestore(ctx context.Context, req *aiplatformpb.CreateFeaturestoreRequest, opts ...gax.CallOption) (*CreateFeaturestoreOperation, error) { + return c.internalClient.CreateFeaturestore(ctx, req, opts...) +} + +// CreateFeaturestoreOperation returns a new CreateFeaturestoreOperation from a given name. +// The name must be that of a previously created CreateFeaturestoreOperation, possibly from a different process. +func (c *FeaturestoreClient) CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation { + return c.internalClient.CreateFeaturestoreOperation(name) +} + +// GetFeaturestore gets details of a single Featurestore. +func (c *FeaturestoreClient) GetFeaturestore(ctx context.Context, req *aiplatformpb.GetFeaturestoreRequest, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + return c.internalClient.GetFeaturestore(ctx, req, opts...) +} + +// ListFeaturestores lists Featurestores in a given project and location. +func (c *FeaturestoreClient) ListFeaturestores(ctx context.Context, req *aiplatformpb.ListFeaturestoresRequest, opts ...gax.CallOption) *FeaturestoreIterator { + return c.internalClient.ListFeaturestores(ctx, req, opts...) +} + +// UpdateFeaturestore updates the parameters of a single Featurestore. +func (c *FeaturestoreClient) UpdateFeaturestore(ctx context.Context, req *aiplatformpb.UpdateFeaturestoreRequest, opts ...gax.CallOption) (*UpdateFeaturestoreOperation, error) { + return c.internalClient.UpdateFeaturestore(ctx, req, opts...) +} + +// UpdateFeaturestoreOperation returns a new UpdateFeaturestoreOperation from a given name. +// The name must be that of a previously created UpdateFeaturestoreOperation, possibly from a different process. +func (c *FeaturestoreClient) UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation { + return c.internalClient.UpdateFeaturestoreOperation(name) +} + +// DeleteFeaturestore deletes a single Featurestore. The Featurestore must not contain any +// EntityTypes or force must be set to true for the request to succeed. +func (c *FeaturestoreClient) DeleteFeaturestore(ctx context.Context, req *aiplatformpb.DeleteFeaturestoreRequest, opts ...gax.CallOption) (*DeleteFeaturestoreOperation, error) { + return c.internalClient.DeleteFeaturestore(ctx, req, opts...) +} + +// DeleteFeaturestoreOperation returns a new DeleteFeaturestoreOperation from a given name. +// The name must be that of a previously created DeleteFeaturestoreOperation, possibly from a different process. +func (c *FeaturestoreClient) DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation { + return c.internalClient.DeleteFeaturestoreOperation(name) +} + +// CreateEntityType creates a new EntityType in a given Featurestore. +func (c *FeaturestoreClient) CreateEntityType(ctx context.Context, req *aiplatformpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*CreateEntityTypeOperation, error) { + return c.internalClient.CreateEntityType(ctx, req, opts...) +} + +// CreateEntityTypeOperation returns a new CreateEntityTypeOperation from a given name. +// The name must be that of a previously created CreateEntityTypeOperation, possibly from a different process. +func (c *FeaturestoreClient) CreateEntityTypeOperation(name string) *CreateEntityTypeOperation { + return c.internalClient.CreateEntityTypeOperation(name) +} + +// GetEntityType gets details of a single EntityType. +func (c *FeaturestoreClient) GetEntityType(ctx context.Context, req *aiplatformpb.GetEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + return c.internalClient.GetEntityType(ctx, req, opts...) +} + +// ListEntityTypes lists EntityTypes in a given Featurestore. +func (c *FeaturestoreClient) ListEntityTypes(ctx context.Context, req *aiplatformpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { + return c.internalClient.ListEntityTypes(ctx, req, opts...) +} + +// UpdateEntityType updates the parameters of a single EntityType. +func (c *FeaturestoreClient) UpdateEntityType(ctx context.Context, req *aiplatformpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + return c.internalClient.UpdateEntityType(ctx, req, opts...) +} + +// DeleteEntityType deletes a single EntityType. The EntityType must not have any Features +// or force must be set to true for the request to succeed. +func (c *FeaturestoreClient) DeleteEntityType(ctx context.Context, req *aiplatformpb.DeleteEntityTypeRequest, opts ...gax.CallOption) (*DeleteEntityTypeOperation, error) { + return c.internalClient.DeleteEntityType(ctx, req, opts...) +} + +// DeleteEntityTypeOperation returns a new DeleteEntityTypeOperation from a given name. +// The name must be that of a previously created DeleteEntityTypeOperation, possibly from a different process. +func (c *FeaturestoreClient) DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation { + return c.internalClient.DeleteEntityTypeOperation(name) +} + +// CreateFeature creates a new Feature in a given EntityType. +func (c *FeaturestoreClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { + return c.internalClient.CreateFeature(ctx, req, opts...) +} + +// CreateFeatureOperation returns a new CreateFeatureOperation from a given name. +// The name must be that of a previously created CreateFeatureOperation, possibly from a different process. +func (c *FeaturestoreClient) CreateFeatureOperation(name string) *CreateFeatureOperation { + return c.internalClient.CreateFeatureOperation(name) +} + +// BatchCreateFeatures creates a batch of Features in a given EntityType. +func (c *FeaturestoreClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { + return c.internalClient.BatchCreateFeatures(ctx, req, opts...) +} + +// BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. +// The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. +func (c *FeaturestoreClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { + return c.internalClient.BatchCreateFeaturesOperation(name) +} + +// GetFeature gets details of a single Feature. +func (c *FeaturestoreClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + return c.internalClient.GetFeature(ctx, req, opts...) +} + +// ListFeatures lists Features in a given EntityType. +func (c *FeaturestoreClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { + return c.internalClient.ListFeatures(ctx, req, opts...) +} + +// UpdateFeature updates the parameters of a single Feature. +func (c *FeaturestoreClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + return c.internalClient.UpdateFeature(ctx, req, opts...) +} + +// DeleteFeature deletes a single Feature. +func (c *FeaturestoreClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { + return c.internalClient.DeleteFeature(ctx, req, opts...) +} + +// DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. +// The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. +func (c *FeaturestoreClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { + return c.internalClient.DeleteFeatureOperation(name) +} + +// ImportFeatureValues imports Feature values into the Featurestore from a source storage. +// +// The progress of the import is tracked by the returned operation. The +// imported features are guaranteed to be visible to subsequent read +// operations after the operation is marked as successfully done. +// +// If an import operation fails, the Feature values returned from +// reads and exports may be inconsistent. If consistency is +// required, the caller must retry the same import request again and wait till +// the new operation returned is marked as successfully done. +// +// There are also scenarios where the caller can cause inconsistency. +// +// Source data for import contains multiple distinct Feature values for +// the same entity ID and timestamp. +// +// Source is modified during an import. This includes adding, updating, or +// removing source data and/or metadata. Examples of updating metadata +// include but are not limited to changing storage location, storage class, +// or retention policy. +// +// Online serving cluster is under-provisioned. +func (c *FeaturestoreClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { + return c.internalClient.ImportFeatureValues(ctx, req, opts...) +} + +// ImportFeatureValuesOperation returns a new ImportFeatureValuesOperation from a given name. +// The name must be that of a previously created ImportFeatureValuesOperation, possibly from a different process. +func (c *FeaturestoreClient) ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation { + return c.internalClient.ImportFeatureValuesOperation(name) +} + +// BatchReadFeatureValues batch reads Feature values from a Featurestore. +// +// This API enables batch reading Feature values, where each read +// instance in the batch may read Feature values of entities from one or +// more EntityTypes. Point-in-time correctness is guaranteed for Feature +// values of each read instance as of each instance’s read timestamp. +func (c *FeaturestoreClient) BatchReadFeatureValues(ctx context.Context, req *aiplatformpb.BatchReadFeatureValuesRequest, opts ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) { + return c.internalClient.BatchReadFeatureValues(ctx, req, opts...) +} + +// BatchReadFeatureValuesOperation returns a new BatchReadFeatureValuesOperation from a given name. +// The name must be that of a previously created BatchReadFeatureValuesOperation, possibly from a different process. +func (c *FeaturestoreClient) BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation { + return c.internalClient.BatchReadFeatureValuesOperation(name) +} + +// ExportFeatureValues exports Feature values from all the entities of a target EntityType. +func (c *FeaturestoreClient) ExportFeatureValues(ctx context.Context, req *aiplatformpb.ExportFeatureValuesRequest, opts ...gax.CallOption) (*ExportFeatureValuesOperation, error) { + return c.internalClient.ExportFeatureValues(ctx, req, opts...) +} + +// ExportFeatureValuesOperation returns a new ExportFeatureValuesOperation from a given name. +// The name must be that of a previously created ExportFeatureValuesOperation, possibly from a different process. +func (c *FeaturestoreClient) ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation { + return c.internalClient.ExportFeatureValuesOperation(name) +} + +// SearchFeatures searches Features matching a query in a given project. +func (c *FeaturestoreClient) SearchFeatures(ctx context.Context, req *aiplatformpb.SearchFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { + return c.internalClient.SearchFeatures(ctx, req, opts...) +} + +// featurestoreGRPCClient is a client for interacting with Vertex AI API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type featurestoreGRPCClient 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 FeaturestoreClient + CallOptions **FeaturestoreCallOptions + + // The gRPC API client. + featurestoreClient aiplatformpb.FeaturestoreServiceClient + + // 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 +} + +// NewFeaturestoreClient creates a new featurestore service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// The service that handles CRUD and List for resources for Featurestore. +func NewFeaturestoreClient(ctx context.Context, opts ...option.ClientOption) (*FeaturestoreClient, error) { + clientOpts := defaultFeaturestoreGRPCClientOptions() + if newFeaturestoreClientHook != nil { + hookOpts, err := newFeaturestoreClientHook(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 := FeaturestoreClient{CallOptions: defaultFeaturestoreCallOptions()} + + c := &featurestoreGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + featurestoreClient: aiplatformpb.NewFeaturestoreServiceClient(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 *featurestoreGRPCClient) 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 *featurestoreGRPCClient) 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 *featurestoreGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *featurestoreGRPCClient) CreateFeaturestore(ctx context.Context, req *aiplatformpb.CreateFeaturestoreRequest, opts ...gax.CallOption) (*CreateFeaturestoreOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateFeaturestore[0:len((*c.CallOptions).CreateFeaturestore):len((*c.CallOptions).CreateFeaturestore)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.CreateFeaturestore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateFeaturestoreOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) GetFeaturestore(ctx context.Context, req *aiplatformpb.GetFeaturestoreRequest, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetFeaturestore[0:len((*c.CallOptions).GetFeaturestore):len((*c.CallOptions).GetFeaturestore)], opts...) + var resp *aiplatformpb.Featurestore + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.GetFeaturestore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreGRPCClient) ListFeaturestores(ctx context.Context, req *aiplatformpb.ListFeaturestoresRequest, opts ...gax.CallOption) *FeaturestoreIterator { + 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).ListFeaturestores[0:len((*c.CallOptions).ListFeaturestores):len((*c.CallOptions).ListFeaturestores)], opts...) + it := &FeaturestoreIterator{} + req = proto.Clone(req).(*aiplatformpb.ListFeaturestoresRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Featurestore, string, error) { + resp := &aiplatformpb.ListFeaturestoresResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.ListFeaturestores(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFeaturestores(), 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 *featurestoreGRPCClient) UpdateFeaturestore(ctx context.Context, req *aiplatformpb.UpdateFeaturestoreRequest, opts ...gax.CallOption) (*UpdateFeaturestoreOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore.name", url.QueryEscape(req.GetFeaturestore().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateFeaturestore[0:len((*c.CallOptions).UpdateFeaturestore):len((*c.CallOptions).UpdateFeaturestore)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.UpdateFeaturestore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateFeaturestoreOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) DeleteFeaturestore(ctx context.Context, req *aiplatformpb.DeleteFeaturestoreRequest, opts ...gax.CallOption) (*DeleteFeaturestoreOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteFeaturestore[0:len((*c.CallOptions).DeleteFeaturestore):len((*c.CallOptions).DeleteFeaturestore)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.DeleteFeaturestore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteFeaturestoreOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) CreateEntityType(ctx context.Context, req *aiplatformpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*CreateEntityTypeOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateEntityType[0:len((*c.CallOptions).CreateEntityType):len((*c.CallOptions).CreateEntityType)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.CreateEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateEntityTypeOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) GetEntityType(ctx context.Context, req *aiplatformpb.GetEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetEntityType[0:len((*c.CallOptions).GetEntityType):len((*c.CallOptions).GetEntityType)], opts...) + var resp *aiplatformpb.EntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.GetEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreGRPCClient) ListEntityTypes(ctx context.Context, req *aiplatformpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { + 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).ListEntityTypes[0:len((*c.CallOptions).ListEntityTypes):len((*c.CallOptions).ListEntityTypes)], opts...) + it := &EntityTypeIterator{} + req = proto.Clone(req).(*aiplatformpb.ListEntityTypesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.EntityType, string, error) { + resp := &aiplatformpb.ListEntityTypesResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.ListEntityTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetEntityTypes(), 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 *featurestoreGRPCClient) UpdateEntityType(ctx context.Context, req *aiplatformpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type.name", url.QueryEscape(req.GetEntityType().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateEntityType[0:len((*c.CallOptions).UpdateEntityType):len((*c.CallOptions).UpdateEntityType)], opts...) + var resp *aiplatformpb.EntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.UpdateEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreGRPCClient) DeleteEntityType(ctx context.Context, req *aiplatformpb.DeleteEntityTypeRequest, opts ...gax.CallOption) (*DeleteEntityTypeOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteEntityType[0:len((*c.CallOptions).DeleteEntityType):len((*c.CallOptions).DeleteEntityType)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.DeleteEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteEntityTypeOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) CreateFeature(ctx context.Context, req *aiplatformpb.CreateFeatureRequest, opts ...gax.CallOption) (*CreateFeatureOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateFeature[0:len((*c.CallOptions).CreateFeature):len((*c.CallOptions).CreateFeature)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.CreateFeature(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateFeatureOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) BatchCreateFeatures(ctx context.Context, req *aiplatformpb.BatchCreateFeaturesRequest, opts ...gax.CallOption) (*BatchCreateFeaturesOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).BatchCreateFeatures[0:len((*c.CallOptions).BatchCreateFeatures):len((*c.CallOptions).BatchCreateFeatures)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.BatchCreateFeatures(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchCreateFeaturesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) GetFeature(ctx context.Context, req *aiplatformpb.GetFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetFeature[0:len((*c.CallOptions).GetFeature):len((*c.CallOptions).GetFeature)], opts...) + var resp *aiplatformpb.Feature + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.GetFeature(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreGRPCClient) ListFeatures(ctx context.Context, req *aiplatformpb.ListFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { + 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).ListFeatures[0:len((*c.CallOptions).ListFeatures):len((*c.CallOptions).ListFeatures)], opts...) + it := &FeatureIterator{} + req = proto.Clone(req).(*aiplatformpb.ListFeaturesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { + resp := &aiplatformpb.ListFeaturesResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.ListFeatures(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFeatures(), 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 *featurestoreGRPCClient) UpdateFeature(ctx context.Context, req *aiplatformpb.UpdateFeatureRequest, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "feature.name", url.QueryEscape(req.GetFeature().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateFeature[0:len((*c.CallOptions).UpdateFeature):len((*c.CallOptions).UpdateFeature)], opts...) + var resp *aiplatformpb.Feature + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.UpdateFeature(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreGRPCClient) DeleteFeature(ctx context.Context, req *aiplatformpb.DeleteFeatureRequest, opts ...gax.CallOption) (*DeleteFeatureOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteFeature[0:len((*c.CallOptions).DeleteFeature):len((*c.CallOptions).DeleteFeature)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.DeleteFeature(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteFeatureOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ImportFeatureValues[0:len((*c.CallOptions).ImportFeatureValues):len((*c.CallOptions).ImportFeatureValues)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.ImportFeatureValues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ImportFeatureValuesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) BatchReadFeatureValues(ctx context.Context, req *aiplatformpb.BatchReadFeatureValuesRequest, opts ...gax.CallOption) (*BatchReadFeatureValuesOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "featurestore", url.QueryEscape(req.GetFeaturestore()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).BatchReadFeatureValues[0:len((*c.CallOptions).BatchReadFeatureValues):len((*c.CallOptions).BatchReadFeatureValues)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.BatchReadFeatureValues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchReadFeatureValuesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) ExportFeatureValues(ctx context.Context, req *aiplatformpb.ExportFeatureValuesRequest, opts ...gax.CallOption) (*ExportFeatureValuesOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ExportFeatureValues[0:len((*c.CallOptions).ExportFeatureValues):len((*c.CallOptions).ExportFeatureValues)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.ExportFeatureValues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportFeatureValuesOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *featurestoreGRPCClient) SearchFeatures(ctx context.Context, req *aiplatformpb.SearchFeaturesRequest, opts ...gax.CallOption) *FeatureIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).SearchFeatures[0:len((*c.CallOptions).SearchFeatures):len((*c.CallOptions).SearchFeatures)], opts...) + it := &FeatureIterator{} + req = proto.Clone(req).(*aiplatformpb.SearchFeaturesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Feature, string, error) { + resp := &aiplatformpb.SearchFeaturesResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreClient.SearchFeatures(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetFeatures(), 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 +} + +// BatchCreateFeaturesOperation manages a long-running operation from BatchCreateFeatures. +type BatchCreateFeaturesOperation struct { + lro *longrunning.Operation +} + +// BatchCreateFeaturesOperation returns a new BatchCreateFeaturesOperation from a given name. +// The name must be that of a previously created BatchCreateFeaturesOperation, possibly from a different process. +func (c *featurestoreGRPCClient) BatchCreateFeaturesOperation(name string) *BatchCreateFeaturesOperation { + return &BatchCreateFeaturesOperation{ + 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 *BatchCreateFeaturesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.BatchCreateFeaturesResponse, error) { + var resp aiplatformpb.BatchCreateFeaturesResponse + 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 *BatchCreateFeaturesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.BatchCreateFeaturesResponse, error) { + var resp aiplatformpb.BatchCreateFeaturesResponse + 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 *BatchCreateFeaturesOperation) Metadata() (*aiplatformpb.BatchCreateFeaturesOperationMetadata, error) { + var meta aiplatformpb.BatchCreateFeaturesOperationMetadata + 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 *BatchCreateFeaturesOperation) 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 *BatchCreateFeaturesOperation) Name() string { + return op.lro.Name() +} + +// BatchReadFeatureValuesOperation manages a long-running operation from BatchReadFeatureValues. +type BatchReadFeatureValuesOperation struct { + lro *longrunning.Operation +} + +// BatchReadFeatureValuesOperation returns a new BatchReadFeatureValuesOperation from a given name. +// The name must be that of a previously created BatchReadFeatureValuesOperation, possibly from a different process. +func (c *featurestoreGRPCClient) BatchReadFeatureValuesOperation(name string) *BatchReadFeatureValuesOperation { + return &BatchReadFeatureValuesOperation{ + 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 *BatchReadFeatureValuesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.BatchReadFeatureValuesResponse, error) { + var resp aiplatformpb.BatchReadFeatureValuesResponse + 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 *BatchReadFeatureValuesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.BatchReadFeatureValuesResponse, error) { + var resp aiplatformpb.BatchReadFeatureValuesResponse + 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 *BatchReadFeatureValuesOperation) Metadata() (*aiplatformpb.BatchReadFeatureValuesOperationMetadata, error) { + var meta aiplatformpb.BatchReadFeatureValuesOperationMetadata + 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 *BatchReadFeatureValuesOperation) 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 *BatchReadFeatureValuesOperation) Name() string { + return op.lro.Name() +} + +// CreateEntityTypeOperation manages a long-running operation from CreateEntityType. +type CreateEntityTypeOperation struct { + lro *longrunning.Operation +} + +// CreateEntityTypeOperation returns a new CreateEntityTypeOperation from a given name. +// The name must be that of a previously created CreateEntityTypeOperation, possibly from a different process. +func (c *featurestoreGRPCClient) CreateEntityTypeOperation(name string) *CreateEntityTypeOperation { + return &CreateEntityTypeOperation{ + 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 *CreateEntityTypeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + var resp aiplatformpb.EntityType + 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 *CreateEntityTypeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.EntityType, error) { + var resp aiplatformpb.EntityType + 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 *CreateEntityTypeOperation) Metadata() (*aiplatformpb.CreateEntityTypeOperationMetadata, error) { + var meta aiplatformpb.CreateEntityTypeOperationMetadata + 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 *CreateEntityTypeOperation) 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 *CreateEntityTypeOperation) Name() string { + return op.lro.Name() +} + +// CreateFeatureOperation manages a long-running operation from CreateFeature. +type CreateFeatureOperation struct { + lro *longrunning.Operation +} + +// CreateFeatureOperation returns a new CreateFeatureOperation from a given name. +// The name must be that of a previously created CreateFeatureOperation, possibly from a different process. +func (c *featurestoreGRPCClient) CreateFeatureOperation(name string) *CreateFeatureOperation { + return &CreateFeatureOperation{ + 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 *CreateFeatureOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + var resp aiplatformpb.Feature + 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 *CreateFeatureOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Feature, error) { + var resp aiplatformpb.Feature + 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 *CreateFeatureOperation) Metadata() (*aiplatformpb.CreateFeatureOperationMetadata, error) { + var meta aiplatformpb.CreateFeatureOperationMetadata + 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 *CreateFeatureOperation) 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 *CreateFeatureOperation) Name() string { + return op.lro.Name() +} + +// CreateFeaturestoreOperation manages a long-running operation from CreateFeaturestore. +type CreateFeaturestoreOperation struct { + lro *longrunning.Operation +} + +// CreateFeaturestoreOperation returns a new CreateFeaturestoreOperation from a given name. +// The name must be that of a previously created CreateFeaturestoreOperation, possibly from a different process. +func (c *featurestoreGRPCClient) CreateFeaturestoreOperation(name string) *CreateFeaturestoreOperation { + return &CreateFeaturestoreOperation{ + 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 *CreateFeaturestoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + var resp aiplatformpb.Featurestore + 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 *CreateFeaturestoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + var resp aiplatformpb.Featurestore + 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 *CreateFeaturestoreOperation) Metadata() (*aiplatformpb.CreateFeaturestoreOperationMetadata, error) { + var meta aiplatformpb.CreateFeaturestoreOperationMetadata + 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 *CreateFeaturestoreOperation) 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 *CreateFeaturestoreOperation) Name() string { + return op.lro.Name() +} + +// DeleteEntityTypeOperation manages a long-running operation from DeleteEntityType. +type DeleteEntityTypeOperation struct { + lro *longrunning.Operation +} + +// DeleteEntityTypeOperation returns a new DeleteEntityTypeOperation from a given name. +// The name must be that of a previously created DeleteEntityTypeOperation, possibly from a different process. +func (c *featurestoreGRPCClient) DeleteEntityTypeOperation(name string) *DeleteEntityTypeOperation { + return &DeleteEntityTypeOperation{ + 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 *DeleteEntityTypeOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteEntityTypeOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteEntityTypeOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteEntityTypeOperation) 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 *DeleteEntityTypeOperation) Name() string { + return op.lro.Name() +} + +// DeleteFeatureOperation manages a long-running operation from DeleteFeature. +type DeleteFeatureOperation struct { + lro *longrunning.Operation +} + +// DeleteFeatureOperation returns a new DeleteFeatureOperation from a given name. +// The name must be that of a previously created DeleteFeatureOperation, possibly from a different process. +func (c *featurestoreGRPCClient) DeleteFeatureOperation(name string) *DeleteFeatureOperation { + return &DeleteFeatureOperation{ + 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 *DeleteFeatureOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteFeatureOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteFeatureOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteFeatureOperation) 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 *DeleteFeatureOperation) Name() string { + return op.lro.Name() +} + +// DeleteFeaturestoreOperation manages a long-running operation from DeleteFeaturestore. +type DeleteFeaturestoreOperation struct { + lro *longrunning.Operation +} + +// DeleteFeaturestoreOperation returns a new DeleteFeaturestoreOperation from a given name. +// The name must be that of a previously created DeleteFeaturestoreOperation, possibly from a different process. +func (c *featurestoreGRPCClient) DeleteFeaturestoreOperation(name string) *DeleteFeaturestoreOperation { + return &DeleteFeaturestoreOperation{ + 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 *DeleteFeaturestoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteFeaturestoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteFeaturestoreOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteFeaturestoreOperation) 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 *DeleteFeaturestoreOperation) Name() string { + return op.lro.Name() +} + +// ExportFeatureValuesOperation manages a long-running operation from ExportFeatureValues. +type ExportFeatureValuesOperation struct { + lro *longrunning.Operation +} + +// ExportFeatureValuesOperation returns a new ExportFeatureValuesOperation from a given name. +// The name must be that of a previously created ExportFeatureValuesOperation, possibly from a different process. +func (c *featurestoreGRPCClient) ExportFeatureValuesOperation(name string) *ExportFeatureValuesOperation { + return &ExportFeatureValuesOperation{ + 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 *ExportFeatureValuesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.ExportFeatureValuesResponse, error) { + var resp aiplatformpb.ExportFeatureValuesResponse + 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 *ExportFeatureValuesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.ExportFeatureValuesResponse, error) { + var resp aiplatformpb.ExportFeatureValuesResponse + 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 *ExportFeatureValuesOperation) Metadata() (*aiplatformpb.ExportFeatureValuesOperationMetadata, error) { + var meta aiplatformpb.ExportFeatureValuesOperationMetadata + 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 *ExportFeatureValuesOperation) 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 *ExportFeatureValuesOperation) Name() string { + return op.lro.Name() +} + +// ImportFeatureValuesOperation manages a long-running operation from ImportFeatureValues. +type ImportFeatureValuesOperation struct { + lro *longrunning.Operation +} + +// ImportFeatureValuesOperation returns a new ImportFeatureValuesOperation from a given name. +// The name must be that of a previously created ImportFeatureValuesOperation, possibly from a different process. +func (c *featurestoreGRPCClient) ImportFeatureValuesOperation(name string) *ImportFeatureValuesOperation { + return &ImportFeatureValuesOperation{ + 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 *ImportFeatureValuesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.ImportFeatureValuesResponse, error) { + var resp aiplatformpb.ImportFeatureValuesResponse + 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 *ImportFeatureValuesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.ImportFeatureValuesResponse, error) { + var resp aiplatformpb.ImportFeatureValuesResponse + 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 *ImportFeatureValuesOperation) Metadata() (*aiplatformpb.ImportFeatureValuesOperationMetadata, error) { + var meta aiplatformpb.ImportFeatureValuesOperationMetadata + 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 *ImportFeatureValuesOperation) 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 *ImportFeatureValuesOperation) Name() string { + return op.lro.Name() +} + +// UpdateFeaturestoreOperation manages a long-running operation from UpdateFeaturestore. +type UpdateFeaturestoreOperation struct { + lro *longrunning.Operation +} + +// UpdateFeaturestoreOperation returns a new UpdateFeaturestoreOperation from a given name. +// The name must be that of a previously created UpdateFeaturestoreOperation, possibly from a different process. +func (c *featurestoreGRPCClient) UpdateFeaturestoreOperation(name string) *UpdateFeaturestoreOperation { + return &UpdateFeaturestoreOperation{ + 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 *UpdateFeaturestoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + var resp aiplatformpb.Featurestore + 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 *UpdateFeaturestoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.Featurestore, error) { + var resp aiplatformpb.Featurestore + 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 *UpdateFeaturestoreOperation) Metadata() (*aiplatformpb.UpdateFeaturestoreOperationMetadata, error) { + var meta aiplatformpb.UpdateFeaturestoreOperationMetadata + 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 *UpdateFeaturestoreOperation) 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 *UpdateFeaturestoreOperation) Name() string { + return op.lro.Name() +} + +// EntityTypeIterator manages a stream of *aiplatformpb.EntityType. +type EntityTypeIterator struct { + items []*aiplatformpb.EntityType + 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 []*aiplatformpb.EntityType, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *EntityTypeIterator) 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 *EntityTypeIterator) Next() (*aiplatformpb.EntityType, error) { + var item *aiplatformpb.EntityType + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *EntityTypeIterator) bufLen() int { + return len(it.items) +} + +func (it *EntityTypeIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// FeatureIterator manages a stream of *aiplatformpb.Feature. +type FeatureIterator struct { + items []*aiplatformpb.Feature + 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 []*aiplatformpb.Feature, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *FeatureIterator) 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 *FeatureIterator) Next() (*aiplatformpb.Feature, error) { + var item *aiplatformpb.Feature + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *FeatureIterator) bufLen() int { + return len(it.items) +} + +func (it *FeatureIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// FeaturestoreIterator manages a stream of *aiplatformpb.Featurestore. +type FeaturestoreIterator struct { + items []*aiplatformpb.Featurestore + 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 []*aiplatformpb.Featurestore, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *FeaturestoreIterator) 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 *FeaturestoreIterator) Next() (*aiplatformpb.Featurestore, error) { + var item *aiplatformpb.Featurestore + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *FeaturestoreIterator) bufLen() int { + return len(it.items) +} + +func (it *FeaturestoreIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/aiplatform/apiv1/featurestore_client_example_test.go b/aiplatform/apiv1/featurestore_client_example_test.go new file mode 100644 index 00000000000..b329968fa1e --- /dev/null +++ b/aiplatform/apiv1/featurestore_client_example_test.go @@ -0,0 +1,510 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package aiplatform_test + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func ExampleNewFeaturestoreClient() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleFeaturestoreClient_CreateFeaturestore() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateFeaturestoreRequest. + } + op, err := c.CreateFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_GetFeaturestore() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetFeaturestoreRequest. + } + resp, err := c.GetFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_ListFeaturestores() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListFeaturestoresRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListFeaturestoresRequest. + } + it := c.ListFeaturestores(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleFeaturestoreClient_UpdateFeaturestore() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateFeaturestoreRequest. + } + op, err := c.UpdateFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_DeleteFeaturestore() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteFeaturestoreRequest. + } + op, err := c.DeleteFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleFeaturestoreClient_CreateEntityType() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateEntityTypeRequest. + } + op, err := c.CreateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_GetEntityType() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetEntityTypeRequest. + } + resp, err := c.GetEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_ListEntityTypes() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListEntityTypesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListEntityTypesRequest. + } + it := c.ListEntityTypes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleFeaturestoreClient_UpdateEntityType() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateEntityTypeRequest. + } + resp, err := c.UpdateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_DeleteEntityType() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteEntityTypeRequest. + } + op, err := c.DeleteEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleFeaturestoreClient_CreateFeature() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateFeatureRequest. + } + op, err := c.CreateFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_BatchCreateFeatures() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.BatchCreateFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#BatchCreateFeaturesRequest. + } + op, err := c.BatchCreateFeatures(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_GetFeature() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetFeatureRequest. + } + resp, err := c.GetFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_ListFeatures() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListFeaturesRequest. + } + it := c.ListFeatures(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleFeaturestoreClient_UpdateFeature() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateFeatureRequest. + } + resp, err := c.UpdateFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_DeleteFeature() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteFeatureRequest. + } + op, err := c.DeleteFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleFeaturestoreClient_ImportFeatureValues() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ImportFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ImportFeatureValuesRequest. + } + op, err := c.ImportFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_BatchReadFeatureValues() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.BatchReadFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#BatchReadFeatureValuesRequest. + } + op, err := c.BatchReadFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_ExportFeatureValues() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ExportFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ExportFeatureValuesRequest. + } + op, err := c.ExportFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleFeaturestoreClient_SearchFeatures() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.SearchFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#SearchFeaturesRequest. + } + it := c.SearchFeatures(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/aiplatform/apiv1/featurestore_online_serving_client.go b/aiplatform/apiv1/featurestore_online_serving_client.go new file mode 100644 index 00000000000..398b537915c --- /dev/null +++ b/aiplatform/apiv1/featurestore_online_serving_client.go @@ -0,0 +1,228 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 aiplatform + +import ( + "context" + "fmt" + "math" + "net/url" + + 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" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newFeaturestoreOnlineServingClientHook clientHook + +// FeaturestoreOnlineServingCallOptions contains the retry settings for each method of FeaturestoreOnlineServingClient. +type FeaturestoreOnlineServingCallOptions struct { + ReadFeatureValues []gax.CallOption + StreamingReadFeatureValues []gax.CallOption +} + +func defaultFeaturestoreOnlineServingGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultFeaturestoreOnlineServingCallOptions() *FeaturestoreOnlineServingCallOptions { + return &FeaturestoreOnlineServingCallOptions{ + ReadFeatureValues: []gax.CallOption{}, + StreamingReadFeatureValues: []gax.CallOption{}, + } +} + +// internalFeaturestoreOnlineServingClient is an interface that defines the methods availaible from Vertex AI API. +type internalFeaturestoreOnlineServingClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + ReadFeatureValues(context.Context, *aiplatformpb.ReadFeatureValuesRequest, ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) + StreamingReadFeatureValues(context.Context, *aiplatformpb.StreamingReadFeatureValuesRequest, ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) +} + +// FeaturestoreOnlineServingClient is a client for interacting with Vertex AI API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// A service for serving online feature values. +type FeaturestoreOnlineServingClient struct { + // The internal transport-dependent client. + internalClient internalFeaturestoreOnlineServingClient + + // The call options for this service. + CallOptions *FeaturestoreOnlineServingCallOptions +} + +// 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 *FeaturestoreOnlineServingClient) 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 *FeaturestoreOnlineServingClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *FeaturestoreOnlineServingClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// ReadFeatureValues reads Feature values of a specific entity of an EntityType. For reading +// feature values of multiple entities of an EntityType, please use +// StreamingReadFeatureValues. +func (c *FeaturestoreOnlineServingClient) ReadFeatureValues(ctx context.Context, req *aiplatformpb.ReadFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) { + return c.internalClient.ReadFeatureValues(ctx, req, opts...) +} + +// StreamingReadFeatureValues reads Feature values for multiple entities. Depending on their size, data +// for different entities may be broken +// up across multiple responses. +func (c *FeaturestoreOnlineServingClient) StreamingReadFeatureValues(ctx context.Context, req *aiplatformpb.StreamingReadFeatureValuesRequest, opts ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) { + return c.internalClient.StreamingReadFeatureValues(ctx, req, opts...) +} + +// featurestoreOnlineServingGRPCClient is a client for interacting with Vertex AI API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type featurestoreOnlineServingGRPCClient 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 FeaturestoreOnlineServingClient + CallOptions **FeaturestoreOnlineServingCallOptions + + // The gRPC API client. + featurestoreOnlineServingClient aiplatformpb.FeaturestoreOnlineServingServiceClient + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewFeaturestoreOnlineServingClient creates a new featurestore online serving service client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// A service for serving online feature values. +func NewFeaturestoreOnlineServingClient(ctx context.Context, opts ...option.ClientOption) (*FeaturestoreOnlineServingClient, error) { + clientOpts := defaultFeaturestoreOnlineServingGRPCClientOptions() + if newFeaturestoreOnlineServingClientHook != nil { + hookOpts, err := newFeaturestoreOnlineServingClientHook(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 := FeaturestoreOnlineServingClient{CallOptions: defaultFeaturestoreOnlineServingCallOptions()} + + c := &featurestoreOnlineServingGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + featurestoreOnlineServingClient: aiplatformpb.NewFeaturestoreOnlineServingServiceClient(connPool), + CallOptions: &client.CallOptions, + } + c.setGoogleClientInfo() + + client.internalClient = c + + return &client, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *featurestoreOnlineServingGRPCClient) 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 *featurestoreOnlineServingGRPCClient) 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 *featurestoreOnlineServingGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *featurestoreOnlineServingGRPCClient) ReadFeatureValues(ctx context.Context, req *aiplatformpb.ReadFeatureValuesRequest, opts ...gax.CallOption) (*aiplatformpb.ReadFeatureValuesResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ReadFeatureValues[0:len((*c.CallOptions).ReadFeatureValues):len((*c.CallOptions).ReadFeatureValues)], opts...) + var resp *aiplatformpb.ReadFeatureValuesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreOnlineServingClient.ReadFeatureValues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *featurestoreOnlineServingGRPCClient) StreamingReadFeatureValues(ctx context.Context, req *aiplatformpb.StreamingReadFeatureValuesRequest, opts ...gax.CallOption) (aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type", url.QueryEscape(req.GetEntityType()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + var resp aiplatformpb.FeaturestoreOnlineServingService_StreamingReadFeatureValuesClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.featurestoreOnlineServingClient.StreamingReadFeatureValues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/aiplatform/apiv1/featurestore_online_serving_client_example_test.go b/aiplatform/apiv1/featurestore_online_serving_client_example_test.go new file mode 100644 index 00000000000..d5ca171de8d --- /dev/null +++ b/aiplatform/apiv1/featurestore_online_serving_client_example_test.go @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package aiplatform_test + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func ExampleNewFeaturestoreOnlineServingClient() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreOnlineServingClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleFeaturestoreOnlineServingClient_ReadFeatureValues() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreOnlineServingClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ReadFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ReadFeatureValuesRequest. + } + resp, err := c.ReadFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/aiplatform/apiv1/gapic_metadata.json b/aiplatform/apiv1/gapic_metadata.json index eaad981f8e3..dfa1d3a16a6 100644 --- a/aiplatform/apiv1/gapic_metadata.json +++ b/aiplatform/apiv1/gapic_metadata.json @@ -108,6 +108,134 @@ } } }, + "FeaturestoreOnlineServingService": { + "clients": { + "grpc": { + "libraryClient": "FeaturestoreOnlineServingClient", + "rpcs": { + "ReadFeatureValues": { + "methods": [ + "ReadFeatureValues" + ] + }, + "StreamingReadFeatureValues": { + "methods": [ + "StreamingReadFeatureValues" + ] + } + } + } + } + }, + "FeaturestoreService": { + "clients": { + "grpc": { + "libraryClient": "FeaturestoreClient", + "rpcs": { + "BatchCreateFeatures": { + "methods": [ + "BatchCreateFeatures" + ] + }, + "BatchReadFeatureValues": { + "methods": [ + "BatchReadFeatureValues" + ] + }, + "CreateEntityType": { + "methods": [ + "CreateEntityType" + ] + }, + "CreateFeature": { + "methods": [ + "CreateFeature" + ] + }, + "CreateFeaturestore": { + "methods": [ + "CreateFeaturestore" + ] + }, + "DeleteEntityType": { + "methods": [ + "DeleteEntityType" + ] + }, + "DeleteFeature": { + "methods": [ + "DeleteFeature" + ] + }, + "DeleteFeaturestore": { + "methods": [ + "DeleteFeaturestore" + ] + }, + "ExportFeatureValues": { + "methods": [ + "ExportFeatureValues" + ] + }, + "GetEntityType": { + "methods": [ + "GetEntityType" + ] + }, + "GetFeature": { + "methods": [ + "GetFeature" + ] + }, + "GetFeaturestore": { + "methods": [ + "GetFeaturestore" + ] + }, + "ImportFeatureValues": { + "methods": [ + "ImportFeatureValues" + ] + }, + "ListEntityTypes": { + "methods": [ + "ListEntityTypes" + ] + }, + "ListFeatures": { + "methods": [ + "ListFeatures" + ] + }, + "ListFeaturestores": { + "methods": [ + "ListFeaturestores" + ] + }, + "SearchFeatures": { + "methods": [ + "SearchFeatures" + ] + }, + "UpdateEntityType": { + "methods": [ + "UpdateEntityType" + ] + }, + "UpdateFeature": { + "methods": [ + "UpdateFeature" + ] + }, + "UpdateFeaturestore": { + "methods": [ + "UpdateFeaturestore" + ] + } + } + } + } + }, "IndexEndpointService": { "clients": { "grpc": { @@ -335,6 +463,170 @@ } } }, + "MetadataService": { + "clients": { + "grpc": { + "libraryClient": "MetadataClient", + "rpcs": { + "AddContextArtifactsAndExecutions": { + "methods": [ + "AddContextArtifactsAndExecutions" + ] + }, + "AddContextChildren": { + "methods": [ + "AddContextChildren" + ] + }, + "AddExecutionEvents": { + "methods": [ + "AddExecutionEvents" + ] + }, + "CreateArtifact": { + "methods": [ + "CreateArtifact" + ] + }, + "CreateContext": { + "methods": [ + "CreateContext" + ] + }, + "CreateExecution": { + "methods": [ + "CreateExecution" + ] + }, + "CreateMetadataSchema": { + "methods": [ + "CreateMetadataSchema" + ] + }, + "CreateMetadataStore": { + "methods": [ + "CreateMetadataStore" + ] + }, + "DeleteArtifact": { + "methods": [ + "DeleteArtifact" + ] + }, + "DeleteContext": { + "methods": [ + "DeleteContext" + ] + }, + "DeleteExecution": { + "methods": [ + "DeleteExecution" + ] + }, + "DeleteMetadataStore": { + "methods": [ + "DeleteMetadataStore" + ] + }, + "GetArtifact": { + "methods": [ + "GetArtifact" + ] + }, + "GetContext": { + "methods": [ + "GetContext" + ] + }, + "GetExecution": { + "methods": [ + "GetExecution" + ] + }, + "GetMetadataSchema": { + "methods": [ + "GetMetadataSchema" + ] + }, + "GetMetadataStore": { + "methods": [ + "GetMetadataStore" + ] + }, + "ListArtifacts": { + "methods": [ + "ListArtifacts" + ] + }, + "ListContexts": { + "methods": [ + "ListContexts" + ] + }, + "ListExecutions": { + "methods": [ + "ListExecutions" + ] + }, + "ListMetadataSchemas": { + "methods": [ + "ListMetadataSchemas" + ] + }, + "ListMetadataStores": { + "methods": [ + "ListMetadataStores" + ] + }, + "PurgeArtifacts": { + "methods": [ + "PurgeArtifacts" + ] + }, + "PurgeContexts": { + "methods": [ + "PurgeContexts" + ] + }, + "PurgeExecutions": { + "methods": [ + "PurgeExecutions" + ] + }, + "QueryArtifactLineageSubgraph": { + "methods": [ + "QueryArtifactLineageSubgraph" + ] + }, + "QueryContextLineageSubgraph": { + "methods": [ + "QueryContextLineageSubgraph" + ] + }, + "QueryExecutionInputsAndOutputs": { + "methods": [ + "QueryExecutionInputsAndOutputs" + ] + }, + "UpdateArtifact": { + "methods": [ + "UpdateArtifact" + ] + }, + "UpdateContext": { + "methods": [ + "UpdateContext" + ] + }, + "UpdateExecution": { + "methods": [ + "UpdateExecution" + ] + } + } + } + } + }, "MigrationService": { "clients": { "grpc": { diff --git a/aiplatform/apiv1/metadata_client.go b/aiplatform/apiv1/metadata_client.go new file mode 100644 index 00000000000..e88708dc957 --- /dev/null +++ b/aiplatform/apiv1/metadata_client.go @@ -0,0 +1,1917 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 aiplatform + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newMetadataClientHook clientHook + +// MetadataCallOptions contains the retry settings for each method of MetadataClient. +type MetadataCallOptions struct { + CreateMetadataStore []gax.CallOption + GetMetadataStore []gax.CallOption + ListMetadataStores []gax.CallOption + DeleteMetadataStore []gax.CallOption + CreateArtifact []gax.CallOption + GetArtifact []gax.CallOption + ListArtifacts []gax.CallOption + UpdateArtifact []gax.CallOption + DeleteArtifact []gax.CallOption + PurgeArtifacts []gax.CallOption + CreateContext []gax.CallOption + GetContext []gax.CallOption + ListContexts []gax.CallOption + UpdateContext []gax.CallOption + DeleteContext []gax.CallOption + PurgeContexts []gax.CallOption + AddContextArtifactsAndExecutions []gax.CallOption + AddContextChildren []gax.CallOption + QueryContextLineageSubgraph []gax.CallOption + CreateExecution []gax.CallOption + GetExecution []gax.CallOption + ListExecutions []gax.CallOption + UpdateExecution []gax.CallOption + DeleteExecution []gax.CallOption + PurgeExecutions []gax.CallOption + AddExecutionEvents []gax.CallOption + QueryExecutionInputsAndOutputs []gax.CallOption + CreateMetadataSchema []gax.CallOption + GetMetadataSchema []gax.CallOption + ListMetadataSchemas []gax.CallOption + QueryArtifactLineageSubgraph []gax.CallOption +} + +func defaultMetadataGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultMetadataCallOptions() *MetadataCallOptions { + return &MetadataCallOptions{ + CreateMetadataStore: []gax.CallOption{}, + GetMetadataStore: []gax.CallOption{}, + ListMetadataStores: []gax.CallOption{}, + DeleteMetadataStore: []gax.CallOption{}, + CreateArtifact: []gax.CallOption{}, + GetArtifact: []gax.CallOption{}, + ListArtifacts: []gax.CallOption{}, + UpdateArtifact: []gax.CallOption{}, + DeleteArtifact: []gax.CallOption{}, + PurgeArtifacts: []gax.CallOption{}, + CreateContext: []gax.CallOption{}, + GetContext: []gax.CallOption{}, + ListContexts: []gax.CallOption{}, + UpdateContext: []gax.CallOption{}, + DeleteContext: []gax.CallOption{}, + PurgeContexts: []gax.CallOption{}, + AddContextArtifactsAndExecutions: []gax.CallOption{}, + AddContextChildren: []gax.CallOption{}, + QueryContextLineageSubgraph: []gax.CallOption{}, + CreateExecution: []gax.CallOption{}, + GetExecution: []gax.CallOption{}, + ListExecutions: []gax.CallOption{}, + UpdateExecution: []gax.CallOption{}, + DeleteExecution: []gax.CallOption{}, + PurgeExecutions: []gax.CallOption{}, + AddExecutionEvents: []gax.CallOption{}, + QueryExecutionInputsAndOutputs: []gax.CallOption{}, + CreateMetadataSchema: []gax.CallOption{}, + GetMetadataSchema: []gax.CallOption{}, + ListMetadataSchemas: []gax.CallOption{}, + QueryArtifactLineageSubgraph: []gax.CallOption{}, + } +} + +// internalMetadataClient is an interface that defines the methods availaible from Vertex AI API. +type internalMetadataClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateMetadataStore(context.Context, *aiplatformpb.CreateMetadataStoreRequest, ...gax.CallOption) (*CreateMetadataStoreOperation, error) + CreateMetadataStoreOperation(name string) *CreateMetadataStoreOperation + GetMetadataStore(context.Context, *aiplatformpb.GetMetadataStoreRequest, ...gax.CallOption) (*aiplatformpb.MetadataStore, error) + ListMetadataStores(context.Context, *aiplatformpb.ListMetadataStoresRequest, ...gax.CallOption) *MetadataStoreIterator + DeleteMetadataStore(context.Context, *aiplatformpb.DeleteMetadataStoreRequest, ...gax.CallOption) (*DeleteMetadataStoreOperation, error) + DeleteMetadataStoreOperation(name string) *DeleteMetadataStoreOperation + CreateArtifact(context.Context, *aiplatformpb.CreateArtifactRequest, ...gax.CallOption) (*aiplatformpb.Artifact, error) + GetArtifact(context.Context, *aiplatformpb.GetArtifactRequest, ...gax.CallOption) (*aiplatformpb.Artifact, error) + ListArtifacts(context.Context, *aiplatformpb.ListArtifactsRequest, ...gax.CallOption) *ArtifactIterator + UpdateArtifact(context.Context, *aiplatformpb.UpdateArtifactRequest, ...gax.CallOption) (*aiplatformpb.Artifact, error) + DeleteArtifact(context.Context, *aiplatformpb.DeleteArtifactRequest, ...gax.CallOption) (*DeleteArtifactOperation, error) + DeleteArtifactOperation(name string) *DeleteArtifactOperation + PurgeArtifacts(context.Context, *aiplatformpb.PurgeArtifactsRequest, ...gax.CallOption) (*PurgeArtifactsOperation, error) + PurgeArtifactsOperation(name string) *PurgeArtifactsOperation + CreateContext(context.Context, *aiplatformpb.CreateContextRequest, ...gax.CallOption) (*aiplatformpb.Context, error) + GetContext(context.Context, *aiplatformpb.GetContextRequest, ...gax.CallOption) (*aiplatformpb.Context, error) + ListContexts(context.Context, *aiplatformpb.ListContextsRequest, ...gax.CallOption) *ContextIterator + UpdateContext(context.Context, *aiplatformpb.UpdateContextRequest, ...gax.CallOption) (*aiplatformpb.Context, error) + DeleteContext(context.Context, *aiplatformpb.DeleteContextRequest, ...gax.CallOption) (*DeleteContextOperation, error) + DeleteContextOperation(name string) *DeleteContextOperation + PurgeContexts(context.Context, *aiplatformpb.PurgeContextsRequest, ...gax.CallOption) (*PurgeContextsOperation, error) + PurgeContextsOperation(name string) *PurgeContextsOperation + AddContextArtifactsAndExecutions(context.Context, *aiplatformpb.AddContextArtifactsAndExecutionsRequest, ...gax.CallOption) (*aiplatformpb.AddContextArtifactsAndExecutionsResponse, error) + AddContextChildren(context.Context, *aiplatformpb.AddContextChildrenRequest, ...gax.CallOption) (*aiplatformpb.AddContextChildrenResponse, error) + QueryContextLineageSubgraph(context.Context, *aiplatformpb.QueryContextLineageSubgraphRequest, ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) + CreateExecution(context.Context, *aiplatformpb.CreateExecutionRequest, ...gax.CallOption) (*aiplatformpb.Execution, error) + GetExecution(context.Context, *aiplatformpb.GetExecutionRequest, ...gax.CallOption) (*aiplatformpb.Execution, error) + ListExecutions(context.Context, *aiplatformpb.ListExecutionsRequest, ...gax.CallOption) *ExecutionIterator + UpdateExecution(context.Context, *aiplatformpb.UpdateExecutionRequest, ...gax.CallOption) (*aiplatformpb.Execution, error) + DeleteExecution(context.Context, *aiplatformpb.DeleteExecutionRequest, ...gax.CallOption) (*DeleteExecutionOperation, error) + DeleteExecutionOperation(name string) *DeleteExecutionOperation + PurgeExecutions(context.Context, *aiplatformpb.PurgeExecutionsRequest, ...gax.CallOption) (*PurgeExecutionsOperation, error) + PurgeExecutionsOperation(name string) *PurgeExecutionsOperation + AddExecutionEvents(context.Context, *aiplatformpb.AddExecutionEventsRequest, ...gax.CallOption) (*aiplatformpb.AddExecutionEventsResponse, error) + QueryExecutionInputsAndOutputs(context.Context, *aiplatformpb.QueryExecutionInputsAndOutputsRequest, ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) + CreateMetadataSchema(context.Context, *aiplatformpb.CreateMetadataSchemaRequest, ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) + GetMetadataSchema(context.Context, *aiplatformpb.GetMetadataSchemaRequest, ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) + ListMetadataSchemas(context.Context, *aiplatformpb.ListMetadataSchemasRequest, ...gax.CallOption) *MetadataSchemaIterator + QueryArtifactLineageSubgraph(context.Context, *aiplatformpb.QueryArtifactLineageSubgraphRequest, ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) +} + +// MetadataClient is a client for interacting with Vertex AI API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Service for reading and writing metadata entries. +type MetadataClient struct { + // The internal transport-dependent client. + internalClient internalMetadataClient + + // The call options for this service. + CallOptions *MetadataCallOptions + + // 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 *MetadataClient) 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 *MetadataClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *MetadataClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateMetadataStore initializes a MetadataStore, including allocation of resources. +func (c *MetadataClient) CreateMetadataStore(ctx context.Context, req *aiplatformpb.CreateMetadataStoreRequest, opts ...gax.CallOption) (*CreateMetadataStoreOperation, error) { + return c.internalClient.CreateMetadataStore(ctx, req, opts...) +} + +// CreateMetadataStoreOperation returns a new CreateMetadataStoreOperation from a given name. +// The name must be that of a previously created CreateMetadataStoreOperation, possibly from a different process. +func (c *MetadataClient) CreateMetadataStoreOperation(name string) *CreateMetadataStoreOperation { + return c.internalClient.CreateMetadataStoreOperation(name) +} + +// GetMetadataStore retrieves a specific MetadataStore. +func (c *MetadataClient) GetMetadataStore(ctx context.Context, req *aiplatformpb.GetMetadataStoreRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataStore, error) { + return c.internalClient.GetMetadataStore(ctx, req, opts...) +} + +// ListMetadataStores lists MetadataStores for a Location. +func (c *MetadataClient) ListMetadataStores(ctx context.Context, req *aiplatformpb.ListMetadataStoresRequest, opts ...gax.CallOption) *MetadataStoreIterator { + return c.internalClient.ListMetadataStores(ctx, req, opts...) +} + +// DeleteMetadataStore deletes a single MetadataStore and all its child resources (Artifacts, +// Executions, and Contexts). +func (c *MetadataClient) DeleteMetadataStore(ctx context.Context, req *aiplatformpb.DeleteMetadataStoreRequest, opts ...gax.CallOption) (*DeleteMetadataStoreOperation, error) { + return c.internalClient.DeleteMetadataStore(ctx, req, opts...) +} + +// DeleteMetadataStoreOperation returns a new DeleteMetadataStoreOperation from a given name. +// The name must be that of a previously created DeleteMetadataStoreOperation, possibly from a different process. +func (c *MetadataClient) DeleteMetadataStoreOperation(name string) *DeleteMetadataStoreOperation { + return c.internalClient.DeleteMetadataStoreOperation(name) +} + +// CreateArtifact creates an Artifact associated with a MetadataStore. +func (c *MetadataClient) CreateArtifact(ctx context.Context, req *aiplatformpb.CreateArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + return c.internalClient.CreateArtifact(ctx, req, opts...) +} + +// GetArtifact retrieves a specific Artifact. +func (c *MetadataClient) GetArtifact(ctx context.Context, req *aiplatformpb.GetArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + return c.internalClient.GetArtifact(ctx, req, opts...) +} + +// ListArtifacts lists Artifacts in the MetadataStore. +func (c *MetadataClient) ListArtifacts(ctx context.Context, req *aiplatformpb.ListArtifactsRequest, opts ...gax.CallOption) *ArtifactIterator { + return c.internalClient.ListArtifacts(ctx, req, opts...) +} + +// UpdateArtifact updates a stored Artifact. +func (c *MetadataClient) UpdateArtifact(ctx context.Context, req *aiplatformpb.UpdateArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + return c.internalClient.UpdateArtifact(ctx, req, opts...) +} + +// DeleteArtifact deletes an Artifact. +func (c *MetadataClient) DeleteArtifact(ctx context.Context, req *aiplatformpb.DeleteArtifactRequest, opts ...gax.CallOption) (*DeleteArtifactOperation, error) { + return c.internalClient.DeleteArtifact(ctx, req, opts...) +} + +// DeleteArtifactOperation returns a new DeleteArtifactOperation from a given name. +// The name must be that of a previously created DeleteArtifactOperation, possibly from a different process. +func (c *MetadataClient) DeleteArtifactOperation(name string) *DeleteArtifactOperation { + return c.internalClient.DeleteArtifactOperation(name) +} + +// PurgeArtifacts purges Artifacts. +func (c *MetadataClient) PurgeArtifacts(ctx context.Context, req *aiplatformpb.PurgeArtifactsRequest, opts ...gax.CallOption) (*PurgeArtifactsOperation, error) { + return c.internalClient.PurgeArtifacts(ctx, req, opts...) +} + +// PurgeArtifactsOperation returns a new PurgeArtifactsOperation from a given name. +// The name must be that of a previously created PurgeArtifactsOperation, possibly from a different process. +func (c *MetadataClient) PurgeArtifactsOperation(name string) *PurgeArtifactsOperation { + return c.internalClient.PurgeArtifactsOperation(name) +} + +// CreateContext creates a Context associated with a MetadataStore. +func (c *MetadataClient) CreateContext(ctx context.Context, req *aiplatformpb.CreateContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + return c.internalClient.CreateContext(ctx, req, opts...) +} + +// GetContext retrieves a specific Context. +func (c *MetadataClient) GetContext(ctx context.Context, req *aiplatformpb.GetContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + return c.internalClient.GetContext(ctx, req, opts...) +} + +// ListContexts lists Contexts on the MetadataStore. +func (c *MetadataClient) ListContexts(ctx context.Context, req *aiplatformpb.ListContextsRequest, opts ...gax.CallOption) *ContextIterator { + return c.internalClient.ListContexts(ctx, req, opts...) +} + +// UpdateContext updates a stored Context. +func (c *MetadataClient) UpdateContext(ctx context.Context, req *aiplatformpb.UpdateContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + return c.internalClient.UpdateContext(ctx, req, opts...) +} + +// DeleteContext deletes a stored Context. +func (c *MetadataClient) DeleteContext(ctx context.Context, req *aiplatformpb.DeleteContextRequest, opts ...gax.CallOption) (*DeleteContextOperation, error) { + return c.internalClient.DeleteContext(ctx, req, opts...) +} + +// DeleteContextOperation returns a new DeleteContextOperation from a given name. +// The name must be that of a previously created DeleteContextOperation, possibly from a different process. +func (c *MetadataClient) DeleteContextOperation(name string) *DeleteContextOperation { + return c.internalClient.DeleteContextOperation(name) +} + +// PurgeContexts purges Contexts. +func (c *MetadataClient) PurgeContexts(ctx context.Context, req *aiplatformpb.PurgeContextsRequest, opts ...gax.CallOption) (*PurgeContextsOperation, error) { + return c.internalClient.PurgeContexts(ctx, req, opts...) +} + +// PurgeContextsOperation returns a new PurgeContextsOperation from a given name. +// The name must be that of a previously created PurgeContextsOperation, possibly from a different process. +func (c *MetadataClient) PurgeContextsOperation(name string) *PurgeContextsOperation { + return c.internalClient.PurgeContextsOperation(name) +} + +// AddContextArtifactsAndExecutions adds a set of Artifacts and Executions to a Context. If any of the +// Artifacts or Executions have already been added to a Context, they are +// simply skipped. +func (c *MetadataClient) AddContextArtifactsAndExecutions(ctx context.Context, req *aiplatformpb.AddContextArtifactsAndExecutionsRequest, opts ...gax.CallOption) (*aiplatformpb.AddContextArtifactsAndExecutionsResponse, error) { + return c.internalClient.AddContextArtifactsAndExecutions(ctx, req, opts...) +} + +// AddContextChildren adds a set of Contexts as children to a parent Context. If any of the +// child Contexts have already been added to the parent Context, they are +// simply skipped. If this call would create a cycle or cause any Context to +// have more than 10 parents, the request will fail with an INVALID_ARGUMENT +// error. +func (c *MetadataClient) AddContextChildren(ctx context.Context, req *aiplatformpb.AddContextChildrenRequest, opts ...gax.CallOption) (*aiplatformpb.AddContextChildrenResponse, error) { + return c.internalClient.AddContextChildren(ctx, req, opts...) +} + +// QueryContextLineageSubgraph retrieves Artifacts and Executions within the specified Context, connected +// by Event edges and returned as a LineageSubgraph. +func (c *MetadataClient) QueryContextLineageSubgraph(ctx context.Context, req *aiplatformpb.QueryContextLineageSubgraphRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + return c.internalClient.QueryContextLineageSubgraph(ctx, req, opts...) +} + +// CreateExecution creates an Execution associated with a MetadataStore. +func (c *MetadataClient) CreateExecution(ctx context.Context, req *aiplatformpb.CreateExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + return c.internalClient.CreateExecution(ctx, req, opts...) +} + +// GetExecution retrieves a specific Execution. +func (c *MetadataClient) GetExecution(ctx context.Context, req *aiplatformpb.GetExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + return c.internalClient.GetExecution(ctx, req, opts...) +} + +// ListExecutions lists Executions in the MetadataStore. +func (c *MetadataClient) ListExecutions(ctx context.Context, req *aiplatformpb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator { + return c.internalClient.ListExecutions(ctx, req, opts...) +} + +// UpdateExecution updates a stored Execution. +func (c *MetadataClient) UpdateExecution(ctx context.Context, req *aiplatformpb.UpdateExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + return c.internalClient.UpdateExecution(ctx, req, opts...) +} + +// DeleteExecution deletes an Execution. +func (c *MetadataClient) DeleteExecution(ctx context.Context, req *aiplatformpb.DeleteExecutionRequest, opts ...gax.CallOption) (*DeleteExecutionOperation, error) { + return c.internalClient.DeleteExecution(ctx, req, opts...) +} + +// DeleteExecutionOperation returns a new DeleteExecutionOperation from a given name. +// The name must be that of a previously created DeleteExecutionOperation, possibly from a different process. +func (c *MetadataClient) DeleteExecutionOperation(name string) *DeleteExecutionOperation { + return c.internalClient.DeleteExecutionOperation(name) +} + +// PurgeExecutions purges Executions. +func (c *MetadataClient) PurgeExecutions(ctx context.Context, req *aiplatformpb.PurgeExecutionsRequest, opts ...gax.CallOption) (*PurgeExecutionsOperation, error) { + return c.internalClient.PurgeExecutions(ctx, req, opts...) +} + +// PurgeExecutionsOperation returns a new PurgeExecutionsOperation from a given name. +// The name must be that of a previously created PurgeExecutionsOperation, possibly from a different process. +func (c *MetadataClient) PurgeExecutionsOperation(name string) *PurgeExecutionsOperation { + return c.internalClient.PurgeExecutionsOperation(name) +} + +// AddExecutionEvents adds Events to the specified Execution. An Event indicates whether an +// Artifact was used as an input or output for an Execution. If an Event +// already exists between the Execution and the Artifact, the Event is +// skipped. +func (c *MetadataClient) AddExecutionEvents(ctx context.Context, req *aiplatformpb.AddExecutionEventsRequest, opts ...gax.CallOption) (*aiplatformpb.AddExecutionEventsResponse, error) { + return c.internalClient.AddExecutionEvents(ctx, req, opts...) +} + +// QueryExecutionInputsAndOutputs obtains the set of input and output Artifacts for this Execution, in the +// form of LineageSubgraph that also contains the Execution and connecting +// Events. +func (c *MetadataClient) QueryExecutionInputsAndOutputs(ctx context.Context, req *aiplatformpb.QueryExecutionInputsAndOutputsRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + return c.internalClient.QueryExecutionInputsAndOutputs(ctx, req, opts...) +} + +// CreateMetadataSchema creates a MetadataSchema. +func (c *MetadataClient) CreateMetadataSchema(ctx context.Context, req *aiplatformpb.CreateMetadataSchemaRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) { + return c.internalClient.CreateMetadataSchema(ctx, req, opts...) +} + +// GetMetadataSchema retrieves a specific MetadataSchema. +func (c *MetadataClient) GetMetadataSchema(ctx context.Context, req *aiplatformpb.GetMetadataSchemaRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) { + return c.internalClient.GetMetadataSchema(ctx, req, opts...) +} + +// ListMetadataSchemas lists MetadataSchemas. +func (c *MetadataClient) ListMetadataSchemas(ctx context.Context, req *aiplatformpb.ListMetadataSchemasRequest, opts ...gax.CallOption) *MetadataSchemaIterator { + return c.internalClient.ListMetadataSchemas(ctx, req, opts...) +} + +// QueryArtifactLineageSubgraph retrieves lineage of an Artifact represented through Artifacts and +// Executions connected by Event edges and returned as a LineageSubgraph. +func (c *MetadataClient) QueryArtifactLineageSubgraph(ctx context.Context, req *aiplatformpb.QueryArtifactLineageSubgraphRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + return c.internalClient.QueryArtifactLineageSubgraph(ctx, req, opts...) +} + +// metadataGRPCClient is a client for interacting with Vertex AI API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type metadataGRPCClient 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 MetadataClient + CallOptions **MetadataCallOptions + + // The gRPC API client. + metadataClient aiplatformpb.MetadataServiceClient + + // 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 +} + +// NewMetadataClient creates a new metadata 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 reading and writing metadata entries. +func NewMetadataClient(ctx context.Context, opts ...option.ClientOption) (*MetadataClient, error) { + clientOpts := defaultMetadataGRPCClientOptions() + if newMetadataClientHook != nil { + hookOpts, err := newMetadataClientHook(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 := MetadataClient{CallOptions: defaultMetadataCallOptions()} + + c := &metadataGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + metadataClient: aiplatformpb.NewMetadataServiceClient(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 *metadataGRPCClient) 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 *metadataGRPCClient) 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 *metadataGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *metadataGRPCClient) CreateMetadataStore(ctx context.Context, req *aiplatformpb.CreateMetadataStoreRequest, opts ...gax.CallOption) (*CreateMetadataStoreOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateMetadataStore[0:len((*c.CallOptions).CreateMetadataStore):len((*c.CallOptions).CreateMetadataStore)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.CreateMetadataStore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateMetadataStoreOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) GetMetadataStore(ctx context.Context, req *aiplatformpb.GetMetadataStoreRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataStore, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetMetadataStore[0:len((*c.CallOptions).GetMetadataStore):len((*c.CallOptions).GetMetadataStore)], opts...) + var resp *aiplatformpb.MetadataStore + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.GetMetadataStore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) ListMetadataStores(ctx context.Context, req *aiplatformpb.ListMetadataStoresRequest, opts ...gax.CallOption) *MetadataStoreIterator { + 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).ListMetadataStores[0:len((*c.CallOptions).ListMetadataStores):len((*c.CallOptions).ListMetadataStores)], opts...) + it := &MetadataStoreIterator{} + req = proto.Clone(req).(*aiplatformpb.ListMetadataStoresRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.MetadataStore, string, error) { + resp := &aiplatformpb.ListMetadataStoresResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.ListMetadataStores(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetMetadataStores(), 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 *metadataGRPCClient) DeleteMetadataStore(ctx context.Context, req *aiplatformpb.DeleteMetadataStoreRequest, opts ...gax.CallOption) (*DeleteMetadataStoreOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteMetadataStore[0:len((*c.CallOptions).DeleteMetadataStore):len((*c.CallOptions).DeleteMetadataStore)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.DeleteMetadataStore(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteMetadataStoreOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) CreateArtifact(ctx context.Context, req *aiplatformpb.CreateArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateArtifact[0:len((*c.CallOptions).CreateArtifact):len((*c.CallOptions).CreateArtifact)], opts...) + var resp *aiplatformpb.Artifact + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.CreateArtifact(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) GetArtifact(ctx context.Context, req *aiplatformpb.GetArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetArtifact[0:len((*c.CallOptions).GetArtifact):len((*c.CallOptions).GetArtifact)], opts...) + var resp *aiplatformpb.Artifact + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.GetArtifact(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) ListArtifacts(ctx context.Context, req *aiplatformpb.ListArtifactsRequest, opts ...gax.CallOption) *ArtifactIterator { + 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).ListArtifacts[0:len((*c.CallOptions).ListArtifacts):len((*c.CallOptions).ListArtifacts)], opts...) + it := &ArtifactIterator{} + req = proto.Clone(req).(*aiplatformpb.ListArtifactsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Artifact, string, error) { + resp := &aiplatformpb.ListArtifactsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.ListArtifacts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetArtifacts(), 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 *metadataGRPCClient) UpdateArtifact(ctx context.Context, req *aiplatformpb.UpdateArtifactRequest, opts ...gax.CallOption) (*aiplatformpb.Artifact, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "artifact.name", url.QueryEscape(req.GetArtifact().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateArtifact[0:len((*c.CallOptions).UpdateArtifact):len((*c.CallOptions).UpdateArtifact)], opts...) + var resp *aiplatformpb.Artifact + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.UpdateArtifact(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) DeleteArtifact(ctx context.Context, req *aiplatformpb.DeleteArtifactRequest, opts ...gax.CallOption) (*DeleteArtifactOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteArtifact[0:len((*c.CallOptions).DeleteArtifact):len((*c.CallOptions).DeleteArtifact)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.DeleteArtifact(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteArtifactOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) PurgeArtifacts(ctx context.Context, req *aiplatformpb.PurgeArtifactsRequest, opts ...gax.CallOption) (*PurgeArtifactsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).PurgeArtifacts[0:len((*c.CallOptions).PurgeArtifacts):len((*c.CallOptions).PurgeArtifacts)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.PurgeArtifacts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &PurgeArtifactsOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) CreateContext(ctx context.Context, req *aiplatformpb.CreateContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateContext[0:len((*c.CallOptions).CreateContext):len((*c.CallOptions).CreateContext)], opts...) + var resp *aiplatformpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.CreateContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) GetContext(ctx context.Context, req *aiplatformpb.GetContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetContext[0:len((*c.CallOptions).GetContext):len((*c.CallOptions).GetContext)], opts...) + var resp *aiplatformpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.GetContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) ListContexts(ctx context.Context, req *aiplatformpb.ListContextsRequest, opts ...gax.CallOption) *ContextIterator { + 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).ListContexts[0:len((*c.CallOptions).ListContexts):len((*c.CallOptions).ListContexts)], opts...) + it := &ContextIterator{} + req = proto.Clone(req).(*aiplatformpb.ListContextsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Context, string, error) { + resp := &aiplatformpb.ListContextsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.ListContexts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetContexts(), 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 *metadataGRPCClient) UpdateContext(ctx context.Context, req *aiplatformpb.UpdateContextRequest, opts ...gax.CallOption) (*aiplatformpb.Context, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "context.name", url.QueryEscape(req.GetContext().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateContext[0:len((*c.CallOptions).UpdateContext):len((*c.CallOptions).UpdateContext)], opts...) + var resp *aiplatformpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.UpdateContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) DeleteContext(ctx context.Context, req *aiplatformpb.DeleteContextRequest, opts ...gax.CallOption) (*DeleteContextOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteContext[0:len((*c.CallOptions).DeleteContext):len((*c.CallOptions).DeleteContext)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.DeleteContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteContextOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) PurgeContexts(ctx context.Context, req *aiplatformpb.PurgeContextsRequest, opts ...gax.CallOption) (*PurgeContextsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).PurgeContexts[0:len((*c.CallOptions).PurgeContexts):len((*c.CallOptions).PurgeContexts)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.PurgeContexts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &PurgeContextsOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) AddContextArtifactsAndExecutions(ctx context.Context, req *aiplatformpb.AddContextArtifactsAndExecutionsRequest, opts ...gax.CallOption) (*aiplatformpb.AddContextArtifactsAndExecutionsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "context", url.QueryEscape(req.GetContext()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).AddContextArtifactsAndExecutions[0:len((*c.CallOptions).AddContextArtifactsAndExecutions):len((*c.CallOptions).AddContextArtifactsAndExecutions)], opts...) + var resp *aiplatformpb.AddContextArtifactsAndExecutionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.AddContextArtifactsAndExecutions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) AddContextChildren(ctx context.Context, req *aiplatformpb.AddContextChildrenRequest, opts ...gax.CallOption) (*aiplatformpb.AddContextChildrenResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "context", url.QueryEscape(req.GetContext()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).AddContextChildren[0:len((*c.CallOptions).AddContextChildren):len((*c.CallOptions).AddContextChildren)], opts...) + var resp *aiplatformpb.AddContextChildrenResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.AddContextChildren(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) QueryContextLineageSubgraph(ctx context.Context, req *aiplatformpb.QueryContextLineageSubgraphRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "context", url.QueryEscape(req.GetContext()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).QueryContextLineageSubgraph[0:len((*c.CallOptions).QueryContextLineageSubgraph):len((*c.CallOptions).QueryContextLineageSubgraph)], opts...) + var resp *aiplatformpb.LineageSubgraph + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.QueryContextLineageSubgraph(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) CreateExecution(ctx context.Context, req *aiplatformpb.CreateExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateExecution[0:len((*c.CallOptions).CreateExecution):len((*c.CallOptions).CreateExecution)], opts...) + var resp *aiplatformpb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.CreateExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) GetExecution(ctx context.Context, req *aiplatformpb.GetExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetExecution[0:len((*c.CallOptions).GetExecution):len((*c.CallOptions).GetExecution)], opts...) + var resp *aiplatformpb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.GetExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) ListExecutions(ctx context.Context, req *aiplatformpb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).ListExecutions[0:len((*c.CallOptions).ListExecutions):len((*c.CallOptions).ListExecutions)], opts...) + it := &ExecutionIterator{} + req = proto.Clone(req).(*aiplatformpb.ListExecutionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.Execution, string, error) { + resp := &aiplatformpb.ListExecutionsResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.ListExecutions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetExecutions(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + + return it +} + +func (c *metadataGRPCClient) UpdateExecution(ctx context.Context, req *aiplatformpb.UpdateExecutionRequest, opts ...gax.CallOption) (*aiplatformpb.Execution, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "execution.name", url.QueryEscape(req.GetExecution().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).UpdateExecution[0:len((*c.CallOptions).UpdateExecution):len((*c.CallOptions).UpdateExecution)], opts...) + var resp *aiplatformpb.Execution + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.UpdateExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) DeleteExecution(ctx context.Context, req *aiplatformpb.DeleteExecutionRequest, opts ...gax.CallOption) (*DeleteExecutionOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteExecution[0:len((*c.CallOptions).DeleteExecution):len((*c.CallOptions).DeleteExecution)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.DeleteExecution(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteExecutionOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) PurgeExecutions(ctx context.Context, req *aiplatformpb.PurgeExecutionsRequest, opts ...gax.CallOption) (*PurgeExecutionsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).PurgeExecutions[0:len((*c.CallOptions).PurgeExecutions):len((*c.CallOptions).PurgeExecutions)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.PurgeExecutions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &PurgeExecutionsOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *metadataGRPCClient) AddExecutionEvents(ctx context.Context, req *aiplatformpb.AddExecutionEventsRequest, opts ...gax.CallOption) (*aiplatformpb.AddExecutionEventsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "execution", url.QueryEscape(req.GetExecution()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).AddExecutionEvents[0:len((*c.CallOptions).AddExecutionEvents):len((*c.CallOptions).AddExecutionEvents)], opts...) + var resp *aiplatformpb.AddExecutionEventsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.AddExecutionEvents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) QueryExecutionInputsAndOutputs(ctx context.Context, req *aiplatformpb.QueryExecutionInputsAndOutputsRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "execution", url.QueryEscape(req.GetExecution()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).QueryExecutionInputsAndOutputs[0:len((*c.CallOptions).QueryExecutionInputsAndOutputs):len((*c.CallOptions).QueryExecutionInputsAndOutputs)], opts...) + var resp *aiplatformpb.LineageSubgraph + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.QueryExecutionInputsAndOutputs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) CreateMetadataSchema(ctx context.Context, req *aiplatformpb.CreateMetadataSchemaRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateMetadataSchema[0:len((*c.CallOptions).CreateMetadataSchema):len((*c.CallOptions).CreateMetadataSchema)], opts...) + var resp *aiplatformpb.MetadataSchema + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.CreateMetadataSchema(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) GetMetadataSchema(ctx context.Context, req *aiplatformpb.GetMetadataSchemaRequest, opts ...gax.CallOption) (*aiplatformpb.MetadataSchema, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetMetadataSchema[0:len((*c.CallOptions).GetMetadataSchema):len((*c.CallOptions).GetMetadataSchema)], opts...) + var resp *aiplatformpb.MetadataSchema + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.GetMetadataSchema(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *metadataGRPCClient) ListMetadataSchemas(ctx context.Context, req *aiplatformpb.ListMetadataSchemasRequest, opts ...gax.CallOption) *MetadataSchemaIterator { + 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).ListMetadataSchemas[0:len((*c.CallOptions).ListMetadataSchemas):len((*c.CallOptions).ListMetadataSchemas)], opts...) + it := &MetadataSchemaIterator{} + req = proto.Clone(req).(*aiplatformpb.ListMetadataSchemasRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.MetadataSchema, string, error) { + resp := &aiplatformpb.ListMetadataSchemasResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.ListMetadataSchemas(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetMetadataSchemas(), 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 *metadataGRPCClient) QueryArtifactLineageSubgraph(ctx context.Context, req *aiplatformpb.QueryArtifactLineageSubgraphRequest, opts ...gax.CallOption) (*aiplatformpb.LineageSubgraph, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "artifact", url.QueryEscape(req.GetArtifact()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).QueryArtifactLineageSubgraph[0:len((*c.CallOptions).QueryArtifactLineageSubgraph):len((*c.CallOptions).QueryArtifactLineageSubgraph)], opts...) + var resp *aiplatformpb.LineageSubgraph + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metadataClient.QueryArtifactLineageSubgraph(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateMetadataStoreOperation manages a long-running operation from CreateMetadataStore. +type CreateMetadataStoreOperation struct { + lro *longrunning.Operation +} + +// CreateMetadataStoreOperation returns a new CreateMetadataStoreOperation from a given name. +// The name must be that of a previously created CreateMetadataStoreOperation, possibly from a different process. +func (c *metadataGRPCClient) CreateMetadataStoreOperation(name string) *CreateMetadataStoreOperation { + return &CreateMetadataStoreOperation{ + 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 *CreateMetadataStoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.MetadataStore, error) { + var resp aiplatformpb.MetadataStore + 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 *CreateMetadataStoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.MetadataStore, error) { + var resp aiplatformpb.MetadataStore + 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 *CreateMetadataStoreOperation) Metadata() (*aiplatformpb.CreateMetadataStoreOperationMetadata, error) { + var meta aiplatformpb.CreateMetadataStoreOperationMetadata + 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 *CreateMetadataStoreOperation) 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 *CreateMetadataStoreOperation) Name() string { + return op.lro.Name() +} + +// DeleteArtifactOperation manages a long-running operation from DeleteArtifact. +type DeleteArtifactOperation struct { + lro *longrunning.Operation +} + +// DeleteArtifactOperation returns a new DeleteArtifactOperation from a given name. +// The name must be that of a previously created DeleteArtifactOperation, possibly from a different process. +func (c *metadataGRPCClient) DeleteArtifactOperation(name string) *DeleteArtifactOperation { + return &DeleteArtifactOperation{ + 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 *DeleteArtifactOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteArtifactOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteArtifactOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteArtifactOperation) 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 *DeleteArtifactOperation) Name() string { + return op.lro.Name() +} + +// DeleteContextOperation manages a long-running operation from DeleteContext. +type DeleteContextOperation struct { + lro *longrunning.Operation +} + +// DeleteContextOperation returns a new DeleteContextOperation from a given name. +// The name must be that of a previously created DeleteContextOperation, possibly from a different process. +func (c *metadataGRPCClient) DeleteContextOperation(name string) *DeleteContextOperation { + return &DeleteContextOperation{ + 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 *DeleteContextOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteContextOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteContextOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteContextOperation) 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 *DeleteContextOperation) Name() string { + return op.lro.Name() +} + +// DeleteExecutionOperation manages a long-running operation from DeleteExecution. +type DeleteExecutionOperation struct { + lro *longrunning.Operation +} + +// DeleteExecutionOperation returns a new DeleteExecutionOperation from a given name. +// The name must be that of a previously created DeleteExecutionOperation, possibly from a different process. +func (c *metadataGRPCClient) DeleteExecutionOperation(name string) *DeleteExecutionOperation { + return &DeleteExecutionOperation{ + 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 *DeleteExecutionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteExecutionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteExecutionOperation) Metadata() (*aiplatformpb.DeleteOperationMetadata, error) { + var meta aiplatformpb.DeleteOperationMetadata + 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 *DeleteExecutionOperation) 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 *DeleteExecutionOperation) Name() string { + return op.lro.Name() +} + +// DeleteMetadataStoreOperation manages a long-running operation from DeleteMetadataStore. +type DeleteMetadataStoreOperation struct { + lro *longrunning.Operation +} + +// DeleteMetadataStoreOperation returns a new DeleteMetadataStoreOperation from a given name. +// The name must be that of a previously created DeleteMetadataStoreOperation, possibly from a different process. +func (c *metadataGRPCClient) DeleteMetadataStoreOperation(name string) *DeleteMetadataStoreOperation { + return &DeleteMetadataStoreOperation{ + 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 *DeleteMetadataStoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteMetadataStoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteMetadataStoreOperation) Metadata() (*aiplatformpb.DeleteMetadataStoreOperationMetadata, error) { + var meta aiplatformpb.DeleteMetadataStoreOperationMetadata + 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 *DeleteMetadataStoreOperation) 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 *DeleteMetadataStoreOperation) Name() string { + return op.lro.Name() +} + +// PurgeArtifactsOperation manages a long-running operation from PurgeArtifacts. +type PurgeArtifactsOperation struct { + lro *longrunning.Operation +} + +// PurgeArtifactsOperation returns a new PurgeArtifactsOperation from a given name. +// The name must be that of a previously created PurgeArtifactsOperation, possibly from a different process. +func (c *metadataGRPCClient) PurgeArtifactsOperation(name string) *PurgeArtifactsOperation { + return &PurgeArtifactsOperation{ + 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 *PurgeArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeArtifactsResponse, error) { + var resp aiplatformpb.PurgeArtifactsResponse + 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 *PurgeArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeArtifactsResponse, error) { + var resp aiplatformpb.PurgeArtifactsResponse + 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 *PurgeArtifactsOperation) Metadata() (*aiplatformpb.PurgeArtifactsMetadata, error) { + var meta aiplatformpb.PurgeArtifactsMetadata + 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 *PurgeArtifactsOperation) 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 *PurgeArtifactsOperation) Name() string { + return op.lro.Name() +} + +// PurgeContextsOperation manages a long-running operation from PurgeContexts. +type PurgeContextsOperation struct { + lro *longrunning.Operation +} + +// PurgeContextsOperation returns a new PurgeContextsOperation from a given name. +// The name must be that of a previously created PurgeContextsOperation, possibly from a different process. +func (c *metadataGRPCClient) PurgeContextsOperation(name string) *PurgeContextsOperation { + return &PurgeContextsOperation{ + 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 *PurgeContextsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeContextsResponse, error) { + var resp aiplatformpb.PurgeContextsResponse + 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 *PurgeContextsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeContextsResponse, error) { + var resp aiplatformpb.PurgeContextsResponse + 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 *PurgeContextsOperation) Metadata() (*aiplatformpb.PurgeContextsMetadata, error) { + var meta aiplatformpb.PurgeContextsMetadata + 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 *PurgeContextsOperation) 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 *PurgeContextsOperation) Name() string { + return op.lro.Name() +} + +// PurgeExecutionsOperation manages a long-running operation from PurgeExecutions. +type PurgeExecutionsOperation struct { + lro *longrunning.Operation +} + +// PurgeExecutionsOperation returns a new PurgeExecutionsOperation from a given name. +// The name must be that of a previously created PurgeExecutionsOperation, possibly from a different process. +func (c *metadataGRPCClient) PurgeExecutionsOperation(name string) *PurgeExecutionsOperation { + return &PurgeExecutionsOperation{ + 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 *PurgeExecutionsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeExecutionsResponse, error) { + var resp aiplatformpb.PurgeExecutionsResponse + 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 *PurgeExecutionsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*aiplatformpb.PurgeExecutionsResponse, error) { + var resp aiplatformpb.PurgeExecutionsResponse + 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 *PurgeExecutionsOperation) Metadata() (*aiplatformpb.PurgeExecutionsMetadata, error) { + var meta aiplatformpb.PurgeExecutionsMetadata + 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 *PurgeExecutionsOperation) 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 *PurgeExecutionsOperation) Name() string { + return op.lro.Name() +} + +// ArtifactIterator manages a stream of *aiplatformpb.Artifact. +type ArtifactIterator struct { + items []*aiplatformpb.Artifact + 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 []*aiplatformpb.Artifact, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ArtifactIterator) 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 *ArtifactIterator) Next() (*aiplatformpb.Artifact, error) { + var item *aiplatformpb.Artifact + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ArtifactIterator) bufLen() int { + return len(it.items) +} + +func (it *ArtifactIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ContextIterator manages a stream of *aiplatformpb.Context. +type ContextIterator struct { + items []*aiplatformpb.Context + 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 []*aiplatformpb.Context, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ContextIterator) 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 *ContextIterator) Next() (*aiplatformpb.Context, error) { + var item *aiplatformpb.Context + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ContextIterator) bufLen() int { + return len(it.items) +} + +func (it *ContextIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ExecutionIterator manages a stream of *aiplatformpb.Execution. +type ExecutionIterator struct { + items []*aiplatformpb.Execution + pageInfo *iterator.PageInfo + nextFunc func() error + + // Response is the raw response for the current page. + // It must be cast to the RPC response type. + // Calling Next() or InternalFetch() updates this value. + Response interface{} + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*aiplatformpb.Execution, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ExecutionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ExecutionIterator) Next() (*aiplatformpb.Execution, error) { + var item *aiplatformpb.Execution + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ExecutionIterator) bufLen() int { + return len(it.items) +} + +func (it *ExecutionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MetadataSchemaIterator manages a stream of *aiplatformpb.MetadataSchema. +type MetadataSchemaIterator struct { + items []*aiplatformpb.MetadataSchema + 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 []*aiplatformpb.MetadataSchema, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MetadataSchemaIterator) 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 *MetadataSchemaIterator) Next() (*aiplatformpb.MetadataSchema, error) { + var item *aiplatformpb.MetadataSchema + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MetadataSchemaIterator) bufLen() int { + return len(it.items) +} + +func (it *MetadataSchemaIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MetadataStoreIterator manages a stream of *aiplatformpb.MetadataStore. +type MetadataStoreIterator struct { + items []*aiplatformpb.MetadataStore + 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 []*aiplatformpb.MetadataStore, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MetadataStoreIterator) 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 *MetadataStoreIterator) Next() (*aiplatformpb.MetadataStore, error) { + var item *aiplatformpb.MetadataStore + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MetadataStoreIterator) bufLen() int { + return len(it.items) +} + +func (it *MetadataStoreIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/aiplatform/apiv1/metadata_client_example_test.go b/aiplatform/apiv1/metadata_client_example_test.go new file mode 100644 index 00000000000..d498523fc44 --- /dev/null +++ b/aiplatform/apiv1/metadata_client_example_test.go @@ -0,0 +1,719 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 aiplatform_test + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func ExampleNewMetadataClient() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleMetadataClient_CreateMetadataStore() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateMetadataStoreRequest. + } + op, err := c.CreateMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_GetMetadataStore() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetMetadataStoreRequest. + } + resp, err := c.GetMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_ListMetadataStores() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListMetadataStoresRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListMetadataStoresRequest. + } + it := c.ListMetadataStores(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetadataClient_DeleteMetadataStore() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteMetadataStoreRequest. + } + op, err := c.DeleteMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleMetadataClient_CreateArtifact() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateArtifactRequest. + } + resp, err := c.CreateArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_GetArtifact() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetArtifactRequest. + } + resp, err := c.GetArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_ListArtifacts() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListArtifactsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListArtifactsRequest. + } + it := c.ListArtifacts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetadataClient_UpdateArtifact() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateArtifactRequest. + } + resp, err := c.UpdateArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_DeleteArtifact() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteArtifactRequest. + } + op, err := c.DeleteArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleMetadataClient_PurgeArtifacts() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeArtifactsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeArtifactsRequest. + } + op, err := c.PurgeArtifacts(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_CreateContext() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateContextRequest. + } + resp, err := c.CreateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_GetContext() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetContextRequest. + } + resp, err := c.GetContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_ListContexts() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListContextsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListContextsRequest. + } + it := c.ListContexts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetadataClient_UpdateContext() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateContextRequest. + } + resp, err := c.UpdateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_DeleteContext() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteContextRequest. + } + op, err := c.DeleteContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleMetadataClient_PurgeContexts() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeContextsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeContextsRequest. + } + op, err := c.PurgeContexts(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_AddContextArtifactsAndExecutions() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddContextArtifactsAndExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddContextArtifactsAndExecutionsRequest. + } + resp, err := c.AddContextArtifactsAndExecutions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_AddContextChildren() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddContextChildrenRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddContextChildrenRequest. + } + resp, err := c.AddContextChildren(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_QueryContextLineageSubgraph() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryContextLineageSubgraphRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryContextLineageSubgraphRequest. + } + resp, err := c.QueryContextLineageSubgraph(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_CreateExecution() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateExecutionRequest. + } + resp, err := c.CreateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_GetExecution() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetExecutionRequest. + } + resp, err := c.GetExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_ListExecutions() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListExecutionsRequest. + } + it := c.ListExecutions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetadataClient_UpdateExecution() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateExecutionRequest. + } + resp, err := c.UpdateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_DeleteExecution() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteExecutionRequest. + } + op, err := c.DeleteExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleMetadataClient_PurgeExecutions() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeExecutionsRequest. + } + op, err := c.PurgeExecutions(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_AddExecutionEvents() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddExecutionEventsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddExecutionEventsRequest. + } + resp, err := c.AddExecutionEvents(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_QueryExecutionInputsAndOutputs() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryExecutionInputsAndOutputsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryExecutionInputsAndOutputsRequest. + } + resp, err := c.QueryExecutionInputsAndOutputs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_CreateMetadataSchema() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateMetadataSchemaRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateMetadataSchemaRequest. + } + resp, err := c.CreateMetadataSchema(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_GetMetadataSchema() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetMetadataSchemaRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetMetadataSchemaRequest. + } + resp, err := c.GetMetadataSchema(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetadataClient_ListMetadataSchemas() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListMetadataSchemasRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListMetadataSchemasRequest. + } + it := c.ListMetadataSchemas(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetadataClient_QueryArtifactLineageSubgraph() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryArtifactLineageSubgraphRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryArtifactLineageSubgraphRequest. + } + resp, err := c.QueryArtifactLineageSubgraph(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/aiplatform/apiv1/model_client.go b/aiplatform/apiv1/model_client.go index 290f848dfc1..b25ff138b8b 100644 --- a/aiplatform/apiv1/model_client.go +++ b/aiplatform/apiv1/model_client.go @@ -167,7 +167,8 @@ func (c *ModelClient) UpdateModel(ctx context.Context, req *aiplatformpb.UpdateM } // DeleteModel deletes a Model. -// Note: Model can only be deleted if there are no DeployedModels created +// +// Model can only be deleted if there are no DeployedModels created // from it. func (c *ModelClient) DeleteModel(ctx context.Context, req *aiplatformpb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error) { return c.internalClient.DeleteModel(ctx, req, opts...) diff --git a/aiplatform/apiv1/prediction_client.go b/aiplatform/apiv1/prediction_client.go index b773b0209a2..58ec54feffa 100644 --- a/aiplatform/apiv1/prediction_client.go +++ b/aiplatform/apiv1/prediction_client.go @@ -111,7 +111,15 @@ func (c *PredictionClient) Predict(ctx context.Context, req *aiplatformpb.Predic return c.internalClient.Predict(ctx, req, opts...) } -// RawPredict perform an online prediction with arbitrary http payload. +// RawPredict perform an online prediction with an arbitrary HTTP payload. +// +// The response includes the following HTTP headers: +// +// X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this +// prediction. +// +// X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s DeployedModel +// that served this prediction. func (c *PredictionClient) RawPredict(ctx context.Context, req *aiplatformpb.RawPredictRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { return c.internalClient.RawPredict(ctx, req, opts...) } diff --git a/aiplatform/go.mod b/aiplatform/go.mod index 568207a0240..f467da3d974 100644 --- a/aiplatform/go.mod +++ b/aiplatform/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.97.0 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/aiplatform/go.sum b/aiplatform/go.sum index 6802184b670..0607e65bf9d 100644 --- a/aiplatform/go.sum +++ b/aiplatform/go.sum @@ -493,8 +493,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5wp1Z6JtoBvnJzX6euyN70FoyMDXy4= -google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/dataproc/apiv1/batch_controller_client.go b/dataproc/apiv1/batch_controller_client.go new file mode 100644 index 00000000000..ddf430121a7 --- /dev/null +++ b/dataproc/apiv1/batch_controller_client.go @@ -0,0 +1,450 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 dataproc + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" +) + +var newBatchControllerClientHook clientHook + +// BatchControllerCallOptions contains the retry settings for each method of BatchControllerClient. +type BatchControllerCallOptions struct { + CreateBatch []gax.CallOption + GetBatch []gax.CallOption + ListBatches []gax.CallOption + DeleteBatch []gax.CallOption +} + +func defaultBatchControllerGRPCClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("dataproc.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("dataproc.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://dataproc.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultBatchControllerCallOptions() *BatchControllerCallOptions { + return &BatchControllerCallOptions{ + CreateBatch: []gax.CallOption{}, + GetBatch: []gax.CallOption{}, + ListBatches: []gax.CallOption{}, + DeleteBatch: []gax.CallOption{}, + } +} + +// internalBatchControllerClient is an interface that defines the methods availaible from Cloud Dataproc API. +type internalBatchControllerClient interface { + Close() error + setGoogleClientInfo(...string) + Connection() *grpc.ClientConn + CreateBatch(context.Context, *dataprocpb.CreateBatchRequest, ...gax.CallOption) (*CreateBatchOperation, error) + CreateBatchOperation(name string) *CreateBatchOperation + GetBatch(context.Context, *dataprocpb.GetBatchRequest, ...gax.CallOption) (*dataprocpb.Batch, error) + ListBatches(context.Context, *dataprocpb.ListBatchesRequest, ...gax.CallOption) *BatchIterator + DeleteBatch(context.Context, *dataprocpb.DeleteBatchRequest, ...gax.CallOption) error +} + +// BatchControllerClient is a client for interacting with Cloud Dataproc API. +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// The BatchController provides methods to manage batch workloads. +type BatchControllerClient struct { + // The internal transport-dependent client. + internalClient internalBatchControllerClient + + // The call options for this service. + CallOptions *BatchControllerCallOptions + + // 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 *BatchControllerClient) 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 *BatchControllerClient) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *BatchControllerClient) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// CreateBatch creates a batch workload that executes asynchronously. +func (c *BatchControllerClient) CreateBatch(ctx context.Context, req *dataprocpb.CreateBatchRequest, opts ...gax.CallOption) (*CreateBatchOperation, error) { + return c.internalClient.CreateBatch(ctx, req, opts...) +} + +// CreateBatchOperation returns a new CreateBatchOperation from a given name. +// The name must be that of a previously created CreateBatchOperation, possibly from a different process. +func (c *BatchControllerClient) CreateBatchOperation(name string) *CreateBatchOperation { + return c.internalClient.CreateBatchOperation(name) +} + +// GetBatch gets the batch workload resource representation. +func (c *BatchControllerClient) GetBatch(ctx context.Context, req *dataprocpb.GetBatchRequest, opts ...gax.CallOption) (*dataprocpb.Batch, error) { + return c.internalClient.GetBatch(ctx, req, opts...) +} + +// ListBatches lists batch workloads. +func (c *BatchControllerClient) ListBatches(ctx context.Context, req *dataprocpb.ListBatchesRequest, opts ...gax.CallOption) *BatchIterator { + return c.internalClient.ListBatches(ctx, req, opts...) +} + +// DeleteBatch deletes the batch workload resource. If the batch is not in terminal state, +// the delete fails and the response returns FAILED_PRECONDITION. +func (c *BatchControllerClient) DeleteBatch(ctx context.Context, req *dataprocpb.DeleteBatchRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteBatch(ctx, req, opts...) +} + +// batchControllerGRPCClient is a client for interacting with Cloud Dataproc API over gRPC transport. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type batchControllerGRPCClient 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 BatchControllerClient + CallOptions **BatchControllerCallOptions + + // The gRPC API client. + batchControllerClient dataprocpb.BatchControllerClient + + // 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 +} + +// NewBatchControllerClient creates a new batch controller client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. +// +// The BatchController provides methods to manage batch workloads. +func NewBatchControllerClient(ctx context.Context, opts ...option.ClientOption) (*BatchControllerClient, error) { + clientOpts := defaultBatchControllerGRPCClientOptions() + if newBatchControllerClientHook != nil { + hookOpts, err := newBatchControllerClientHook(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 := BatchControllerClient{CallOptions: defaultBatchControllerCallOptions()} + + c := &batchControllerGRPCClient{ + connPool: connPool, + disableDeadlines: disableDeadlines, + batchControllerClient: dataprocpb.NewBatchControllerClient(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 *batchControllerGRPCClient) 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 *batchControllerGRPCClient) 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 *batchControllerGRPCClient) Close() error { + return c.connPool.Close() +} + +func (c *batchControllerGRPCClient) CreateBatch(ctx context.Context, req *dataprocpb.CreateBatchRequest, opts ...gax.CallOption) (*CreateBatchOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CreateBatch[0:len((*c.CallOptions).CreateBatch):len((*c.CallOptions).CreateBatch)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.batchControllerClient.CreateBatch(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateBatchOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + +func (c *batchControllerGRPCClient) GetBatch(ctx context.Context, req *dataprocpb.GetBatchRequest, opts ...gax.CallOption) (*dataprocpb.Batch, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).GetBatch[0:len((*c.CallOptions).GetBatch):len((*c.CallOptions).GetBatch)], opts...) + var resp *dataprocpb.Batch + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.batchControllerClient.GetBatch(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *batchControllerGRPCClient) ListBatches(ctx context.Context, req *dataprocpb.ListBatchesRequest, opts ...gax.CallOption) *BatchIterator { + 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).ListBatches[0:len((*c.CallOptions).ListBatches):len((*c.CallOptions).ListBatches)], opts...) + it := &BatchIterator{} + req = proto.Clone(req).(*dataprocpb.ListBatchesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.Batch, string, error) { + resp := &dataprocpb.ListBatchesResponse{} + if pageToken != "" { + req.PageToken = pageToken + } + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else if pageSize != 0 { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.batchControllerClient.ListBatches(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetBatches(), 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 *batchControllerGRPCClient) DeleteBatch(ctx context.Context, req *dataprocpb.DeleteBatchRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).DeleteBatch[0:len((*c.CallOptions).DeleteBatch):len((*c.CallOptions).DeleteBatch)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.batchControllerClient.DeleteBatch(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateBatchOperation manages a long-running operation from CreateBatch. +type CreateBatchOperation struct { + lro *longrunning.Operation +} + +// CreateBatchOperation returns a new CreateBatchOperation from a given name. +// The name must be that of a previously created CreateBatchOperation, possibly from a different process. +func (c *batchControllerGRPCClient) CreateBatchOperation(name string) *CreateBatchOperation { + return &CreateBatchOperation{ + 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 *CreateBatchOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Batch, error) { + var resp dataprocpb.Batch + 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 *CreateBatchOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Batch, error) { + var resp dataprocpb.Batch + 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 *CreateBatchOperation) Metadata() (*dataprocpb.BatchOperationMetadata, error) { + var meta dataprocpb.BatchOperationMetadata + 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 *CreateBatchOperation) 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 *CreateBatchOperation) Name() string { + return op.lro.Name() +} + +// BatchIterator manages a stream of *dataprocpb.Batch. +type BatchIterator struct { + items []*dataprocpb.Batch + 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 []*dataprocpb.Batch, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *BatchIterator) 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 *BatchIterator) Next() (*dataprocpb.Batch, error) { + var item *dataprocpb.Batch + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *BatchIterator) bufLen() int { + return len(it.items) +} + +func (it *BatchIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/dataproc/apiv1/batch_controller_client_example_test.go b/dataproc/apiv1/batch_controller_client_example_test.go new file mode 100644 index 00000000000..9f9ccd24cb0 --- /dev/null +++ b/dataproc/apiv1/batch_controller_client_example_test.go @@ -0,0 +1,126 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.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 dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func ExampleNewBatchControllerClient() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + // TODO: Use client. + _ = c +} + +func ExampleBatchControllerClient_CreateBatch() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.CreateBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#CreateBatchRequest. + } + op, err := c.CreateBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBatchControllerClient_GetBatch() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.GetBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#GetBatchRequest. + } + resp, err := c.GetBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleBatchControllerClient_ListBatches() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.ListBatchesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#ListBatchesRequest. + } + it := c.ListBatches(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleBatchControllerClient_DeleteBatch() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.DeleteBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#DeleteBatchRequest. + } + err = c.DeleteBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/dataproc/apiv1/cluster_controller_client.go b/dataproc/apiv1/cluster_controller_client.go index af61065efc3..7be4ec159b8 100644 --- a/dataproc/apiv1/cluster_controller_client.go +++ b/dataproc/apiv1/cluster_controller_client.go @@ -219,6 +219,8 @@ func (c *ClusterControllerClient) CreateClusterOperation(name string) *CreateClu // UpdateCluster updates a cluster in a project. The returned // Operation.metadata will be // ClusterOperationMetadata (at https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). +// The cluster must be in a [RUNNING][google.cloud.dataproc.v1.ClusterStatus.State] state or an error +// is returned. func (c *ClusterControllerClient) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error) { return c.internalClient.UpdateCluster(ctx, req, opts...) } diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index 95b720a3033..8989e50d3be 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -84,7 +84,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210921" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/dataproc/apiv1/gapic_metadata.json b/dataproc/apiv1/gapic_metadata.json index 0d02cbf337d..5a2ad2f2bb1 100644 --- a/dataproc/apiv1/gapic_metadata.json +++ b/dataproc/apiv1/gapic_metadata.json @@ -39,6 +39,35 @@ } } }, + "BatchController": { + "clients": { + "grpc": { + "libraryClient": "BatchControllerClient", + "rpcs": { + "CreateBatch": { + "methods": [ + "CreateBatch" + ] + }, + "DeleteBatch": { + "methods": [ + "DeleteBatch" + ] + }, + "GetBatch": { + "methods": [ + "GetBatch" + ] + }, + "ListBatches": { + "methods": [ + "ListBatches" + ] + } + } + } + } + }, "ClusterController": { "clients": { "grpc": { diff --git a/dataproc/apiv1/workflow_template_client.go b/dataproc/apiv1/workflow_template_client.go index cb56915cecc..cade39b33ce 100644 --- a/dataproc/apiv1/workflow_template_client.go +++ b/dataproc/apiv1/workflow_template_client.go @@ -252,8 +252,7 @@ func (c *WorkflowTemplateClient) InstantiateWorkflowTemplateOperation(name strin // InstantiateInlineWorkflowTemplate instantiates a template and begins execution. // // This method is equivalent to executing the sequence -// CreateWorkflowTemplate, -// InstantiateWorkflowTemplate, +// CreateWorkflowTemplate, InstantiateWorkflowTemplate, // DeleteWorkflowTemplate. // // The returned Operation can be used to track execution of diff --git a/dataproc/go.mod b/dataproc/go.mod index b40ccad5692..cba6da8b1ce 100644 --- a/dataproc/go.mod +++ b/dataproc/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/dataproc/go.sum b/dataproc/go.sum index 3fd8b5ffab7..0607e65bf9d 100644 --- a/dataproc/go.sum +++ b/dataproc/go.sum @@ -492,8 +492,9 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index 33cc8bcfa40..bffe4ab11ad 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -92,7 +92,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210921" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/datastore/go.mod b/datastore/go.mod index 7202a00b9b7..ddc16fa7543 100644 --- a/datastore/go.mod +++ b/datastore/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.5.6 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/datastore/go.sum b/datastore/go.sum index 3fd8b5ffab7..0607e65bf9d 100644 --- a/datastore/go.sum +++ b/datastore/go.sum @@ -492,8 +492,9 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/go.mod b/go.mod index eab496b5bb5..37197ddb391 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 5c9902de142..a40a9b4b998 100644 --- a/go.sum +++ b/go.sum @@ -492,8 +492,8 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178 h1:sjksfRCbEowdKjfEEAUtbT/Ji7rS6z/Rr/075r57JLQ= -google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchCreateFeatures/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchCreateFeatures/main.go new file mode 100644 index 00000000000..2dc4f18a820 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchCreateFeatures/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.BatchCreateFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#BatchCreateFeaturesRequest. + } + op, err := c.BatchCreateFeatures(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_BatchCreateFeatures_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchReadFeatureValues/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchReadFeatureValues/main.go new file mode 100644 index 00000000000..2a35d0ac3e3 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/BatchReadFeatureValues/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.BatchReadFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#BatchReadFeatureValuesRequest. + } + op, err := c.BatchReadFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_BatchReadFeatureValues_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateEntityType/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateEntityType/main.go new file mode 100644 index 00000000000..a99778693a0 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateEntityType/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_CreateEntityType_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateEntityTypeRequest. + } + op, err := c.CreateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_CreateEntityType_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeature/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeature/main.go new file mode 100644 index 00000000000..46c2a894604 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeature/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeature_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateFeatureRequest. + } + op, err := c.CreateFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeature_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeaturestore/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeaturestore/main.go new file mode 100644 index 00000000000..2cb64de7b31 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/CreateFeaturestore/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateFeaturestoreRequest. + } + op, err := c.CreateFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_CreateFeaturestore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteEntityType/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteEntityType/main.go new file mode 100644 index 00000000000..fac171e118e --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteEntityType/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteEntityTypeRequest. + } + op, err := c.DeleteEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_DeleteEntityType_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeature/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeature/main.go new file mode 100644 index 00000000000..27dbdc6b3b9 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeature/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeature_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteFeatureRequest. + } + op, err := c.DeleteFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeature_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeaturestore/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeaturestore/main.go new file mode 100644 index 00000000000..b03848e7e8d --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/DeleteFeaturestore/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteFeaturestoreRequest. + } + op, err := c.DeleteFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_DeleteFeaturestore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ExportFeatureValues/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ExportFeatureValues/main.go new file mode 100644 index 00000000000..02121dade86 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ExportFeatureValues/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ExportFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ExportFeatureValuesRequest. + } + op, err := c.ExportFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_ExportFeatureValues_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetEntityType/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetEntityType/main.go new file mode 100644 index 00000000000..73e955b4165 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetEntityType/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_GetEntityType_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetEntityTypeRequest. + } + resp, err := c.GetEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_GetEntityType_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeature/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeature/main.go new file mode 100644 index 00000000000..3659cc2c7c5 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeature/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeature_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetFeatureRequest. + } + resp, err := c.GetFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_GetFeature_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeaturestore/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeaturestore/main.go new file mode 100644 index 00000000000..4d6f5caec93 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/GetFeaturestore/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetFeaturestoreRequest. + } + resp, err := c.GetFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_GetFeaturestore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ImportFeatureValues/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ImportFeatureValues/main.go new file mode 100644 index 00000000000..05c0d96f316 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ImportFeatureValues/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ImportFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ImportFeatureValuesRequest. + } + op, err := c.ImportFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_ImportFeatureValues_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListEntityTypes/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListEntityTypes/main.go new file mode 100644 index 00000000000..5bfaf448721 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListEntityTypes/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListEntityTypesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListEntityTypesRequest. + } + it := c.ListEntityTypes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeatures/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeatures/main.go new file mode 100644 index 00000000000..346731e92ca --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeatures/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListFeaturesRequest. + } + it := c.ListFeatures(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_ListFeatures_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeaturestores/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeaturestores/main.go new file mode 100644 index 00000000000..52d6648053a --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/ListFeaturestores/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListFeaturestoresRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListFeaturestoresRequest. + } + it := c.ListFeaturestores(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_ListFeaturestores_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/SearchFeatures/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/SearchFeatures/main.go new file mode 100644 index 00000000000..15ac3b7fe85 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/SearchFeatures/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_SearchFeatures_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.SearchFeaturesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#SearchFeaturesRequest. + } + it := c.SearchFeatures(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_FeaturestoreService_SearchFeatures_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateEntityType/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateEntityType/main.go new file mode 100644 index 00000000000..a751b52ec56 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateEntityType/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateEntityTypeRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateEntityTypeRequest. + } + resp, err := c.UpdateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_UpdateEntityType_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeature/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeature/main.go new file mode 100644 index 00000000000..45b19a15c05 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeature/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeature_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateFeatureRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateFeatureRequest. + } + resp, err := c.UpdateFeature(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeature_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeaturestore/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeaturestore/main.go new file mode 100644 index 00000000000..d186d9e2502 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreClient/UpdateFeaturestore/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateFeaturestoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateFeaturestoreRequest. + } + op, err := c.UpdateFeaturestore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreService_UpdateFeaturestore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/FeaturestoreOnlineServingClient/ReadFeatureValues/main.go b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreOnlineServingClient/ReadFeatureValues/main.go new file mode 100644 index 00000000000..30060c39f6d --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/FeaturestoreOnlineServingClient/ReadFeatureValues/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewFeaturestoreOnlineServingClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ReadFeatureValuesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ReadFeatureValuesRequest. + } + resp, err := c.ReadFeatureValues(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_FeaturestoreOnlineServingService_ReadFeatureValues_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextArtifactsAndExecutions/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextArtifactsAndExecutions/main.go new file mode 100644 index 00000000000..fec4b222221 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextArtifactsAndExecutions/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddContextArtifactsAndExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddContextArtifactsAndExecutionsRequest. + } + resp, err := c.AddContextArtifactsAndExecutions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_AddContextArtifactsAndExecutions_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextChildren/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextChildren/main.go new file mode 100644 index 00000000000..607f9e289c1 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddContextChildren/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_AddContextChildren_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddContextChildrenRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddContextChildrenRequest. + } + resp, err := c.AddContextChildren(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_AddContextChildren_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddExecutionEvents/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddExecutionEvents/main.go new file mode 100644 index 00000000000..1af8c1c581f --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/AddExecutionEvents/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_AddExecutionEvents_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.AddExecutionEventsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#AddExecutionEventsRequest. + } + resp, err := c.AddExecutionEvents(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_AddExecutionEvents_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateArtifact/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateArtifact/main.go new file mode 100644 index 00000000000..279b17fd0b7 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateArtifact/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_CreateArtifact_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateArtifactRequest. + } + resp, err := c.CreateArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_CreateArtifact_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateContext/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateContext/main.go new file mode 100644 index 00000000000..7e04837bf47 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateContext/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_CreateContext_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateContextRequest. + } + resp, err := c.CreateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_CreateContext_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateExecution/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateExecution/main.go new file mode 100644 index 00000000000..55bb0b0c2c0 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateExecution/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_CreateExecution_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateExecutionRequest. + } + resp, err := c.CreateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_CreateExecution_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataSchema/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataSchema/main.go new file mode 100644 index 00000000000..241f1440857 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataSchema/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataSchema_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateMetadataSchemaRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateMetadataSchemaRequest. + } + resp, err := c.CreateMetadataSchema(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_CreateMetadataSchema_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataStore/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataStore/main.go new file mode 100644 index 00000000000..016d7c8f35f --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/CreateMetadataStore/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_CreateMetadataStore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.CreateMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateMetadataStoreRequest. + } + op, err := c.CreateMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_CreateMetadataStore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteArtifact/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteArtifact/main.go new file mode 100644 index 00000000000..bf1a8a11c62 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteArtifact/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_DeleteArtifact_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteArtifactRequest. + } + op, err := c.DeleteArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_MetadataService_DeleteArtifact_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteContext/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteContext/main.go new file mode 100644 index 00000000000..54065d6cefc --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteContext/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_DeleteContext_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteContextRequest. + } + op, err := c.DeleteContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_MetadataService_DeleteContext_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteExecution/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteExecution/main.go new file mode 100644 index 00000000000..f49c9ce476f --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteExecution/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_DeleteExecution_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteExecutionRequest. + } + op, err := c.DeleteExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_MetadataService_DeleteExecution_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteMetadataStore/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteMetadataStore/main.go new file mode 100644 index 00000000000..536236a3fbb --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/DeleteMetadataStore/main.go @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_DeleteMetadataStore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.DeleteMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#DeleteMetadataStoreRequest. + } + op, err := c.DeleteMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +// [END aiplatform_v1_generated_MetadataService_DeleteMetadataStore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetArtifact/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetArtifact/main.go new file mode 100644 index 00000000000..65fe8d447fe --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetArtifact/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_GetArtifact_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetArtifactRequest. + } + resp, err := c.GetArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_GetArtifact_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetContext/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetContext/main.go new file mode 100644 index 00000000000..a308f31cc10 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetContext/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_GetContext_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetContextRequest. + } + resp, err := c.GetContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_GetContext_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetExecution/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetExecution/main.go new file mode 100644 index 00000000000..f99b6a14bd5 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetExecution/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_GetExecution_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetExecutionRequest. + } + resp, err := c.GetExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_GetExecution_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataSchema/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataSchema/main.go new file mode 100644 index 00000000000..a208b4685ab --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataSchema/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_GetMetadataSchema_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetMetadataSchemaRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetMetadataSchemaRequest. + } + resp, err := c.GetMetadataSchema(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_GetMetadataSchema_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataStore/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataStore/main.go new file mode 100644 index 00000000000..96fa708b7e4 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/GetMetadataStore/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_GetMetadataStore_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.GetMetadataStoreRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#GetMetadataStoreRequest. + } + resp, err := c.GetMetadataStore(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_GetMetadataStore_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListArtifacts/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListArtifacts/main.go new file mode 100644 index 00000000000..318312e6bd3 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListArtifacts/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_ListArtifacts_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListArtifactsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListArtifactsRequest. + } + it := c.ListArtifacts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_MetadataService_ListArtifacts_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListContexts/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListContexts/main.go new file mode 100644 index 00000000000..dcb68d6bc10 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListContexts/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_ListContexts_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListContextsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListContextsRequest. + } + it := c.ListContexts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_MetadataService_ListContexts_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListExecutions/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListExecutions/main.go new file mode 100644 index 00000000000..a7d50bffacf --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListExecutions/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_ListExecutions_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListExecutionsRequest. + } + it := c.ListExecutions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_MetadataService_ListExecutions_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataSchemas/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataSchemas/main.go new file mode 100644 index 00000000000..523509a096d --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataSchemas/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_ListMetadataSchemas_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListMetadataSchemasRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListMetadataSchemasRequest. + } + it := c.ListMetadataSchemas(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_MetadataService_ListMetadataSchemas_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataStores/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataStores/main.go new file mode 100644 index 00000000000..066805fca06 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/ListMetadataStores/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_ListMetadataStores_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + "google.golang.org/api/iterator" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.ListMetadataStoresRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#ListMetadataStoresRequest. + } + it := c.ListMetadataStores(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END aiplatform_v1_generated_MetadataService_ListMetadataStores_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeArtifacts/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeArtifacts/main.go new file mode 100644 index 00000000000..d402d597bd9 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeArtifacts/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_PurgeArtifacts_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeArtifactsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeArtifactsRequest. + } + op, err := c.PurgeArtifacts(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_PurgeArtifacts_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeContexts/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeContexts/main.go new file mode 100644 index 00000000000..cc699a5d5f2 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeContexts/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_PurgeContexts_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeContextsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeContextsRequest. + } + op, err := c.PurgeContexts(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_PurgeContexts_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeExecutions/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeExecutions/main.go new file mode 100644 index 00000000000..42ae9345292 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/PurgeExecutions/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_PurgeExecutions_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.PurgeExecutionsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#PurgeExecutionsRequest. + } + op, err := c.PurgeExecutions(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_PurgeExecutions_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryArtifactLineageSubgraph/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryArtifactLineageSubgraph/main.go new file mode 100644 index 00000000000..98eca1c28b9 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryArtifactLineageSubgraph/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryArtifactLineageSubgraphRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryArtifactLineageSubgraphRequest. + } + resp, err := c.QueryArtifactLineageSubgraph(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_QueryArtifactLineageSubgraph_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryContextLineageSubgraph/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryContextLineageSubgraph/main.go new file mode 100644 index 00000000000..3235aa29c4e --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryContextLineageSubgraph/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryContextLineageSubgraphRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryContextLineageSubgraphRequest. + } + resp, err := c.QueryContextLineageSubgraph(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_QueryContextLineageSubgraph_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryExecutionInputsAndOutputs/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryExecutionInputsAndOutputs/main.go new file mode 100644 index 00000000000..4d3ebd22042 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/QueryExecutionInputsAndOutputs/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.QueryExecutionInputsAndOutputsRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#QueryExecutionInputsAndOutputsRequest. + } + resp, err := c.QueryExecutionInputsAndOutputs(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_QueryExecutionInputsAndOutputs_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateArtifact/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateArtifact/main.go new file mode 100644 index 00000000000..4ae6a614f68 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateArtifact/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_UpdateArtifact_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateArtifactRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateArtifactRequest. + } + resp, err := c.UpdateArtifact(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_UpdateArtifact_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateContext/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateContext/main.go new file mode 100644 index 00000000000..8bd62db26c7 --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateContext/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_UpdateContext_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateContextRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateContextRequest. + } + resp, err := c.UpdateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_UpdateContext_sync] diff --git a/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateExecution/main.go b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateExecution/main.go new file mode 100644 index 00000000000..55c78ad923d --- /dev/null +++ b/internal/generated/snippets/aiplatform/apiv1/MetadataClient/UpdateExecution/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START aiplatform_v1_generated_MetadataService_UpdateExecution_sync] + +package main + +import ( + "context" + + aiplatform "cloud.google.com/go/aiplatform/apiv1" + aiplatformpb "google.golang.org/genproto/googleapis/cloud/aiplatform/v1" +) + +func main() { + ctx := context.Background() + c, err := aiplatform.NewMetadataClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &aiplatformpb.UpdateExecutionRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#UpdateExecutionRequest. + } + resp, err := c.UpdateExecution(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END aiplatform_v1_generated_MetadataService_UpdateExecution_sync] diff --git a/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/CreateBatch/main.go b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/CreateBatch/main.go new file mode 100644 index 00000000000..e5e348217fd --- /dev/null +++ b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/CreateBatch/main.go @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataproc_v1_generated_BatchController_CreateBatch_sync] + +package main + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func main() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.CreateBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#CreateBatchRequest. + } + op, err := c.CreateBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataproc_v1_generated_BatchController_CreateBatch_sync] diff --git a/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/DeleteBatch/main.go b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/DeleteBatch/main.go new file mode 100644 index 00000000000..6a427388570 --- /dev/null +++ b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/DeleteBatch/main.go @@ -0,0 +1,46 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataproc_v1_generated_BatchController_DeleteBatch_sync] + +package main + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func main() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.DeleteBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#DeleteBatchRequest. + } + err = c.DeleteBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +// [END dataproc_v1_generated_BatchController_DeleteBatch_sync] diff --git a/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/GetBatch/main.go b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/GetBatch/main.go new file mode 100644 index 00000000000..b0ebdcbec8a --- /dev/null +++ b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/GetBatch/main.go @@ -0,0 +1,48 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataproc_v1_generated_BatchController_GetBatch_sync] + +package main + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func main() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.GetBatchRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#GetBatchRequest. + } + resp, err := c.GetBatch(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END dataproc_v1_generated_BatchController_GetBatch_sync] diff --git a/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/ListBatches/main.go b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/ListBatches/main.go new file mode 100644 index 00000000000..bfc11c2e166 --- /dev/null +++ b/internal/generated/snippets/dataproc/apiv1/BatchControllerClient/ListBatches/main.go @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START dataproc_v1_generated_BatchController_ListBatches_sync] + +package main + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func main() { + ctx := context.Background() + c, err := dataproc.NewBatchControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &dataprocpb.ListBatchesRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#ListBatchesRequest. + } + it := c.ListBatches(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +// [END dataproc_v1_generated_BatchController_ListBatches_sync] diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index bf7c70f4289..5c47285a30c 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -125,7 +125,7 @@ require ( cloud.google.com/go/websecurityscanner v0.1.0 cloud.google.com/go/workflows v0.1.0 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index ef737218610..f4ddda5ece0 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -162,8 +162,9 @@ google.golang.org/genproto v0.0.0-20210927142257-433400c27d05/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178 h1:sjksfRCbEowdKjfEEAUtbT/Ji7rS6z/Rr/075r57JLQ= google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index b8f936a19e6..8099747671c 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -314,8 +314,8 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178 h1:sjksfRCbEowdKjfEEAUtbT/Ji7rS6z/Rr/075r57JLQ= -google.golang.org/genproto v0.0.0-20211012143446-e1d23e1da178/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index f483eaffc38..7d7e1343102 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -95,7 +95,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20211008" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/monitoring/go.mod b/monitoring/go.mod index 90ff0fe555f..1a118399c0f 100644 --- a/monitoring/go.mod +++ b/monitoring/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20211008145708-270636b82663 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/monitoring/go.sum b/monitoring/go.sum index e873bf39b81..0607e65bf9d 100644 --- a/monitoring/go.sum +++ b/monitoring/go.sum @@ -493,8 +493,8 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663 h1:33YYJanAOLxgS7pGjzC1IUrFLpwN//bbgtnKYikOmQU= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/monitoring/metricsscope/apiv1/doc.go b/monitoring/metricsscope/apiv1/doc.go index e34b2e4ccf3..92e4580f768 100644 --- a/monitoring/metricsscope/apiv1/doc.go +++ b/monitoring/metricsscope/apiv1/doc.go @@ -91,7 +91,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210929" +const versionClient = "20211013" 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 f39fda95821..380a54ce949 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -10,7 +10,7 @@ require ( golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/storage/go.sum b/storage/go.sum index 181c5ef033a..ee376ea36ef 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -496,8 +496,9 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/video/go.mod b/video/go.mod index 021c8065520..7cda5f2c87a 100644 --- a/video/go.mod +++ b/video/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/googleapis/gax-go/v2 v2.1.1 google.golang.org/api v0.58.0 - google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 + google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 ) diff --git a/video/go.sum b/video/go.sum index ff65d3aefe4..3660c6b4a88 100644 --- a/video/go.sum +++ b/video/go.sum @@ -488,8 +488,8 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 h1:2ncG/LajxmrclaZH+ppVi02rQxz4eXYJzGHdFN4Y9UA= -google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= +google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/video/transcoder/apiv1/doc.go b/video/transcoder/apiv1/doc.go index 2525804df62..f1552f55e7d 100644 --- a/video/transcoder/apiv1/doc.go +++ b/video/transcoder/apiv1/doc.go @@ -85,7 +85,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210921" +const versionClient = "20211013" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx)