cloud.google.com/go/aiplatform@v1.106.0/apiv1beta1/deployment_resource_pool_client.go (about)

     1  // Copyright 2025 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     https://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
    16  
    17  package aiplatform
    18  
    19  import (
    20  	"bytes"
    21  	"context"
    22  	"fmt"
    23  	"log/slog"
    24  	"math"
    25  	"net/http"
    26  	"net/url"
    27  
    28  	aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb"
    29  	iampb "cloud.google.com/go/iam/apiv1/iampb"
    30  	"cloud.google.com/go/longrunning"
    31  	lroauto "cloud.google.com/go/longrunning/autogen"
    32  	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
    33  	gax "github.com/googleapis/gax-go/v2"
    34  	"google.golang.org/api/iterator"
    35  	"google.golang.org/api/option"
    36  	"google.golang.org/api/option/internaloption"
    37  	gtransport "google.golang.org/api/transport/grpc"
    38  	httptransport "google.golang.org/api/transport/http"
    39  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    40  	"google.golang.org/grpc"
    41  	"google.golang.org/protobuf/encoding/protojson"
    42  	"google.golang.org/protobuf/proto"
    43  )
    44  
    45  var newDeploymentResourcePoolClientHook clientHook
    46  
    47  // DeploymentResourcePoolCallOptions contains the retry settings for each method of DeploymentResourcePoolClient.
    48  type DeploymentResourcePoolCallOptions struct {
    49  	CreateDeploymentResourcePool []gax.CallOption
    50  	GetDeploymentResourcePool    []gax.CallOption
    51  	ListDeploymentResourcePools  []gax.CallOption
    52  	UpdateDeploymentResourcePool []gax.CallOption
    53  	DeleteDeploymentResourcePool []gax.CallOption
    54  	QueryDeployedModels          []gax.CallOption
    55  	GetLocation                  []gax.CallOption
    56  	ListLocations                []gax.CallOption
    57  	GetIamPolicy                 []gax.CallOption
    58  	SetIamPolicy                 []gax.CallOption
    59  	TestIamPermissions           []gax.CallOption
    60  	CancelOperation              []gax.CallOption
    61  	DeleteOperation              []gax.CallOption
    62  	GetOperation                 []gax.CallOption
    63  	ListOperations               []gax.CallOption
    64  	WaitOperation                []gax.CallOption
    65  }
    66  
    67  func defaultDeploymentResourcePoolGRPCClientOptions() []option.ClientOption {
    68  	return []option.ClientOption{
    69  		internaloption.WithDefaultEndpoint("aiplatform.googleapis.com:443"),
    70  		internaloption.WithDefaultEndpointTemplate("aiplatform.UNIVERSE_DOMAIN:443"),
    71  		internaloption.WithDefaultMTLSEndpoint("aiplatform.mtls.googleapis.com:443"),
    72  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    73  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
    74  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
    75  		internaloption.EnableJwtWithScope(),
    76  		internaloption.EnableNewAuthLibrary(),
    77  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
    78  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
    79  	}
    80  }
    81  
    82  func defaultDeploymentResourcePoolCallOptions() *DeploymentResourcePoolCallOptions {
    83  	return &DeploymentResourcePoolCallOptions{
    84  		CreateDeploymentResourcePool: []gax.CallOption{},
    85  		GetDeploymentResourcePool:    []gax.CallOption{},
    86  		ListDeploymentResourcePools:  []gax.CallOption{},
    87  		UpdateDeploymentResourcePool: []gax.CallOption{},
    88  		DeleteDeploymentResourcePool: []gax.CallOption{},
    89  		QueryDeployedModels:          []gax.CallOption{},
    90  		GetLocation:                  []gax.CallOption{},
    91  		ListLocations:                []gax.CallOption{},
    92  		GetIamPolicy:                 []gax.CallOption{},
    93  		SetIamPolicy:                 []gax.CallOption{},
    94  		TestIamPermissions:           []gax.CallOption{},
    95  		CancelOperation:              []gax.CallOption{},
    96  		DeleteOperation:              []gax.CallOption{},
    97  		GetOperation:                 []gax.CallOption{},
    98  		ListOperations:               []gax.CallOption{},
    99  		WaitOperation:                []gax.CallOption{},
   100  	}
   101  }
   102  
   103  func defaultDeploymentResourcePoolRESTCallOptions() *DeploymentResourcePoolCallOptions {
   104  	return &DeploymentResourcePoolCallOptions{
   105  		CreateDeploymentResourcePool: []gax.CallOption{},
   106  		GetDeploymentResourcePool:    []gax.CallOption{},
   107  		ListDeploymentResourcePools:  []gax.CallOption{},
   108  		UpdateDeploymentResourcePool: []gax.CallOption{},
   109  		DeleteDeploymentResourcePool: []gax.CallOption{},
   110  		QueryDeployedModels:          []gax.CallOption{},
   111  		GetLocation:                  []gax.CallOption{},
   112  		ListLocations:                []gax.CallOption{},
   113  		GetIamPolicy:                 []gax.CallOption{},
   114  		SetIamPolicy:                 []gax.CallOption{},
   115  		TestIamPermissions:           []gax.CallOption{},
   116  		CancelOperation:              []gax.CallOption{},
   117  		DeleteOperation:              []gax.CallOption{},
   118  		GetOperation:                 []gax.CallOption{},
   119  		ListOperations:               []gax.CallOption{},
   120  		WaitOperation:                []gax.CallOption{},
   121  	}
   122  }
   123  
   124  // internalDeploymentResourcePoolClient is an interface that defines the methods available from Vertex AI API.
   125  type internalDeploymentResourcePoolClient interface {
   126  	Close() error
   127  	setGoogleClientInfo(...string)
   128  	Connection() *grpc.ClientConn
   129  	CreateDeploymentResourcePool(context.Context, *aiplatformpb.CreateDeploymentResourcePoolRequest, ...gax.CallOption) (*CreateDeploymentResourcePoolOperation, error)
   130  	CreateDeploymentResourcePoolOperation(name string) *CreateDeploymentResourcePoolOperation
   131  	GetDeploymentResourcePool(context.Context, *aiplatformpb.GetDeploymentResourcePoolRequest, ...gax.CallOption) (*aiplatformpb.DeploymentResourcePool, error)
   132  	ListDeploymentResourcePools(context.Context, *aiplatformpb.ListDeploymentResourcePoolsRequest, ...gax.CallOption) *DeploymentResourcePoolIterator
   133  	UpdateDeploymentResourcePool(context.Context, *aiplatformpb.UpdateDeploymentResourcePoolRequest, ...gax.CallOption) (*UpdateDeploymentResourcePoolOperation, error)
   134  	UpdateDeploymentResourcePoolOperation(name string) *UpdateDeploymentResourcePoolOperation
   135  	DeleteDeploymentResourcePool(context.Context, *aiplatformpb.DeleteDeploymentResourcePoolRequest, ...gax.CallOption) (*DeleteDeploymentResourcePoolOperation, error)
   136  	DeleteDeploymentResourcePoolOperation(name string) *DeleteDeploymentResourcePoolOperation
   137  	QueryDeployedModels(context.Context, *aiplatformpb.QueryDeployedModelsRequest, ...gax.CallOption) *DeployedModelIterator
   138  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
   139  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
   140  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   141  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   142  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
   143  	CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
   144  	DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
   145  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   146  	ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
   147  	WaitOperation(context.Context, *longrunningpb.WaitOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   148  }
   149  
   150  // DeploymentResourcePoolClient is a client for interacting with Vertex AI API.
   151  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   152  //
   153  // A service that manages the DeploymentResourcePool resource.
   154  type DeploymentResourcePoolClient struct {
   155  	// The internal transport-dependent client.
   156  	internalClient internalDeploymentResourcePoolClient
   157  
   158  	// The call options for this service.
   159  	CallOptions *DeploymentResourcePoolCallOptions
   160  
   161  	// LROClient is used internally to handle long-running operations.
   162  	// It is exposed so that its CallOptions can be modified if required.
   163  	// Users should not Close this client.
   164  	LROClient *lroauto.OperationsClient
   165  }
   166  
   167  // Wrapper methods routed to the internal client.
   168  
   169  // Close closes the connection to the API service. The user should invoke this when
   170  // the client is no longer required.
   171  func (c *DeploymentResourcePoolClient) Close() error {
   172  	return c.internalClient.Close()
   173  }
   174  
   175  // setGoogleClientInfo sets the name and version of the application in
   176  // the `x-goog-api-client` header passed on each request. Intended for
   177  // use by Google-written clients.
   178  func (c *DeploymentResourcePoolClient) setGoogleClientInfo(keyval ...string) {
   179  	c.internalClient.setGoogleClientInfo(keyval...)
   180  }
   181  
   182  // Connection returns a connection to the API service.
   183  //
   184  // Deprecated: Connections are now pooled so this method does not always
   185  // return the same resource.
   186  func (c *DeploymentResourcePoolClient) Connection() *grpc.ClientConn {
   187  	return c.internalClient.Connection()
   188  }
   189  
   190  // CreateDeploymentResourcePool create a DeploymentResourcePool.
   191  func (c *DeploymentResourcePoolClient) CreateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.CreateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*CreateDeploymentResourcePoolOperation, error) {
   192  	return c.internalClient.CreateDeploymentResourcePool(ctx, req, opts...)
   193  }
   194  
   195  // CreateDeploymentResourcePoolOperation returns a new CreateDeploymentResourcePoolOperation from a given name.
   196  // The name must be that of a previously created CreateDeploymentResourcePoolOperation, possibly from a different process.
   197  func (c *DeploymentResourcePoolClient) CreateDeploymentResourcePoolOperation(name string) *CreateDeploymentResourcePoolOperation {
   198  	return c.internalClient.CreateDeploymentResourcePoolOperation(name)
   199  }
   200  
   201  // GetDeploymentResourcePool get a DeploymentResourcePool.
   202  func (c *DeploymentResourcePoolClient) GetDeploymentResourcePool(ctx context.Context, req *aiplatformpb.GetDeploymentResourcePoolRequest, opts ...gax.CallOption) (*aiplatformpb.DeploymentResourcePool, error) {
   203  	return c.internalClient.GetDeploymentResourcePool(ctx, req, opts...)
   204  }
   205  
   206  // ListDeploymentResourcePools list DeploymentResourcePools in a location.
   207  func (c *DeploymentResourcePoolClient) ListDeploymentResourcePools(ctx context.Context, req *aiplatformpb.ListDeploymentResourcePoolsRequest, opts ...gax.CallOption) *DeploymentResourcePoolIterator {
   208  	return c.internalClient.ListDeploymentResourcePools(ctx, req, opts...)
   209  }
   210  
   211  // UpdateDeploymentResourcePool update a DeploymentResourcePool.
   212  func (c *DeploymentResourcePoolClient) UpdateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.UpdateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*UpdateDeploymentResourcePoolOperation, error) {
   213  	return c.internalClient.UpdateDeploymentResourcePool(ctx, req, opts...)
   214  }
   215  
   216  // UpdateDeploymentResourcePoolOperation returns a new UpdateDeploymentResourcePoolOperation from a given name.
   217  // The name must be that of a previously created UpdateDeploymentResourcePoolOperation, possibly from a different process.
   218  func (c *DeploymentResourcePoolClient) UpdateDeploymentResourcePoolOperation(name string) *UpdateDeploymentResourcePoolOperation {
   219  	return c.internalClient.UpdateDeploymentResourcePoolOperation(name)
   220  }
   221  
   222  // DeleteDeploymentResourcePool delete a DeploymentResourcePool.
   223  func (c *DeploymentResourcePoolClient) DeleteDeploymentResourcePool(ctx context.Context, req *aiplatformpb.DeleteDeploymentResourcePoolRequest, opts ...gax.CallOption) (*DeleteDeploymentResourcePoolOperation, error) {
   224  	return c.internalClient.DeleteDeploymentResourcePool(ctx, req, opts...)
   225  }
   226  
   227  // DeleteDeploymentResourcePoolOperation returns a new DeleteDeploymentResourcePoolOperation from a given name.
   228  // The name must be that of a previously created DeleteDeploymentResourcePoolOperation, possibly from a different process.
   229  func (c *DeploymentResourcePoolClient) DeleteDeploymentResourcePoolOperation(name string) *DeleteDeploymentResourcePoolOperation {
   230  	return c.internalClient.DeleteDeploymentResourcePoolOperation(name)
   231  }
   232  
   233  // QueryDeployedModels list DeployedModels that have been deployed on this DeploymentResourcePool.
   234  func (c *DeploymentResourcePoolClient) QueryDeployedModels(ctx context.Context, req *aiplatformpb.QueryDeployedModelsRequest, opts ...gax.CallOption) *DeployedModelIterator {
   235  	return c.internalClient.QueryDeployedModels(ctx, req, opts...)
   236  }
   237  
   238  // GetLocation gets information about a location.
   239  func (c *DeploymentResourcePoolClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   240  	return c.internalClient.GetLocation(ctx, req, opts...)
   241  }
   242  
   243  // ListLocations lists information about the supported locations for this service.
   244  func (c *DeploymentResourcePoolClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   245  	return c.internalClient.ListLocations(ctx, req, opts...)
   246  }
   247  
   248  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
   249  // if the resource exists and does not have a policy set.
   250  func (c *DeploymentResourcePoolClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   251  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   252  }
   253  
   254  // SetIamPolicy sets the access control policy on the specified resource. Replaces
   255  // any existing policy.
   256  //
   257  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
   258  // errors.
   259  func (c *DeploymentResourcePoolClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   260  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   261  }
   262  
   263  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
   264  // resource does not exist, this will return an empty set of
   265  // permissions, not a NOT_FOUND error.
   266  //
   267  // Note: This operation is designed to be used for building
   268  // permission-aware UIs and command-line tools, not for authorization
   269  // checking. This operation may “fail open” without warning.
   270  func (c *DeploymentResourcePoolClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   271  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   272  }
   273  
   274  // CancelOperation is a utility method from google.longrunning.Operations.
   275  func (c *DeploymentResourcePoolClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   276  	return c.internalClient.CancelOperation(ctx, req, opts...)
   277  }
   278  
   279  // DeleteOperation is a utility method from google.longrunning.Operations.
   280  func (c *DeploymentResourcePoolClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   281  	return c.internalClient.DeleteOperation(ctx, req, opts...)
   282  }
   283  
   284  // GetOperation is a utility method from google.longrunning.Operations.
   285  func (c *DeploymentResourcePoolClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   286  	return c.internalClient.GetOperation(ctx, req, opts...)
   287  }
   288  
   289  // ListOperations is a utility method from google.longrunning.Operations.
   290  func (c *DeploymentResourcePoolClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   291  	return c.internalClient.ListOperations(ctx, req, opts...)
   292  }
   293  
   294  // WaitOperation is a utility method from google.longrunning.Operations.
   295  func (c *DeploymentResourcePoolClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   296  	return c.internalClient.WaitOperation(ctx, req, opts...)
   297  }
   298  
   299  // deploymentResourcePoolGRPCClient is a client for interacting with Vertex AI API over gRPC transport.
   300  //
   301  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   302  type deploymentResourcePoolGRPCClient struct {
   303  	// Connection pool of gRPC connections to the service.
   304  	connPool gtransport.ConnPool
   305  
   306  	// Points back to the CallOptions field of the containing DeploymentResourcePoolClient
   307  	CallOptions **DeploymentResourcePoolCallOptions
   308  
   309  	// The gRPC API client.
   310  	deploymentResourcePoolClient aiplatformpb.DeploymentResourcePoolServiceClient
   311  
   312  	// LROClient is used internally to handle long-running operations.
   313  	// It is exposed so that its CallOptions can be modified if required.
   314  	// Users should not Close this client.
   315  	LROClient **lroauto.OperationsClient
   316  
   317  	operationsClient longrunningpb.OperationsClient
   318  
   319  	iamPolicyClient iampb.IAMPolicyClient
   320  
   321  	locationsClient locationpb.LocationsClient
   322  
   323  	// The x-goog-* metadata to be sent with each request.
   324  	xGoogHeaders []string
   325  
   326  	logger *slog.Logger
   327  }
   328  
   329  // NewDeploymentResourcePoolClient creates a new deployment resource pool service client based on gRPC.
   330  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   331  //
   332  // A service that manages the DeploymentResourcePool resource.
   333  func NewDeploymentResourcePoolClient(ctx context.Context, opts ...option.ClientOption) (*DeploymentResourcePoolClient, error) {
   334  	clientOpts := defaultDeploymentResourcePoolGRPCClientOptions()
   335  	if newDeploymentResourcePoolClientHook != nil {
   336  		hookOpts, err := newDeploymentResourcePoolClientHook(ctx, clientHookParams{})
   337  		if err != nil {
   338  			return nil, err
   339  		}
   340  		clientOpts = append(clientOpts, hookOpts...)
   341  	}
   342  
   343  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   344  	if err != nil {
   345  		return nil, err
   346  	}
   347  	client := DeploymentResourcePoolClient{CallOptions: defaultDeploymentResourcePoolCallOptions()}
   348  
   349  	c := &deploymentResourcePoolGRPCClient{
   350  		connPool:                     connPool,
   351  		deploymentResourcePoolClient: aiplatformpb.NewDeploymentResourcePoolServiceClient(connPool),
   352  		CallOptions:                  &client.CallOptions,
   353  		logger:                       internaloption.GetLogger(opts),
   354  		operationsClient:             longrunningpb.NewOperationsClient(connPool),
   355  		iamPolicyClient:              iampb.NewIAMPolicyClient(connPool),
   356  		locationsClient:              locationpb.NewLocationsClient(connPool),
   357  	}
   358  	c.setGoogleClientInfo()
   359  
   360  	client.internalClient = c
   361  
   362  	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
   363  	if err != nil {
   364  		// This error "should not happen", since we are just reusing old connection pool
   365  		// and never actually need to dial.
   366  		// If this does happen, we could leak connp. However, we cannot close conn:
   367  		// If the user invoked the constructor with option.WithGRPCConn,
   368  		// we would close a connection that's still in use.
   369  		// TODO: investigate error conditions.
   370  		return nil, err
   371  	}
   372  	c.LROClient = &client.LROClient
   373  	return &client, nil
   374  }
   375  
   376  // Connection returns a connection to the API service.
   377  //
   378  // Deprecated: Connections are now pooled so this method does not always
   379  // return the same resource.
   380  func (c *deploymentResourcePoolGRPCClient) Connection() *grpc.ClientConn {
   381  	return c.connPool.Conn()
   382  }
   383  
   384  // setGoogleClientInfo sets the name and version of the application in
   385  // the `x-goog-api-client` header passed on each request. Intended for
   386  // use by Google-written clients.
   387  func (c *deploymentResourcePoolGRPCClient) setGoogleClientInfo(keyval ...string) {
   388  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   389  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
   390  	c.xGoogHeaders = []string{
   391  		"x-goog-api-client", gax.XGoogHeader(kv...),
   392  	}
   393  }
   394  
   395  // Close closes the connection to the API service. The user should invoke this when
   396  // the client is no longer required.
   397  func (c *deploymentResourcePoolGRPCClient) Close() error {
   398  	return c.connPool.Close()
   399  }
   400  
   401  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   402  type deploymentResourcePoolRESTClient struct {
   403  	// The http endpoint to connect to.
   404  	endpoint string
   405  
   406  	// The http client.
   407  	httpClient *http.Client
   408  
   409  	// LROClient is used internally to handle long-running operations.
   410  	// It is exposed so that its CallOptions can be modified if required.
   411  	// Users should not Close this client.
   412  	LROClient **lroauto.OperationsClient
   413  
   414  	// The x-goog-* headers to be sent with each request.
   415  	xGoogHeaders []string
   416  
   417  	// Points back to the CallOptions field of the containing DeploymentResourcePoolClient
   418  	CallOptions **DeploymentResourcePoolCallOptions
   419  
   420  	logger *slog.Logger
   421  }
   422  
   423  // NewDeploymentResourcePoolRESTClient creates a new deployment resource pool service rest client.
   424  //
   425  // A service that manages the DeploymentResourcePool resource.
   426  func NewDeploymentResourcePoolRESTClient(ctx context.Context, opts ...option.ClientOption) (*DeploymentResourcePoolClient, error) {
   427  	clientOpts := append(defaultDeploymentResourcePoolRESTClientOptions(), opts...)
   428  	httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
   429  	if err != nil {
   430  		return nil, err
   431  	}
   432  
   433  	callOpts := defaultDeploymentResourcePoolRESTCallOptions()
   434  	c := &deploymentResourcePoolRESTClient{
   435  		endpoint:    endpoint,
   436  		httpClient:  httpClient,
   437  		CallOptions: &callOpts,
   438  		logger:      internaloption.GetLogger(opts),
   439  	}
   440  	c.setGoogleClientInfo()
   441  
   442  	lroOpts := []option.ClientOption{
   443  		option.WithHTTPClient(httpClient),
   444  		option.WithEndpoint(endpoint),
   445  	}
   446  	opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
   447  	if err != nil {
   448  		return nil, err
   449  	}
   450  	c.LROClient = &opClient
   451  
   452  	return &DeploymentResourcePoolClient{internalClient: c, CallOptions: callOpts}, nil
   453  }
   454  
   455  func defaultDeploymentResourcePoolRESTClientOptions() []option.ClientOption {
   456  	return []option.ClientOption{
   457  		internaloption.WithDefaultEndpoint("https://aiplatform.googleapis.com"),
   458  		internaloption.WithDefaultEndpointTemplate("https://aiplatform.UNIVERSE_DOMAIN"),
   459  		internaloption.WithDefaultMTLSEndpoint("https://aiplatform.mtls.googleapis.com"),
   460  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
   461  		internaloption.WithDefaultAudience("https://aiplatform.googleapis.com/"),
   462  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
   463  		internaloption.EnableNewAuthLibrary(),
   464  	}
   465  }
   466  
   467  // setGoogleClientInfo sets the name and version of the application in
   468  // the `x-goog-api-client` header passed on each request. Intended for
   469  // use by Google-written clients.
   470  func (c *deploymentResourcePoolRESTClient) setGoogleClientInfo(keyval ...string) {
   471  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   472  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
   473  	c.xGoogHeaders = []string{
   474  		"x-goog-api-client", gax.XGoogHeader(kv...),
   475  	}
   476  }
   477  
   478  // Close closes the connection to the API service. The user should invoke this when
   479  // the client is no longer required.
   480  func (c *deploymentResourcePoolRESTClient) Close() error {
   481  	// Replace httpClient with nil to force cleanup.
   482  	c.httpClient = nil
   483  	return nil
   484  }
   485  
   486  // Connection returns a connection to the API service.
   487  //
   488  // Deprecated: This method always returns nil.
   489  func (c *deploymentResourcePoolRESTClient) Connection() *grpc.ClientConn {
   490  	return nil
   491  }
   492  func (c *deploymentResourcePoolGRPCClient) CreateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.CreateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*CreateDeploymentResourcePoolOperation, error) {
   493  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   494  
   495  	hds = append(c.xGoogHeaders, hds...)
   496  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   497  	opts = append((*c.CallOptions).CreateDeploymentResourcePool[0:len((*c.CallOptions).CreateDeploymentResourcePool):len((*c.CallOptions).CreateDeploymentResourcePool)], opts...)
   498  	var resp *longrunningpb.Operation
   499  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   500  		var err error
   501  		resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.CreateDeploymentResourcePool, req, settings.GRPC, c.logger, "CreateDeploymentResourcePool")
   502  		return err
   503  	}, opts...)
   504  	if err != nil {
   505  		return nil, err
   506  	}
   507  	return &CreateDeploymentResourcePoolOperation{
   508  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   509  	}, nil
   510  }
   511  
   512  func (c *deploymentResourcePoolGRPCClient) GetDeploymentResourcePool(ctx context.Context, req *aiplatformpb.GetDeploymentResourcePoolRequest, opts ...gax.CallOption) (*aiplatformpb.DeploymentResourcePool, error) {
   513  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   514  
   515  	hds = append(c.xGoogHeaders, hds...)
   516  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   517  	opts = append((*c.CallOptions).GetDeploymentResourcePool[0:len((*c.CallOptions).GetDeploymentResourcePool):len((*c.CallOptions).GetDeploymentResourcePool)], opts...)
   518  	var resp *aiplatformpb.DeploymentResourcePool
   519  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   520  		var err error
   521  		resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.GetDeploymentResourcePool, req, settings.GRPC, c.logger, "GetDeploymentResourcePool")
   522  		return err
   523  	}, opts...)
   524  	if err != nil {
   525  		return nil, err
   526  	}
   527  	return resp, nil
   528  }
   529  
   530  func (c *deploymentResourcePoolGRPCClient) ListDeploymentResourcePools(ctx context.Context, req *aiplatformpb.ListDeploymentResourcePoolsRequest, opts ...gax.CallOption) *DeploymentResourcePoolIterator {
   531  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   532  
   533  	hds = append(c.xGoogHeaders, hds...)
   534  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   535  	opts = append((*c.CallOptions).ListDeploymentResourcePools[0:len((*c.CallOptions).ListDeploymentResourcePools):len((*c.CallOptions).ListDeploymentResourcePools)], opts...)
   536  	it := &DeploymentResourcePoolIterator{}
   537  	req = proto.Clone(req).(*aiplatformpb.ListDeploymentResourcePoolsRequest)
   538  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DeploymentResourcePool, string, error) {
   539  		resp := &aiplatformpb.ListDeploymentResourcePoolsResponse{}
   540  		if pageToken != "" {
   541  			req.PageToken = pageToken
   542  		}
   543  		if pageSize > math.MaxInt32 {
   544  			req.PageSize = math.MaxInt32
   545  		} else if pageSize != 0 {
   546  			req.PageSize = int32(pageSize)
   547  		}
   548  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   549  			var err error
   550  			resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.ListDeploymentResourcePools, req, settings.GRPC, c.logger, "ListDeploymentResourcePools")
   551  			return err
   552  		}, opts...)
   553  		if err != nil {
   554  			return nil, "", err
   555  		}
   556  
   557  		it.Response = resp
   558  		return resp.GetDeploymentResourcePools(), resp.GetNextPageToken(), nil
   559  	}
   560  	fetch := func(pageSize int, pageToken string) (string, error) {
   561  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   562  		if err != nil {
   563  			return "", err
   564  		}
   565  		it.items = append(it.items, items...)
   566  		return nextPageToken, nil
   567  	}
   568  
   569  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   570  	it.pageInfo.MaxSize = int(req.GetPageSize())
   571  	it.pageInfo.Token = req.GetPageToken()
   572  
   573  	return it
   574  }
   575  
   576  func (c *deploymentResourcePoolGRPCClient) UpdateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.UpdateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*UpdateDeploymentResourcePoolOperation, error) {
   577  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "deployment_resource_pool.name", url.QueryEscape(req.GetDeploymentResourcePool().GetName()))}
   578  
   579  	hds = append(c.xGoogHeaders, hds...)
   580  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   581  	opts = append((*c.CallOptions).UpdateDeploymentResourcePool[0:len((*c.CallOptions).UpdateDeploymentResourcePool):len((*c.CallOptions).UpdateDeploymentResourcePool)], opts...)
   582  	var resp *longrunningpb.Operation
   583  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   584  		var err error
   585  		resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.UpdateDeploymentResourcePool, req, settings.GRPC, c.logger, "UpdateDeploymentResourcePool")
   586  		return err
   587  	}, opts...)
   588  	if err != nil {
   589  		return nil, err
   590  	}
   591  	return &UpdateDeploymentResourcePoolOperation{
   592  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   593  	}, nil
   594  }
   595  
   596  func (c *deploymentResourcePoolGRPCClient) DeleteDeploymentResourcePool(ctx context.Context, req *aiplatformpb.DeleteDeploymentResourcePoolRequest, opts ...gax.CallOption) (*DeleteDeploymentResourcePoolOperation, error) {
   597  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   598  
   599  	hds = append(c.xGoogHeaders, hds...)
   600  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   601  	opts = append((*c.CallOptions).DeleteDeploymentResourcePool[0:len((*c.CallOptions).DeleteDeploymentResourcePool):len((*c.CallOptions).DeleteDeploymentResourcePool)], opts...)
   602  	var resp *longrunningpb.Operation
   603  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   604  		var err error
   605  		resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.DeleteDeploymentResourcePool, req, settings.GRPC, c.logger, "DeleteDeploymentResourcePool")
   606  		return err
   607  	}, opts...)
   608  	if err != nil {
   609  		return nil, err
   610  	}
   611  	return &DeleteDeploymentResourcePoolOperation{
   612  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
   613  	}, nil
   614  }
   615  
   616  func (c *deploymentResourcePoolGRPCClient) QueryDeployedModels(ctx context.Context, req *aiplatformpb.QueryDeployedModelsRequest, opts ...gax.CallOption) *DeployedModelIterator {
   617  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "deployment_resource_pool", url.QueryEscape(req.GetDeploymentResourcePool()))}
   618  
   619  	hds = append(c.xGoogHeaders, hds...)
   620  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   621  	opts = append((*c.CallOptions).QueryDeployedModels[0:len((*c.CallOptions).QueryDeployedModels):len((*c.CallOptions).QueryDeployedModels)], opts...)
   622  	it := &DeployedModelIterator{}
   623  	req = proto.Clone(req).(*aiplatformpb.QueryDeployedModelsRequest)
   624  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DeployedModel, string, error) {
   625  		resp := &aiplatformpb.QueryDeployedModelsResponse{}
   626  		if pageToken != "" {
   627  			req.PageToken = pageToken
   628  		}
   629  		if pageSize > math.MaxInt32 {
   630  			req.PageSize = math.MaxInt32
   631  		} else if pageSize != 0 {
   632  			req.PageSize = int32(pageSize)
   633  		}
   634  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   635  			var err error
   636  			resp, err = executeRPC(ctx, c.deploymentResourcePoolClient.QueryDeployedModels, req, settings.GRPC, c.logger, "QueryDeployedModels")
   637  			return err
   638  		}, opts...)
   639  		if err != nil {
   640  			return nil, "", err
   641  		}
   642  
   643  		it.Response = resp
   644  		return resp.GetDeployedModels(), resp.GetNextPageToken(), nil
   645  	}
   646  	fetch := func(pageSize int, pageToken string) (string, error) {
   647  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   648  		if err != nil {
   649  			return "", err
   650  		}
   651  		it.items = append(it.items, items...)
   652  		return nextPageToken, nil
   653  	}
   654  
   655  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   656  	it.pageInfo.MaxSize = int(req.GetPageSize())
   657  	it.pageInfo.Token = req.GetPageToken()
   658  
   659  	return it
   660  }
   661  
   662  func (c *deploymentResourcePoolGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   663  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   664  
   665  	hds = append(c.xGoogHeaders, hds...)
   666  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   667  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
   668  	var resp *locationpb.Location
   669  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   670  		var err error
   671  		resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
   672  		return err
   673  	}, opts...)
   674  	if err != nil {
   675  		return nil, err
   676  	}
   677  	return resp, nil
   678  }
   679  
   680  func (c *deploymentResourcePoolGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   681  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   682  
   683  	hds = append(c.xGoogHeaders, hds...)
   684  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   685  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
   686  	it := &LocationIterator{}
   687  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
   688  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
   689  		resp := &locationpb.ListLocationsResponse{}
   690  		if pageToken != "" {
   691  			req.PageToken = pageToken
   692  		}
   693  		if pageSize > math.MaxInt32 {
   694  			req.PageSize = math.MaxInt32
   695  		} else if pageSize != 0 {
   696  			req.PageSize = int32(pageSize)
   697  		}
   698  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   699  			var err error
   700  			resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
   701  			return err
   702  		}, opts...)
   703  		if err != nil {
   704  			return nil, "", err
   705  		}
   706  
   707  		it.Response = resp
   708  		return resp.GetLocations(), resp.GetNextPageToken(), nil
   709  	}
   710  	fetch := func(pageSize int, pageToken string) (string, error) {
   711  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   712  		if err != nil {
   713  			return "", err
   714  		}
   715  		it.items = append(it.items, items...)
   716  		return nextPageToken, nil
   717  	}
   718  
   719  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   720  	it.pageInfo.MaxSize = int(req.GetPageSize())
   721  	it.pageInfo.Token = req.GetPageToken()
   722  
   723  	return it
   724  }
   725  
   726  func (c *deploymentResourcePoolGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   727  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   728  
   729  	hds = append(c.xGoogHeaders, hds...)
   730  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   731  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
   732  	var resp *iampb.Policy
   733  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   734  		var err error
   735  		resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
   736  		return err
   737  	}, opts...)
   738  	if err != nil {
   739  		return nil, err
   740  	}
   741  	return resp, nil
   742  }
   743  
   744  func (c *deploymentResourcePoolGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   745  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   746  
   747  	hds = append(c.xGoogHeaders, hds...)
   748  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   749  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
   750  	var resp *iampb.Policy
   751  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   752  		var err error
   753  		resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
   754  		return err
   755  	}, opts...)
   756  	if err != nil {
   757  		return nil, err
   758  	}
   759  	return resp, nil
   760  }
   761  
   762  func (c *deploymentResourcePoolGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   763  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
   764  
   765  	hds = append(c.xGoogHeaders, hds...)
   766  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   767  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
   768  	var resp *iampb.TestIamPermissionsResponse
   769  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   770  		var err error
   771  		resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
   772  		return err
   773  	}, opts...)
   774  	if err != nil {
   775  		return nil, err
   776  	}
   777  	return resp, nil
   778  }
   779  
   780  func (c *deploymentResourcePoolGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
   781  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   782  
   783  	hds = append(c.xGoogHeaders, hds...)
   784  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   785  	opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
   786  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   787  		var err error
   788  		_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
   789  		return err
   790  	}, opts...)
   791  	return err
   792  }
   793  
   794  func (c *deploymentResourcePoolGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
   795  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   796  
   797  	hds = append(c.xGoogHeaders, hds...)
   798  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   799  	opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
   800  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   801  		var err error
   802  		_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
   803  		return err
   804  	}, opts...)
   805  	return err
   806  }
   807  
   808  func (c *deploymentResourcePoolGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   809  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   810  
   811  	hds = append(c.xGoogHeaders, hds...)
   812  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   813  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
   814  	var resp *longrunningpb.Operation
   815  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   816  		var err error
   817  		resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
   818  		return err
   819  	}, opts...)
   820  	if err != nil {
   821  		return nil, err
   822  	}
   823  	return resp, nil
   824  }
   825  
   826  func (c *deploymentResourcePoolGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
   827  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   828  
   829  	hds = append(c.xGoogHeaders, hds...)
   830  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   831  	opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
   832  	it := &OperationIterator{}
   833  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
   834  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
   835  		resp := &longrunningpb.ListOperationsResponse{}
   836  		if pageToken != "" {
   837  			req.PageToken = pageToken
   838  		}
   839  		if pageSize > math.MaxInt32 {
   840  			req.PageSize = math.MaxInt32
   841  		} else if pageSize != 0 {
   842  			req.PageSize = int32(pageSize)
   843  		}
   844  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   845  			var err error
   846  			resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
   847  			return err
   848  		}, opts...)
   849  		if err != nil {
   850  			return nil, "", err
   851  		}
   852  
   853  		it.Response = resp
   854  		return resp.GetOperations(), resp.GetNextPageToken(), nil
   855  	}
   856  	fetch := func(pageSize int, pageToken string) (string, error) {
   857  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   858  		if err != nil {
   859  			return "", err
   860  		}
   861  		it.items = append(it.items, items...)
   862  		return nextPageToken, nil
   863  	}
   864  
   865  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   866  	it.pageInfo.MaxSize = int(req.GetPageSize())
   867  	it.pageInfo.Token = req.GetPageToken()
   868  
   869  	return it
   870  }
   871  
   872  func (c *deploymentResourcePoolGRPCClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   873  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   874  
   875  	hds = append(c.xGoogHeaders, hds...)
   876  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   877  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
   878  	var resp *longrunningpb.Operation
   879  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   880  		var err error
   881  		resp, err = executeRPC(ctx, c.operationsClient.WaitOperation, req, settings.GRPC, c.logger, "WaitOperation")
   882  		return err
   883  	}, opts...)
   884  	if err != nil {
   885  		return nil, err
   886  	}
   887  	return resp, nil
   888  }
   889  
   890  // CreateDeploymentResourcePool create a DeploymentResourcePool.
   891  func (c *deploymentResourcePoolRESTClient) CreateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.CreateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*CreateDeploymentResourcePoolOperation, error) {
   892  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
   893  	jsonReq, err := m.Marshal(req)
   894  	if err != nil {
   895  		return nil, err
   896  	}
   897  
   898  	baseUrl, err := url.Parse(c.endpoint)
   899  	if err != nil {
   900  		return nil, err
   901  	}
   902  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v/deploymentResourcePools", req.GetParent())
   903  
   904  	params := url.Values{}
   905  	params.Add("$alt", "json;enum-encoding=int")
   906  
   907  	baseUrl.RawQuery = params.Encode()
   908  
   909  	// Build HTTP headers from client and context metadata.
   910  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   911  
   912  	hds = append(c.xGoogHeaders, hds...)
   913  	hds = append(hds, "Content-Type", "application/json")
   914  	headers := gax.BuildHeaders(ctx, hds...)
   915  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
   916  	resp := &longrunningpb.Operation{}
   917  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   918  		if settings.Path != "" {
   919  			baseUrl.Path = settings.Path
   920  		}
   921  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
   922  		if err != nil {
   923  			return err
   924  		}
   925  		httpReq = httpReq.WithContext(ctx)
   926  		httpReq.Header = headers
   927  
   928  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateDeploymentResourcePool")
   929  		if err != nil {
   930  			return err
   931  		}
   932  		if err := unm.Unmarshal(buf, resp); err != nil {
   933  			return err
   934  		}
   935  
   936  		return nil
   937  	}, opts...)
   938  	if e != nil {
   939  		return nil, e
   940  	}
   941  
   942  	override := fmt.Sprintf("/ui/%s", resp.GetName())
   943  	return &CreateDeploymentResourcePoolOperation{
   944  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
   945  		pollPath: override,
   946  	}, nil
   947  }
   948  
   949  // GetDeploymentResourcePool get a DeploymentResourcePool.
   950  func (c *deploymentResourcePoolRESTClient) GetDeploymentResourcePool(ctx context.Context, req *aiplatformpb.GetDeploymentResourcePoolRequest, opts ...gax.CallOption) (*aiplatformpb.DeploymentResourcePool, error) {
   951  	baseUrl, err := url.Parse(c.endpoint)
   952  	if err != nil {
   953  		return nil, err
   954  	}
   955  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName())
   956  
   957  	params := url.Values{}
   958  	params.Add("$alt", "json;enum-encoding=int")
   959  
   960  	baseUrl.RawQuery = params.Encode()
   961  
   962  	// Build HTTP headers from client and context metadata.
   963  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   964  
   965  	hds = append(c.xGoogHeaders, hds...)
   966  	hds = append(hds, "Content-Type", "application/json")
   967  	headers := gax.BuildHeaders(ctx, hds...)
   968  	opts = append((*c.CallOptions).GetDeploymentResourcePool[0:len((*c.CallOptions).GetDeploymentResourcePool):len((*c.CallOptions).GetDeploymentResourcePool)], opts...)
   969  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
   970  	resp := &aiplatformpb.DeploymentResourcePool{}
   971  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   972  		if settings.Path != "" {
   973  			baseUrl.Path = settings.Path
   974  		}
   975  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
   976  		if err != nil {
   977  			return err
   978  		}
   979  		httpReq = httpReq.WithContext(ctx)
   980  		httpReq.Header = headers
   981  
   982  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetDeploymentResourcePool")
   983  		if err != nil {
   984  			return err
   985  		}
   986  
   987  		if err := unm.Unmarshal(buf, resp); err != nil {
   988  			return err
   989  		}
   990  
   991  		return nil
   992  	}, opts...)
   993  	if e != nil {
   994  		return nil, e
   995  	}
   996  	return resp, nil
   997  }
   998  
   999  // ListDeploymentResourcePools list DeploymentResourcePools in a location.
  1000  func (c *deploymentResourcePoolRESTClient) ListDeploymentResourcePools(ctx context.Context, req *aiplatformpb.ListDeploymentResourcePoolsRequest, opts ...gax.CallOption) *DeploymentResourcePoolIterator {
  1001  	it := &DeploymentResourcePoolIterator{}
  1002  	req = proto.Clone(req).(*aiplatformpb.ListDeploymentResourcePoolsRequest)
  1003  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1004  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DeploymentResourcePool, string, error) {
  1005  		resp := &aiplatformpb.ListDeploymentResourcePoolsResponse{}
  1006  		if pageToken != "" {
  1007  			req.PageToken = pageToken
  1008  		}
  1009  		if pageSize > math.MaxInt32 {
  1010  			req.PageSize = math.MaxInt32
  1011  		} else if pageSize != 0 {
  1012  			req.PageSize = int32(pageSize)
  1013  		}
  1014  		baseUrl, err := url.Parse(c.endpoint)
  1015  		if err != nil {
  1016  			return nil, "", err
  1017  		}
  1018  		baseUrl.Path += fmt.Sprintf("/v1beta1/%v/deploymentResourcePools", req.GetParent())
  1019  
  1020  		params := url.Values{}
  1021  		params.Add("$alt", "json;enum-encoding=int")
  1022  		if req.GetPageSize() != 0 {
  1023  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  1024  		}
  1025  		if req.GetPageToken() != "" {
  1026  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  1027  		}
  1028  
  1029  		baseUrl.RawQuery = params.Encode()
  1030  
  1031  		// Build HTTP headers from client and context metadata.
  1032  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  1033  		headers := gax.BuildHeaders(ctx, hds...)
  1034  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1035  			if settings.Path != "" {
  1036  				baseUrl.Path = settings.Path
  1037  			}
  1038  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1039  			if err != nil {
  1040  				return err
  1041  			}
  1042  			httpReq.Header = headers
  1043  
  1044  			buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListDeploymentResourcePools")
  1045  			if err != nil {
  1046  				return err
  1047  			}
  1048  			if err := unm.Unmarshal(buf, resp); err != nil {
  1049  				return err
  1050  			}
  1051  
  1052  			return nil
  1053  		}, opts...)
  1054  		if e != nil {
  1055  			return nil, "", e
  1056  		}
  1057  		it.Response = resp
  1058  		return resp.GetDeploymentResourcePools(), resp.GetNextPageToken(), nil
  1059  	}
  1060  
  1061  	fetch := func(pageSize int, pageToken string) (string, error) {
  1062  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1063  		if err != nil {
  1064  			return "", err
  1065  		}
  1066  		it.items = append(it.items, items...)
  1067  		return nextPageToken, nil
  1068  	}
  1069  
  1070  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1071  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1072  	it.pageInfo.Token = req.GetPageToken()
  1073  
  1074  	return it
  1075  }
  1076  
  1077  // UpdateDeploymentResourcePool update a DeploymentResourcePool.
  1078  func (c *deploymentResourcePoolRESTClient) UpdateDeploymentResourcePool(ctx context.Context, req *aiplatformpb.UpdateDeploymentResourcePoolRequest, opts ...gax.CallOption) (*UpdateDeploymentResourcePoolOperation, error) {
  1079  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  1080  	body := req.GetDeploymentResourcePool()
  1081  	jsonReq, err := m.Marshal(body)
  1082  	if err != nil {
  1083  		return nil, err
  1084  	}
  1085  
  1086  	baseUrl, err := url.Parse(c.endpoint)
  1087  	if err != nil {
  1088  		return nil, err
  1089  	}
  1090  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetDeploymentResourcePool().GetName())
  1091  
  1092  	params := url.Values{}
  1093  	params.Add("$alt", "json;enum-encoding=int")
  1094  	if req.GetUpdateMask() != nil {
  1095  		field, err := protojson.Marshal(req.GetUpdateMask())
  1096  		if err != nil {
  1097  			return nil, err
  1098  		}
  1099  		params.Add("updateMask", string(field[1:len(field)-1]))
  1100  	}
  1101  
  1102  	baseUrl.RawQuery = params.Encode()
  1103  
  1104  	// Build HTTP headers from client and context metadata.
  1105  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "deployment_resource_pool.name", url.QueryEscape(req.GetDeploymentResourcePool().GetName()))}
  1106  
  1107  	hds = append(c.xGoogHeaders, hds...)
  1108  	hds = append(hds, "Content-Type", "application/json")
  1109  	headers := gax.BuildHeaders(ctx, hds...)
  1110  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1111  	resp := &longrunningpb.Operation{}
  1112  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1113  		if settings.Path != "" {
  1114  			baseUrl.Path = settings.Path
  1115  		}
  1116  		httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
  1117  		if err != nil {
  1118  			return err
  1119  		}
  1120  		httpReq = httpReq.WithContext(ctx)
  1121  		httpReq.Header = headers
  1122  
  1123  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateDeploymentResourcePool")
  1124  		if err != nil {
  1125  			return err
  1126  		}
  1127  		if err := unm.Unmarshal(buf, resp); err != nil {
  1128  			return err
  1129  		}
  1130  
  1131  		return nil
  1132  	}, opts...)
  1133  	if e != nil {
  1134  		return nil, e
  1135  	}
  1136  
  1137  	override := fmt.Sprintf("/ui/%s", resp.GetName())
  1138  	return &UpdateDeploymentResourcePoolOperation{
  1139  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  1140  		pollPath: override,
  1141  	}, nil
  1142  }
  1143  
  1144  // DeleteDeploymentResourcePool delete a DeploymentResourcePool.
  1145  func (c *deploymentResourcePoolRESTClient) DeleteDeploymentResourcePool(ctx context.Context, req *aiplatformpb.DeleteDeploymentResourcePoolRequest, opts ...gax.CallOption) (*DeleteDeploymentResourcePoolOperation, error) {
  1146  	baseUrl, err := url.Parse(c.endpoint)
  1147  	if err != nil {
  1148  		return nil, err
  1149  	}
  1150  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v", req.GetName())
  1151  
  1152  	params := url.Values{}
  1153  	params.Add("$alt", "json;enum-encoding=int")
  1154  
  1155  	baseUrl.RawQuery = params.Encode()
  1156  
  1157  	// Build HTTP headers from client and context metadata.
  1158  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1159  
  1160  	hds = append(c.xGoogHeaders, hds...)
  1161  	hds = append(hds, "Content-Type", "application/json")
  1162  	headers := gax.BuildHeaders(ctx, hds...)
  1163  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1164  	resp := &longrunningpb.Operation{}
  1165  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1166  		if settings.Path != "" {
  1167  			baseUrl.Path = settings.Path
  1168  		}
  1169  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  1170  		if err != nil {
  1171  			return err
  1172  		}
  1173  		httpReq = httpReq.WithContext(ctx)
  1174  		httpReq.Header = headers
  1175  
  1176  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteDeploymentResourcePool")
  1177  		if err != nil {
  1178  			return err
  1179  		}
  1180  		if err := unm.Unmarshal(buf, resp); err != nil {
  1181  			return err
  1182  		}
  1183  
  1184  		return nil
  1185  	}, opts...)
  1186  	if e != nil {
  1187  		return nil, e
  1188  	}
  1189  
  1190  	override := fmt.Sprintf("/ui/%s", resp.GetName())
  1191  	return &DeleteDeploymentResourcePoolOperation{
  1192  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  1193  		pollPath: override,
  1194  	}, nil
  1195  }
  1196  
  1197  // QueryDeployedModels list DeployedModels that have been deployed on this DeploymentResourcePool.
  1198  func (c *deploymentResourcePoolRESTClient) QueryDeployedModels(ctx context.Context, req *aiplatformpb.QueryDeployedModelsRequest, opts ...gax.CallOption) *DeployedModelIterator {
  1199  	it := &DeployedModelIterator{}
  1200  	req = proto.Clone(req).(*aiplatformpb.QueryDeployedModelsRequest)
  1201  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1202  	it.InternalFetch = func(pageSize int, pageToken string) ([]*aiplatformpb.DeployedModel, string, error) {
  1203  		resp := &aiplatformpb.QueryDeployedModelsResponse{}
  1204  		if pageToken != "" {
  1205  			req.PageToken = pageToken
  1206  		}
  1207  		if pageSize > math.MaxInt32 {
  1208  			req.PageSize = math.MaxInt32
  1209  		} else if pageSize != 0 {
  1210  			req.PageSize = int32(pageSize)
  1211  		}
  1212  		baseUrl, err := url.Parse(c.endpoint)
  1213  		if err != nil {
  1214  			return nil, "", err
  1215  		}
  1216  		baseUrl.Path += fmt.Sprintf("/v1beta1/%v:queryDeployedModels", req.GetDeploymentResourcePool())
  1217  
  1218  		params := url.Values{}
  1219  		params.Add("$alt", "json;enum-encoding=int")
  1220  		if req.GetPageSize() != 0 {
  1221  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  1222  		}
  1223  		if req.GetPageToken() != "" {
  1224  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  1225  		}
  1226  
  1227  		baseUrl.RawQuery = params.Encode()
  1228  
  1229  		// Build HTTP headers from client and context metadata.
  1230  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  1231  		headers := gax.BuildHeaders(ctx, hds...)
  1232  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1233  			if settings.Path != "" {
  1234  				baseUrl.Path = settings.Path
  1235  			}
  1236  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1237  			if err != nil {
  1238  				return err
  1239  			}
  1240  			httpReq.Header = headers
  1241  
  1242  			buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "QueryDeployedModels")
  1243  			if err != nil {
  1244  				return err
  1245  			}
  1246  			if err := unm.Unmarshal(buf, resp); err != nil {
  1247  				return err
  1248  			}
  1249  
  1250  			return nil
  1251  		}, opts...)
  1252  		if e != nil {
  1253  			return nil, "", e
  1254  		}
  1255  		it.Response = resp
  1256  		return resp.GetDeployedModels(), resp.GetNextPageToken(), nil
  1257  	}
  1258  
  1259  	fetch := func(pageSize int, pageToken string) (string, error) {
  1260  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1261  		if err != nil {
  1262  			return "", err
  1263  		}
  1264  		it.items = append(it.items, items...)
  1265  		return nextPageToken, nil
  1266  	}
  1267  
  1268  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1269  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1270  	it.pageInfo.Token = req.GetPageToken()
  1271  
  1272  	return it
  1273  }
  1274  
  1275  // GetLocation gets information about a location.
  1276  func (c *deploymentResourcePoolRESTClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
  1277  	baseUrl, err := url.Parse(c.endpoint)
  1278  	if err != nil {
  1279  		return nil, err
  1280  	}
  1281  	baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName())
  1282  
  1283  	params := url.Values{}
  1284  	params.Add("$alt", "json;enum-encoding=int")
  1285  
  1286  	baseUrl.RawQuery = params.Encode()
  1287  
  1288  	// Build HTTP headers from client and context metadata.
  1289  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1290  
  1291  	hds = append(c.xGoogHeaders, hds...)
  1292  	hds = append(hds, "Content-Type", "application/json")
  1293  	headers := gax.BuildHeaders(ctx, hds...)
  1294  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
  1295  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1296  	resp := &locationpb.Location{}
  1297  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1298  		if settings.Path != "" {
  1299  			baseUrl.Path = settings.Path
  1300  		}
  1301  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1302  		if err != nil {
  1303  			return err
  1304  		}
  1305  		httpReq = httpReq.WithContext(ctx)
  1306  		httpReq.Header = headers
  1307  
  1308  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation")
  1309  		if err != nil {
  1310  			return err
  1311  		}
  1312  
  1313  		if err := unm.Unmarshal(buf, resp); err != nil {
  1314  			return err
  1315  		}
  1316  
  1317  		return nil
  1318  	}, opts...)
  1319  	if e != nil {
  1320  		return nil, e
  1321  	}
  1322  	return resp, nil
  1323  }
  1324  
  1325  // ListLocations lists information about the supported locations for this service.
  1326  func (c *deploymentResourcePoolRESTClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
  1327  	it := &LocationIterator{}
  1328  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
  1329  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1330  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
  1331  		resp := &locationpb.ListLocationsResponse{}
  1332  		if pageToken != "" {
  1333  			req.PageToken = pageToken
  1334  		}
  1335  		if pageSize > math.MaxInt32 {
  1336  			req.PageSize = math.MaxInt32
  1337  		} else if pageSize != 0 {
  1338  			req.PageSize = int32(pageSize)
  1339  		}
  1340  		baseUrl, err := url.Parse(c.endpoint)
  1341  		if err != nil {
  1342  			return nil, "", err
  1343  		}
  1344  		baseUrl.Path += fmt.Sprintf("/ui/%v/locations", req.GetName())
  1345  
  1346  		params := url.Values{}
  1347  		params.Add("$alt", "json;enum-encoding=int")
  1348  		if req.GetFilter() != "" {
  1349  			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
  1350  		}
  1351  		if req.GetPageSize() != 0 {
  1352  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  1353  		}
  1354  		if req.GetPageToken() != "" {
  1355  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  1356  		}
  1357  
  1358  		baseUrl.RawQuery = params.Encode()
  1359  
  1360  		// Build HTTP headers from client and context metadata.
  1361  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  1362  		headers := gax.BuildHeaders(ctx, hds...)
  1363  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1364  			if settings.Path != "" {
  1365  				baseUrl.Path = settings.Path
  1366  			}
  1367  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1368  			if err != nil {
  1369  				return err
  1370  			}
  1371  			httpReq.Header = headers
  1372  
  1373  			buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations")
  1374  			if err != nil {
  1375  				return err
  1376  			}
  1377  			if err := unm.Unmarshal(buf, resp); err != nil {
  1378  				return err
  1379  			}
  1380  
  1381  			return nil
  1382  		}, opts...)
  1383  		if e != nil {
  1384  			return nil, "", e
  1385  		}
  1386  		it.Response = resp
  1387  		return resp.GetLocations(), resp.GetNextPageToken(), nil
  1388  	}
  1389  
  1390  	fetch := func(pageSize int, pageToken string) (string, error) {
  1391  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1392  		if err != nil {
  1393  			return "", err
  1394  		}
  1395  		it.items = append(it.items, items...)
  1396  		return nextPageToken, nil
  1397  	}
  1398  
  1399  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1400  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1401  	it.pageInfo.Token = req.GetPageToken()
  1402  
  1403  	return it
  1404  }
  1405  
  1406  // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
  1407  // if the resource exists and does not have a policy set.
  1408  func (c *deploymentResourcePoolRESTClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1409  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  1410  	jsonReq, err := m.Marshal(req)
  1411  	if err != nil {
  1412  		return nil, err
  1413  	}
  1414  
  1415  	baseUrl, err := url.Parse(c.endpoint)
  1416  	if err != nil {
  1417  		return nil, err
  1418  	}
  1419  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v:getIamPolicy", req.GetResource())
  1420  
  1421  	params := url.Values{}
  1422  	params.Add("$alt", "json;enum-encoding=int")
  1423  
  1424  	baseUrl.RawQuery = params.Encode()
  1425  
  1426  	// Build HTTP headers from client and context metadata.
  1427  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1428  
  1429  	hds = append(c.xGoogHeaders, hds...)
  1430  	hds = append(hds, "Content-Type", "application/json")
  1431  	headers := gax.BuildHeaders(ctx, hds...)
  1432  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
  1433  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1434  	resp := &iampb.Policy{}
  1435  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1436  		if settings.Path != "" {
  1437  			baseUrl.Path = settings.Path
  1438  		}
  1439  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  1440  		if err != nil {
  1441  			return err
  1442  		}
  1443  		httpReq = httpReq.WithContext(ctx)
  1444  		httpReq.Header = headers
  1445  
  1446  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "GetIamPolicy")
  1447  		if err != nil {
  1448  			return err
  1449  		}
  1450  
  1451  		if err := unm.Unmarshal(buf, resp); err != nil {
  1452  			return err
  1453  		}
  1454  
  1455  		return nil
  1456  	}, opts...)
  1457  	if e != nil {
  1458  		return nil, e
  1459  	}
  1460  	return resp, nil
  1461  }
  1462  
  1463  // SetIamPolicy sets the access control policy on the specified resource. Replaces
  1464  // any existing policy.
  1465  //
  1466  // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
  1467  // errors.
  1468  func (c *deploymentResourcePoolRESTClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1469  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  1470  	jsonReq, err := m.Marshal(req)
  1471  	if err != nil {
  1472  		return nil, err
  1473  	}
  1474  
  1475  	baseUrl, err := url.Parse(c.endpoint)
  1476  	if err != nil {
  1477  		return nil, err
  1478  	}
  1479  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v:setIamPolicy", req.GetResource())
  1480  
  1481  	params := url.Values{}
  1482  	params.Add("$alt", "json;enum-encoding=int")
  1483  
  1484  	baseUrl.RawQuery = params.Encode()
  1485  
  1486  	// Build HTTP headers from client and context metadata.
  1487  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1488  
  1489  	hds = append(c.xGoogHeaders, hds...)
  1490  	hds = append(hds, "Content-Type", "application/json")
  1491  	headers := gax.BuildHeaders(ctx, hds...)
  1492  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
  1493  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1494  	resp := &iampb.Policy{}
  1495  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1496  		if settings.Path != "" {
  1497  			baseUrl.Path = settings.Path
  1498  		}
  1499  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  1500  		if err != nil {
  1501  			return err
  1502  		}
  1503  		httpReq = httpReq.WithContext(ctx)
  1504  		httpReq.Header = headers
  1505  
  1506  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SetIamPolicy")
  1507  		if err != nil {
  1508  			return err
  1509  		}
  1510  
  1511  		if err := unm.Unmarshal(buf, resp); err != nil {
  1512  			return err
  1513  		}
  1514  
  1515  		return nil
  1516  	}, opts...)
  1517  	if e != nil {
  1518  		return nil, e
  1519  	}
  1520  	return resp, nil
  1521  }
  1522  
  1523  // TestIamPermissions returns permissions that a caller has on the specified resource. If the
  1524  // resource does not exist, this will return an empty set of
  1525  // permissions, not a NOT_FOUND error.
  1526  //
  1527  // Note: This operation is designed to be used for building
  1528  // permission-aware UIs and command-line tools, not for authorization
  1529  // checking. This operation may “fail open” without warning.
  1530  func (c *deploymentResourcePoolRESTClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
  1531  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  1532  	jsonReq, err := m.Marshal(req)
  1533  	if err != nil {
  1534  		return nil, err
  1535  	}
  1536  
  1537  	baseUrl, err := url.Parse(c.endpoint)
  1538  	if err != nil {
  1539  		return nil, err
  1540  	}
  1541  	baseUrl.Path += fmt.Sprintf("/v1beta1/%v:testIamPermissions", req.GetResource())
  1542  
  1543  	params := url.Values{}
  1544  	params.Add("$alt", "json;enum-encoding=int")
  1545  
  1546  	baseUrl.RawQuery = params.Encode()
  1547  
  1548  	// Build HTTP headers from client and context metadata.
  1549  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1550  
  1551  	hds = append(c.xGoogHeaders, hds...)
  1552  	hds = append(hds, "Content-Type", "application/json")
  1553  	headers := gax.BuildHeaders(ctx, hds...)
  1554  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
  1555  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1556  	resp := &iampb.TestIamPermissionsResponse{}
  1557  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1558  		if settings.Path != "" {
  1559  			baseUrl.Path = settings.Path
  1560  		}
  1561  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  1562  		if err != nil {
  1563  			return err
  1564  		}
  1565  		httpReq = httpReq.WithContext(ctx)
  1566  		httpReq.Header = headers
  1567  
  1568  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "TestIamPermissions")
  1569  		if err != nil {
  1570  			return err
  1571  		}
  1572  
  1573  		if err := unm.Unmarshal(buf, resp); err != nil {
  1574  			return err
  1575  		}
  1576  
  1577  		return nil
  1578  	}, opts...)
  1579  	if e != nil {
  1580  		return nil, e
  1581  	}
  1582  	return resp, nil
  1583  }
  1584  
  1585  // CancelOperation is a utility method from google.longrunning.Operations.
  1586  func (c *deploymentResourcePoolRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
  1587  	baseUrl, err := url.Parse(c.endpoint)
  1588  	if err != nil {
  1589  		return err
  1590  	}
  1591  	baseUrl.Path += fmt.Sprintf("/ui/%v:cancel", req.GetName())
  1592  
  1593  	params := url.Values{}
  1594  	params.Add("$alt", "json;enum-encoding=int")
  1595  
  1596  	baseUrl.RawQuery = params.Encode()
  1597  
  1598  	// Build HTTP headers from client and context metadata.
  1599  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1600  
  1601  	hds = append(c.xGoogHeaders, hds...)
  1602  	hds = append(hds, "Content-Type", "application/json")
  1603  	headers := gax.BuildHeaders(ctx, hds...)
  1604  	return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1605  		if settings.Path != "" {
  1606  			baseUrl.Path = settings.Path
  1607  		}
  1608  		httpReq, err := http.NewRequest("POST", baseUrl.String(), nil)
  1609  		if err != nil {
  1610  			return err
  1611  		}
  1612  		httpReq = httpReq.WithContext(ctx)
  1613  		httpReq.Header = headers
  1614  
  1615  		_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "CancelOperation")
  1616  		return err
  1617  	}, opts...)
  1618  }
  1619  
  1620  // DeleteOperation is a utility method from google.longrunning.Operations.
  1621  func (c *deploymentResourcePoolRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
  1622  	baseUrl, err := url.Parse(c.endpoint)
  1623  	if err != nil {
  1624  		return err
  1625  	}
  1626  	baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName())
  1627  
  1628  	params := url.Values{}
  1629  	params.Add("$alt", "json;enum-encoding=int")
  1630  
  1631  	baseUrl.RawQuery = params.Encode()
  1632  
  1633  	// Build HTTP headers from client and context metadata.
  1634  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1635  
  1636  	hds = append(c.xGoogHeaders, hds...)
  1637  	hds = append(hds, "Content-Type", "application/json")
  1638  	headers := gax.BuildHeaders(ctx, hds...)
  1639  	return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1640  		if settings.Path != "" {
  1641  			baseUrl.Path = settings.Path
  1642  		}
  1643  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  1644  		if err != nil {
  1645  			return err
  1646  		}
  1647  		httpReq = httpReq.WithContext(ctx)
  1648  		httpReq.Header = headers
  1649  
  1650  		_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
  1651  		return err
  1652  	}, opts...)
  1653  }
  1654  
  1655  // GetOperation is a utility method from google.longrunning.Operations.
  1656  func (c *deploymentResourcePoolRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  1657  	baseUrl, err := url.Parse(c.endpoint)
  1658  	if err != nil {
  1659  		return nil, err
  1660  	}
  1661  	baseUrl.Path += fmt.Sprintf("/ui/%v", req.GetName())
  1662  
  1663  	params := url.Values{}
  1664  	params.Add("$alt", "json;enum-encoding=int")
  1665  
  1666  	baseUrl.RawQuery = params.Encode()
  1667  
  1668  	// Build HTTP headers from client and context metadata.
  1669  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1670  
  1671  	hds = append(c.xGoogHeaders, hds...)
  1672  	hds = append(hds, "Content-Type", "application/json")
  1673  	headers := gax.BuildHeaders(ctx, hds...)
  1674  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
  1675  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1676  	resp := &longrunningpb.Operation{}
  1677  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1678  		if settings.Path != "" {
  1679  			baseUrl.Path = settings.Path
  1680  		}
  1681  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1682  		if err != nil {
  1683  			return err
  1684  		}
  1685  		httpReq = httpReq.WithContext(ctx)
  1686  		httpReq.Header = headers
  1687  
  1688  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
  1689  		if err != nil {
  1690  			return err
  1691  		}
  1692  
  1693  		if err := unm.Unmarshal(buf, resp); err != nil {
  1694  			return err
  1695  		}
  1696  
  1697  		return nil
  1698  	}, opts...)
  1699  	if e != nil {
  1700  		return nil, e
  1701  	}
  1702  	return resp, nil
  1703  }
  1704  
  1705  // ListOperations is a utility method from google.longrunning.Operations.
  1706  func (c *deploymentResourcePoolRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
  1707  	it := &OperationIterator{}
  1708  	req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
  1709  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1710  	it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
  1711  		resp := &longrunningpb.ListOperationsResponse{}
  1712  		if pageToken != "" {
  1713  			req.PageToken = pageToken
  1714  		}
  1715  		if pageSize > math.MaxInt32 {
  1716  			req.PageSize = math.MaxInt32
  1717  		} else if pageSize != 0 {
  1718  			req.PageSize = int32(pageSize)
  1719  		}
  1720  		baseUrl, err := url.Parse(c.endpoint)
  1721  		if err != nil {
  1722  			return nil, "", err
  1723  		}
  1724  		baseUrl.Path += fmt.Sprintf("/ui/%v/operations", req.GetName())
  1725  
  1726  		params := url.Values{}
  1727  		params.Add("$alt", "json;enum-encoding=int")
  1728  		if req.GetFilter() != "" {
  1729  			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
  1730  		}
  1731  		if req.GetPageSize() != 0 {
  1732  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  1733  		}
  1734  		if req.GetPageToken() != "" {
  1735  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  1736  		}
  1737  
  1738  		baseUrl.RawQuery = params.Encode()
  1739  
  1740  		// Build HTTP headers from client and context metadata.
  1741  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  1742  		headers := gax.BuildHeaders(ctx, hds...)
  1743  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1744  			if settings.Path != "" {
  1745  				baseUrl.Path = settings.Path
  1746  			}
  1747  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1748  			if err != nil {
  1749  				return err
  1750  			}
  1751  			httpReq.Header = headers
  1752  
  1753  			buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
  1754  			if err != nil {
  1755  				return err
  1756  			}
  1757  			if err := unm.Unmarshal(buf, resp); err != nil {
  1758  				return err
  1759  			}
  1760  
  1761  			return nil
  1762  		}, opts...)
  1763  		if e != nil {
  1764  			return nil, "", e
  1765  		}
  1766  		it.Response = resp
  1767  		return resp.GetOperations(), resp.GetNextPageToken(), nil
  1768  	}
  1769  
  1770  	fetch := func(pageSize int, pageToken string) (string, error) {
  1771  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1772  		if err != nil {
  1773  			return "", err
  1774  		}
  1775  		it.items = append(it.items, items...)
  1776  		return nextPageToken, nil
  1777  	}
  1778  
  1779  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1780  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1781  	it.pageInfo.Token = req.GetPageToken()
  1782  
  1783  	return it
  1784  }
  1785  
  1786  // WaitOperation is a utility method from google.longrunning.Operations.
  1787  func (c *deploymentResourcePoolRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  1788  	baseUrl, err := url.Parse(c.endpoint)
  1789  	if err != nil {
  1790  		return nil, err
  1791  	}
  1792  	baseUrl.Path += fmt.Sprintf("/ui/%v:wait", req.GetName())
  1793  
  1794  	params := url.Values{}
  1795  	params.Add("$alt", "json;enum-encoding=int")
  1796  	if req.GetTimeout() != nil {
  1797  		field, err := protojson.Marshal(req.GetTimeout())
  1798  		if err != nil {
  1799  			return nil, err
  1800  		}
  1801  		params.Add("timeout", string(field[1:len(field)-1]))
  1802  	}
  1803  
  1804  	baseUrl.RawQuery = params.Encode()
  1805  
  1806  	// Build HTTP headers from client and context metadata.
  1807  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1808  
  1809  	hds = append(c.xGoogHeaders, hds...)
  1810  	hds = append(hds, "Content-Type", "application/json")
  1811  	headers := gax.BuildHeaders(ctx, hds...)
  1812  	opts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)
  1813  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1814  	resp := &longrunningpb.Operation{}
  1815  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1816  		if settings.Path != "" {
  1817  			baseUrl.Path = settings.Path
  1818  		}
  1819  		httpReq, err := http.NewRequest("POST", baseUrl.String(), nil)
  1820  		if err != nil {
  1821  			return err
  1822  		}
  1823  		httpReq = httpReq.WithContext(ctx)
  1824  		httpReq.Header = headers
  1825  
  1826  		buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "WaitOperation")
  1827  		if err != nil {
  1828  			return err
  1829  		}
  1830  
  1831  		if err := unm.Unmarshal(buf, resp); err != nil {
  1832  			return err
  1833  		}
  1834  
  1835  		return nil
  1836  	}, opts...)
  1837  	if e != nil {
  1838  		return nil, e
  1839  	}
  1840  	return resp, nil
  1841  }
  1842  
  1843  // CreateDeploymentResourcePoolOperation returns a new CreateDeploymentResourcePoolOperation from a given name.
  1844  // The name must be that of a previously created CreateDeploymentResourcePoolOperation, possibly from a different process.
  1845  func (c *deploymentResourcePoolGRPCClient) CreateDeploymentResourcePoolOperation(name string) *CreateDeploymentResourcePoolOperation {
  1846  	return &CreateDeploymentResourcePoolOperation{
  1847  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1848  	}
  1849  }
  1850  
  1851  // CreateDeploymentResourcePoolOperation returns a new CreateDeploymentResourcePoolOperation from a given name.
  1852  // The name must be that of a previously created CreateDeploymentResourcePoolOperation, possibly from a different process.
  1853  func (c *deploymentResourcePoolRESTClient) CreateDeploymentResourcePoolOperation(name string) *CreateDeploymentResourcePoolOperation {
  1854  	override := fmt.Sprintf("/ui/%s", name)
  1855  	return &CreateDeploymentResourcePoolOperation{
  1856  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1857  		pollPath: override,
  1858  	}
  1859  }
  1860  
  1861  // DeleteDeploymentResourcePoolOperation returns a new DeleteDeploymentResourcePoolOperation from a given name.
  1862  // The name must be that of a previously created DeleteDeploymentResourcePoolOperation, possibly from a different process.
  1863  func (c *deploymentResourcePoolGRPCClient) DeleteDeploymentResourcePoolOperation(name string) *DeleteDeploymentResourcePoolOperation {
  1864  	return &DeleteDeploymentResourcePoolOperation{
  1865  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1866  	}
  1867  }
  1868  
  1869  // DeleteDeploymentResourcePoolOperation returns a new DeleteDeploymentResourcePoolOperation from a given name.
  1870  // The name must be that of a previously created DeleteDeploymentResourcePoolOperation, possibly from a different process.
  1871  func (c *deploymentResourcePoolRESTClient) DeleteDeploymentResourcePoolOperation(name string) *DeleteDeploymentResourcePoolOperation {
  1872  	override := fmt.Sprintf("/ui/%s", name)
  1873  	return &DeleteDeploymentResourcePoolOperation{
  1874  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1875  		pollPath: override,
  1876  	}
  1877  }
  1878  
  1879  // UpdateDeploymentResourcePoolOperation returns a new UpdateDeploymentResourcePoolOperation from a given name.
  1880  // The name must be that of a previously created UpdateDeploymentResourcePoolOperation, possibly from a different process.
  1881  func (c *deploymentResourcePoolGRPCClient) UpdateDeploymentResourcePoolOperation(name string) *UpdateDeploymentResourcePoolOperation {
  1882  	return &UpdateDeploymentResourcePoolOperation{
  1883  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1884  	}
  1885  }
  1886  
  1887  // UpdateDeploymentResourcePoolOperation returns a new UpdateDeploymentResourcePoolOperation from a given name.
  1888  // The name must be that of a previously created UpdateDeploymentResourcePoolOperation, possibly from a different process.
  1889  func (c *deploymentResourcePoolRESTClient) UpdateDeploymentResourcePoolOperation(name string) *UpdateDeploymentResourcePoolOperation {
  1890  	override := fmt.Sprintf("/ui/%s", name)
  1891  	return &UpdateDeploymentResourcePoolOperation{
  1892  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  1893  		pollPath: override,
  1894  	}
  1895  }