...

Source file src/cloud.google.com/go/artifactregistry/apiv1/artifact_registry_client.go

Documentation: cloud.google.com/go/artifactregistry/apiv1

     1  // Copyright 2024 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 artifactregistry
    18  
    19  import (
    20  	"bytes"
    21  	"context"
    22  	"fmt"
    23  	"io"
    24  	"math"
    25  	"net/http"
    26  	"net/url"
    27  	"time"
    28  
    29  	artifactregistrypb "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb"
    30  	iampb "cloud.google.com/go/iam/apiv1/iampb"
    31  	"cloud.google.com/go/longrunning"
    32  	lroauto "cloud.google.com/go/longrunning/autogen"
    33  	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
    34  	gax "github.com/googleapis/gax-go/v2"
    35  	"google.golang.org/api/googleapi"
    36  	"google.golang.org/api/iterator"
    37  	"google.golang.org/api/option"
    38  	"google.golang.org/api/option/internaloption"
    39  	gtransport "google.golang.org/api/transport/grpc"
    40  	httptransport "google.golang.org/api/transport/http"
    41  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    42  	"google.golang.org/grpc"
    43  	"google.golang.org/protobuf/encoding/protojson"
    44  	"google.golang.org/protobuf/proto"
    45  )
    46  
    47  var newClientHook clientHook
    48  
    49  // CallOptions contains the retry settings for each method of Client.
    50  type CallOptions struct {
    51  	ListDockerImages      []gax.CallOption
    52  	GetDockerImage        []gax.CallOption
    53  	ListMavenArtifacts    []gax.CallOption
    54  	GetMavenArtifact      []gax.CallOption
    55  	ListNpmPackages       []gax.CallOption
    56  	GetNpmPackage         []gax.CallOption
    57  	ListPythonPackages    []gax.CallOption
    58  	GetPythonPackage      []gax.CallOption
    59  	ImportAptArtifacts    []gax.CallOption
    60  	ImportYumArtifacts    []gax.CallOption
    61  	ListRepositories      []gax.CallOption
    62  	GetRepository         []gax.CallOption
    63  	CreateRepository      []gax.CallOption
    64  	UpdateRepository      []gax.CallOption
    65  	DeleteRepository      []gax.CallOption
    66  	ListPackages          []gax.CallOption
    67  	GetPackage            []gax.CallOption
    68  	DeletePackage         []gax.CallOption
    69  	ListVersions          []gax.CallOption
    70  	GetVersion            []gax.CallOption
    71  	DeleteVersion         []gax.CallOption
    72  	BatchDeleteVersions   []gax.CallOption
    73  	ListFiles             []gax.CallOption
    74  	GetFile               []gax.CallOption
    75  	ListTags              []gax.CallOption
    76  	GetTag                []gax.CallOption
    77  	CreateTag             []gax.CallOption
    78  	UpdateTag             []gax.CallOption
    79  	DeleteTag             []gax.CallOption
    80  	SetIamPolicy          []gax.CallOption
    81  	GetIamPolicy          []gax.CallOption
    82  	TestIamPermissions    []gax.CallOption
    83  	GetProjectSettings    []gax.CallOption
    84  	UpdateProjectSettings []gax.CallOption
    85  	GetVPCSCConfig        []gax.CallOption
    86  	UpdateVPCSCConfig     []gax.CallOption
    87  	GetLocation           []gax.CallOption
    88  	ListLocations         []gax.CallOption
    89  	GetOperation          []gax.CallOption
    90  }
    91  
    92  func defaultGRPCClientOptions() []option.ClientOption {
    93  	return []option.ClientOption{
    94  		internaloption.WithDefaultEndpoint("artifactregistry.googleapis.com:443"),
    95  		internaloption.WithDefaultEndpointTemplate("artifactregistry.UNIVERSE_DOMAIN:443"),
    96  		internaloption.WithDefaultMTLSEndpoint("artifactregistry.mtls.googleapis.com:443"),
    97  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
    98  		internaloption.WithDefaultAudience("https://artifactregistry.googleapis.com/"),
    99  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
   100  		internaloption.EnableJwtWithScope(),
   101  		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
   102  			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
   103  	}
   104  }
   105  
   106  func defaultCallOptions() *CallOptions {
   107  	return &CallOptions{
   108  		ListDockerImages: []gax.CallOption{
   109  			gax.WithTimeout(60000 * time.Millisecond),
   110  		},
   111  		GetDockerImage: []gax.CallOption{
   112  			gax.WithTimeout(60000 * time.Millisecond),
   113  		},
   114  		ListMavenArtifacts: []gax.CallOption{
   115  			gax.WithTimeout(60000 * time.Millisecond),
   116  		},
   117  		GetMavenArtifact: []gax.CallOption{
   118  			gax.WithTimeout(60000 * time.Millisecond),
   119  		},
   120  		ListNpmPackages: []gax.CallOption{
   121  			gax.WithTimeout(60000 * time.Millisecond),
   122  		},
   123  		GetNpmPackage: []gax.CallOption{
   124  			gax.WithTimeout(60000 * time.Millisecond),
   125  		},
   126  		ListPythonPackages: []gax.CallOption{
   127  			gax.WithTimeout(60000 * time.Millisecond),
   128  		},
   129  		GetPythonPackage: []gax.CallOption{
   130  			gax.WithTimeout(60000 * time.Millisecond),
   131  		},
   132  		ImportAptArtifacts: []gax.CallOption{
   133  			gax.WithTimeout(60000 * time.Millisecond),
   134  		},
   135  		ImportYumArtifacts: []gax.CallOption{
   136  			gax.WithTimeout(60000 * time.Millisecond),
   137  		},
   138  		ListRepositories: []gax.CallOption{
   139  			gax.WithTimeout(60000 * time.Millisecond),
   140  		},
   141  		GetRepository: []gax.CallOption{
   142  			gax.WithTimeout(60000 * time.Millisecond),
   143  		},
   144  		CreateRepository: []gax.CallOption{
   145  			gax.WithTimeout(60000 * time.Millisecond),
   146  		},
   147  		UpdateRepository: []gax.CallOption{
   148  			gax.WithTimeout(60000 * time.Millisecond),
   149  		},
   150  		DeleteRepository: []gax.CallOption{
   151  			gax.WithTimeout(60000 * time.Millisecond),
   152  		},
   153  		ListPackages: []gax.CallOption{
   154  			gax.WithTimeout(60000 * time.Millisecond),
   155  		},
   156  		GetPackage: []gax.CallOption{
   157  			gax.WithTimeout(60000 * time.Millisecond),
   158  		},
   159  		DeletePackage: []gax.CallOption{
   160  			gax.WithTimeout(60000 * time.Millisecond),
   161  		},
   162  		ListVersions: []gax.CallOption{
   163  			gax.WithTimeout(60000 * time.Millisecond),
   164  		},
   165  		GetVersion: []gax.CallOption{
   166  			gax.WithTimeout(60000 * time.Millisecond),
   167  		},
   168  		DeleteVersion: []gax.CallOption{
   169  			gax.WithTimeout(60000 * time.Millisecond),
   170  		},
   171  		BatchDeleteVersions: []gax.CallOption{
   172  			gax.WithTimeout(60000 * time.Millisecond),
   173  		},
   174  		ListFiles: []gax.CallOption{
   175  			gax.WithTimeout(60000 * time.Millisecond),
   176  		},
   177  		GetFile: []gax.CallOption{
   178  			gax.WithTimeout(60000 * time.Millisecond),
   179  		},
   180  		ListTags: []gax.CallOption{
   181  			gax.WithTimeout(60000 * time.Millisecond),
   182  		},
   183  		GetTag: []gax.CallOption{
   184  			gax.WithTimeout(60000 * time.Millisecond),
   185  		},
   186  		CreateTag: []gax.CallOption{
   187  			gax.WithTimeout(60000 * time.Millisecond),
   188  		},
   189  		UpdateTag: []gax.CallOption{
   190  			gax.WithTimeout(60000 * time.Millisecond),
   191  		},
   192  		DeleteTag: []gax.CallOption{
   193  			gax.WithTimeout(60000 * time.Millisecond),
   194  		},
   195  		SetIamPolicy: []gax.CallOption{
   196  			gax.WithTimeout(60000 * time.Millisecond),
   197  		},
   198  		GetIamPolicy: []gax.CallOption{
   199  			gax.WithTimeout(60000 * time.Millisecond),
   200  		},
   201  		TestIamPermissions: []gax.CallOption{
   202  			gax.WithTimeout(60000 * time.Millisecond),
   203  		},
   204  		GetProjectSettings: []gax.CallOption{
   205  			gax.WithTimeout(60000 * time.Millisecond),
   206  		},
   207  		UpdateProjectSettings: []gax.CallOption{
   208  			gax.WithTimeout(60000 * time.Millisecond),
   209  		},
   210  		GetVPCSCConfig: []gax.CallOption{
   211  			gax.WithTimeout(60000 * time.Millisecond),
   212  		},
   213  		UpdateVPCSCConfig: []gax.CallOption{
   214  			gax.WithTimeout(60000 * time.Millisecond),
   215  		},
   216  		GetLocation:   []gax.CallOption{},
   217  		ListLocations: []gax.CallOption{},
   218  		GetOperation:  []gax.CallOption{},
   219  	}
   220  }
   221  
   222  func defaultRESTCallOptions() *CallOptions {
   223  	return &CallOptions{
   224  		ListDockerImages: []gax.CallOption{
   225  			gax.WithTimeout(60000 * time.Millisecond),
   226  		},
   227  		GetDockerImage: []gax.CallOption{
   228  			gax.WithTimeout(60000 * time.Millisecond),
   229  		},
   230  		ListMavenArtifacts: []gax.CallOption{
   231  			gax.WithTimeout(60000 * time.Millisecond),
   232  		},
   233  		GetMavenArtifact: []gax.CallOption{
   234  			gax.WithTimeout(60000 * time.Millisecond),
   235  		},
   236  		ListNpmPackages: []gax.CallOption{
   237  			gax.WithTimeout(60000 * time.Millisecond),
   238  		},
   239  		GetNpmPackage: []gax.CallOption{
   240  			gax.WithTimeout(60000 * time.Millisecond),
   241  		},
   242  		ListPythonPackages: []gax.CallOption{
   243  			gax.WithTimeout(60000 * time.Millisecond),
   244  		},
   245  		GetPythonPackage: []gax.CallOption{
   246  			gax.WithTimeout(60000 * time.Millisecond),
   247  		},
   248  		ImportAptArtifacts: []gax.CallOption{
   249  			gax.WithTimeout(60000 * time.Millisecond),
   250  		},
   251  		ImportYumArtifacts: []gax.CallOption{
   252  			gax.WithTimeout(60000 * time.Millisecond),
   253  		},
   254  		ListRepositories: []gax.CallOption{
   255  			gax.WithTimeout(60000 * time.Millisecond),
   256  		},
   257  		GetRepository: []gax.CallOption{
   258  			gax.WithTimeout(60000 * time.Millisecond),
   259  		},
   260  		CreateRepository: []gax.CallOption{
   261  			gax.WithTimeout(60000 * time.Millisecond),
   262  		},
   263  		UpdateRepository: []gax.CallOption{
   264  			gax.WithTimeout(60000 * time.Millisecond),
   265  		},
   266  		DeleteRepository: []gax.CallOption{
   267  			gax.WithTimeout(60000 * time.Millisecond),
   268  		},
   269  		ListPackages: []gax.CallOption{
   270  			gax.WithTimeout(60000 * time.Millisecond),
   271  		},
   272  		GetPackage: []gax.CallOption{
   273  			gax.WithTimeout(60000 * time.Millisecond),
   274  		},
   275  		DeletePackage: []gax.CallOption{
   276  			gax.WithTimeout(60000 * time.Millisecond),
   277  		},
   278  		ListVersions: []gax.CallOption{
   279  			gax.WithTimeout(60000 * time.Millisecond),
   280  		},
   281  		GetVersion: []gax.CallOption{
   282  			gax.WithTimeout(60000 * time.Millisecond),
   283  		},
   284  		DeleteVersion: []gax.CallOption{
   285  			gax.WithTimeout(60000 * time.Millisecond),
   286  		},
   287  		BatchDeleteVersions: []gax.CallOption{
   288  			gax.WithTimeout(60000 * time.Millisecond),
   289  		},
   290  		ListFiles: []gax.CallOption{
   291  			gax.WithTimeout(60000 * time.Millisecond),
   292  		},
   293  		GetFile: []gax.CallOption{
   294  			gax.WithTimeout(60000 * time.Millisecond),
   295  		},
   296  		ListTags: []gax.CallOption{
   297  			gax.WithTimeout(60000 * time.Millisecond),
   298  		},
   299  		GetTag: []gax.CallOption{
   300  			gax.WithTimeout(60000 * time.Millisecond),
   301  		},
   302  		CreateTag: []gax.CallOption{
   303  			gax.WithTimeout(60000 * time.Millisecond),
   304  		},
   305  		UpdateTag: []gax.CallOption{
   306  			gax.WithTimeout(60000 * time.Millisecond),
   307  		},
   308  		DeleteTag: []gax.CallOption{
   309  			gax.WithTimeout(60000 * time.Millisecond),
   310  		},
   311  		SetIamPolicy: []gax.CallOption{
   312  			gax.WithTimeout(60000 * time.Millisecond),
   313  		},
   314  		GetIamPolicy: []gax.CallOption{
   315  			gax.WithTimeout(60000 * time.Millisecond),
   316  		},
   317  		TestIamPermissions: []gax.CallOption{
   318  			gax.WithTimeout(60000 * time.Millisecond),
   319  		},
   320  		GetProjectSettings: []gax.CallOption{
   321  			gax.WithTimeout(60000 * time.Millisecond),
   322  		},
   323  		UpdateProjectSettings: []gax.CallOption{
   324  			gax.WithTimeout(60000 * time.Millisecond),
   325  		},
   326  		GetVPCSCConfig: []gax.CallOption{
   327  			gax.WithTimeout(60000 * time.Millisecond),
   328  		},
   329  		UpdateVPCSCConfig: []gax.CallOption{
   330  			gax.WithTimeout(60000 * time.Millisecond),
   331  		},
   332  		GetLocation:   []gax.CallOption{},
   333  		ListLocations: []gax.CallOption{},
   334  		GetOperation:  []gax.CallOption{},
   335  	}
   336  }
   337  
   338  // internalClient is an interface that defines the methods available from Artifact Registry API.
   339  type internalClient interface {
   340  	Close() error
   341  	setGoogleClientInfo(...string)
   342  	Connection() *grpc.ClientConn
   343  	ListDockerImages(context.Context, *artifactregistrypb.ListDockerImagesRequest, ...gax.CallOption) *DockerImageIterator
   344  	GetDockerImage(context.Context, *artifactregistrypb.GetDockerImageRequest, ...gax.CallOption) (*artifactregistrypb.DockerImage, error)
   345  	ListMavenArtifacts(context.Context, *artifactregistrypb.ListMavenArtifactsRequest, ...gax.CallOption) *MavenArtifactIterator
   346  	GetMavenArtifact(context.Context, *artifactregistrypb.GetMavenArtifactRequest, ...gax.CallOption) (*artifactregistrypb.MavenArtifact, error)
   347  	ListNpmPackages(context.Context, *artifactregistrypb.ListNpmPackagesRequest, ...gax.CallOption) *NpmPackageIterator
   348  	GetNpmPackage(context.Context, *artifactregistrypb.GetNpmPackageRequest, ...gax.CallOption) (*artifactregistrypb.NpmPackage, error)
   349  	ListPythonPackages(context.Context, *artifactregistrypb.ListPythonPackagesRequest, ...gax.CallOption) *PythonPackageIterator
   350  	GetPythonPackage(context.Context, *artifactregistrypb.GetPythonPackageRequest, ...gax.CallOption) (*artifactregistrypb.PythonPackage, error)
   351  	ImportAptArtifacts(context.Context, *artifactregistrypb.ImportAptArtifactsRequest, ...gax.CallOption) (*ImportAptArtifactsOperation, error)
   352  	ImportAptArtifactsOperation(name string) *ImportAptArtifactsOperation
   353  	ImportYumArtifacts(context.Context, *artifactregistrypb.ImportYumArtifactsRequest, ...gax.CallOption) (*ImportYumArtifactsOperation, error)
   354  	ImportYumArtifactsOperation(name string) *ImportYumArtifactsOperation
   355  	ListRepositories(context.Context, *artifactregistrypb.ListRepositoriesRequest, ...gax.CallOption) *RepositoryIterator
   356  	GetRepository(context.Context, *artifactregistrypb.GetRepositoryRequest, ...gax.CallOption) (*artifactregistrypb.Repository, error)
   357  	CreateRepository(context.Context, *artifactregistrypb.CreateRepositoryRequest, ...gax.CallOption) (*CreateRepositoryOperation, error)
   358  	CreateRepositoryOperation(name string) *CreateRepositoryOperation
   359  	UpdateRepository(context.Context, *artifactregistrypb.UpdateRepositoryRequest, ...gax.CallOption) (*artifactregistrypb.Repository, error)
   360  	DeleteRepository(context.Context, *artifactregistrypb.DeleteRepositoryRequest, ...gax.CallOption) (*DeleteRepositoryOperation, error)
   361  	DeleteRepositoryOperation(name string) *DeleteRepositoryOperation
   362  	ListPackages(context.Context, *artifactregistrypb.ListPackagesRequest, ...gax.CallOption) *PackageIterator
   363  	GetPackage(context.Context, *artifactregistrypb.GetPackageRequest, ...gax.CallOption) (*artifactregistrypb.Package, error)
   364  	DeletePackage(context.Context, *artifactregistrypb.DeletePackageRequest, ...gax.CallOption) (*DeletePackageOperation, error)
   365  	DeletePackageOperation(name string) *DeletePackageOperation
   366  	ListVersions(context.Context, *artifactregistrypb.ListVersionsRequest, ...gax.CallOption) *VersionIterator
   367  	GetVersion(context.Context, *artifactregistrypb.GetVersionRequest, ...gax.CallOption) (*artifactregistrypb.Version, error)
   368  	DeleteVersion(context.Context, *artifactregistrypb.DeleteVersionRequest, ...gax.CallOption) (*DeleteVersionOperation, error)
   369  	DeleteVersionOperation(name string) *DeleteVersionOperation
   370  	BatchDeleteVersions(context.Context, *artifactregistrypb.BatchDeleteVersionsRequest, ...gax.CallOption) (*BatchDeleteVersionsOperation, error)
   371  	BatchDeleteVersionsOperation(name string) *BatchDeleteVersionsOperation
   372  	ListFiles(context.Context, *artifactregistrypb.ListFilesRequest, ...gax.CallOption) *FileIterator
   373  	GetFile(context.Context, *artifactregistrypb.GetFileRequest, ...gax.CallOption) (*artifactregistrypb.File, error)
   374  	ListTags(context.Context, *artifactregistrypb.ListTagsRequest, ...gax.CallOption) *TagIterator
   375  	GetTag(context.Context, *artifactregistrypb.GetTagRequest, ...gax.CallOption) (*artifactregistrypb.Tag, error)
   376  	CreateTag(context.Context, *artifactregistrypb.CreateTagRequest, ...gax.CallOption) (*artifactregistrypb.Tag, error)
   377  	UpdateTag(context.Context, *artifactregistrypb.UpdateTagRequest, ...gax.CallOption) (*artifactregistrypb.Tag, error)
   378  	DeleteTag(context.Context, *artifactregistrypb.DeleteTagRequest, ...gax.CallOption) error
   379  	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   380  	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
   381  	TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
   382  	GetProjectSettings(context.Context, *artifactregistrypb.GetProjectSettingsRequest, ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error)
   383  	UpdateProjectSettings(context.Context, *artifactregistrypb.UpdateProjectSettingsRequest, ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error)
   384  	GetVPCSCConfig(context.Context, *artifactregistrypb.GetVPCSCConfigRequest, ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error)
   385  	UpdateVPCSCConfig(context.Context, *artifactregistrypb.UpdateVPCSCConfigRequest, ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error)
   386  	GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
   387  	ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
   388  	GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
   389  }
   390  
   391  // Client is a client for interacting with Artifact Registry API.
   392  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   393  //
   394  // The Artifact Registry API service.
   395  //
   396  // Artifact Registry is an artifact management system for storing artifacts
   397  // from different package management systems.
   398  //
   399  // The resources managed by this API are:
   400  //
   401  //	Repositories, which group packages and their data.
   402  //
   403  //	Packages, which group versions and their tags.
   404  //
   405  //	Versions, which are specific forms of a package.
   406  //
   407  //	Tags, which represent alternative names for versions.
   408  //
   409  //	Files, which contain content and are optionally associated with a Package
   410  //	or Version.
   411  type Client struct {
   412  	// The internal transport-dependent client.
   413  	internalClient internalClient
   414  
   415  	// The call options for this service.
   416  	CallOptions *CallOptions
   417  
   418  	// LROClient is used internally to handle long-running operations.
   419  	// It is exposed so that its CallOptions can be modified if required.
   420  	// Users should not Close this client.
   421  	LROClient *lroauto.OperationsClient
   422  }
   423  
   424  // Wrapper methods routed to the internal client.
   425  
   426  // Close closes the connection to the API service. The user should invoke this when
   427  // the client is no longer required.
   428  func (c *Client) Close() error {
   429  	return c.internalClient.Close()
   430  }
   431  
   432  // setGoogleClientInfo sets the name and version of the application in
   433  // the `x-goog-api-client` header passed on each request. Intended for
   434  // use by Google-written clients.
   435  func (c *Client) setGoogleClientInfo(keyval ...string) {
   436  	c.internalClient.setGoogleClientInfo(keyval...)
   437  }
   438  
   439  // Connection returns a connection to the API service.
   440  //
   441  // Deprecated: Connections are now pooled so this method does not always
   442  // return the same resource.
   443  func (c *Client) Connection() *grpc.ClientConn {
   444  	return c.internalClient.Connection()
   445  }
   446  
   447  // ListDockerImages lists docker images.
   448  func (c *Client) ListDockerImages(ctx context.Context, req *artifactregistrypb.ListDockerImagesRequest, opts ...gax.CallOption) *DockerImageIterator {
   449  	return c.internalClient.ListDockerImages(ctx, req, opts...)
   450  }
   451  
   452  // GetDockerImage gets a docker image.
   453  func (c *Client) GetDockerImage(ctx context.Context, req *artifactregistrypb.GetDockerImageRequest, opts ...gax.CallOption) (*artifactregistrypb.DockerImage, error) {
   454  	return c.internalClient.GetDockerImage(ctx, req, opts...)
   455  }
   456  
   457  // ListMavenArtifacts lists maven artifacts.
   458  func (c *Client) ListMavenArtifacts(ctx context.Context, req *artifactregistrypb.ListMavenArtifactsRequest, opts ...gax.CallOption) *MavenArtifactIterator {
   459  	return c.internalClient.ListMavenArtifacts(ctx, req, opts...)
   460  }
   461  
   462  // GetMavenArtifact gets a maven artifact.
   463  func (c *Client) GetMavenArtifact(ctx context.Context, req *artifactregistrypb.GetMavenArtifactRequest, opts ...gax.CallOption) (*artifactregistrypb.MavenArtifact, error) {
   464  	return c.internalClient.GetMavenArtifact(ctx, req, opts...)
   465  }
   466  
   467  // ListNpmPackages lists npm packages.
   468  func (c *Client) ListNpmPackages(ctx context.Context, req *artifactregistrypb.ListNpmPackagesRequest, opts ...gax.CallOption) *NpmPackageIterator {
   469  	return c.internalClient.ListNpmPackages(ctx, req, opts...)
   470  }
   471  
   472  // GetNpmPackage gets a npm package.
   473  func (c *Client) GetNpmPackage(ctx context.Context, req *artifactregistrypb.GetNpmPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.NpmPackage, error) {
   474  	return c.internalClient.GetNpmPackage(ctx, req, opts...)
   475  }
   476  
   477  // ListPythonPackages lists python packages.
   478  func (c *Client) ListPythonPackages(ctx context.Context, req *artifactregistrypb.ListPythonPackagesRequest, opts ...gax.CallOption) *PythonPackageIterator {
   479  	return c.internalClient.ListPythonPackages(ctx, req, opts...)
   480  }
   481  
   482  // GetPythonPackage gets a python package.
   483  func (c *Client) GetPythonPackage(ctx context.Context, req *artifactregistrypb.GetPythonPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.PythonPackage, error) {
   484  	return c.internalClient.GetPythonPackage(ctx, req, opts...)
   485  }
   486  
   487  // ImportAptArtifacts imports Apt artifacts. The returned Operation will complete once the
   488  // resources are imported. Package, Version, and File resources are created
   489  // based on the imported artifacts. Imported artifacts that conflict with
   490  // existing resources are ignored.
   491  func (c *Client) ImportAptArtifacts(ctx context.Context, req *artifactregistrypb.ImportAptArtifactsRequest, opts ...gax.CallOption) (*ImportAptArtifactsOperation, error) {
   492  	return c.internalClient.ImportAptArtifacts(ctx, req, opts...)
   493  }
   494  
   495  // ImportAptArtifactsOperation returns a new ImportAptArtifactsOperation from a given name.
   496  // The name must be that of a previously created ImportAptArtifactsOperation, possibly from a different process.
   497  func (c *Client) ImportAptArtifactsOperation(name string) *ImportAptArtifactsOperation {
   498  	return c.internalClient.ImportAptArtifactsOperation(name)
   499  }
   500  
   501  // ImportYumArtifacts imports Yum (RPM) artifacts. The returned Operation will complete once the
   502  // resources are imported. Package, Version, and File resources are created
   503  // based on the imported artifacts. Imported artifacts that conflict with
   504  // existing resources are ignored.
   505  func (c *Client) ImportYumArtifacts(ctx context.Context, req *artifactregistrypb.ImportYumArtifactsRequest, opts ...gax.CallOption) (*ImportYumArtifactsOperation, error) {
   506  	return c.internalClient.ImportYumArtifacts(ctx, req, opts...)
   507  }
   508  
   509  // ImportYumArtifactsOperation returns a new ImportYumArtifactsOperation from a given name.
   510  // The name must be that of a previously created ImportYumArtifactsOperation, possibly from a different process.
   511  func (c *Client) ImportYumArtifactsOperation(name string) *ImportYumArtifactsOperation {
   512  	return c.internalClient.ImportYumArtifactsOperation(name)
   513  }
   514  
   515  // ListRepositories lists repositories.
   516  func (c *Client) ListRepositories(ctx context.Context, req *artifactregistrypb.ListRepositoriesRequest, opts ...gax.CallOption) *RepositoryIterator {
   517  	return c.internalClient.ListRepositories(ctx, req, opts...)
   518  }
   519  
   520  // GetRepository gets a repository.
   521  func (c *Client) GetRepository(ctx context.Context, req *artifactregistrypb.GetRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
   522  	return c.internalClient.GetRepository(ctx, req, opts...)
   523  }
   524  
   525  // CreateRepository creates a repository. The returned Operation will finish once the
   526  // repository has been created. Its response will be the created Repository.
   527  func (c *Client) CreateRepository(ctx context.Context, req *artifactregistrypb.CreateRepositoryRequest, opts ...gax.CallOption) (*CreateRepositoryOperation, error) {
   528  	return c.internalClient.CreateRepository(ctx, req, opts...)
   529  }
   530  
   531  // CreateRepositoryOperation returns a new CreateRepositoryOperation from a given name.
   532  // The name must be that of a previously created CreateRepositoryOperation, possibly from a different process.
   533  func (c *Client) CreateRepositoryOperation(name string) *CreateRepositoryOperation {
   534  	return c.internalClient.CreateRepositoryOperation(name)
   535  }
   536  
   537  // UpdateRepository updates a repository.
   538  func (c *Client) UpdateRepository(ctx context.Context, req *artifactregistrypb.UpdateRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
   539  	return c.internalClient.UpdateRepository(ctx, req, opts...)
   540  }
   541  
   542  // DeleteRepository deletes a repository and all of its contents. The returned Operation will
   543  // finish once the repository has been deleted. It will not have any Operation
   544  // metadata and will return a google.protobuf.Empty response.
   545  func (c *Client) DeleteRepository(ctx context.Context, req *artifactregistrypb.DeleteRepositoryRequest, opts ...gax.CallOption) (*DeleteRepositoryOperation, error) {
   546  	return c.internalClient.DeleteRepository(ctx, req, opts...)
   547  }
   548  
   549  // DeleteRepositoryOperation returns a new DeleteRepositoryOperation from a given name.
   550  // The name must be that of a previously created DeleteRepositoryOperation, possibly from a different process.
   551  func (c *Client) DeleteRepositoryOperation(name string) *DeleteRepositoryOperation {
   552  	return c.internalClient.DeleteRepositoryOperation(name)
   553  }
   554  
   555  // ListPackages lists packages.
   556  func (c *Client) ListPackages(ctx context.Context, req *artifactregistrypb.ListPackagesRequest, opts ...gax.CallOption) *PackageIterator {
   557  	return c.internalClient.ListPackages(ctx, req, opts...)
   558  }
   559  
   560  // GetPackage gets a package.
   561  func (c *Client) GetPackage(ctx context.Context, req *artifactregistrypb.GetPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.Package, error) {
   562  	return c.internalClient.GetPackage(ctx, req, opts...)
   563  }
   564  
   565  // DeletePackage deletes a package and all of its versions and tags. The returned operation
   566  // will complete once the package has been deleted.
   567  func (c *Client) DeletePackage(ctx context.Context, req *artifactregistrypb.DeletePackageRequest, opts ...gax.CallOption) (*DeletePackageOperation, error) {
   568  	return c.internalClient.DeletePackage(ctx, req, opts...)
   569  }
   570  
   571  // DeletePackageOperation returns a new DeletePackageOperation from a given name.
   572  // The name must be that of a previously created DeletePackageOperation, possibly from a different process.
   573  func (c *Client) DeletePackageOperation(name string) *DeletePackageOperation {
   574  	return c.internalClient.DeletePackageOperation(name)
   575  }
   576  
   577  // ListVersions lists versions.
   578  func (c *Client) ListVersions(ctx context.Context, req *artifactregistrypb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator {
   579  	return c.internalClient.ListVersions(ctx, req, opts...)
   580  }
   581  
   582  // GetVersion gets a version
   583  func (c *Client) GetVersion(ctx context.Context, req *artifactregistrypb.GetVersionRequest, opts ...gax.CallOption) (*artifactregistrypb.Version, error) {
   584  	return c.internalClient.GetVersion(ctx, req, opts...)
   585  }
   586  
   587  // DeleteVersion deletes a version and all of its content. The returned operation will
   588  // complete once the version has been deleted.
   589  func (c *Client) DeleteVersion(ctx context.Context, req *artifactregistrypb.DeleteVersionRequest, opts ...gax.CallOption) (*DeleteVersionOperation, error) {
   590  	return c.internalClient.DeleteVersion(ctx, req, opts...)
   591  }
   592  
   593  // DeleteVersionOperation returns a new DeleteVersionOperation from a given name.
   594  // The name must be that of a previously created DeleteVersionOperation, possibly from a different process.
   595  func (c *Client) DeleteVersionOperation(name string) *DeleteVersionOperation {
   596  	return c.internalClient.DeleteVersionOperation(name)
   597  }
   598  
   599  // BatchDeleteVersions deletes multiple versions across a repository. The returned operation will
   600  // complete once the versions have been deleted.
   601  func (c *Client) BatchDeleteVersions(ctx context.Context, req *artifactregistrypb.BatchDeleteVersionsRequest, opts ...gax.CallOption) (*BatchDeleteVersionsOperation, error) {
   602  	return c.internalClient.BatchDeleteVersions(ctx, req, opts...)
   603  }
   604  
   605  // BatchDeleteVersionsOperation returns a new BatchDeleteVersionsOperation from a given name.
   606  // The name must be that of a previously created BatchDeleteVersionsOperation, possibly from a different process.
   607  func (c *Client) BatchDeleteVersionsOperation(name string) *BatchDeleteVersionsOperation {
   608  	return c.internalClient.BatchDeleteVersionsOperation(name)
   609  }
   610  
   611  // ListFiles lists files.
   612  func (c *Client) ListFiles(ctx context.Context, req *artifactregistrypb.ListFilesRequest, opts ...gax.CallOption) *FileIterator {
   613  	return c.internalClient.ListFiles(ctx, req, opts...)
   614  }
   615  
   616  // GetFile gets a file.
   617  func (c *Client) GetFile(ctx context.Context, req *artifactregistrypb.GetFileRequest, opts ...gax.CallOption) (*artifactregistrypb.File, error) {
   618  	return c.internalClient.GetFile(ctx, req, opts...)
   619  }
   620  
   621  // ListTags lists tags.
   622  func (c *Client) ListTags(ctx context.Context, req *artifactregistrypb.ListTagsRequest, opts ...gax.CallOption) *TagIterator {
   623  	return c.internalClient.ListTags(ctx, req, opts...)
   624  }
   625  
   626  // GetTag gets a tag.
   627  func (c *Client) GetTag(ctx context.Context, req *artifactregistrypb.GetTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
   628  	return c.internalClient.GetTag(ctx, req, opts...)
   629  }
   630  
   631  // CreateTag creates a tag.
   632  func (c *Client) CreateTag(ctx context.Context, req *artifactregistrypb.CreateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
   633  	return c.internalClient.CreateTag(ctx, req, opts...)
   634  }
   635  
   636  // UpdateTag updates a tag.
   637  func (c *Client) UpdateTag(ctx context.Context, req *artifactregistrypb.UpdateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
   638  	return c.internalClient.UpdateTag(ctx, req, opts...)
   639  }
   640  
   641  // DeleteTag deletes a tag.
   642  func (c *Client) DeleteTag(ctx context.Context, req *artifactregistrypb.DeleteTagRequest, opts ...gax.CallOption) error {
   643  	return c.internalClient.DeleteTag(ctx, req, opts...)
   644  }
   645  
   646  // SetIamPolicy updates the IAM policy for a given resource.
   647  func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   648  	return c.internalClient.SetIamPolicy(ctx, req, opts...)
   649  }
   650  
   651  // GetIamPolicy gets the IAM policy for a given resource.
   652  func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
   653  	return c.internalClient.GetIamPolicy(ctx, req, opts...)
   654  }
   655  
   656  // TestIamPermissions tests if the caller has a list of permissions on a resource.
   657  func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
   658  	return c.internalClient.TestIamPermissions(ctx, req, opts...)
   659  }
   660  
   661  // GetProjectSettings retrieves the Settings for the Project.
   662  func (c *Client) GetProjectSettings(ctx context.Context, req *artifactregistrypb.GetProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
   663  	return c.internalClient.GetProjectSettings(ctx, req, opts...)
   664  }
   665  
   666  // UpdateProjectSettings updates the Settings for the Project.
   667  func (c *Client) UpdateProjectSettings(ctx context.Context, req *artifactregistrypb.UpdateProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
   668  	return c.internalClient.UpdateProjectSettings(ctx, req, opts...)
   669  }
   670  
   671  // GetVPCSCConfig retrieves the VPCSC Config for the Project.
   672  func (c *Client) GetVPCSCConfig(ctx context.Context, req *artifactregistrypb.GetVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
   673  	return c.internalClient.GetVPCSCConfig(ctx, req, opts...)
   674  }
   675  
   676  // UpdateVPCSCConfig updates the VPCSC Config for the Project.
   677  func (c *Client) UpdateVPCSCConfig(ctx context.Context, req *artifactregistrypb.UpdateVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
   678  	return c.internalClient.UpdateVPCSCConfig(ctx, req, opts...)
   679  }
   680  
   681  // GetLocation gets information about a location.
   682  func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
   683  	return c.internalClient.GetLocation(ctx, req, opts...)
   684  }
   685  
   686  // ListLocations lists information about the supported locations for this service.
   687  func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
   688  	return c.internalClient.ListLocations(ctx, req, opts...)
   689  }
   690  
   691  // GetOperation is a utility method from google.longrunning.Operations.
   692  func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
   693  	return c.internalClient.GetOperation(ctx, req, opts...)
   694  }
   695  
   696  // gRPCClient is a client for interacting with Artifact Registry API over gRPC transport.
   697  //
   698  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   699  type gRPCClient struct {
   700  	// Connection pool of gRPC connections to the service.
   701  	connPool gtransport.ConnPool
   702  
   703  	// Points back to the CallOptions field of the containing Client
   704  	CallOptions **CallOptions
   705  
   706  	// The gRPC API client.
   707  	client artifactregistrypb.ArtifactRegistryClient
   708  
   709  	// LROClient is used internally to handle long-running operations.
   710  	// It is exposed so that its CallOptions can be modified if required.
   711  	// Users should not Close this client.
   712  	LROClient **lroauto.OperationsClient
   713  
   714  	operationsClient longrunningpb.OperationsClient
   715  
   716  	locationsClient locationpb.LocationsClient
   717  
   718  	// The x-goog-* metadata to be sent with each request.
   719  	xGoogHeaders []string
   720  }
   721  
   722  // NewClient creates a new artifact registry client based on gRPC.
   723  // The returned client must be Closed when it is done being used to clean up its underlying connections.
   724  //
   725  // The Artifact Registry API service.
   726  //
   727  // Artifact Registry is an artifact management system for storing artifacts
   728  // from different package management systems.
   729  //
   730  // The resources managed by this API are:
   731  //
   732  //	Repositories, which group packages and their data.
   733  //
   734  //	Packages, which group versions and their tags.
   735  //
   736  //	Versions, which are specific forms of a package.
   737  //
   738  //	Tags, which represent alternative names for versions.
   739  //
   740  //	Files, which contain content and are optionally associated with a Package
   741  //	or Version.
   742  func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
   743  	clientOpts := defaultGRPCClientOptions()
   744  	if newClientHook != nil {
   745  		hookOpts, err := newClientHook(ctx, clientHookParams{})
   746  		if err != nil {
   747  			return nil, err
   748  		}
   749  		clientOpts = append(clientOpts, hookOpts...)
   750  	}
   751  
   752  	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
   753  	if err != nil {
   754  		return nil, err
   755  	}
   756  	client := Client{CallOptions: defaultCallOptions()}
   757  
   758  	c := &gRPCClient{
   759  		connPool:         connPool,
   760  		client:           artifactregistrypb.NewArtifactRegistryClient(connPool),
   761  		CallOptions:      &client.CallOptions,
   762  		operationsClient: longrunningpb.NewOperationsClient(connPool),
   763  		locationsClient:  locationpb.NewLocationsClient(connPool),
   764  	}
   765  	c.setGoogleClientInfo()
   766  
   767  	client.internalClient = c
   768  
   769  	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
   770  	if err != nil {
   771  		// This error "should not happen", since we are just reusing old connection pool
   772  		// and never actually need to dial.
   773  		// If this does happen, we could leak connp. However, we cannot close conn:
   774  		// If the user invoked the constructor with option.WithGRPCConn,
   775  		// we would close a connection that's still in use.
   776  		// TODO: investigate error conditions.
   777  		return nil, err
   778  	}
   779  	c.LROClient = &client.LROClient
   780  	return &client, nil
   781  }
   782  
   783  // Connection returns a connection to the API service.
   784  //
   785  // Deprecated: Connections are now pooled so this method does not always
   786  // return the same resource.
   787  func (c *gRPCClient) Connection() *grpc.ClientConn {
   788  	return c.connPool.Conn()
   789  }
   790  
   791  // setGoogleClientInfo sets the name and version of the application in
   792  // the `x-goog-api-client` header passed on each request. Intended for
   793  // use by Google-written clients.
   794  func (c *gRPCClient) setGoogleClientInfo(keyval ...string) {
   795  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   796  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
   797  	c.xGoogHeaders = []string{"x-goog-api-client", gax.XGoogHeader(kv...)}
   798  }
   799  
   800  // Close closes the connection to the API service. The user should invoke this when
   801  // the client is no longer required.
   802  func (c *gRPCClient) Close() error {
   803  	return c.connPool.Close()
   804  }
   805  
   806  // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
   807  type restClient struct {
   808  	// The http endpoint to connect to.
   809  	endpoint string
   810  
   811  	// The http client.
   812  	httpClient *http.Client
   813  
   814  	// LROClient is used internally to handle long-running operations.
   815  	// It is exposed so that its CallOptions can be modified if required.
   816  	// Users should not Close this client.
   817  	LROClient **lroauto.OperationsClient
   818  
   819  	// The x-goog-* headers to be sent with each request.
   820  	xGoogHeaders []string
   821  
   822  	// Points back to the CallOptions field of the containing Client
   823  	CallOptions **CallOptions
   824  }
   825  
   826  // NewRESTClient creates a new artifact registry rest client.
   827  //
   828  // The Artifact Registry API service.
   829  //
   830  // Artifact Registry is an artifact management system for storing artifacts
   831  // from different package management systems.
   832  //
   833  // The resources managed by this API are:
   834  //
   835  //	Repositories, which group packages and their data.
   836  //
   837  //	Packages, which group versions and their tags.
   838  //
   839  //	Versions, which are specific forms of a package.
   840  //
   841  //	Tags, which represent alternative names for versions.
   842  //
   843  //	Files, which contain content and are optionally associated with a Package
   844  //	or Version.
   845  func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
   846  	clientOpts := append(defaultRESTClientOptions(), opts...)
   847  	httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
   848  	if err != nil {
   849  		return nil, err
   850  	}
   851  
   852  	callOpts := defaultRESTCallOptions()
   853  	c := &restClient{
   854  		endpoint:    endpoint,
   855  		httpClient:  httpClient,
   856  		CallOptions: &callOpts,
   857  	}
   858  	c.setGoogleClientInfo()
   859  
   860  	lroOpts := []option.ClientOption{
   861  		option.WithHTTPClient(httpClient),
   862  		option.WithEndpoint(endpoint),
   863  	}
   864  	opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
   865  	if err != nil {
   866  		return nil, err
   867  	}
   868  	c.LROClient = &opClient
   869  
   870  	return &Client{internalClient: c, CallOptions: callOpts}, nil
   871  }
   872  
   873  func defaultRESTClientOptions() []option.ClientOption {
   874  	return []option.ClientOption{
   875  		internaloption.WithDefaultEndpoint("https://artifactregistry.googleapis.com"),
   876  		internaloption.WithDefaultEndpointTemplate("https://artifactregistry.UNIVERSE_DOMAIN"),
   877  		internaloption.WithDefaultMTLSEndpoint("https://artifactregistry.mtls.googleapis.com"),
   878  		internaloption.WithDefaultUniverseDomain("googleapis.com"),
   879  		internaloption.WithDefaultAudience("https://artifactregistry.googleapis.com/"),
   880  		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
   881  	}
   882  }
   883  
   884  // setGoogleClientInfo sets the name and version of the application in
   885  // the `x-goog-api-client` header passed on each request. Intended for
   886  // use by Google-written clients.
   887  func (c *restClient) setGoogleClientInfo(keyval ...string) {
   888  	kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
   889  	kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN")
   890  	c.xGoogHeaders = []string{"x-goog-api-client", gax.XGoogHeader(kv...)}
   891  }
   892  
   893  // Close closes the connection to the API service. The user should invoke this when
   894  // the client is no longer required.
   895  func (c *restClient) Close() error {
   896  	// Replace httpClient with nil to force cleanup.
   897  	c.httpClient = nil
   898  	return nil
   899  }
   900  
   901  // Connection returns a connection to the API service.
   902  //
   903  // Deprecated: This method always returns nil.
   904  func (c *restClient) Connection() *grpc.ClientConn {
   905  	return nil
   906  }
   907  func (c *gRPCClient) ListDockerImages(ctx context.Context, req *artifactregistrypb.ListDockerImagesRequest, opts ...gax.CallOption) *DockerImageIterator {
   908  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   909  
   910  	hds = append(c.xGoogHeaders, hds...)
   911  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   912  	opts = append((*c.CallOptions).ListDockerImages[0:len((*c.CallOptions).ListDockerImages):len((*c.CallOptions).ListDockerImages)], opts...)
   913  	it := &DockerImageIterator{}
   914  	req = proto.Clone(req).(*artifactregistrypb.ListDockerImagesRequest)
   915  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.DockerImage, string, error) {
   916  		resp := &artifactregistrypb.ListDockerImagesResponse{}
   917  		if pageToken != "" {
   918  			req.PageToken = pageToken
   919  		}
   920  		if pageSize > math.MaxInt32 {
   921  			req.PageSize = math.MaxInt32
   922  		} else if pageSize != 0 {
   923  			req.PageSize = int32(pageSize)
   924  		}
   925  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   926  			var err error
   927  			resp, err = c.client.ListDockerImages(ctx, req, settings.GRPC...)
   928  			return err
   929  		}, opts...)
   930  		if err != nil {
   931  			return nil, "", err
   932  		}
   933  
   934  		it.Response = resp
   935  		return resp.GetDockerImages(), resp.GetNextPageToken(), nil
   936  	}
   937  	fetch := func(pageSize int, pageToken string) (string, error) {
   938  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
   939  		if err != nil {
   940  			return "", err
   941  		}
   942  		it.items = append(it.items, items...)
   943  		return nextPageToken, nil
   944  	}
   945  
   946  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
   947  	it.pageInfo.MaxSize = int(req.GetPageSize())
   948  	it.pageInfo.Token = req.GetPageToken()
   949  
   950  	return it
   951  }
   952  
   953  func (c *gRPCClient) GetDockerImage(ctx context.Context, req *artifactregistrypb.GetDockerImageRequest, opts ...gax.CallOption) (*artifactregistrypb.DockerImage, error) {
   954  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
   955  
   956  	hds = append(c.xGoogHeaders, hds...)
   957  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   958  	opts = append((*c.CallOptions).GetDockerImage[0:len((*c.CallOptions).GetDockerImage):len((*c.CallOptions).GetDockerImage)], opts...)
   959  	var resp *artifactregistrypb.DockerImage
   960  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   961  		var err error
   962  		resp, err = c.client.GetDockerImage(ctx, req, settings.GRPC...)
   963  		return err
   964  	}, opts...)
   965  	if err != nil {
   966  		return nil, err
   967  	}
   968  	return resp, nil
   969  }
   970  
   971  func (c *gRPCClient) ListMavenArtifacts(ctx context.Context, req *artifactregistrypb.ListMavenArtifactsRequest, opts ...gax.CallOption) *MavenArtifactIterator {
   972  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
   973  
   974  	hds = append(c.xGoogHeaders, hds...)
   975  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
   976  	opts = append((*c.CallOptions).ListMavenArtifacts[0:len((*c.CallOptions).ListMavenArtifacts):len((*c.CallOptions).ListMavenArtifacts)], opts...)
   977  	it := &MavenArtifactIterator{}
   978  	req = proto.Clone(req).(*artifactregistrypb.ListMavenArtifactsRequest)
   979  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.MavenArtifact, string, error) {
   980  		resp := &artifactregistrypb.ListMavenArtifactsResponse{}
   981  		if pageToken != "" {
   982  			req.PageToken = pageToken
   983  		}
   984  		if pageSize > math.MaxInt32 {
   985  			req.PageSize = math.MaxInt32
   986  		} else if pageSize != 0 {
   987  			req.PageSize = int32(pageSize)
   988  		}
   989  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
   990  			var err error
   991  			resp, err = c.client.ListMavenArtifacts(ctx, req, settings.GRPC...)
   992  			return err
   993  		}, opts...)
   994  		if err != nil {
   995  			return nil, "", err
   996  		}
   997  
   998  		it.Response = resp
   999  		return resp.GetMavenArtifacts(), resp.GetNextPageToken(), nil
  1000  	}
  1001  	fetch := func(pageSize int, pageToken string) (string, error) {
  1002  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1003  		if err != nil {
  1004  			return "", err
  1005  		}
  1006  		it.items = append(it.items, items...)
  1007  		return nextPageToken, nil
  1008  	}
  1009  
  1010  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1011  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1012  	it.pageInfo.Token = req.GetPageToken()
  1013  
  1014  	return it
  1015  }
  1016  
  1017  func (c *gRPCClient) GetMavenArtifact(ctx context.Context, req *artifactregistrypb.GetMavenArtifactRequest, opts ...gax.CallOption) (*artifactregistrypb.MavenArtifact, error) {
  1018  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1019  
  1020  	hds = append(c.xGoogHeaders, hds...)
  1021  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1022  	opts = append((*c.CallOptions).GetMavenArtifact[0:len((*c.CallOptions).GetMavenArtifact):len((*c.CallOptions).GetMavenArtifact)], opts...)
  1023  	var resp *artifactregistrypb.MavenArtifact
  1024  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1025  		var err error
  1026  		resp, err = c.client.GetMavenArtifact(ctx, req, settings.GRPC...)
  1027  		return err
  1028  	}, opts...)
  1029  	if err != nil {
  1030  		return nil, err
  1031  	}
  1032  	return resp, nil
  1033  }
  1034  
  1035  func (c *gRPCClient) ListNpmPackages(ctx context.Context, req *artifactregistrypb.ListNpmPackagesRequest, opts ...gax.CallOption) *NpmPackageIterator {
  1036  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1037  
  1038  	hds = append(c.xGoogHeaders, hds...)
  1039  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1040  	opts = append((*c.CallOptions).ListNpmPackages[0:len((*c.CallOptions).ListNpmPackages):len((*c.CallOptions).ListNpmPackages)], opts...)
  1041  	it := &NpmPackageIterator{}
  1042  	req = proto.Clone(req).(*artifactregistrypb.ListNpmPackagesRequest)
  1043  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.NpmPackage, string, error) {
  1044  		resp := &artifactregistrypb.ListNpmPackagesResponse{}
  1045  		if pageToken != "" {
  1046  			req.PageToken = pageToken
  1047  		}
  1048  		if pageSize > math.MaxInt32 {
  1049  			req.PageSize = math.MaxInt32
  1050  		} else if pageSize != 0 {
  1051  			req.PageSize = int32(pageSize)
  1052  		}
  1053  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1054  			var err error
  1055  			resp, err = c.client.ListNpmPackages(ctx, req, settings.GRPC...)
  1056  			return err
  1057  		}, opts...)
  1058  		if err != nil {
  1059  			return nil, "", err
  1060  		}
  1061  
  1062  		it.Response = resp
  1063  		return resp.GetNpmPackages(), resp.GetNextPageToken(), nil
  1064  	}
  1065  	fetch := func(pageSize int, pageToken string) (string, error) {
  1066  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1067  		if err != nil {
  1068  			return "", err
  1069  		}
  1070  		it.items = append(it.items, items...)
  1071  		return nextPageToken, nil
  1072  	}
  1073  
  1074  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1075  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1076  	it.pageInfo.Token = req.GetPageToken()
  1077  
  1078  	return it
  1079  }
  1080  
  1081  func (c *gRPCClient) GetNpmPackage(ctx context.Context, req *artifactregistrypb.GetNpmPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.NpmPackage, error) {
  1082  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1083  
  1084  	hds = append(c.xGoogHeaders, hds...)
  1085  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1086  	opts = append((*c.CallOptions).GetNpmPackage[0:len((*c.CallOptions).GetNpmPackage):len((*c.CallOptions).GetNpmPackage)], opts...)
  1087  	var resp *artifactregistrypb.NpmPackage
  1088  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1089  		var err error
  1090  		resp, err = c.client.GetNpmPackage(ctx, req, settings.GRPC...)
  1091  		return err
  1092  	}, opts...)
  1093  	if err != nil {
  1094  		return nil, err
  1095  	}
  1096  	return resp, nil
  1097  }
  1098  
  1099  func (c *gRPCClient) ListPythonPackages(ctx context.Context, req *artifactregistrypb.ListPythonPackagesRequest, opts ...gax.CallOption) *PythonPackageIterator {
  1100  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1101  
  1102  	hds = append(c.xGoogHeaders, hds...)
  1103  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1104  	opts = append((*c.CallOptions).ListPythonPackages[0:len((*c.CallOptions).ListPythonPackages):len((*c.CallOptions).ListPythonPackages)], opts...)
  1105  	it := &PythonPackageIterator{}
  1106  	req = proto.Clone(req).(*artifactregistrypb.ListPythonPackagesRequest)
  1107  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.PythonPackage, string, error) {
  1108  		resp := &artifactregistrypb.ListPythonPackagesResponse{}
  1109  		if pageToken != "" {
  1110  			req.PageToken = pageToken
  1111  		}
  1112  		if pageSize > math.MaxInt32 {
  1113  			req.PageSize = math.MaxInt32
  1114  		} else if pageSize != 0 {
  1115  			req.PageSize = int32(pageSize)
  1116  		}
  1117  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1118  			var err error
  1119  			resp, err = c.client.ListPythonPackages(ctx, req, settings.GRPC...)
  1120  			return err
  1121  		}, opts...)
  1122  		if err != nil {
  1123  			return nil, "", err
  1124  		}
  1125  
  1126  		it.Response = resp
  1127  		return resp.GetPythonPackages(), resp.GetNextPageToken(), nil
  1128  	}
  1129  	fetch := func(pageSize int, pageToken string) (string, error) {
  1130  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1131  		if err != nil {
  1132  			return "", err
  1133  		}
  1134  		it.items = append(it.items, items...)
  1135  		return nextPageToken, nil
  1136  	}
  1137  
  1138  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1139  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1140  	it.pageInfo.Token = req.GetPageToken()
  1141  
  1142  	return it
  1143  }
  1144  
  1145  func (c *gRPCClient) GetPythonPackage(ctx context.Context, req *artifactregistrypb.GetPythonPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.PythonPackage, error) {
  1146  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1147  
  1148  	hds = append(c.xGoogHeaders, hds...)
  1149  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1150  	opts = append((*c.CallOptions).GetPythonPackage[0:len((*c.CallOptions).GetPythonPackage):len((*c.CallOptions).GetPythonPackage)], opts...)
  1151  	var resp *artifactregistrypb.PythonPackage
  1152  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1153  		var err error
  1154  		resp, err = c.client.GetPythonPackage(ctx, req, settings.GRPC...)
  1155  		return err
  1156  	}, opts...)
  1157  	if err != nil {
  1158  		return nil, err
  1159  	}
  1160  	return resp, nil
  1161  }
  1162  
  1163  func (c *gRPCClient) ImportAptArtifacts(ctx context.Context, req *artifactregistrypb.ImportAptArtifactsRequest, opts ...gax.CallOption) (*ImportAptArtifactsOperation, error) {
  1164  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1165  
  1166  	hds = append(c.xGoogHeaders, hds...)
  1167  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1168  	opts = append((*c.CallOptions).ImportAptArtifacts[0:len((*c.CallOptions).ImportAptArtifacts):len((*c.CallOptions).ImportAptArtifacts)], opts...)
  1169  	var resp *longrunningpb.Operation
  1170  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1171  		var err error
  1172  		resp, err = c.client.ImportAptArtifacts(ctx, req, settings.GRPC...)
  1173  		return err
  1174  	}, opts...)
  1175  	if err != nil {
  1176  		return nil, err
  1177  	}
  1178  	return &ImportAptArtifactsOperation{
  1179  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1180  	}, nil
  1181  }
  1182  
  1183  func (c *gRPCClient) ImportYumArtifacts(ctx context.Context, req *artifactregistrypb.ImportYumArtifactsRequest, opts ...gax.CallOption) (*ImportYumArtifactsOperation, error) {
  1184  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1185  
  1186  	hds = append(c.xGoogHeaders, hds...)
  1187  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1188  	opts = append((*c.CallOptions).ImportYumArtifacts[0:len((*c.CallOptions).ImportYumArtifacts):len((*c.CallOptions).ImportYumArtifacts)], opts...)
  1189  	var resp *longrunningpb.Operation
  1190  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1191  		var err error
  1192  		resp, err = c.client.ImportYumArtifacts(ctx, req, settings.GRPC...)
  1193  		return err
  1194  	}, opts...)
  1195  	if err != nil {
  1196  		return nil, err
  1197  	}
  1198  	return &ImportYumArtifactsOperation{
  1199  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1200  	}, nil
  1201  }
  1202  
  1203  func (c *gRPCClient) ListRepositories(ctx context.Context, req *artifactregistrypb.ListRepositoriesRequest, opts ...gax.CallOption) *RepositoryIterator {
  1204  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1205  
  1206  	hds = append(c.xGoogHeaders, hds...)
  1207  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1208  	opts = append((*c.CallOptions).ListRepositories[0:len((*c.CallOptions).ListRepositories):len((*c.CallOptions).ListRepositories)], opts...)
  1209  	it := &RepositoryIterator{}
  1210  	req = proto.Clone(req).(*artifactregistrypb.ListRepositoriesRequest)
  1211  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Repository, string, error) {
  1212  		resp := &artifactregistrypb.ListRepositoriesResponse{}
  1213  		if pageToken != "" {
  1214  			req.PageToken = pageToken
  1215  		}
  1216  		if pageSize > math.MaxInt32 {
  1217  			req.PageSize = math.MaxInt32
  1218  		} else if pageSize != 0 {
  1219  			req.PageSize = int32(pageSize)
  1220  		}
  1221  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1222  			var err error
  1223  			resp, err = c.client.ListRepositories(ctx, req, settings.GRPC...)
  1224  			return err
  1225  		}, opts...)
  1226  		if err != nil {
  1227  			return nil, "", err
  1228  		}
  1229  
  1230  		it.Response = resp
  1231  		return resp.GetRepositories(), resp.GetNextPageToken(), nil
  1232  	}
  1233  	fetch := func(pageSize int, pageToken string) (string, error) {
  1234  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1235  		if err != nil {
  1236  			return "", err
  1237  		}
  1238  		it.items = append(it.items, items...)
  1239  		return nextPageToken, nil
  1240  	}
  1241  
  1242  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1243  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1244  	it.pageInfo.Token = req.GetPageToken()
  1245  
  1246  	return it
  1247  }
  1248  
  1249  func (c *gRPCClient) GetRepository(ctx context.Context, req *artifactregistrypb.GetRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
  1250  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1251  
  1252  	hds = append(c.xGoogHeaders, hds...)
  1253  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1254  	opts = append((*c.CallOptions).GetRepository[0:len((*c.CallOptions).GetRepository):len((*c.CallOptions).GetRepository)], opts...)
  1255  	var resp *artifactregistrypb.Repository
  1256  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1257  		var err error
  1258  		resp, err = c.client.GetRepository(ctx, req, settings.GRPC...)
  1259  		return err
  1260  	}, opts...)
  1261  	if err != nil {
  1262  		return nil, err
  1263  	}
  1264  	return resp, nil
  1265  }
  1266  
  1267  func (c *gRPCClient) CreateRepository(ctx context.Context, req *artifactregistrypb.CreateRepositoryRequest, opts ...gax.CallOption) (*CreateRepositoryOperation, error) {
  1268  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1269  
  1270  	hds = append(c.xGoogHeaders, hds...)
  1271  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1272  	opts = append((*c.CallOptions).CreateRepository[0:len((*c.CallOptions).CreateRepository):len((*c.CallOptions).CreateRepository)], opts...)
  1273  	var resp *longrunningpb.Operation
  1274  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1275  		var err error
  1276  		resp, err = c.client.CreateRepository(ctx, req, settings.GRPC...)
  1277  		return err
  1278  	}, opts...)
  1279  	if err != nil {
  1280  		return nil, err
  1281  	}
  1282  	return &CreateRepositoryOperation{
  1283  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1284  	}, nil
  1285  }
  1286  
  1287  func (c *gRPCClient) UpdateRepository(ctx context.Context, req *artifactregistrypb.UpdateRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
  1288  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "repository.name", url.QueryEscape(req.GetRepository().GetName()))}
  1289  
  1290  	hds = append(c.xGoogHeaders, hds...)
  1291  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1292  	opts = append((*c.CallOptions).UpdateRepository[0:len((*c.CallOptions).UpdateRepository):len((*c.CallOptions).UpdateRepository)], opts...)
  1293  	var resp *artifactregistrypb.Repository
  1294  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1295  		var err error
  1296  		resp, err = c.client.UpdateRepository(ctx, req, settings.GRPC...)
  1297  		return err
  1298  	}, opts...)
  1299  	if err != nil {
  1300  		return nil, err
  1301  	}
  1302  	return resp, nil
  1303  }
  1304  
  1305  func (c *gRPCClient) DeleteRepository(ctx context.Context, req *artifactregistrypb.DeleteRepositoryRequest, opts ...gax.CallOption) (*DeleteRepositoryOperation, error) {
  1306  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1307  
  1308  	hds = append(c.xGoogHeaders, hds...)
  1309  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1310  	opts = append((*c.CallOptions).DeleteRepository[0:len((*c.CallOptions).DeleteRepository):len((*c.CallOptions).DeleteRepository)], opts...)
  1311  	var resp *longrunningpb.Operation
  1312  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1313  		var err error
  1314  		resp, err = c.client.DeleteRepository(ctx, req, settings.GRPC...)
  1315  		return err
  1316  	}, opts...)
  1317  	if err != nil {
  1318  		return nil, err
  1319  	}
  1320  	return &DeleteRepositoryOperation{
  1321  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1322  	}, nil
  1323  }
  1324  
  1325  func (c *gRPCClient) ListPackages(ctx context.Context, req *artifactregistrypb.ListPackagesRequest, opts ...gax.CallOption) *PackageIterator {
  1326  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1327  
  1328  	hds = append(c.xGoogHeaders, hds...)
  1329  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1330  	opts = append((*c.CallOptions).ListPackages[0:len((*c.CallOptions).ListPackages):len((*c.CallOptions).ListPackages)], opts...)
  1331  	it := &PackageIterator{}
  1332  	req = proto.Clone(req).(*artifactregistrypb.ListPackagesRequest)
  1333  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Package, string, error) {
  1334  		resp := &artifactregistrypb.ListPackagesResponse{}
  1335  		if pageToken != "" {
  1336  			req.PageToken = pageToken
  1337  		}
  1338  		if pageSize > math.MaxInt32 {
  1339  			req.PageSize = math.MaxInt32
  1340  		} else if pageSize != 0 {
  1341  			req.PageSize = int32(pageSize)
  1342  		}
  1343  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1344  			var err error
  1345  			resp, err = c.client.ListPackages(ctx, req, settings.GRPC...)
  1346  			return err
  1347  		}, opts...)
  1348  		if err != nil {
  1349  			return nil, "", err
  1350  		}
  1351  
  1352  		it.Response = resp
  1353  		return resp.GetPackages(), resp.GetNextPageToken(), nil
  1354  	}
  1355  	fetch := func(pageSize int, pageToken string) (string, error) {
  1356  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1357  		if err != nil {
  1358  			return "", err
  1359  		}
  1360  		it.items = append(it.items, items...)
  1361  		return nextPageToken, nil
  1362  	}
  1363  
  1364  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1365  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1366  	it.pageInfo.Token = req.GetPageToken()
  1367  
  1368  	return it
  1369  }
  1370  
  1371  func (c *gRPCClient) GetPackage(ctx context.Context, req *artifactregistrypb.GetPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.Package, error) {
  1372  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1373  
  1374  	hds = append(c.xGoogHeaders, hds...)
  1375  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1376  	opts = append((*c.CallOptions).GetPackage[0:len((*c.CallOptions).GetPackage):len((*c.CallOptions).GetPackage)], opts...)
  1377  	var resp *artifactregistrypb.Package
  1378  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1379  		var err error
  1380  		resp, err = c.client.GetPackage(ctx, req, settings.GRPC...)
  1381  		return err
  1382  	}, opts...)
  1383  	if err != nil {
  1384  		return nil, err
  1385  	}
  1386  	return resp, nil
  1387  }
  1388  
  1389  func (c *gRPCClient) DeletePackage(ctx context.Context, req *artifactregistrypb.DeletePackageRequest, opts ...gax.CallOption) (*DeletePackageOperation, error) {
  1390  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1391  
  1392  	hds = append(c.xGoogHeaders, hds...)
  1393  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1394  	opts = append((*c.CallOptions).DeletePackage[0:len((*c.CallOptions).DeletePackage):len((*c.CallOptions).DeletePackage)], opts...)
  1395  	var resp *longrunningpb.Operation
  1396  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1397  		var err error
  1398  		resp, err = c.client.DeletePackage(ctx, req, settings.GRPC...)
  1399  		return err
  1400  	}, opts...)
  1401  	if err != nil {
  1402  		return nil, err
  1403  	}
  1404  	return &DeletePackageOperation{
  1405  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1406  	}, nil
  1407  }
  1408  
  1409  func (c *gRPCClient) ListVersions(ctx context.Context, req *artifactregistrypb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator {
  1410  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1411  
  1412  	hds = append(c.xGoogHeaders, hds...)
  1413  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1414  	opts = append((*c.CallOptions).ListVersions[0:len((*c.CallOptions).ListVersions):len((*c.CallOptions).ListVersions)], opts...)
  1415  	it := &VersionIterator{}
  1416  	req = proto.Clone(req).(*artifactregistrypb.ListVersionsRequest)
  1417  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Version, string, error) {
  1418  		resp := &artifactregistrypb.ListVersionsResponse{}
  1419  		if pageToken != "" {
  1420  			req.PageToken = pageToken
  1421  		}
  1422  		if pageSize > math.MaxInt32 {
  1423  			req.PageSize = math.MaxInt32
  1424  		} else if pageSize != 0 {
  1425  			req.PageSize = int32(pageSize)
  1426  		}
  1427  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1428  			var err error
  1429  			resp, err = c.client.ListVersions(ctx, req, settings.GRPC...)
  1430  			return err
  1431  		}, opts...)
  1432  		if err != nil {
  1433  			return nil, "", err
  1434  		}
  1435  
  1436  		it.Response = resp
  1437  		return resp.GetVersions(), resp.GetNextPageToken(), nil
  1438  	}
  1439  	fetch := func(pageSize int, pageToken string) (string, error) {
  1440  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1441  		if err != nil {
  1442  			return "", err
  1443  		}
  1444  		it.items = append(it.items, items...)
  1445  		return nextPageToken, nil
  1446  	}
  1447  
  1448  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1449  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1450  	it.pageInfo.Token = req.GetPageToken()
  1451  
  1452  	return it
  1453  }
  1454  
  1455  func (c *gRPCClient) GetVersion(ctx context.Context, req *artifactregistrypb.GetVersionRequest, opts ...gax.CallOption) (*artifactregistrypb.Version, error) {
  1456  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1457  
  1458  	hds = append(c.xGoogHeaders, hds...)
  1459  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1460  	opts = append((*c.CallOptions).GetVersion[0:len((*c.CallOptions).GetVersion):len((*c.CallOptions).GetVersion)], opts...)
  1461  	var resp *artifactregistrypb.Version
  1462  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1463  		var err error
  1464  		resp, err = c.client.GetVersion(ctx, req, settings.GRPC...)
  1465  		return err
  1466  	}, opts...)
  1467  	if err != nil {
  1468  		return nil, err
  1469  	}
  1470  	return resp, nil
  1471  }
  1472  
  1473  func (c *gRPCClient) DeleteVersion(ctx context.Context, req *artifactregistrypb.DeleteVersionRequest, opts ...gax.CallOption) (*DeleteVersionOperation, error) {
  1474  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1475  
  1476  	hds = append(c.xGoogHeaders, hds...)
  1477  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1478  	opts = append((*c.CallOptions).DeleteVersion[0:len((*c.CallOptions).DeleteVersion):len((*c.CallOptions).DeleteVersion)], opts...)
  1479  	var resp *longrunningpb.Operation
  1480  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1481  		var err error
  1482  		resp, err = c.client.DeleteVersion(ctx, req, settings.GRPC...)
  1483  		return err
  1484  	}, opts...)
  1485  	if err != nil {
  1486  		return nil, err
  1487  	}
  1488  	return &DeleteVersionOperation{
  1489  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1490  	}, nil
  1491  }
  1492  
  1493  func (c *gRPCClient) BatchDeleteVersions(ctx context.Context, req *artifactregistrypb.BatchDeleteVersionsRequest, opts ...gax.CallOption) (*BatchDeleteVersionsOperation, error) {
  1494  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1495  
  1496  	hds = append(c.xGoogHeaders, hds...)
  1497  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1498  	opts = append((*c.CallOptions).BatchDeleteVersions[0:len((*c.CallOptions).BatchDeleteVersions):len((*c.CallOptions).BatchDeleteVersions)], opts...)
  1499  	var resp *longrunningpb.Operation
  1500  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1501  		var err error
  1502  		resp, err = c.client.BatchDeleteVersions(ctx, req, settings.GRPC...)
  1503  		return err
  1504  	}, opts...)
  1505  	if err != nil {
  1506  		return nil, err
  1507  	}
  1508  	return &BatchDeleteVersionsOperation{
  1509  		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
  1510  	}, nil
  1511  }
  1512  
  1513  func (c *gRPCClient) ListFiles(ctx context.Context, req *artifactregistrypb.ListFilesRequest, opts ...gax.CallOption) *FileIterator {
  1514  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1515  
  1516  	hds = append(c.xGoogHeaders, hds...)
  1517  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1518  	opts = append((*c.CallOptions).ListFiles[0:len((*c.CallOptions).ListFiles):len((*c.CallOptions).ListFiles)], opts...)
  1519  	it := &FileIterator{}
  1520  	req = proto.Clone(req).(*artifactregistrypb.ListFilesRequest)
  1521  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.File, string, error) {
  1522  		resp := &artifactregistrypb.ListFilesResponse{}
  1523  		if pageToken != "" {
  1524  			req.PageToken = pageToken
  1525  		}
  1526  		if pageSize > math.MaxInt32 {
  1527  			req.PageSize = math.MaxInt32
  1528  		} else if pageSize != 0 {
  1529  			req.PageSize = int32(pageSize)
  1530  		}
  1531  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1532  			var err error
  1533  			resp, err = c.client.ListFiles(ctx, req, settings.GRPC...)
  1534  			return err
  1535  		}, opts...)
  1536  		if err != nil {
  1537  			return nil, "", err
  1538  		}
  1539  
  1540  		it.Response = resp
  1541  		return resp.GetFiles(), resp.GetNextPageToken(), nil
  1542  	}
  1543  	fetch := func(pageSize int, pageToken string) (string, error) {
  1544  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1545  		if err != nil {
  1546  			return "", err
  1547  		}
  1548  		it.items = append(it.items, items...)
  1549  		return nextPageToken, nil
  1550  	}
  1551  
  1552  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1553  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1554  	it.pageInfo.Token = req.GetPageToken()
  1555  
  1556  	return it
  1557  }
  1558  
  1559  func (c *gRPCClient) GetFile(ctx context.Context, req *artifactregistrypb.GetFileRequest, opts ...gax.CallOption) (*artifactregistrypb.File, error) {
  1560  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1561  
  1562  	hds = append(c.xGoogHeaders, hds...)
  1563  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1564  	opts = append((*c.CallOptions).GetFile[0:len((*c.CallOptions).GetFile):len((*c.CallOptions).GetFile)], opts...)
  1565  	var resp *artifactregistrypb.File
  1566  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1567  		var err error
  1568  		resp, err = c.client.GetFile(ctx, req, settings.GRPC...)
  1569  		return err
  1570  	}, opts...)
  1571  	if err != nil {
  1572  		return nil, err
  1573  	}
  1574  	return resp, nil
  1575  }
  1576  
  1577  func (c *gRPCClient) ListTags(ctx context.Context, req *artifactregistrypb.ListTagsRequest, opts ...gax.CallOption) *TagIterator {
  1578  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1579  
  1580  	hds = append(c.xGoogHeaders, hds...)
  1581  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1582  	opts = append((*c.CallOptions).ListTags[0:len((*c.CallOptions).ListTags):len((*c.CallOptions).ListTags)], opts...)
  1583  	it := &TagIterator{}
  1584  	req = proto.Clone(req).(*artifactregistrypb.ListTagsRequest)
  1585  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Tag, string, error) {
  1586  		resp := &artifactregistrypb.ListTagsResponse{}
  1587  		if pageToken != "" {
  1588  			req.PageToken = pageToken
  1589  		}
  1590  		if pageSize > math.MaxInt32 {
  1591  			req.PageSize = math.MaxInt32
  1592  		} else if pageSize != 0 {
  1593  			req.PageSize = int32(pageSize)
  1594  		}
  1595  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1596  			var err error
  1597  			resp, err = c.client.ListTags(ctx, req, settings.GRPC...)
  1598  			return err
  1599  		}, opts...)
  1600  		if err != nil {
  1601  			return nil, "", err
  1602  		}
  1603  
  1604  		it.Response = resp
  1605  		return resp.GetTags(), resp.GetNextPageToken(), nil
  1606  	}
  1607  	fetch := func(pageSize int, pageToken string) (string, error) {
  1608  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1609  		if err != nil {
  1610  			return "", err
  1611  		}
  1612  		it.items = append(it.items, items...)
  1613  		return nextPageToken, nil
  1614  	}
  1615  
  1616  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1617  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1618  	it.pageInfo.Token = req.GetPageToken()
  1619  
  1620  	return it
  1621  }
  1622  
  1623  func (c *gRPCClient) GetTag(ctx context.Context, req *artifactregistrypb.GetTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  1624  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1625  
  1626  	hds = append(c.xGoogHeaders, hds...)
  1627  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1628  	opts = append((*c.CallOptions).GetTag[0:len((*c.CallOptions).GetTag):len((*c.CallOptions).GetTag)], opts...)
  1629  	var resp *artifactregistrypb.Tag
  1630  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1631  		var err error
  1632  		resp, err = c.client.GetTag(ctx, req, settings.GRPC...)
  1633  		return err
  1634  	}, opts...)
  1635  	if err != nil {
  1636  		return nil, err
  1637  	}
  1638  	return resp, nil
  1639  }
  1640  
  1641  func (c *gRPCClient) CreateTag(ctx context.Context, req *artifactregistrypb.CreateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  1642  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  1643  
  1644  	hds = append(c.xGoogHeaders, hds...)
  1645  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1646  	opts = append((*c.CallOptions).CreateTag[0:len((*c.CallOptions).CreateTag):len((*c.CallOptions).CreateTag)], opts...)
  1647  	var resp *artifactregistrypb.Tag
  1648  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1649  		var err error
  1650  		resp, err = c.client.CreateTag(ctx, req, settings.GRPC...)
  1651  		return err
  1652  	}, opts...)
  1653  	if err != nil {
  1654  		return nil, err
  1655  	}
  1656  	return resp, nil
  1657  }
  1658  
  1659  func (c *gRPCClient) UpdateTag(ctx context.Context, req *artifactregistrypb.UpdateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  1660  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tag.name", url.QueryEscape(req.GetTag().GetName()))}
  1661  
  1662  	hds = append(c.xGoogHeaders, hds...)
  1663  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1664  	opts = append((*c.CallOptions).UpdateTag[0:len((*c.CallOptions).UpdateTag):len((*c.CallOptions).UpdateTag)], opts...)
  1665  	var resp *artifactregistrypb.Tag
  1666  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1667  		var err error
  1668  		resp, err = c.client.UpdateTag(ctx, req, settings.GRPC...)
  1669  		return err
  1670  	}, opts...)
  1671  	if err != nil {
  1672  		return nil, err
  1673  	}
  1674  	return resp, nil
  1675  }
  1676  
  1677  func (c *gRPCClient) DeleteTag(ctx context.Context, req *artifactregistrypb.DeleteTagRequest, opts ...gax.CallOption) error {
  1678  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1679  
  1680  	hds = append(c.xGoogHeaders, hds...)
  1681  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1682  	opts = append((*c.CallOptions).DeleteTag[0:len((*c.CallOptions).DeleteTag):len((*c.CallOptions).DeleteTag)], opts...)
  1683  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1684  		var err error
  1685  		_, err = c.client.DeleteTag(ctx, req, settings.GRPC...)
  1686  		return err
  1687  	}, opts...)
  1688  	return err
  1689  }
  1690  
  1691  func (c *gRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1692  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1693  
  1694  	hds = append(c.xGoogHeaders, hds...)
  1695  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1696  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
  1697  	var resp *iampb.Policy
  1698  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1699  		var err error
  1700  		resp, err = c.client.SetIamPolicy(ctx, req, settings.GRPC...)
  1701  		return err
  1702  	}, opts...)
  1703  	if err != nil {
  1704  		return nil, err
  1705  	}
  1706  	return resp, nil
  1707  }
  1708  
  1709  func (c *gRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  1710  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1711  
  1712  	hds = append(c.xGoogHeaders, hds...)
  1713  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1714  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
  1715  	var resp *iampb.Policy
  1716  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1717  		var err error
  1718  		resp, err = c.client.GetIamPolicy(ctx, req, settings.GRPC...)
  1719  		return err
  1720  	}, opts...)
  1721  	if err != nil {
  1722  		return nil, err
  1723  	}
  1724  	return resp, nil
  1725  }
  1726  
  1727  func (c *gRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
  1728  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  1729  
  1730  	hds = append(c.xGoogHeaders, hds...)
  1731  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1732  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
  1733  	var resp *iampb.TestIamPermissionsResponse
  1734  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1735  		var err error
  1736  		resp, err = c.client.TestIamPermissions(ctx, req, settings.GRPC...)
  1737  		return err
  1738  	}, opts...)
  1739  	if err != nil {
  1740  		return nil, err
  1741  	}
  1742  	return resp, nil
  1743  }
  1744  
  1745  func (c *gRPCClient) GetProjectSettings(ctx context.Context, req *artifactregistrypb.GetProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
  1746  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1747  
  1748  	hds = append(c.xGoogHeaders, hds...)
  1749  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1750  	opts = append((*c.CallOptions).GetProjectSettings[0:len((*c.CallOptions).GetProjectSettings):len((*c.CallOptions).GetProjectSettings)], opts...)
  1751  	var resp *artifactregistrypb.ProjectSettings
  1752  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1753  		var err error
  1754  		resp, err = c.client.GetProjectSettings(ctx, req, settings.GRPC...)
  1755  		return err
  1756  	}, opts...)
  1757  	if err != nil {
  1758  		return nil, err
  1759  	}
  1760  	return resp, nil
  1761  }
  1762  
  1763  func (c *gRPCClient) UpdateProjectSettings(ctx context.Context, req *artifactregistrypb.UpdateProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
  1764  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "project_settings.name", url.QueryEscape(req.GetProjectSettings().GetName()))}
  1765  
  1766  	hds = append(c.xGoogHeaders, hds...)
  1767  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1768  	opts = append((*c.CallOptions).UpdateProjectSettings[0:len((*c.CallOptions).UpdateProjectSettings):len((*c.CallOptions).UpdateProjectSettings)], opts...)
  1769  	var resp *artifactregistrypb.ProjectSettings
  1770  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1771  		var err error
  1772  		resp, err = c.client.UpdateProjectSettings(ctx, req, settings.GRPC...)
  1773  		return err
  1774  	}, opts...)
  1775  	if err != nil {
  1776  		return nil, err
  1777  	}
  1778  	return resp, nil
  1779  }
  1780  
  1781  func (c *gRPCClient) GetVPCSCConfig(ctx context.Context, req *artifactregistrypb.GetVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
  1782  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1783  
  1784  	hds = append(c.xGoogHeaders, hds...)
  1785  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1786  	opts = append((*c.CallOptions).GetVPCSCConfig[0:len((*c.CallOptions).GetVPCSCConfig):len((*c.CallOptions).GetVPCSCConfig)], opts...)
  1787  	var resp *artifactregistrypb.VPCSCConfig
  1788  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1789  		var err error
  1790  		resp, err = c.client.GetVPCSCConfig(ctx, req, settings.GRPC...)
  1791  		return err
  1792  	}, opts...)
  1793  	if err != nil {
  1794  		return nil, err
  1795  	}
  1796  	return resp, nil
  1797  }
  1798  
  1799  func (c *gRPCClient) UpdateVPCSCConfig(ctx context.Context, req *artifactregistrypb.UpdateVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
  1800  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "vpcsc_config.name", url.QueryEscape(req.GetVpcscConfig().GetName()))}
  1801  
  1802  	hds = append(c.xGoogHeaders, hds...)
  1803  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1804  	opts = append((*c.CallOptions).UpdateVPCSCConfig[0:len((*c.CallOptions).UpdateVPCSCConfig):len((*c.CallOptions).UpdateVPCSCConfig)], opts...)
  1805  	var resp *artifactregistrypb.VPCSCConfig
  1806  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1807  		var err error
  1808  		resp, err = c.client.UpdateVPCSCConfig(ctx, req, settings.GRPC...)
  1809  		return err
  1810  	}, opts...)
  1811  	if err != nil {
  1812  		return nil, err
  1813  	}
  1814  	return resp, nil
  1815  }
  1816  
  1817  func (c *gRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
  1818  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1819  
  1820  	hds = append(c.xGoogHeaders, hds...)
  1821  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1822  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
  1823  	var resp *locationpb.Location
  1824  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1825  		var err error
  1826  		resp, err = c.locationsClient.GetLocation(ctx, req, settings.GRPC...)
  1827  		return err
  1828  	}, opts...)
  1829  	if err != nil {
  1830  		return nil, err
  1831  	}
  1832  	return resp, nil
  1833  }
  1834  
  1835  func (c *gRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
  1836  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1837  
  1838  	hds = append(c.xGoogHeaders, hds...)
  1839  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1840  	opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
  1841  	it := &LocationIterator{}
  1842  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
  1843  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
  1844  		resp := &locationpb.ListLocationsResponse{}
  1845  		if pageToken != "" {
  1846  			req.PageToken = pageToken
  1847  		}
  1848  		if pageSize > math.MaxInt32 {
  1849  			req.PageSize = math.MaxInt32
  1850  		} else if pageSize != 0 {
  1851  			req.PageSize = int32(pageSize)
  1852  		}
  1853  		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1854  			var err error
  1855  			resp, err = c.locationsClient.ListLocations(ctx, req, settings.GRPC...)
  1856  			return err
  1857  		}, opts...)
  1858  		if err != nil {
  1859  			return nil, "", err
  1860  		}
  1861  
  1862  		it.Response = resp
  1863  		return resp.GetLocations(), resp.GetNextPageToken(), nil
  1864  	}
  1865  	fetch := func(pageSize int, pageToken string) (string, error) {
  1866  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1867  		if err != nil {
  1868  			return "", err
  1869  		}
  1870  		it.items = append(it.items, items...)
  1871  		return nextPageToken, nil
  1872  	}
  1873  
  1874  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1875  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1876  	it.pageInfo.Token = req.GetPageToken()
  1877  
  1878  	return it
  1879  }
  1880  
  1881  func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  1882  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  1883  
  1884  	hds = append(c.xGoogHeaders, hds...)
  1885  	ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
  1886  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
  1887  	var resp *longrunningpb.Operation
  1888  	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1889  		var err error
  1890  		resp, err = c.operationsClient.GetOperation(ctx, req, settings.GRPC...)
  1891  		return err
  1892  	}, opts...)
  1893  	if err != nil {
  1894  		return nil, err
  1895  	}
  1896  	return resp, nil
  1897  }
  1898  
  1899  // ListDockerImages lists docker images.
  1900  func (c *restClient) ListDockerImages(ctx context.Context, req *artifactregistrypb.ListDockerImagesRequest, opts ...gax.CallOption) *DockerImageIterator {
  1901  	it := &DockerImageIterator{}
  1902  	req = proto.Clone(req).(*artifactregistrypb.ListDockerImagesRequest)
  1903  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  1904  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.DockerImage, string, error) {
  1905  		resp := &artifactregistrypb.ListDockerImagesResponse{}
  1906  		if pageToken != "" {
  1907  			req.PageToken = pageToken
  1908  		}
  1909  		if pageSize > math.MaxInt32 {
  1910  			req.PageSize = math.MaxInt32
  1911  		} else if pageSize != 0 {
  1912  			req.PageSize = int32(pageSize)
  1913  		}
  1914  		baseUrl, err := url.Parse(c.endpoint)
  1915  		if err != nil {
  1916  			return nil, "", err
  1917  		}
  1918  		baseUrl.Path += fmt.Sprintf("/v1/%v/dockerImages", req.GetParent())
  1919  
  1920  		params := url.Values{}
  1921  		params.Add("$alt", "json;enum-encoding=int")
  1922  		if req.GetOrderBy() != "" {
  1923  			params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
  1924  		}
  1925  		if req.GetPageSize() != 0 {
  1926  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  1927  		}
  1928  		if req.GetPageToken() != "" {
  1929  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  1930  		}
  1931  
  1932  		baseUrl.RawQuery = params.Encode()
  1933  
  1934  		// Build HTTP headers from client and context metadata.
  1935  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  1936  		headers := gax.BuildHeaders(ctx, hds...)
  1937  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  1938  			if settings.Path != "" {
  1939  				baseUrl.Path = settings.Path
  1940  			}
  1941  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  1942  			if err != nil {
  1943  				return err
  1944  			}
  1945  			httpReq.Header = headers
  1946  
  1947  			httpRsp, err := c.httpClient.Do(httpReq)
  1948  			if err != nil {
  1949  				return err
  1950  			}
  1951  			defer httpRsp.Body.Close()
  1952  
  1953  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  1954  				return err
  1955  			}
  1956  
  1957  			buf, err := io.ReadAll(httpRsp.Body)
  1958  			if err != nil {
  1959  				return err
  1960  			}
  1961  
  1962  			if err := unm.Unmarshal(buf, resp); err != nil {
  1963  				return err
  1964  			}
  1965  
  1966  			return nil
  1967  		}, opts...)
  1968  		if e != nil {
  1969  			return nil, "", e
  1970  		}
  1971  		it.Response = resp
  1972  		return resp.GetDockerImages(), resp.GetNextPageToken(), nil
  1973  	}
  1974  
  1975  	fetch := func(pageSize int, pageToken string) (string, error) {
  1976  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  1977  		if err != nil {
  1978  			return "", err
  1979  		}
  1980  		it.items = append(it.items, items...)
  1981  		return nextPageToken, nil
  1982  	}
  1983  
  1984  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  1985  	it.pageInfo.MaxSize = int(req.GetPageSize())
  1986  	it.pageInfo.Token = req.GetPageToken()
  1987  
  1988  	return it
  1989  }
  1990  
  1991  // GetDockerImage gets a docker image.
  1992  func (c *restClient) GetDockerImage(ctx context.Context, req *artifactregistrypb.GetDockerImageRequest, opts ...gax.CallOption) (*artifactregistrypb.DockerImage, error) {
  1993  	baseUrl, err := url.Parse(c.endpoint)
  1994  	if err != nil {
  1995  		return nil, err
  1996  	}
  1997  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  1998  
  1999  	params := url.Values{}
  2000  	params.Add("$alt", "json;enum-encoding=int")
  2001  
  2002  	baseUrl.RawQuery = params.Encode()
  2003  
  2004  	// Build HTTP headers from client and context metadata.
  2005  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2006  
  2007  	hds = append(c.xGoogHeaders, hds...)
  2008  	hds = append(hds, "Content-Type", "application/json")
  2009  	headers := gax.BuildHeaders(ctx, hds...)
  2010  	opts = append((*c.CallOptions).GetDockerImage[0:len((*c.CallOptions).GetDockerImage):len((*c.CallOptions).GetDockerImage)], opts...)
  2011  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2012  	resp := &artifactregistrypb.DockerImage{}
  2013  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2014  		if settings.Path != "" {
  2015  			baseUrl.Path = settings.Path
  2016  		}
  2017  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2018  		if err != nil {
  2019  			return err
  2020  		}
  2021  		httpReq = httpReq.WithContext(ctx)
  2022  		httpReq.Header = headers
  2023  
  2024  		httpRsp, err := c.httpClient.Do(httpReq)
  2025  		if err != nil {
  2026  			return err
  2027  		}
  2028  		defer httpRsp.Body.Close()
  2029  
  2030  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2031  			return err
  2032  		}
  2033  
  2034  		buf, err := io.ReadAll(httpRsp.Body)
  2035  		if err != nil {
  2036  			return err
  2037  		}
  2038  
  2039  		if err := unm.Unmarshal(buf, resp); err != nil {
  2040  			return err
  2041  		}
  2042  
  2043  		return nil
  2044  	}, opts...)
  2045  	if e != nil {
  2046  		return nil, e
  2047  	}
  2048  	return resp, nil
  2049  }
  2050  
  2051  // ListMavenArtifacts lists maven artifacts.
  2052  func (c *restClient) ListMavenArtifacts(ctx context.Context, req *artifactregistrypb.ListMavenArtifactsRequest, opts ...gax.CallOption) *MavenArtifactIterator {
  2053  	it := &MavenArtifactIterator{}
  2054  	req = proto.Clone(req).(*artifactregistrypb.ListMavenArtifactsRequest)
  2055  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2056  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.MavenArtifact, string, error) {
  2057  		resp := &artifactregistrypb.ListMavenArtifactsResponse{}
  2058  		if pageToken != "" {
  2059  			req.PageToken = pageToken
  2060  		}
  2061  		if pageSize > math.MaxInt32 {
  2062  			req.PageSize = math.MaxInt32
  2063  		} else if pageSize != 0 {
  2064  			req.PageSize = int32(pageSize)
  2065  		}
  2066  		baseUrl, err := url.Parse(c.endpoint)
  2067  		if err != nil {
  2068  			return nil, "", err
  2069  		}
  2070  		baseUrl.Path += fmt.Sprintf("/v1/%v/mavenArtifacts", req.GetParent())
  2071  
  2072  		params := url.Values{}
  2073  		params.Add("$alt", "json;enum-encoding=int")
  2074  		if req.GetPageSize() != 0 {
  2075  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  2076  		}
  2077  		if req.GetPageToken() != "" {
  2078  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  2079  		}
  2080  
  2081  		baseUrl.RawQuery = params.Encode()
  2082  
  2083  		// Build HTTP headers from client and context metadata.
  2084  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  2085  		headers := gax.BuildHeaders(ctx, hds...)
  2086  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2087  			if settings.Path != "" {
  2088  				baseUrl.Path = settings.Path
  2089  			}
  2090  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2091  			if err != nil {
  2092  				return err
  2093  			}
  2094  			httpReq.Header = headers
  2095  
  2096  			httpRsp, err := c.httpClient.Do(httpReq)
  2097  			if err != nil {
  2098  				return err
  2099  			}
  2100  			defer httpRsp.Body.Close()
  2101  
  2102  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  2103  				return err
  2104  			}
  2105  
  2106  			buf, err := io.ReadAll(httpRsp.Body)
  2107  			if err != nil {
  2108  				return err
  2109  			}
  2110  
  2111  			if err := unm.Unmarshal(buf, resp); err != nil {
  2112  				return err
  2113  			}
  2114  
  2115  			return nil
  2116  		}, opts...)
  2117  		if e != nil {
  2118  			return nil, "", e
  2119  		}
  2120  		it.Response = resp
  2121  		return resp.GetMavenArtifacts(), resp.GetNextPageToken(), nil
  2122  	}
  2123  
  2124  	fetch := func(pageSize int, pageToken string) (string, error) {
  2125  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  2126  		if err != nil {
  2127  			return "", err
  2128  		}
  2129  		it.items = append(it.items, items...)
  2130  		return nextPageToken, nil
  2131  	}
  2132  
  2133  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  2134  	it.pageInfo.MaxSize = int(req.GetPageSize())
  2135  	it.pageInfo.Token = req.GetPageToken()
  2136  
  2137  	return it
  2138  }
  2139  
  2140  // GetMavenArtifact gets a maven artifact.
  2141  func (c *restClient) GetMavenArtifact(ctx context.Context, req *artifactregistrypb.GetMavenArtifactRequest, opts ...gax.CallOption) (*artifactregistrypb.MavenArtifact, error) {
  2142  	baseUrl, err := url.Parse(c.endpoint)
  2143  	if err != nil {
  2144  		return nil, err
  2145  	}
  2146  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  2147  
  2148  	params := url.Values{}
  2149  	params.Add("$alt", "json;enum-encoding=int")
  2150  
  2151  	baseUrl.RawQuery = params.Encode()
  2152  
  2153  	// Build HTTP headers from client and context metadata.
  2154  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2155  
  2156  	hds = append(c.xGoogHeaders, hds...)
  2157  	hds = append(hds, "Content-Type", "application/json")
  2158  	headers := gax.BuildHeaders(ctx, hds...)
  2159  	opts = append((*c.CallOptions).GetMavenArtifact[0:len((*c.CallOptions).GetMavenArtifact):len((*c.CallOptions).GetMavenArtifact)], opts...)
  2160  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2161  	resp := &artifactregistrypb.MavenArtifact{}
  2162  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2163  		if settings.Path != "" {
  2164  			baseUrl.Path = settings.Path
  2165  		}
  2166  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2167  		if err != nil {
  2168  			return err
  2169  		}
  2170  		httpReq = httpReq.WithContext(ctx)
  2171  		httpReq.Header = headers
  2172  
  2173  		httpRsp, err := c.httpClient.Do(httpReq)
  2174  		if err != nil {
  2175  			return err
  2176  		}
  2177  		defer httpRsp.Body.Close()
  2178  
  2179  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2180  			return err
  2181  		}
  2182  
  2183  		buf, err := io.ReadAll(httpRsp.Body)
  2184  		if err != nil {
  2185  			return err
  2186  		}
  2187  
  2188  		if err := unm.Unmarshal(buf, resp); err != nil {
  2189  			return err
  2190  		}
  2191  
  2192  		return nil
  2193  	}, opts...)
  2194  	if e != nil {
  2195  		return nil, e
  2196  	}
  2197  	return resp, nil
  2198  }
  2199  
  2200  // ListNpmPackages lists npm packages.
  2201  func (c *restClient) ListNpmPackages(ctx context.Context, req *artifactregistrypb.ListNpmPackagesRequest, opts ...gax.CallOption) *NpmPackageIterator {
  2202  	it := &NpmPackageIterator{}
  2203  	req = proto.Clone(req).(*artifactregistrypb.ListNpmPackagesRequest)
  2204  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2205  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.NpmPackage, string, error) {
  2206  		resp := &artifactregistrypb.ListNpmPackagesResponse{}
  2207  		if pageToken != "" {
  2208  			req.PageToken = pageToken
  2209  		}
  2210  		if pageSize > math.MaxInt32 {
  2211  			req.PageSize = math.MaxInt32
  2212  		} else if pageSize != 0 {
  2213  			req.PageSize = int32(pageSize)
  2214  		}
  2215  		baseUrl, err := url.Parse(c.endpoint)
  2216  		if err != nil {
  2217  			return nil, "", err
  2218  		}
  2219  		baseUrl.Path += fmt.Sprintf("/v1/%v/npmPackages", req.GetParent())
  2220  
  2221  		params := url.Values{}
  2222  		params.Add("$alt", "json;enum-encoding=int")
  2223  		if req.GetPageSize() != 0 {
  2224  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  2225  		}
  2226  		if req.GetPageToken() != "" {
  2227  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  2228  		}
  2229  
  2230  		baseUrl.RawQuery = params.Encode()
  2231  
  2232  		// Build HTTP headers from client and context metadata.
  2233  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  2234  		headers := gax.BuildHeaders(ctx, hds...)
  2235  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2236  			if settings.Path != "" {
  2237  				baseUrl.Path = settings.Path
  2238  			}
  2239  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2240  			if err != nil {
  2241  				return err
  2242  			}
  2243  			httpReq.Header = headers
  2244  
  2245  			httpRsp, err := c.httpClient.Do(httpReq)
  2246  			if err != nil {
  2247  				return err
  2248  			}
  2249  			defer httpRsp.Body.Close()
  2250  
  2251  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  2252  				return err
  2253  			}
  2254  
  2255  			buf, err := io.ReadAll(httpRsp.Body)
  2256  			if err != nil {
  2257  				return err
  2258  			}
  2259  
  2260  			if err := unm.Unmarshal(buf, resp); err != nil {
  2261  				return err
  2262  			}
  2263  
  2264  			return nil
  2265  		}, opts...)
  2266  		if e != nil {
  2267  			return nil, "", e
  2268  		}
  2269  		it.Response = resp
  2270  		return resp.GetNpmPackages(), resp.GetNextPageToken(), nil
  2271  	}
  2272  
  2273  	fetch := func(pageSize int, pageToken string) (string, error) {
  2274  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  2275  		if err != nil {
  2276  			return "", err
  2277  		}
  2278  		it.items = append(it.items, items...)
  2279  		return nextPageToken, nil
  2280  	}
  2281  
  2282  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  2283  	it.pageInfo.MaxSize = int(req.GetPageSize())
  2284  	it.pageInfo.Token = req.GetPageToken()
  2285  
  2286  	return it
  2287  }
  2288  
  2289  // GetNpmPackage gets a npm package.
  2290  func (c *restClient) GetNpmPackage(ctx context.Context, req *artifactregistrypb.GetNpmPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.NpmPackage, error) {
  2291  	baseUrl, err := url.Parse(c.endpoint)
  2292  	if err != nil {
  2293  		return nil, err
  2294  	}
  2295  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  2296  
  2297  	params := url.Values{}
  2298  	params.Add("$alt", "json;enum-encoding=int")
  2299  
  2300  	baseUrl.RawQuery = params.Encode()
  2301  
  2302  	// Build HTTP headers from client and context metadata.
  2303  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2304  
  2305  	hds = append(c.xGoogHeaders, hds...)
  2306  	hds = append(hds, "Content-Type", "application/json")
  2307  	headers := gax.BuildHeaders(ctx, hds...)
  2308  	opts = append((*c.CallOptions).GetNpmPackage[0:len((*c.CallOptions).GetNpmPackage):len((*c.CallOptions).GetNpmPackage)], opts...)
  2309  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2310  	resp := &artifactregistrypb.NpmPackage{}
  2311  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2312  		if settings.Path != "" {
  2313  			baseUrl.Path = settings.Path
  2314  		}
  2315  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2316  		if err != nil {
  2317  			return err
  2318  		}
  2319  		httpReq = httpReq.WithContext(ctx)
  2320  		httpReq.Header = headers
  2321  
  2322  		httpRsp, err := c.httpClient.Do(httpReq)
  2323  		if err != nil {
  2324  			return err
  2325  		}
  2326  		defer httpRsp.Body.Close()
  2327  
  2328  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2329  			return err
  2330  		}
  2331  
  2332  		buf, err := io.ReadAll(httpRsp.Body)
  2333  		if err != nil {
  2334  			return err
  2335  		}
  2336  
  2337  		if err := unm.Unmarshal(buf, resp); err != nil {
  2338  			return err
  2339  		}
  2340  
  2341  		return nil
  2342  	}, opts...)
  2343  	if e != nil {
  2344  		return nil, e
  2345  	}
  2346  	return resp, nil
  2347  }
  2348  
  2349  // ListPythonPackages lists python packages.
  2350  func (c *restClient) ListPythonPackages(ctx context.Context, req *artifactregistrypb.ListPythonPackagesRequest, opts ...gax.CallOption) *PythonPackageIterator {
  2351  	it := &PythonPackageIterator{}
  2352  	req = proto.Clone(req).(*artifactregistrypb.ListPythonPackagesRequest)
  2353  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2354  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.PythonPackage, string, error) {
  2355  		resp := &artifactregistrypb.ListPythonPackagesResponse{}
  2356  		if pageToken != "" {
  2357  			req.PageToken = pageToken
  2358  		}
  2359  		if pageSize > math.MaxInt32 {
  2360  			req.PageSize = math.MaxInt32
  2361  		} else if pageSize != 0 {
  2362  			req.PageSize = int32(pageSize)
  2363  		}
  2364  		baseUrl, err := url.Parse(c.endpoint)
  2365  		if err != nil {
  2366  			return nil, "", err
  2367  		}
  2368  		baseUrl.Path += fmt.Sprintf("/v1/%v/pythonPackages", req.GetParent())
  2369  
  2370  		params := url.Values{}
  2371  		params.Add("$alt", "json;enum-encoding=int")
  2372  		if req.GetPageSize() != 0 {
  2373  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  2374  		}
  2375  		if req.GetPageToken() != "" {
  2376  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  2377  		}
  2378  
  2379  		baseUrl.RawQuery = params.Encode()
  2380  
  2381  		// Build HTTP headers from client and context metadata.
  2382  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  2383  		headers := gax.BuildHeaders(ctx, hds...)
  2384  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2385  			if settings.Path != "" {
  2386  				baseUrl.Path = settings.Path
  2387  			}
  2388  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2389  			if err != nil {
  2390  				return err
  2391  			}
  2392  			httpReq.Header = headers
  2393  
  2394  			httpRsp, err := c.httpClient.Do(httpReq)
  2395  			if err != nil {
  2396  				return err
  2397  			}
  2398  			defer httpRsp.Body.Close()
  2399  
  2400  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  2401  				return err
  2402  			}
  2403  
  2404  			buf, err := io.ReadAll(httpRsp.Body)
  2405  			if err != nil {
  2406  				return err
  2407  			}
  2408  
  2409  			if err := unm.Unmarshal(buf, resp); err != nil {
  2410  				return err
  2411  			}
  2412  
  2413  			return nil
  2414  		}, opts...)
  2415  		if e != nil {
  2416  			return nil, "", e
  2417  		}
  2418  		it.Response = resp
  2419  		return resp.GetPythonPackages(), resp.GetNextPageToken(), nil
  2420  	}
  2421  
  2422  	fetch := func(pageSize int, pageToken string) (string, error) {
  2423  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  2424  		if err != nil {
  2425  			return "", err
  2426  		}
  2427  		it.items = append(it.items, items...)
  2428  		return nextPageToken, nil
  2429  	}
  2430  
  2431  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  2432  	it.pageInfo.MaxSize = int(req.GetPageSize())
  2433  	it.pageInfo.Token = req.GetPageToken()
  2434  
  2435  	return it
  2436  }
  2437  
  2438  // GetPythonPackage gets a python package.
  2439  func (c *restClient) GetPythonPackage(ctx context.Context, req *artifactregistrypb.GetPythonPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.PythonPackage, error) {
  2440  	baseUrl, err := url.Parse(c.endpoint)
  2441  	if err != nil {
  2442  		return nil, err
  2443  	}
  2444  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  2445  
  2446  	params := url.Values{}
  2447  	params.Add("$alt", "json;enum-encoding=int")
  2448  
  2449  	baseUrl.RawQuery = params.Encode()
  2450  
  2451  	// Build HTTP headers from client and context metadata.
  2452  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2453  
  2454  	hds = append(c.xGoogHeaders, hds...)
  2455  	hds = append(hds, "Content-Type", "application/json")
  2456  	headers := gax.BuildHeaders(ctx, hds...)
  2457  	opts = append((*c.CallOptions).GetPythonPackage[0:len((*c.CallOptions).GetPythonPackage):len((*c.CallOptions).GetPythonPackage)], opts...)
  2458  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2459  	resp := &artifactregistrypb.PythonPackage{}
  2460  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2461  		if settings.Path != "" {
  2462  			baseUrl.Path = settings.Path
  2463  		}
  2464  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2465  		if err != nil {
  2466  			return err
  2467  		}
  2468  		httpReq = httpReq.WithContext(ctx)
  2469  		httpReq.Header = headers
  2470  
  2471  		httpRsp, err := c.httpClient.Do(httpReq)
  2472  		if err != nil {
  2473  			return err
  2474  		}
  2475  		defer httpRsp.Body.Close()
  2476  
  2477  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2478  			return err
  2479  		}
  2480  
  2481  		buf, err := io.ReadAll(httpRsp.Body)
  2482  		if err != nil {
  2483  			return err
  2484  		}
  2485  
  2486  		if err := unm.Unmarshal(buf, resp); err != nil {
  2487  			return err
  2488  		}
  2489  
  2490  		return nil
  2491  	}, opts...)
  2492  	if e != nil {
  2493  		return nil, e
  2494  	}
  2495  	return resp, nil
  2496  }
  2497  
  2498  // ImportAptArtifacts imports Apt artifacts. The returned Operation will complete once the
  2499  // resources are imported. Package, Version, and File resources are created
  2500  // based on the imported artifacts. Imported artifacts that conflict with
  2501  // existing resources are ignored.
  2502  func (c *restClient) ImportAptArtifacts(ctx context.Context, req *artifactregistrypb.ImportAptArtifactsRequest, opts ...gax.CallOption) (*ImportAptArtifactsOperation, error) {
  2503  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  2504  	jsonReq, err := m.Marshal(req)
  2505  	if err != nil {
  2506  		return nil, err
  2507  	}
  2508  
  2509  	baseUrl, err := url.Parse(c.endpoint)
  2510  	if err != nil {
  2511  		return nil, err
  2512  	}
  2513  	baseUrl.Path += fmt.Sprintf("/v1/%v/aptArtifacts:import", req.GetParent())
  2514  
  2515  	params := url.Values{}
  2516  	params.Add("$alt", "json;enum-encoding=int")
  2517  
  2518  	baseUrl.RawQuery = params.Encode()
  2519  
  2520  	// Build HTTP headers from client and context metadata.
  2521  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  2522  
  2523  	hds = append(c.xGoogHeaders, hds...)
  2524  	hds = append(hds, "Content-Type", "application/json")
  2525  	headers := gax.BuildHeaders(ctx, hds...)
  2526  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2527  	resp := &longrunningpb.Operation{}
  2528  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2529  		if settings.Path != "" {
  2530  			baseUrl.Path = settings.Path
  2531  		}
  2532  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  2533  		if err != nil {
  2534  			return err
  2535  		}
  2536  		httpReq = httpReq.WithContext(ctx)
  2537  		httpReq.Header = headers
  2538  
  2539  		httpRsp, err := c.httpClient.Do(httpReq)
  2540  		if err != nil {
  2541  			return err
  2542  		}
  2543  		defer httpRsp.Body.Close()
  2544  
  2545  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2546  			return err
  2547  		}
  2548  
  2549  		buf, err := io.ReadAll(httpRsp.Body)
  2550  		if err != nil {
  2551  			return err
  2552  		}
  2553  
  2554  		if err := unm.Unmarshal(buf, resp); err != nil {
  2555  			return err
  2556  		}
  2557  
  2558  		return nil
  2559  	}, opts...)
  2560  	if e != nil {
  2561  		return nil, e
  2562  	}
  2563  
  2564  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  2565  	return &ImportAptArtifactsOperation{
  2566  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  2567  		pollPath: override,
  2568  	}, nil
  2569  }
  2570  
  2571  // ImportYumArtifacts imports Yum (RPM) artifacts. The returned Operation will complete once the
  2572  // resources are imported. Package, Version, and File resources are created
  2573  // based on the imported artifacts. Imported artifacts that conflict with
  2574  // existing resources are ignored.
  2575  func (c *restClient) ImportYumArtifacts(ctx context.Context, req *artifactregistrypb.ImportYumArtifactsRequest, opts ...gax.CallOption) (*ImportYumArtifactsOperation, error) {
  2576  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  2577  	jsonReq, err := m.Marshal(req)
  2578  	if err != nil {
  2579  		return nil, err
  2580  	}
  2581  
  2582  	baseUrl, err := url.Parse(c.endpoint)
  2583  	if err != nil {
  2584  		return nil, err
  2585  	}
  2586  	baseUrl.Path += fmt.Sprintf("/v1/%v/yumArtifacts:import", req.GetParent())
  2587  
  2588  	params := url.Values{}
  2589  	params.Add("$alt", "json;enum-encoding=int")
  2590  
  2591  	baseUrl.RawQuery = params.Encode()
  2592  
  2593  	// Build HTTP headers from client and context metadata.
  2594  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  2595  
  2596  	hds = append(c.xGoogHeaders, hds...)
  2597  	hds = append(hds, "Content-Type", "application/json")
  2598  	headers := gax.BuildHeaders(ctx, hds...)
  2599  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2600  	resp := &longrunningpb.Operation{}
  2601  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2602  		if settings.Path != "" {
  2603  			baseUrl.Path = settings.Path
  2604  		}
  2605  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  2606  		if err != nil {
  2607  			return err
  2608  		}
  2609  		httpReq = httpReq.WithContext(ctx)
  2610  		httpReq.Header = headers
  2611  
  2612  		httpRsp, err := c.httpClient.Do(httpReq)
  2613  		if err != nil {
  2614  			return err
  2615  		}
  2616  		defer httpRsp.Body.Close()
  2617  
  2618  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2619  			return err
  2620  		}
  2621  
  2622  		buf, err := io.ReadAll(httpRsp.Body)
  2623  		if err != nil {
  2624  			return err
  2625  		}
  2626  
  2627  		if err := unm.Unmarshal(buf, resp); err != nil {
  2628  			return err
  2629  		}
  2630  
  2631  		return nil
  2632  	}, opts...)
  2633  	if e != nil {
  2634  		return nil, e
  2635  	}
  2636  
  2637  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  2638  	return &ImportYumArtifactsOperation{
  2639  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  2640  		pollPath: override,
  2641  	}, nil
  2642  }
  2643  
  2644  // ListRepositories lists repositories.
  2645  func (c *restClient) ListRepositories(ctx context.Context, req *artifactregistrypb.ListRepositoriesRequest, opts ...gax.CallOption) *RepositoryIterator {
  2646  	it := &RepositoryIterator{}
  2647  	req = proto.Clone(req).(*artifactregistrypb.ListRepositoriesRequest)
  2648  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2649  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Repository, string, error) {
  2650  		resp := &artifactregistrypb.ListRepositoriesResponse{}
  2651  		if pageToken != "" {
  2652  			req.PageToken = pageToken
  2653  		}
  2654  		if pageSize > math.MaxInt32 {
  2655  			req.PageSize = math.MaxInt32
  2656  		} else if pageSize != 0 {
  2657  			req.PageSize = int32(pageSize)
  2658  		}
  2659  		baseUrl, err := url.Parse(c.endpoint)
  2660  		if err != nil {
  2661  			return nil, "", err
  2662  		}
  2663  		baseUrl.Path += fmt.Sprintf("/v1/%v/repositories", req.GetParent())
  2664  
  2665  		params := url.Values{}
  2666  		params.Add("$alt", "json;enum-encoding=int")
  2667  		if req.GetPageSize() != 0 {
  2668  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  2669  		}
  2670  		if req.GetPageToken() != "" {
  2671  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  2672  		}
  2673  
  2674  		baseUrl.RawQuery = params.Encode()
  2675  
  2676  		// Build HTTP headers from client and context metadata.
  2677  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  2678  		headers := gax.BuildHeaders(ctx, hds...)
  2679  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2680  			if settings.Path != "" {
  2681  				baseUrl.Path = settings.Path
  2682  			}
  2683  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2684  			if err != nil {
  2685  				return err
  2686  			}
  2687  			httpReq.Header = headers
  2688  
  2689  			httpRsp, err := c.httpClient.Do(httpReq)
  2690  			if err != nil {
  2691  				return err
  2692  			}
  2693  			defer httpRsp.Body.Close()
  2694  
  2695  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  2696  				return err
  2697  			}
  2698  
  2699  			buf, err := io.ReadAll(httpRsp.Body)
  2700  			if err != nil {
  2701  				return err
  2702  			}
  2703  
  2704  			if err := unm.Unmarshal(buf, resp); err != nil {
  2705  				return err
  2706  			}
  2707  
  2708  			return nil
  2709  		}, opts...)
  2710  		if e != nil {
  2711  			return nil, "", e
  2712  		}
  2713  		it.Response = resp
  2714  		return resp.GetRepositories(), resp.GetNextPageToken(), nil
  2715  	}
  2716  
  2717  	fetch := func(pageSize int, pageToken string) (string, error) {
  2718  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  2719  		if err != nil {
  2720  			return "", err
  2721  		}
  2722  		it.items = append(it.items, items...)
  2723  		return nextPageToken, nil
  2724  	}
  2725  
  2726  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  2727  	it.pageInfo.MaxSize = int(req.GetPageSize())
  2728  	it.pageInfo.Token = req.GetPageToken()
  2729  
  2730  	return it
  2731  }
  2732  
  2733  // GetRepository gets a repository.
  2734  func (c *restClient) GetRepository(ctx context.Context, req *artifactregistrypb.GetRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
  2735  	baseUrl, err := url.Parse(c.endpoint)
  2736  	if err != nil {
  2737  		return nil, err
  2738  	}
  2739  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  2740  
  2741  	params := url.Values{}
  2742  	params.Add("$alt", "json;enum-encoding=int")
  2743  
  2744  	baseUrl.RawQuery = params.Encode()
  2745  
  2746  	// Build HTTP headers from client and context metadata.
  2747  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2748  
  2749  	hds = append(c.xGoogHeaders, hds...)
  2750  	hds = append(hds, "Content-Type", "application/json")
  2751  	headers := gax.BuildHeaders(ctx, hds...)
  2752  	opts = append((*c.CallOptions).GetRepository[0:len((*c.CallOptions).GetRepository):len((*c.CallOptions).GetRepository)], opts...)
  2753  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2754  	resp := &artifactregistrypb.Repository{}
  2755  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2756  		if settings.Path != "" {
  2757  			baseUrl.Path = settings.Path
  2758  		}
  2759  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  2760  		if err != nil {
  2761  			return err
  2762  		}
  2763  		httpReq = httpReq.WithContext(ctx)
  2764  		httpReq.Header = headers
  2765  
  2766  		httpRsp, err := c.httpClient.Do(httpReq)
  2767  		if err != nil {
  2768  			return err
  2769  		}
  2770  		defer httpRsp.Body.Close()
  2771  
  2772  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2773  			return err
  2774  		}
  2775  
  2776  		buf, err := io.ReadAll(httpRsp.Body)
  2777  		if err != nil {
  2778  			return err
  2779  		}
  2780  
  2781  		if err := unm.Unmarshal(buf, resp); err != nil {
  2782  			return err
  2783  		}
  2784  
  2785  		return nil
  2786  	}, opts...)
  2787  	if e != nil {
  2788  		return nil, e
  2789  	}
  2790  	return resp, nil
  2791  }
  2792  
  2793  // CreateRepository creates a repository. The returned Operation will finish once the
  2794  // repository has been created. Its response will be the created Repository.
  2795  func (c *restClient) CreateRepository(ctx context.Context, req *artifactregistrypb.CreateRepositoryRequest, opts ...gax.CallOption) (*CreateRepositoryOperation, error) {
  2796  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  2797  	body := req.GetRepository()
  2798  	jsonReq, err := m.Marshal(body)
  2799  	if err != nil {
  2800  		return nil, err
  2801  	}
  2802  
  2803  	baseUrl, err := url.Parse(c.endpoint)
  2804  	if err != nil {
  2805  		return nil, err
  2806  	}
  2807  	baseUrl.Path += fmt.Sprintf("/v1/%v/repositories", req.GetParent())
  2808  
  2809  	params := url.Values{}
  2810  	params.Add("$alt", "json;enum-encoding=int")
  2811  	params.Add("repositoryId", fmt.Sprintf("%v", req.GetRepositoryId()))
  2812  
  2813  	baseUrl.RawQuery = params.Encode()
  2814  
  2815  	// Build HTTP headers from client and context metadata.
  2816  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  2817  
  2818  	hds = append(c.xGoogHeaders, hds...)
  2819  	hds = append(hds, "Content-Type", "application/json")
  2820  	headers := gax.BuildHeaders(ctx, hds...)
  2821  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2822  	resp := &longrunningpb.Operation{}
  2823  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2824  		if settings.Path != "" {
  2825  			baseUrl.Path = settings.Path
  2826  		}
  2827  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  2828  		if err != nil {
  2829  			return err
  2830  		}
  2831  		httpReq = httpReq.WithContext(ctx)
  2832  		httpReq.Header = headers
  2833  
  2834  		httpRsp, err := c.httpClient.Do(httpReq)
  2835  		if err != nil {
  2836  			return err
  2837  		}
  2838  		defer httpRsp.Body.Close()
  2839  
  2840  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2841  			return err
  2842  		}
  2843  
  2844  		buf, err := io.ReadAll(httpRsp.Body)
  2845  		if err != nil {
  2846  			return err
  2847  		}
  2848  
  2849  		if err := unm.Unmarshal(buf, resp); err != nil {
  2850  			return err
  2851  		}
  2852  
  2853  		return nil
  2854  	}, opts...)
  2855  	if e != nil {
  2856  		return nil, e
  2857  	}
  2858  
  2859  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  2860  	return &CreateRepositoryOperation{
  2861  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  2862  		pollPath: override,
  2863  	}, nil
  2864  }
  2865  
  2866  // UpdateRepository updates a repository.
  2867  func (c *restClient) UpdateRepository(ctx context.Context, req *artifactregistrypb.UpdateRepositoryRequest, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
  2868  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  2869  	body := req.GetRepository()
  2870  	jsonReq, err := m.Marshal(body)
  2871  	if err != nil {
  2872  		return nil, err
  2873  	}
  2874  
  2875  	baseUrl, err := url.Parse(c.endpoint)
  2876  	if err != nil {
  2877  		return nil, err
  2878  	}
  2879  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetRepository().GetName())
  2880  
  2881  	params := url.Values{}
  2882  	params.Add("$alt", "json;enum-encoding=int")
  2883  	if req.GetUpdateMask() != nil {
  2884  		updateMask, err := protojson.Marshal(req.GetUpdateMask())
  2885  		if err != nil {
  2886  			return nil, err
  2887  		}
  2888  		params.Add("updateMask", string(updateMask[1:len(updateMask)-1]))
  2889  	}
  2890  
  2891  	baseUrl.RawQuery = params.Encode()
  2892  
  2893  	// Build HTTP headers from client and context metadata.
  2894  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "repository.name", url.QueryEscape(req.GetRepository().GetName()))}
  2895  
  2896  	hds = append(c.xGoogHeaders, hds...)
  2897  	hds = append(hds, "Content-Type", "application/json")
  2898  	headers := gax.BuildHeaders(ctx, hds...)
  2899  	opts = append((*c.CallOptions).UpdateRepository[0:len((*c.CallOptions).UpdateRepository):len((*c.CallOptions).UpdateRepository)], opts...)
  2900  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2901  	resp := &artifactregistrypb.Repository{}
  2902  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2903  		if settings.Path != "" {
  2904  			baseUrl.Path = settings.Path
  2905  		}
  2906  		httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
  2907  		if err != nil {
  2908  			return err
  2909  		}
  2910  		httpReq = httpReq.WithContext(ctx)
  2911  		httpReq.Header = headers
  2912  
  2913  		httpRsp, err := c.httpClient.Do(httpReq)
  2914  		if err != nil {
  2915  			return err
  2916  		}
  2917  		defer httpRsp.Body.Close()
  2918  
  2919  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2920  			return err
  2921  		}
  2922  
  2923  		buf, err := io.ReadAll(httpRsp.Body)
  2924  		if err != nil {
  2925  			return err
  2926  		}
  2927  
  2928  		if err := unm.Unmarshal(buf, resp); err != nil {
  2929  			return err
  2930  		}
  2931  
  2932  		return nil
  2933  	}, opts...)
  2934  	if e != nil {
  2935  		return nil, e
  2936  	}
  2937  	return resp, nil
  2938  }
  2939  
  2940  // DeleteRepository deletes a repository and all of its contents. The returned Operation will
  2941  // finish once the repository has been deleted. It will not have any Operation
  2942  // metadata and will return a google.protobuf.Empty response.
  2943  func (c *restClient) DeleteRepository(ctx context.Context, req *artifactregistrypb.DeleteRepositoryRequest, opts ...gax.CallOption) (*DeleteRepositoryOperation, error) {
  2944  	baseUrl, err := url.Parse(c.endpoint)
  2945  	if err != nil {
  2946  		return nil, err
  2947  	}
  2948  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  2949  
  2950  	params := url.Values{}
  2951  	params.Add("$alt", "json;enum-encoding=int")
  2952  
  2953  	baseUrl.RawQuery = params.Encode()
  2954  
  2955  	// Build HTTP headers from client and context metadata.
  2956  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  2957  
  2958  	hds = append(c.xGoogHeaders, hds...)
  2959  	hds = append(hds, "Content-Type", "application/json")
  2960  	headers := gax.BuildHeaders(ctx, hds...)
  2961  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  2962  	resp := &longrunningpb.Operation{}
  2963  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  2964  		if settings.Path != "" {
  2965  			baseUrl.Path = settings.Path
  2966  		}
  2967  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  2968  		if err != nil {
  2969  			return err
  2970  		}
  2971  		httpReq = httpReq.WithContext(ctx)
  2972  		httpReq.Header = headers
  2973  
  2974  		httpRsp, err := c.httpClient.Do(httpReq)
  2975  		if err != nil {
  2976  			return err
  2977  		}
  2978  		defer httpRsp.Body.Close()
  2979  
  2980  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  2981  			return err
  2982  		}
  2983  
  2984  		buf, err := io.ReadAll(httpRsp.Body)
  2985  		if err != nil {
  2986  			return err
  2987  		}
  2988  
  2989  		if err := unm.Unmarshal(buf, resp); err != nil {
  2990  			return err
  2991  		}
  2992  
  2993  		return nil
  2994  	}, opts...)
  2995  	if e != nil {
  2996  		return nil, e
  2997  	}
  2998  
  2999  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  3000  	return &DeleteRepositoryOperation{
  3001  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  3002  		pollPath: override,
  3003  	}, nil
  3004  }
  3005  
  3006  // ListPackages lists packages.
  3007  func (c *restClient) ListPackages(ctx context.Context, req *artifactregistrypb.ListPackagesRequest, opts ...gax.CallOption) *PackageIterator {
  3008  	it := &PackageIterator{}
  3009  	req = proto.Clone(req).(*artifactregistrypb.ListPackagesRequest)
  3010  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3011  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Package, string, error) {
  3012  		resp := &artifactregistrypb.ListPackagesResponse{}
  3013  		if pageToken != "" {
  3014  			req.PageToken = pageToken
  3015  		}
  3016  		if pageSize > math.MaxInt32 {
  3017  			req.PageSize = math.MaxInt32
  3018  		} else if pageSize != 0 {
  3019  			req.PageSize = int32(pageSize)
  3020  		}
  3021  		baseUrl, err := url.Parse(c.endpoint)
  3022  		if err != nil {
  3023  			return nil, "", err
  3024  		}
  3025  		baseUrl.Path += fmt.Sprintf("/v1/%v/packages", req.GetParent())
  3026  
  3027  		params := url.Values{}
  3028  		params.Add("$alt", "json;enum-encoding=int")
  3029  		if req.GetPageSize() != 0 {
  3030  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  3031  		}
  3032  		if req.GetPageToken() != "" {
  3033  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  3034  		}
  3035  
  3036  		baseUrl.RawQuery = params.Encode()
  3037  
  3038  		// Build HTTP headers from client and context metadata.
  3039  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  3040  		headers := gax.BuildHeaders(ctx, hds...)
  3041  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3042  			if settings.Path != "" {
  3043  				baseUrl.Path = settings.Path
  3044  			}
  3045  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3046  			if err != nil {
  3047  				return err
  3048  			}
  3049  			httpReq.Header = headers
  3050  
  3051  			httpRsp, err := c.httpClient.Do(httpReq)
  3052  			if err != nil {
  3053  				return err
  3054  			}
  3055  			defer httpRsp.Body.Close()
  3056  
  3057  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  3058  				return err
  3059  			}
  3060  
  3061  			buf, err := io.ReadAll(httpRsp.Body)
  3062  			if err != nil {
  3063  				return err
  3064  			}
  3065  
  3066  			if err := unm.Unmarshal(buf, resp); err != nil {
  3067  				return err
  3068  			}
  3069  
  3070  			return nil
  3071  		}, opts...)
  3072  		if e != nil {
  3073  			return nil, "", e
  3074  		}
  3075  		it.Response = resp
  3076  		return resp.GetPackages(), resp.GetNextPageToken(), nil
  3077  	}
  3078  
  3079  	fetch := func(pageSize int, pageToken string) (string, error) {
  3080  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  3081  		if err != nil {
  3082  			return "", err
  3083  		}
  3084  		it.items = append(it.items, items...)
  3085  		return nextPageToken, nil
  3086  	}
  3087  
  3088  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  3089  	it.pageInfo.MaxSize = int(req.GetPageSize())
  3090  	it.pageInfo.Token = req.GetPageToken()
  3091  
  3092  	return it
  3093  }
  3094  
  3095  // GetPackage gets a package.
  3096  func (c *restClient) GetPackage(ctx context.Context, req *artifactregistrypb.GetPackageRequest, opts ...gax.CallOption) (*artifactregistrypb.Package, error) {
  3097  	baseUrl, err := url.Parse(c.endpoint)
  3098  	if err != nil {
  3099  		return nil, err
  3100  	}
  3101  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3102  
  3103  	params := url.Values{}
  3104  	params.Add("$alt", "json;enum-encoding=int")
  3105  
  3106  	baseUrl.RawQuery = params.Encode()
  3107  
  3108  	// Build HTTP headers from client and context metadata.
  3109  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3110  
  3111  	hds = append(c.xGoogHeaders, hds...)
  3112  	hds = append(hds, "Content-Type", "application/json")
  3113  	headers := gax.BuildHeaders(ctx, hds...)
  3114  	opts = append((*c.CallOptions).GetPackage[0:len((*c.CallOptions).GetPackage):len((*c.CallOptions).GetPackage)], opts...)
  3115  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3116  	resp := &artifactregistrypb.Package{}
  3117  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3118  		if settings.Path != "" {
  3119  			baseUrl.Path = settings.Path
  3120  		}
  3121  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3122  		if err != nil {
  3123  			return err
  3124  		}
  3125  		httpReq = httpReq.WithContext(ctx)
  3126  		httpReq.Header = headers
  3127  
  3128  		httpRsp, err := c.httpClient.Do(httpReq)
  3129  		if err != nil {
  3130  			return err
  3131  		}
  3132  		defer httpRsp.Body.Close()
  3133  
  3134  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3135  			return err
  3136  		}
  3137  
  3138  		buf, err := io.ReadAll(httpRsp.Body)
  3139  		if err != nil {
  3140  			return err
  3141  		}
  3142  
  3143  		if err := unm.Unmarshal(buf, resp); err != nil {
  3144  			return err
  3145  		}
  3146  
  3147  		return nil
  3148  	}, opts...)
  3149  	if e != nil {
  3150  		return nil, e
  3151  	}
  3152  	return resp, nil
  3153  }
  3154  
  3155  // DeletePackage deletes a package and all of its versions and tags. The returned operation
  3156  // will complete once the package has been deleted.
  3157  func (c *restClient) DeletePackage(ctx context.Context, req *artifactregistrypb.DeletePackageRequest, opts ...gax.CallOption) (*DeletePackageOperation, error) {
  3158  	baseUrl, err := url.Parse(c.endpoint)
  3159  	if err != nil {
  3160  		return nil, err
  3161  	}
  3162  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3163  
  3164  	params := url.Values{}
  3165  	params.Add("$alt", "json;enum-encoding=int")
  3166  
  3167  	baseUrl.RawQuery = params.Encode()
  3168  
  3169  	// Build HTTP headers from client and context metadata.
  3170  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3171  
  3172  	hds = append(c.xGoogHeaders, hds...)
  3173  	hds = append(hds, "Content-Type", "application/json")
  3174  	headers := gax.BuildHeaders(ctx, hds...)
  3175  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3176  	resp := &longrunningpb.Operation{}
  3177  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3178  		if settings.Path != "" {
  3179  			baseUrl.Path = settings.Path
  3180  		}
  3181  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  3182  		if err != nil {
  3183  			return err
  3184  		}
  3185  		httpReq = httpReq.WithContext(ctx)
  3186  		httpReq.Header = headers
  3187  
  3188  		httpRsp, err := c.httpClient.Do(httpReq)
  3189  		if err != nil {
  3190  			return err
  3191  		}
  3192  		defer httpRsp.Body.Close()
  3193  
  3194  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3195  			return err
  3196  		}
  3197  
  3198  		buf, err := io.ReadAll(httpRsp.Body)
  3199  		if err != nil {
  3200  			return err
  3201  		}
  3202  
  3203  		if err := unm.Unmarshal(buf, resp); err != nil {
  3204  			return err
  3205  		}
  3206  
  3207  		return nil
  3208  	}, opts...)
  3209  	if e != nil {
  3210  		return nil, e
  3211  	}
  3212  
  3213  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  3214  	return &DeletePackageOperation{
  3215  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  3216  		pollPath: override,
  3217  	}, nil
  3218  }
  3219  
  3220  // ListVersions lists versions.
  3221  func (c *restClient) ListVersions(ctx context.Context, req *artifactregistrypb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator {
  3222  	it := &VersionIterator{}
  3223  	req = proto.Clone(req).(*artifactregistrypb.ListVersionsRequest)
  3224  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3225  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Version, string, error) {
  3226  		resp := &artifactregistrypb.ListVersionsResponse{}
  3227  		if pageToken != "" {
  3228  			req.PageToken = pageToken
  3229  		}
  3230  		if pageSize > math.MaxInt32 {
  3231  			req.PageSize = math.MaxInt32
  3232  		} else if pageSize != 0 {
  3233  			req.PageSize = int32(pageSize)
  3234  		}
  3235  		baseUrl, err := url.Parse(c.endpoint)
  3236  		if err != nil {
  3237  			return nil, "", err
  3238  		}
  3239  		baseUrl.Path += fmt.Sprintf("/v1/%v/versions", req.GetParent())
  3240  
  3241  		params := url.Values{}
  3242  		params.Add("$alt", "json;enum-encoding=int")
  3243  		if req.GetOrderBy() != "" {
  3244  			params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
  3245  		}
  3246  		if req.GetPageSize() != 0 {
  3247  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  3248  		}
  3249  		if req.GetPageToken() != "" {
  3250  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  3251  		}
  3252  		if req.GetView() != 0 {
  3253  			params.Add("view", fmt.Sprintf("%v", req.GetView()))
  3254  		}
  3255  
  3256  		baseUrl.RawQuery = params.Encode()
  3257  
  3258  		// Build HTTP headers from client and context metadata.
  3259  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  3260  		headers := gax.BuildHeaders(ctx, hds...)
  3261  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3262  			if settings.Path != "" {
  3263  				baseUrl.Path = settings.Path
  3264  			}
  3265  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3266  			if err != nil {
  3267  				return err
  3268  			}
  3269  			httpReq.Header = headers
  3270  
  3271  			httpRsp, err := c.httpClient.Do(httpReq)
  3272  			if err != nil {
  3273  				return err
  3274  			}
  3275  			defer httpRsp.Body.Close()
  3276  
  3277  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  3278  				return err
  3279  			}
  3280  
  3281  			buf, err := io.ReadAll(httpRsp.Body)
  3282  			if err != nil {
  3283  				return err
  3284  			}
  3285  
  3286  			if err := unm.Unmarshal(buf, resp); err != nil {
  3287  				return err
  3288  			}
  3289  
  3290  			return nil
  3291  		}, opts...)
  3292  		if e != nil {
  3293  			return nil, "", e
  3294  		}
  3295  		it.Response = resp
  3296  		return resp.GetVersions(), resp.GetNextPageToken(), nil
  3297  	}
  3298  
  3299  	fetch := func(pageSize int, pageToken string) (string, error) {
  3300  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  3301  		if err != nil {
  3302  			return "", err
  3303  		}
  3304  		it.items = append(it.items, items...)
  3305  		return nextPageToken, nil
  3306  	}
  3307  
  3308  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  3309  	it.pageInfo.MaxSize = int(req.GetPageSize())
  3310  	it.pageInfo.Token = req.GetPageToken()
  3311  
  3312  	return it
  3313  }
  3314  
  3315  // GetVersion gets a version
  3316  func (c *restClient) GetVersion(ctx context.Context, req *artifactregistrypb.GetVersionRequest, opts ...gax.CallOption) (*artifactregistrypb.Version, error) {
  3317  	baseUrl, err := url.Parse(c.endpoint)
  3318  	if err != nil {
  3319  		return nil, err
  3320  	}
  3321  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3322  
  3323  	params := url.Values{}
  3324  	params.Add("$alt", "json;enum-encoding=int")
  3325  	if req.GetView() != 0 {
  3326  		params.Add("view", fmt.Sprintf("%v", req.GetView()))
  3327  	}
  3328  
  3329  	baseUrl.RawQuery = params.Encode()
  3330  
  3331  	// Build HTTP headers from client and context metadata.
  3332  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3333  
  3334  	hds = append(c.xGoogHeaders, hds...)
  3335  	hds = append(hds, "Content-Type", "application/json")
  3336  	headers := gax.BuildHeaders(ctx, hds...)
  3337  	opts = append((*c.CallOptions).GetVersion[0:len((*c.CallOptions).GetVersion):len((*c.CallOptions).GetVersion)], opts...)
  3338  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3339  	resp := &artifactregistrypb.Version{}
  3340  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3341  		if settings.Path != "" {
  3342  			baseUrl.Path = settings.Path
  3343  		}
  3344  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3345  		if err != nil {
  3346  			return err
  3347  		}
  3348  		httpReq = httpReq.WithContext(ctx)
  3349  		httpReq.Header = headers
  3350  
  3351  		httpRsp, err := c.httpClient.Do(httpReq)
  3352  		if err != nil {
  3353  			return err
  3354  		}
  3355  		defer httpRsp.Body.Close()
  3356  
  3357  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3358  			return err
  3359  		}
  3360  
  3361  		buf, err := io.ReadAll(httpRsp.Body)
  3362  		if err != nil {
  3363  			return err
  3364  		}
  3365  
  3366  		if err := unm.Unmarshal(buf, resp); err != nil {
  3367  			return err
  3368  		}
  3369  
  3370  		return nil
  3371  	}, opts...)
  3372  	if e != nil {
  3373  		return nil, e
  3374  	}
  3375  	return resp, nil
  3376  }
  3377  
  3378  // DeleteVersion deletes a version and all of its content. The returned operation will
  3379  // complete once the version has been deleted.
  3380  func (c *restClient) DeleteVersion(ctx context.Context, req *artifactregistrypb.DeleteVersionRequest, opts ...gax.CallOption) (*DeleteVersionOperation, error) {
  3381  	baseUrl, err := url.Parse(c.endpoint)
  3382  	if err != nil {
  3383  		return nil, err
  3384  	}
  3385  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3386  
  3387  	params := url.Values{}
  3388  	params.Add("$alt", "json;enum-encoding=int")
  3389  	if req.GetForce() {
  3390  		params.Add("force", fmt.Sprintf("%v", req.GetForce()))
  3391  	}
  3392  
  3393  	baseUrl.RawQuery = params.Encode()
  3394  
  3395  	// Build HTTP headers from client and context metadata.
  3396  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3397  
  3398  	hds = append(c.xGoogHeaders, hds...)
  3399  	hds = append(hds, "Content-Type", "application/json")
  3400  	headers := gax.BuildHeaders(ctx, hds...)
  3401  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3402  	resp := &longrunningpb.Operation{}
  3403  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3404  		if settings.Path != "" {
  3405  			baseUrl.Path = settings.Path
  3406  		}
  3407  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  3408  		if err != nil {
  3409  			return err
  3410  		}
  3411  		httpReq = httpReq.WithContext(ctx)
  3412  		httpReq.Header = headers
  3413  
  3414  		httpRsp, err := c.httpClient.Do(httpReq)
  3415  		if err != nil {
  3416  			return err
  3417  		}
  3418  		defer httpRsp.Body.Close()
  3419  
  3420  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3421  			return err
  3422  		}
  3423  
  3424  		buf, err := io.ReadAll(httpRsp.Body)
  3425  		if err != nil {
  3426  			return err
  3427  		}
  3428  
  3429  		if err := unm.Unmarshal(buf, resp); err != nil {
  3430  			return err
  3431  		}
  3432  
  3433  		return nil
  3434  	}, opts...)
  3435  	if e != nil {
  3436  		return nil, e
  3437  	}
  3438  
  3439  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  3440  	return &DeleteVersionOperation{
  3441  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  3442  		pollPath: override,
  3443  	}, nil
  3444  }
  3445  
  3446  // BatchDeleteVersions deletes multiple versions across a repository. The returned operation will
  3447  // complete once the versions have been deleted.
  3448  func (c *restClient) BatchDeleteVersions(ctx context.Context, req *artifactregistrypb.BatchDeleteVersionsRequest, opts ...gax.CallOption) (*BatchDeleteVersionsOperation, error) {
  3449  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  3450  	jsonReq, err := m.Marshal(req)
  3451  	if err != nil {
  3452  		return nil, err
  3453  	}
  3454  
  3455  	baseUrl, err := url.Parse(c.endpoint)
  3456  	if err != nil {
  3457  		return nil, err
  3458  	}
  3459  	baseUrl.Path += fmt.Sprintf("/v1/%v/versions:batchDelete", req.GetParent())
  3460  
  3461  	params := url.Values{}
  3462  	params.Add("$alt", "json;enum-encoding=int")
  3463  
  3464  	baseUrl.RawQuery = params.Encode()
  3465  
  3466  	// Build HTTP headers from client and context metadata.
  3467  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  3468  
  3469  	hds = append(c.xGoogHeaders, hds...)
  3470  	hds = append(hds, "Content-Type", "application/json")
  3471  	headers := gax.BuildHeaders(ctx, hds...)
  3472  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3473  	resp := &longrunningpb.Operation{}
  3474  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3475  		if settings.Path != "" {
  3476  			baseUrl.Path = settings.Path
  3477  		}
  3478  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  3479  		if err != nil {
  3480  			return err
  3481  		}
  3482  		httpReq = httpReq.WithContext(ctx)
  3483  		httpReq.Header = headers
  3484  
  3485  		httpRsp, err := c.httpClient.Do(httpReq)
  3486  		if err != nil {
  3487  			return err
  3488  		}
  3489  		defer httpRsp.Body.Close()
  3490  
  3491  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3492  			return err
  3493  		}
  3494  
  3495  		buf, err := io.ReadAll(httpRsp.Body)
  3496  		if err != nil {
  3497  			return err
  3498  		}
  3499  
  3500  		if err := unm.Unmarshal(buf, resp); err != nil {
  3501  			return err
  3502  		}
  3503  
  3504  		return nil
  3505  	}, opts...)
  3506  	if e != nil {
  3507  		return nil, e
  3508  	}
  3509  
  3510  	override := fmt.Sprintf("/v1/%s", resp.GetName())
  3511  	return &BatchDeleteVersionsOperation{
  3512  		lro:      longrunning.InternalNewOperation(*c.LROClient, resp),
  3513  		pollPath: override,
  3514  	}, nil
  3515  }
  3516  
  3517  // ListFiles lists files.
  3518  func (c *restClient) ListFiles(ctx context.Context, req *artifactregistrypb.ListFilesRequest, opts ...gax.CallOption) *FileIterator {
  3519  	it := &FileIterator{}
  3520  	req = proto.Clone(req).(*artifactregistrypb.ListFilesRequest)
  3521  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3522  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.File, string, error) {
  3523  		resp := &artifactregistrypb.ListFilesResponse{}
  3524  		if pageToken != "" {
  3525  			req.PageToken = pageToken
  3526  		}
  3527  		if pageSize > math.MaxInt32 {
  3528  			req.PageSize = math.MaxInt32
  3529  		} else if pageSize != 0 {
  3530  			req.PageSize = int32(pageSize)
  3531  		}
  3532  		baseUrl, err := url.Parse(c.endpoint)
  3533  		if err != nil {
  3534  			return nil, "", err
  3535  		}
  3536  		baseUrl.Path += fmt.Sprintf("/v1/%v/files", req.GetParent())
  3537  
  3538  		params := url.Values{}
  3539  		params.Add("$alt", "json;enum-encoding=int")
  3540  		if req.GetFilter() != "" {
  3541  			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
  3542  		}
  3543  		if req.GetOrderBy() != "" {
  3544  			params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
  3545  		}
  3546  		if req.GetPageSize() != 0 {
  3547  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  3548  		}
  3549  		if req.GetPageToken() != "" {
  3550  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  3551  		}
  3552  
  3553  		baseUrl.RawQuery = params.Encode()
  3554  
  3555  		// Build HTTP headers from client and context metadata.
  3556  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  3557  		headers := gax.BuildHeaders(ctx, hds...)
  3558  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3559  			if settings.Path != "" {
  3560  				baseUrl.Path = settings.Path
  3561  			}
  3562  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3563  			if err != nil {
  3564  				return err
  3565  			}
  3566  			httpReq.Header = headers
  3567  
  3568  			httpRsp, err := c.httpClient.Do(httpReq)
  3569  			if err != nil {
  3570  				return err
  3571  			}
  3572  			defer httpRsp.Body.Close()
  3573  
  3574  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  3575  				return err
  3576  			}
  3577  
  3578  			buf, err := io.ReadAll(httpRsp.Body)
  3579  			if err != nil {
  3580  				return err
  3581  			}
  3582  
  3583  			if err := unm.Unmarshal(buf, resp); err != nil {
  3584  				return err
  3585  			}
  3586  
  3587  			return nil
  3588  		}, opts...)
  3589  		if e != nil {
  3590  			return nil, "", e
  3591  		}
  3592  		it.Response = resp
  3593  		return resp.GetFiles(), resp.GetNextPageToken(), nil
  3594  	}
  3595  
  3596  	fetch := func(pageSize int, pageToken string) (string, error) {
  3597  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  3598  		if err != nil {
  3599  			return "", err
  3600  		}
  3601  		it.items = append(it.items, items...)
  3602  		return nextPageToken, nil
  3603  	}
  3604  
  3605  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  3606  	it.pageInfo.MaxSize = int(req.GetPageSize())
  3607  	it.pageInfo.Token = req.GetPageToken()
  3608  
  3609  	return it
  3610  }
  3611  
  3612  // GetFile gets a file.
  3613  func (c *restClient) GetFile(ctx context.Context, req *artifactregistrypb.GetFileRequest, opts ...gax.CallOption) (*artifactregistrypb.File, error) {
  3614  	baseUrl, err := url.Parse(c.endpoint)
  3615  	if err != nil {
  3616  		return nil, err
  3617  	}
  3618  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3619  
  3620  	params := url.Values{}
  3621  	params.Add("$alt", "json;enum-encoding=int")
  3622  
  3623  	baseUrl.RawQuery = params.Encode()
  3624  
  3625  	// Build HTTP headers from client and context metadata.
  3626  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3627  
  3628  	hds = append(c.xGoogHeaders, hds...)
  3629  	hds = append(hds, "Content-Type", "application/json")
  3630  	headers := gax.BuildHeaders(ctx, hds...)
  3631  	opts = append((*c.CallOptions).GetFile[0:len((*c.CallOptions).GetFile):len((*c.CallOptions).GetFile)], opts...)
  3632  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3633  	resp := &artifactregistrypb.File{}
  3634  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3635  		if settings.Path != "" {
  3636  			baseUrl.Path = settings.Path
  3637  		}
  3638  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3639  		if err != nil {
  3640  			return err
  3641  		}
  3642  		httpReq = httpReq.WithContext(ctx)
  3643  		httpReq.Header = headers
  3644  
  3645  		httpRsp, err := c.httpClient.Do(httpReq)
  3646  		if err != nil {
  3647  			return err
  3648  		}
  3649  		defer httpRsp.Body.Close()
  3650  
  3651  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3652  			return err
  3653  		}
  3654  
  3655  		buf, err := io.ReadAll(httpRsp.Body)
  3656  		if err != nil {
  3657  			return err
  3658  		}
  3659  
  3660  		if err := unm.Unmarshal(buf, resp); err != nil {
  3661  			return err
  3662  		}
  3663  
  3664  		return nil
  3665  	}, opts...)
  3666  	if e != nil {
  3667  		return nil, e
  3668  	}
  3669  	return resp, nil
  3670  }
  3671  
  3672  // ListTags lists tags.
  3673  func (c *restClient) ListTags(ctx context.Context, req *artifactregistrypb.ListTagsRequest, opts ...gax.CallOption) *TagIterator {
  3674  	it := &TagIterator{}
  3675  	req = proto.Clone(req).(*artifactregistrypb.ListTagsRequest)
  3676  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3677  	it.InternalFetch = func(pageSize int, pageToken string) ([]*artifactregistrypb.Tag, string, error) {
  3678  		resp := &artifactregistrypb.ListTagsResponse{}
  3679  		if pageToken != "" {
  3680  			req.PageToken = pageToken
  3681  		}
  3682  		if pageSize > math.MaxInt32 {
  3683  			req.PageSize = math.MaxInt32
  3684  		} else if pageSize != 0 {
  3685  			req.PageSize = int32(pageSize)
  3686  		}
  3687  		baseUrl, err := url.Parse(c.endpoint)
  3688  		if err != nil {
  3689  			return nil, "", err
  3690  		}
  3691  		baseUrl.Path += fmt.Sprintf("/v1/%v/tags", req.GetParent())
  3692  
  3693  		params := url.Values{}
  3694  		params.Add("$alt", "json;enum-encoding=int")
  3695  		if req.GetFilter() != "" {
  3696  			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
  3697  		}
  3698  		if req.GetPageSize() != 0 {
  3699  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  3700  		}
  3701  		if req.GetPageToken() != "" {
  3702  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  3703  		}
  3704  
  3705  		baseUrl.RawQuery = params.Encode()
  3706  
  3707  		// Build HTTP headers from client and context metadata.
  3708  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  3709  		headers := gax.BuildHeaders(ctx, hds...)
  3710  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3711  			if settings.Path != "" {
  3712  				baseUrl.Path = settings.Path
  3713  			}
  3714  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3715  			if err != nil {
  3716  				return err
  3717  			}
  3718  			httpReq.Header = headers
  3719  
  3720  			httpRsp, err := c.httpClient.Do(httpReq)
  3721  			if err != nil {
  3722  				return err
  3723  			}
  3724  			defer httpRsp.Body.Close()
  3725  
  3726  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  3727  				return err
  3728  			}
  3729  
  3730  			buf, err := io.ReadAll(httpRsp.Body)
  3731  			if err != nil {
  3732  				return err
  3733  			}
  3734  
  3735  			if err := unm.Unmarshal(buf, resp); err != nil {
  3736  				return err
  3737  			}
  3738  
  3739  			return nil
  3740  		}, opts...)
  3741  		if e != nil {
  3742  			return nil, "", e
  3743  		}
  3744  		it.Response = resp
  3745  		return resp.GetTags(), resp.GetNextPageToken(), nil
  3746  	}
  3747  
  3748  	fetch := func(pageSize int, pageToken string) (string, error) {
  3749  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  3750  		if err != nil {
  3751  			return "", err
  3752  		}
  3753  		it.items = append(it.items, items...)
  3754  		return nextPageToken, nil
  3755  	}
  3756  
  3757  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  3758  	it.pageInfo.MaxSize = int(req.GetPageSize())
  3759  	it.pageInfo.Token = req.GetPageToken()
  3760  
  3761  	return it
  3762  }
  3763  
  3764  // GetTag gets a tag.
  3765  func (c *restClient) GetTag(ctx context.Context, req *artifactregistrypb.GetTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  3766  	baseUrl, err := url.Parse(c.endpoint)
  3767  	if err != nil {
  3768  		return nil, err
  3769  	}
  3770  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3771  
  3772  	params := url.Values{}
  3773  	params.Add("$alt", "json;enum-encoding=int")
  3774  
  3775  	baseUrl.RawQuery = params.Encode()
  3776  
  3777  	// Build HTTP headers from client and context metadata.
  3778  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3779  
  3780  	hds = append(c.xGoogHeaders, hds...)
  3781  	hds = append(hds, "Content-Type", "application/json")
  3782  	headers := gax.BuildHeaders(ctx, hds...)
  3783  	opts = append((*c.CallOptions).GetTag[0:len((*c.CallOptions).GetTag):len((*c.CallOptions).GetTag)], opts...)
  3784  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3785  	resp := &artifactregistrypb.Tag{}
  3786  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3787  		if settings.Path != "" {
  3788  			baseUrl.Path = settings.Path
  3789  		}
  3790  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  3791  		if err != nil {
  3792  			return err
  3793  		}
  3794  		httpReq = httpReq.WithContext(ctx)
  3795  		httpReq.Header = headers
  3796  
  3797  		httpRsp, err := c.httpClient.Do(httpReq)
  3798  		if err != nil {
  3799  			return err
  3800  		}
  3801  		defer httpRsp.Body.Close()
  3802  
  3803  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3804  			return err
  3805  		}
  3806  
  3807  		buf, err := io.ReadAll(httpRsp.Body)
  3808  		if err != nil {
  3809  			return err
  3810  		}
  3811  
  3812  		if err := unm.Unmarshal(buf, resp); err != nil {
  3813  			return err
  3814  		}
  3815  
  3816  		return nil
  3817  	}, opts...)
  3818  	if e != nil {
  3819  		return nil, e
  3820  	}
  3821  	return resp, nil
  3822  }
  3823  
  3824  // CreateTag creates a tag.
  3825  func (c *restClient) CreateTag(ctx context.Context, req *artifactregistrypb.CreateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  3826  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  3827  	body := req.GetTag()
  3828  	jsonReq, err := m.Marshal(body)
  3829  	if err != nil {
  3830  		return nil, err
  3831  	}
  3832  
  3833  	baseUrl, err := url.Parse(c.endpoint)
  3834  	if err != nil {
  3835  		return nil, err
  3836  	}
  3837  	baseUrl.Path += fmt.Sprintf("/v1/%v/tags", req.GetParent())
  3838  
  3839  	params := url.Values{}
  3840  	params.Add("$alt", "json;enum-encoding=int")
  3841  	if req.GetTagId() != "" {
  3842  		params.Add("tagId", fmt.Sprintf("%v", req.GetTagId()))
  3843  	}
  3844  
  3845  	baseUrl.RawQuery = params.Encode()
  3846  
  3847  	// Build HTTP headers from client and context metadata.
  3848  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
  3849  
  3850  	hds = append(c.xGoogHeaders, hds...)
  3851  	hds = append(hds, "Content-Type", "application/json")
  3852  	headers := gax.BuildHeaders(ctx, hds...)
  3853  	opts = append((*c.CallOptions).CreateTag[0:len((*c.CallOptions).CreateTag):len((*c.CallOptions).CreateTag)], opts...)
  3854  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3855  	resp := &artifactregistrypb.Tag{}
  3856  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3857  		if settings.Path != "" {
  3858  			baseUrl.Path = settings.Path
  3859  		}
  3860  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  3861  		if err != nil {
  3862  			return err
  3863  		}
  3864  		httpReq = httpReq.WithContext(ctx)
  3865  		httpReq.Header = headers
  3866  
  3867  		httpRsp, err := c.httpClient.Do(httpReq)
  3868  		if err != nil {
  3869  			return err
  3870  		}
  3871  		defer httpRsp.Body.Close()
  3872  
  3873  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3874  			return err
  3875  		}
  3876  
  3877  		buf, err := io.ReadAll(httpRsp.Body)
  3878  		if err != nil {
  3879  			return err
  3880  		}
  3881  
  3882  		if err := unm.Unmarshal(buf, resp); err != nil {
  3883  			return err
  3884  		}
  3885  
  3886  		return nil
  3887  	}, opts...)
  3888  	if e != nil {
  3889  		return nil, e
  3890  	}
  3891  	return resp, nil
  3892  }
  3893  
  3894  // UpdateTag updates a tag.
  3895  func (c *restClient) UpdateTag(ctx context.Context, req *artifactregistrypb.UpdateTagRequest, opts ...gax.CallOption) (*artifactregistrypb.Tag, error) {
  3896  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  3897  	body := req.GetTag()
  3898  	jsonReq, err := m.Marshal(body)
  3899  	if err != nil {
  3900  		return nil, err
  3901  	}
  3902  
  3903  	baseUrl, err := url.Parse(c.endpoint)
  3904  	if err != nil {
  3905  		return nil, err
  3906  	}
  3907  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetTag().GetName())
  3908  
  3909  	params := url.Values{}
  3910  	params.Add("$alt", "json;enum-encoding=int")
  3911  	if req.GetUpdateMask() != nil {
  3912  		updateMask, err := protojson.Marshal(req.GetUpdateMask())
  3913  		if err != nil {
  3914  			return nil, err
  3915  		}
  3916  		params.Add("updateMask", string(updateMask[1:len(updateMask)-1]))
  3917  	}
  3918  
  3919  	baseUrl.RawQuery = params.Encode()
  3920  
  3921  	// Build HTTP headers from client and context metadata.
  3922  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tag.name", url.QueryEscape(req.GetTag().GetName()))}
  3923  
  3924  	hds = append(c.xGoogHeaders, hds...)
  3925  	hds = append(hds, "Content-Type", "application/json")
  3926  	headers := gax.BuildHeaders(ctx, hds...)
  3927  	opts = append((*c.CallOptions).UpdateTag[0:len((*c.CallOptions).UpdateTag):len((*c.CallOptions).UpdateTag)], opts...)
  3928  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  3929  	resp := &artifactregistrypb.Tag{}
  3930  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3931  		if settings.Path != "" {
  3932  			baseUrl.Path = settings.Path
  3933  		}
  3934  		httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
  3935  		if err != nil {
  3936  			return err
  3937  		}
  3938  		httpReq = httpReq.WithContext(ctx)
  3939  		httpReq.Header = headers
  3940  
  3941  		httpRsp, err := c.httpClient.Do(httpReq)
  3942  		if err != nil {
  3943  			return err
  3944  		}
  3945  		defer httpRsp.Body.Close()
  3946  
  3947  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  3948  			return err
  3949  		}
  3950  
  3951  		buf, err := io.ReadAll(httpRsp.Body)
  3952  		if err != nil {
  3953  			return err
  3954  		}
  3955  
  3956  		if err := unm.Unmarshal(buf, resp); err != nil {
  3957  			return err
  3958  		}
  3959  
  3960  		return nil
  3961  	}, opts...)
  3962  	if e != nil {
  3963  		return nil, e
  3964  	}
  3965  	return resp, nil
  3966  }
  3967  
  3968  // DeleteTag deletes a tag.
  3969  func (c *restClient) DeleteTag(ctx context.Context, req *artifactregistrypb.DeleteTagRequest, opts ...gax.CallOption) error {
  3970  	baseUrl, err := url.Parse(c.endpoint)
  3971  	if err != nil {
  3972  		return err
  3973  	}
  3974  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  3975  
  3976  	params := url.Values{}
  3977  	params.Add("$alt", "json;enum-encoding=int")
  3978  
  3979  	baseUrl.RawQuery = params.Encode()
  3980  
  3981  	// Build HTTP headers from client and context metadata.
  3982  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  3983  
  3984  	hds = append(c.xGoogHeaders, hds...)
  3985  	hds = append(hds, "Content-Type", "application/json")
  3986  	headers := gax.BuildHeaders(ctx, hds...)
  3987  	return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  3988  		if settings.Path != "" {
  3989  			baseUrl.Path = settings.Path
  3990  		}
  3991  		httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
  3992  		if err != nil {
  3993  			return err
  3994  		}
  3995  		httpReq = httpReq.WithContext(ctx)
  3996  		httpReq.Header = headers
  3997  
  3998  		httpRsp, err := c.httpClient.Do(httpReq)
  3999  		if err != nil {
  4000  			return err
  4001  		}
  4002  		defer httpRsp.Body.Close()
  4003  
  4004  		// Returns nil if there is no error, otherwise wraps
  4005  		// the response code and body into a non-nil error
  4006  		return googleapi.CheckResponse(httpRsp)
  4007  	}, opts...)
  4008  }
  4009  
  4010  // SetIamPolicy updates the IAM policy for a given resource.
  4011  func (c *restClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  4012  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  4013  	jsonReq, err := m.Marshal(req)
  4014  	if err != nil {
  4015  		return nil, err
  4016  	}
  4017  
  4018  	baseUrl, err := url.Parse(c.endpoint)
  4019  	if err != nil {
  4020  		return nil, err
  4021  	}
  4022  	baseUrl.Path += fmt.Sprintf("/v1/%v:setIamPolicy", req.GetResource())
  4023  
  4024  	params := url.Values{}
  4025  	params.Add("$alt", "json;enum-encoding=int")
  4026  
  4027  	baseUrl.RawQuery = params.Encode()
  4028  
  4029  	// Build HTTP headers from client and context metadata.
  4030  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  4031  
  4032  	hds = append(c.xGoogHeaders, hds...)
  4033  	hds = append(hds, "Content-Type", "application/json")
  4034  	headers := gax.BuildHeaders(ctx, hds...)
  4035  	opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
  4036  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4037  	resp := &iampb.Policy{}
  4038  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4039  		if settings.Path != "" {
  4040  			baseUrl.Path = settings.Path
  4041  		}
  4042  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  4043  		if err != nil {
  4044  			return err
  4045  		}
  4046  		httpReq = httpReq.WithContext(ctx)
  4047  		httpReq.Header = headers
  4048  
  4049  		httpRsp, err := c.httpClient.Do(httpReq)
  4050  		if err != nil {
  4051  			return err
  4052  		}
  4053  		defer httpRsp.Body.Close()
  4054  
  4055  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4056  			return err
  4057  		}
  4058  
  4059  		buf, err := io.ReadAll(httpRsp.Body)
  4060  		if err != nil {
  4061  			return err
  4062  		}
  4063  
  4064  		if err := unm.Unmarshal(buf, resp); err != nil {
  4065  			return err
  4066  		}
  4067  
  4068  		return nil
  4069  	}, opts...)
  4070  	if e != nil {
  4071  		return nil, e
  4072  	}
  4073  	return resp, nil
  4074  }
  4075  
  4076  // GetIamPolicy gets the IAM policy for a given resource.
  4077  func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
  4078  	baseUrl, err := url.Parse(c.endpoint)
  4079  	if err != nil {
  4080  		return nil, err
  4081  	}
  4082  	baseUrl.Path += fmt.Sprintf("/v1/%v:getIamPolicy", req.GetResource())
  4083  
  4084  	params := url.Values{}
  4085  	params.Add("$alt", "json;enum-encoding=int")
  4086  	if req.GetOptions().GetRequestedPolicyVersion() != 0 {
  4087  		params.Add("options.requestedPolicyVersion", fmt.Sprintf("%v", req.GetOptions().GetRequestedPolicyVersion()))
  4088  	}
  4089  
  4090  	baseUrl.RawQuery = params.Encode()
  4091  
  4092  	// Build HTTP headers from client and context metadata.
  4093  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  4094  
  4095  	hds = append(c.xGoogHeaders, hds...)
  4096  	hds = append(hds, "Content-Type", "application/json")
  4097  	headers := gax.BuildHeaders(ctx, hds...)
  4098  	opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
  4099  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4100  	resp := &iampb.Policy{}
  4101  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4102  		if settings.Path != "" {
  4103  			baseUrl.Path = settings.Path
  4104  		}
  4105  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4106  		if err != nil {
  4107  			return err
  4108  		}
  4109  		httpReq = httpReq.WithContext(ctx)
  4110  		httpReq.Header = headers
  4111  
  4112  		httpRsp, err := c.httpClient.Do(httpReq)
  4113  		if err != nil {
  4114  			return err
  4115  		}
  4116  		defer httpRsp.Body.Close()
  4117  
  4118  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4119  			return err
  4120  		}
  4121  
  4122  		buf, err := io.ReadAll(httpRsp.Body)
  4123  		if err != nil {
  4124  			return err
  4125  		}
  4126  
  4127  		if err := unm.Unmarshal(buf, resp); err != nil {
  4128  			return err
  4129  		}
  4130  
  4131  		return nil
  4132  	}, opts...)
  4133  	if e != nil {
  4134  		return nil, e
  4135  	}
  4136  	return resp, nil
  4137  }
  4138  
  4139  // TestIamPermissions tests if the caller has a list of permissions on a resource.
  4140  func (c *restClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
  4141  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  4142  	jsonReq, err := m.Marshal(req)
  4143  	if err != nil {
  4144  		return nil, err
  4145  	}
  4146  
  4147  	baseUrl, err := url.Parse(c.endpoint)
  4148  	if err != nil {
  4149  		return nil, err
  4150  	}
  4151  	baseUrl.Path += fmt.Sprintf("/v1/%v:testIamPermissions", req.GetResource())
  4152  
  4153  	params := url.Values{}
  4154  	params.Add("$alt", "json;enum-encoding=int")
  4155  
  4156  	baseUrl.RawQuery = params.Encode()
  4157  
  4158  	// Build HTTP headers from client and context metadata.
  4159  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
  4160  
  4161  	hds = append(c.xGoogHeaders, hds...)
  4162  	hds = append(hds, "Content-Type", "application/json")
  4163  	headers := gax.BuildHeaders(ctx, hds...)
  4164  	opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
  4165  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4166  	resp := &iampb.TestIamPermissionsResponse{}
  4167  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4168  		if settings.Path != "" {
  4169  			baseUrl.Path = settings.Path
  4170  		}
  4171  		httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
  4172  		if err != nil {
  4173  			return err
  4174  		}
  4175  		httpReq = httpReq.WithContext(ctx)
  4176  		httpReq.Header = headers
  4177  
  4178  		httpRsp, err := c.httpClient.Do(httpReq)
  4179  		if err != nil {
  4180  			return err
  4181  		}
  4182  		defer httpRsp.Body.Close()
  4183  
  4184  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4185  			return err
  4186  		}
  4187  
  4188  		buf, err := io.ReadAll(httpRsp.Body)
  4189  		if err != nil {
  4190  			return err
  4191  		}
  4192  
  4193  		if err := unm.Unmarshal(buf, resp); err != nil {
  4194  			return err
  4195  		}
  4196  
  4197  		return nil
  4198  	}, opts...)
  4199  	if e != nil {
  4200  		return nil, e
  4201  	}
  4202  	return resp, nil
  4203  }
  4204  
  4205  // GetProjectSettings retrieves the Settings for the Project.
  4206  func (c *restClient) GetProjectSettings(ctx context.Context, req *artifactregistrypb.GetProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
  4207  	baseUrl, err := url.Parse(c.endpoint)
  4208  	if err != nil {
  4209  		return nil, err
  4210  	}
  4211  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  4212  
  4213  	params := url.Values{}
  4214  	params.Add("$alt", "json;enum-encoding=int")
  4215  
  4216  	baseUrl.RawQuery = params.Encode()
  4217  
  4218  	// Build HTTP headers from client and context metadata.
  4219  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  4220  
  4221  	hds = append(c.xGoogHeaders, hds...)
  4222  	hds = append(hds, "Content-Type", "application/json")
  4223  	headers := gax.BuildHeaders(ctx, hds...)
  4224  	opts = append((*c.CallOptions).GetProjectSettings[0:len((*c.CallOptions).GetProjectSettings):len((*c.CallOptions).GetProjectSettings)], opts...)
  4225  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4226  	resp := &artifactregistrypb.ProjectSettings{}
  4227  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4228  		if settings.Path != "" {
  4229  			baseUrl.Path = settings.Path
  4230  		}
  4231  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4232  		if err != nil {
  4233  			return err
  4234  		}
  4235  		httpReq = httpReq.WithContext(ctx)
  4236  		httpReq.Header = headers
  4237  
  4238  		httpRsp, err := c.httpClient.Do(httpReq)
  4239  		if err != nil {
  4240  			return err
  4241  		}
  4242  		defer httpRsp.Body.Close()
  4243  
  4244  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4245  			return err
  4246  		}
  4247  
  4248  		buf, err := io.ReadAll(httpRsp.Body)
  4249  		if err != nil {
  4250  			return err
  4251  		}
  4252  
  4253  		if err := unm.Unmarshal(buf, resp); err != nil {
  4254  			return err
  4255  		}
  4256  
  4257  		return nil
  4258  	}, opts...)
  4259  	if e != nil {
  4260  		return nil, e
  4261  	}
  4262  	return resp, nil
  4263  }
  4264  
  4265  // UpdateProjectSettings updates the Settings for the Project.
  4266  func (c *restClient) UpdateProjectSettings(ctx context.Context, req *artifactregistrypb.UpdateProjectSettingsRequest, opts ...gax.CallOption) (*artifactregistrypb.ProjectSettings, error) {
  4267  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  4268  	body := req.GetProjectSettings()
  4269  	jsonReq, err := m.Marshal(body)
  4270  	if err != nil {
  4271  		return nil, err
  4272  	}
  4273  
  4274  	baseUrl, err := url.Parse(c.endpoint)
  4275  	if err != nil {
  4276  		return nil, err
  4277  	}
  4278  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetProjectSettings().GetName())
  4279  
  4280  	params := url.Values{}
  4281  	params.Add("$alt", "json;enum-encoding=int")
  4282  	if req.GetUpdateMask() != nil {
  4283  		updateMask, err := protojson.Marshal(req.GetUpdateMask())
  4284  		if err != nil {
  4285  			return nil, err
  4286  		}
  4287  		params.Add("updateMask", string(updateMask[1:len(updateMask)-1]))
  4288  	}
  4289  
  4290  	baseUrl.RawQuery = params.Encode()
  4291  
  4292  	// Build HTTP headers from client and context metadata.
  4293  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "project_settings.name", url.QueryEscape(req.GetProjectSettings().GetName()))}
  4294  
  4295  	hds = append(c.xGoogHeaders, hds...)
  4296  	hds = append(hds, "Content-Type", "application/json")
  4297  	headers := gax.BuildHeaders(ctx, hds...)
  4298  	opts = append((*c.CallOptions).UpdateProjectSettings[0:len((*c.CallOptions).UpdateProjectSettings):len((*c.CallOptions).UpdateProjectSettings)], opts...)
  4299  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4300  	resp := &artifactregistrypb.ProjectSettings{}
  4301  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4302  		if settings.Path != "" {
  4303  			baseUrl.Path = settings.Path
  4304  		}
  4305  		httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
  4306  		if err != nil {
  4307  			return err
  4308  		}
  4309  		httpReq = httpReq.WithContext(ctx)
  4310  		httpReq.Header = headers
  4311  
  4312  		httpRsp, err := c.httpClient.Do(httpReq)
  4313  		if err != nil {
  4314  			return err
  4315  		}
  4316  		defer httpRsp.Body.Close()
  4317  
  4318  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4319  			return err
  4320  		}
  4321  
  4322  		buf, err := io.ReadAll(httpRsp.Body)
  4323  		if err != nil {
  4324  			return err
  4325  		}
  4326  
  4327  		if err := unm.Unmarshal(buf, resp); err != nil {
  4328  			return err
  4329  		}
  4330  
  4331  		return nil
  4332  	}, opts...)
  4333  	if e != nil {
  4334  		return nil, e
  4335  	}
  4336  	return resp, nil
  4337  }
  4338  
  4339  // GetVPCSCConfig retrieves the VPCSC Config for the Project.
  4340  func (c *restClient) GetVPCSCConfig(ctx context.Context, req *artifactregistrypb.GetVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
  4341  	baseUrl, err := url.Parse(c.endpoint)
  4342  	if err != nil {
  4343  		return nil, err
  4344  	}
  4345  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  4346  
  4347  	params := url.Values{}
  4348  	params.Add("$alt", "json;enum-encoding=int")
  4349  
  4350  	baseUrl.RawQuery = params.Encode()
  4351  
  4352  	// Build HTTP headers from client and context metadata.
  4353  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  4354  
  4355  	hds = append(c.xGoogHeaders, hds...)
  4356  	hds = append(hds, "Content-Type", "application/json")
  4357  	headers := gax.BuildHeaders(ctx, hds...)
  4358  	opts = append((*c.CallOptions).GetVPCSCConfig[0:len((*c.CallOptions).GetVPCSCConfig):len((*c.CallOptions).GetVPCSCConfig)], opts...)
  4359  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4360  	resp := &artifactregistrypb.VPCSCConfig{}
  4361  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4362  		if settings.Path != "" {
  4363  			baseUrl.Path = settings.Path
  4364  		}
  4365  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4366  		if err != nil {
  4367  			return err
  4368  		}
  4369  		httpReq = httpReq.WithContext(ctx)
  4370  		httpReq.Header = headers
  4371  
  4372  		httpRsp, err := c.httpClient.Do(httpReq)
  4373  		if err != nil {
  4374  			return err
  4375  		}
  4376  		defer httpRsp.Body.Close()
  4377  
  4378  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4379  			return err
  4380  		}
  4381  
  4382  		buf, err := io.ReadAll(httpRsp.Body)
  4383  		if err != nil {
  4384  			return err
  4385  		}
  4386  
  4387  		if err := unm.Unmarshal(buf, resp); err != nil {
  4388  			return err
  4389  		}
  4390  
  4391  		return nil
  4392  	}, opts...)
  4393  	if e != nil {
  4394  		return nil, e
  4395  	}
  4396  	return resp, nil
  4397  }
  4398  
  4399  // UpdateVPCSCConfig updates the VPCSC Config for the Project.
  4400  func (c *restClient) UpdateVPCSCConfig(ctx context.Context, req *artifactregistrypb.UpdateVPCSCConfigRequest, opts ...gax.CallOption) (*artifactregistrypb.VPCSCConfig, error) {
  4401  	m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
  4402  	body := req.GetVpcscConfig()
  4403  	jsonReq, err := m.Marshal(body)
  4404  	if err != nil {
  4405  		return nil, err
  4406  	}
  4407  
  4408  	baseUrl, err := url.Parse(c.endpoint)
  4409  	if err != nil {
  4410  		return nil, err
  4411  	}
  4412  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetVpcscConfig().GetName())
  4413  
  4414  	params := url.Values{}
  4415  	params.Add("$alt", "json;enum-encoding=int")
  4416  	if req.GetUpdateMask() != nil {
  4417  		updateMask, err := protojson.Marshal(req.GetUpdateMask())
  4418  		if err != nil {
  4419  			return nil, err
  4420  		}
  4421  		params.Add("updateMask", string(updateMask[1:len(updateMask)-1]))
  4422  	}
  4423  
  4424  	baseUrl.RawQuery = params.Encode()
  4425  
  4426  	// Build HTTP headers from client and context metadata.
  4427  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "vpcsc_config.name", url.QueryEscape(req.GetVpcscConfig().GetName()))}
  4428  
  4429  	hds = append(c.xGoogHeaders, hds...)
  4430  	hds = append(hds, "Content-Type", "application/json")
  4431  	headers := gax.BuildHeaders(ctx, hds...)
  4432  	opts = append((*c.CallOptions).UpdateVPCSCConfig[0:len((*c.CallOptions).UpdateVPCSCConfig):len((*c.CallOptions).UpdateVPCSCConfig)], opts...)
  4433  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4434  	resp := &artifactregistrypb.VPCSCConfig{}
  4435  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4436  		if settings.Path != "" {
  4437  			baseUrl.Path = settings.Path
  4438  		}
  4439  		httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
  4440  		if err != nil {
  4441  			return err
  4442  		}
  4443  		httpReq = httpReq.WithContext(ctx)
  4444  		httpReq.Header = headers
  4445  
  4446  		httpRsp, err := c.httpClient.Do(httpReq)
  4447  		if err != nil {
  4448  			return err
  4449  		}
  4450  		defer httpRsp.Body.Close()
  4451  
  4452  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4453  			return err
  4454  		}
  4455  
  4456  		buf, err := io.ReadAll(httpRsp.Body)
  4457  		if err != nil {
  4458  			return err
  4459  		}
  4460  
  4461  		if err := unm.Unmarshal(buf, resp); err != nil {
  4462  			return err
  4463  		}
  4464  
  4465  		return nil
  4466  	}, opts...)
  4467  	if e != nil {
  4468  		return nil, e
  4469  	}
  4470  	return resp, nil
  4471  }
  4472  
  4473  // GetLocation gets information about a location.
  4474  func (c *restClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
  4475  	baseUrl, err := url.Parse(c.endpoint)
  4476  	if err != nil {
  4477  		return nil, err
  4478  	}
  4479  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  4480  
  4481  	params := url.Values{}
  4482  	params.Add("$alt", "json;enum-encoding=int")
  4483  
  4484  	baseUrl.RawQuery = params.Encode()
  4485  
  4486  	// Build HTTP headers from client and context metadata.
  4487  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  4488  
  4489  	hds = append(c.xGoogHeaders, hds...)
  4490  	hds = append(hds, "Content-Type", "application/json")
  4491  	headers := gax.BuildHeaders(ctx, hds...)
  4492  	opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
  4493  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4494  	resp := &locationpb.Location{}
  4495  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4496  		if settings.Path != "" {
  4497  			baseUrl.Path = settings.Path
  4498  		}
  4499  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4500  		if err != nil {
  4501  			return err
  4502  		}
  4503  		httpReq = httpReq.WithContext(ctx)
  4504  		httpReq.Header = headers
  4505  
  4506  		httpRsp, err := c.httpClient.Do(httpReq)
  4507  		if err != nil {
  4508  			return err
  4509  		}
  4510  		defer httpRsp.Body.Close()
  4511  
  4512  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4513  			return err
  4514  		}
  4515  
  4516  		buf, err := io.ReadAll(httpRsp.Body)
  4517  		if err != nil {
  4518  			return err
  4519  		}
  4520  
  4521  		if err := unm.Unmarshal(buf, resp); err != nil {
  4522  			return err
  4523  		}
  4524  
  4525  		return nil
  4526  	}, opts...)
  4527  	if e != nil {
  4528  		return nil, e
  4529  	}
  4530  	return resp, nil
  4531  }
  4532  
  4533  // ListLocations lists information about the supported locations for this service.
  4534  func (c *restClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
  4535  	it := &LocationIterator{}
  4536  	req = proto.Clone(req).(*locationpb.ListLocationsRequest)
  4537  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4538  	it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
  4539  		resp := &locationpb.ListLocationsResponse{}
  4540  		if pageToken != "" {
  4541  			req.PageToken = pageToken
  4542  		}
  4543  		if pageSize > math.MaxInt32 {
  4544  			req.PageSize = math.MaxInt32
  4545  		} else if pageSize != 0 {
  4546  			req.PageSize = int32(pageSize)
  4547  		}
  4548  		baseUrl, err := url.Parse(c.endpoint)
  4549  		if err != nil {
  4550  			return nil, "", err
  4551  		}
  4552  		baseUrl.Path += fmt.Sprintf("/v1/%v/locations", req.GetName())
  4553  
  4554  		params := url.Values{}
  4555  		params.Add("$alt", "json;enum-encoding=int")
  4556  		if req.GetFilter() != "" {
  4557  			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
  4558  		}
  4559  		if req.GetPageSize() != 0 {
  4560  			params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
  4561  		}
  4562  		if req.GetPageToken() != "" {
  4563  			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
  4564  		}
  4565  
  4566  		baseUrl.RawQuery = params.Encode()
  4567  
  4568  		// Build HTTP headers from client and context metadata.
  4569  		hds := append(c.xGoogHeaders, "Content-Type", "application/json")
  4570  		headers := gax.BuildHeaders(ctx, hds...)
  4571  		e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4572  			if settings.Path != "" {
  4573  				baseUrl.Path = settings.Path
  4574  			}
  4575  			httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4576  			if err != nil {
  4577  				return err
  4578  			}
  4579  			httpReq.Header = headers
  4580  
  4581  			httpRsp, err := c.httpClient.Do(httpReq)
  4582  			if err != nil {
  4583  				return err
  4584  			}
  4585  			defer httpRsp.Body.Close()
  4586  
  4587  			if err = googleapi.CheckResponse(httpRsp); err != nil {
  4588  				return err
  4589  			}
  4590  
  4591  			buf, err := io.ReadAll(httpRsp.Body)
  4592  			if err != nil {
  4593  				return err
  4594  			}
  4595  
  4596  			if err := unm.Unmarshal(buf, resp); err != nil {
  4597  				return err
  4598  			}
  4599  
  4600  			return nil
  4601  		}, opts...)
  4602  		if e != nil {
  4603  			return nil, "", e
  4604  		}
  4605  		it.Response = resp
  4606  		return resp.GetLocations(), resp.GetNextPageToken(), nil
  4607  	}
  4608  
  4609  	fetch := func(pageSize int, pageToken string) (string, error) {
  4610  		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
  4611  		if err != nil {
  4612  			return "", err
  4613  		}
  4614  		it.items = append(it.items, items...)
  4615  		return nextPageToken, nil
  4616  	}
  4617  
  4618  	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
  4619  	it.pageInfo.MaxSize = int(req.GetPageSize())
  4620  	it.pageInfo.Token = req.GetPageToken()
  4621  
  4622  	return it
  4623  }
  4624  
  4625  // GetOperation is a utility method from google.longrunning.Operations.
  4626  func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
  4627  	baseUrl, err := url.Parse(c.endpoint)
  4628  	if err != nil {
  4629  		return nil, err
  4630  	}
  4631  	baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
  4632  
  4633  	params := url.Values{}
  4634  	params.Add("$alt", "json;enum-encoding=int")
  4635  
  4636  	baseUrl.RawQuery = params.Encode()
  4637  
  4638  	// Build HTTP headers from client and context metadata.
  4639  	hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
  4640  
  4641  	hds = append(c.xGoogHeaders, hds...)
  4642  	hds = append(hds, "Content-Type", "application/json")
  4643  	headers := gax.BuildHeaders(ctx, hds...)
  4644  	opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
  4645  	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
  4646  	resp := &longrunningpb.Operation{}
  4647  	e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
  4648  		if settings.Path != "" {
  4649  			baseUrl.Path = settings.Path
  4650  		}
  4651  		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
  4652  		if err != nil {
  4653  			return err
  4654  		}
  4655  		httpReq = httpReq.WithContext(ctx)
  4656  		httpReq.Header = headers
  4657  
  4658  		httpRsp, err := c.httpClient.Do(httpReq)
  4659  		if err != nil {
  4660  			return err
  4661  		}
  4662  		defer httpRsp.Body.Close()
  4663  
  4664  		if err = googleapi.CheckResponse(httpRsp); err != nil {
  4665  			return err
  4666  		}
  4667  
  4668  		buf, err := io.ReadAll(httpRsp.Body)
  4669  		if err != nil {
  4670  			return err
  4671  		}
  4672  
  4673  		if err := unm.Unmarshal(buf, resp); err != nil {
  4674  			return err
  4675  		}
  4676  
  4677  		return nil
  4678  	}, opts...)
  4679  	if e != nil {
  4680  		return nil, e
  4681  	}
  4682  	return resp, nil
  4683  }
  4684  
  4685  // BatchDeleteVersionsOperation returns a new BatchDeleteVersionsOperation from a given name.
  4686  // The name must be that of a previously created BatchDeleteVersionsOperation, possibly from a different process.
  4687  func (c *gRPCClient) BatchDeleteVersionsOperation(name string) *BatchDeleteVersionsOperation {
  4688  	return &BatchDeleteVersionsOperation{
  4689  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4690  	}
  4691  }
  4692  
  4693  // BatchDeleteVersionsOperation returns a new BatchDeleteVersionsOperation from a given name.
  4694  // The name must be that of a previously created BatchDeleteVersionsOperation, possibly from a different process.
  4695  func (c *restClient) BatchDeleteVersionsOperation(name string) *BatchDeleteVersionsOperation {
  4696  	override := fmt.Sprintf("/v1/%s", name)
  4697  	return &BatchDeleteVersionsOperation{
  4698  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4699  		pollPath: override,
  4700  	}
  4701  }
  4702  
  4703  // CreateRepositoryOperation returns a new CreateRepositoryOperation from a given name.
  4704  // The name must be that of a previously created CreateRepositoryOperation, possibly from a different process.
  4705  func (c *gRPCClient) CreateRepositoryOperation(name string) *CreateRepositoryOperation {
  4706  	return &CreateRepositoryOperation{
  4707  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4708  	}
  4709  }
  4710  
  4711  // CreateRepositoryOperation returns a new CreateRepositoryOperation from a given name.
  4712  // The name must be that of a previously created CreateRepositoryOperation, possibly from a different process.
  4713  func (c *restClient) CreateRepositoryOperation(name string) *CreateRepositoryOperation {
  4714  	override := fmt.Sprintf("/v1/%s", name)
  4715  	return &CreateRepositoryOperation{
  4716  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4717  		pollPath: override,
  4718  	}
  4719  }
  4720  
  4721  // DeletePackageOperation returns a new DeletePackageOperation from a given name.
  4722  // The name must be that of a previously created DeletePackageOperation, possibly from a different process.
  4723  func (c *gRPCClient) DeletePackageOperation(name string) *DeletePackageOperation {
  4724  	return &DeletePackageOperation{
  4725  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4726  	}
  4727  }
  4728  
  4729  // DeletePackageOperation returns a new DeletePackageOperation from a given name.
  4730  // The name must be that of a previously created DeletePackageOperation, possibly from a different process.
  4731  func (c *restClient) DeletePackageOperation(name string) *DeletePackageOperation {
  4732  	override := fmt.Sprintf("/v1/%s", name)
  4733  	return &DeletePackageOperation{
  4734  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4735  		pollPath: override,
  4736  	}
  4737  }
  4738  
  4739  // DeleteRepositoryOperation returns a new DeleteRepositoryOperation from a given name.
  4740  // The name must be that of a previously created DeleteRepositoryOperation, possibly from a different process.
  4741  func (c *gRPCClient) DeleteRepositoryOperation(name string) *DeleteRepositoryOperation {
  4742  	return &DeleteRepositoryOperation{
  4743  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4744  	}
  4745  }
  4746  
  4747  // DeleteRepositoryOperation returns a new DeleteRepositoryOperation from a given name.
  4748  // The name must be that of a previously created DeleteRepositoryOperation, possibly from a different process.
  4749  func (c *restClient) DeleteRepositoryOperation(name string) *DeleteRepositoryOperation {
  4750  	override := fmt.Sprintf("/v1/%s", name)
  4751  	return &DeleteRepositoryOperation{
  4752  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4753  		pollPath: override,
  4754  	}
  4755  }
  4756  
  4757  // DeleteVersionOperation returns a new DeleteVersionOperation from a given name.
  4758  // The name must be that of a previously created DeleteVersionOperation, possibly from a different process.
  4759  func (c *gRPCClient) DeleteVersionOperation(name string) *DeleteVersionOperation {
  4760  	return &DeleteVersionOperation{
  4761  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4762  	}
  4763  }
  4764  
  4765  // DeleteVersionOperation returns a new DeleteVersionOperation from a given name.
  4766  // The name must be that of a previously created DeleteVersionOperation, possibly from a different process.
  4767  func (c *restClient) DeleteVersionOperation(name string) *DeleteVersionOperation {
  4768  	override := fmt.Sprintf("/v1/%s", name)
  4769  	return &DeleteVersionOperation{
  4770  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4771  		pollPath: override,
  4772  	}
  4773  }
  4774  
  4775  // ImportAptArtifactsOperation returns a new ImportAptArtifactsOperation from a given name.
  4776  // The name must be that of a previously created ImportAptArtifactsOperation, possibly from a different process.
  4777  func (c *gRPCClient) ImportAptArtifactsOperation(name string) *ImportAptArtifactsOperation {
  4778  	return &ImportAptArtifactsOperation{
  4779  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4780  	}
  4781  }
  4782  
  4783  // ImportAptArtifactsOperation returns a new ImportAptArtifactsOperation from a given name.
  4784  // The name must be that of a previously created ImportAptArtifactsOperation, possibly from a different process.
  4785  func (c *restClient) ImportAptArtifactsOperation(name string) *ImportAptArtifactsOperation {
  4786  	override := fmt.Sprintf("/v1/%s", name)
  4787  	return &ImportAptArtifactsOperation{
  4788  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4789  		pollPath: override,
  4790  	}
  4791  }
  4792  
  4793  // ImportYumArtifactsOperation returns a new ImportYumArtifactsOperation from a given name.
  4794  // The name must be that of a previously created ImportYumArtifactsOperation, possibly from a different process.
  4795  func (c *gRPCClient) ImportYumArtifactsOperation(name string) *ImportYumArtifactsOperation {
  4796  	return &ImportYumArtifactsOperation{
  4797  		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4798  	}
  4799  }
  4800  
  4801  // ImportYumArtifactsOperation returns a new ImportYumArtifactsOperation from a given name.
  4802  // The name must be that of a previously created ImportYumArtifactsOperation, possibly from a different process.
  4803  func (c *restClient) ImportYumArtifactsOperation(name string) *ImportYumArtifactsOperation {
  4804  	override := fmt.Sprintf("/v1/%s", name)
  4805  	return &ImportYumArtifactsOperation{
  4806  		lro:      longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
  4807  		pollPath: override,
  4808  	}
  4809  }
  4810  

View as plain text