Class v1.ArtifactRegistryClient

The Artifact Registry API service.

Artifact Registry is an artifact management system for storing artifacts from different package management systems.

The resources managed by this API are:

* Repositories, which group packages and their data. * Packages, which group versions and their tags. * Versions, which are specific forms of a package. * Tags, which represent alternative names for versions. * Files, which contain content and are optionally associated with a Package or Version. v1

Package

@google-cloud/artifact-registry

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of ArtifactRegistryClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

artifactRegistryStub

artifactRegistryStub?: Promise<{
        [name: string]: Function;
    }>;

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

dockerImagePath(project, location, repository, dockerImage)

dockerImagePath(project: string, location: string, repository: string, dockerImage: string): string;

Return a fully-qualified dockerImage resource name string.

Parameters
NameDescription
project string
location string
repository string
dockerImage string
Returns
TypeDescription
string

{string} Resource name string.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getRepository(request, options)

getRepository(request?: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, options?: CallOptions): Promise<[
        protos.google.devtools.artifactregistry.v1.IRepository,
        (protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | undefined),
        {} | undefined
    ]>;

Gets a repository.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.devtools.artifactregistry.v1.IRepository, (protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Repository]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the repository to retrieve.
   */
  // const name = 'abc123'

  // Imports the Artifactregistry library
  const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1;

  // Instantiates a client
  const artifactregistryClient = new ArtifactRegistryClient();

  async function callGetRepository() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await artifactregistryClient.getRepository(request);
    console.log(response);
  }

  callGetRepository();

getRepository(request, options, callback)

getRepository(request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, options: CallOptions, callback: Callback<protos.google.devtools.artifactregistry.v1.IRepository, protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest
options CallOptions
callback Callback<protos.google.devtools.artifactregistry.v1.IRepository, protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getRepository(request, callback)

getRepository(request: protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest, callback: Callback<protos.google.devtools.artifactregistry.v1.IRepository, protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest
callback Callback<protos.google.devtools.artifactregistry.v1.IRepository, protos.google.devtools.artifactregistry.v1.IGetRepositoryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listDockerImages(request, options)

listDockerImages(request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, options?: CallOptions): Promise<[
        protos.google.devtools.artifactregistry.v1.IDockerImage[],
        protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest | null,
        protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse
    ]>;

Lists docker images.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.devtools.artifactregistry.v1.IDockerImage[], protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest | null, protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [DockerImage]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listDockerImagesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listDockerImages(request, options, callback)

listDockerImages(request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, options: CallOptions, callback: PaginationCallback<protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IDockerImage>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest
options CallOptions
callback PaginationCallback<protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IDockerImage>
Returns
TypeDescription
void

listDockerImages(request, callback)

listDockerImages(request: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, callback: PaginationCallback<protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IDockerImage>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest
callback PaginationCallback<protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, protos.google.devtools.artifactregistry.v1.IListDockerImagesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IDockerImage>
Returns
TypeDescription
void

listDockerImagesAsync(request, options)

listDockerImagesAsync(request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, options?: CallOptions): AsyncIterable<protos.google.devtools.artifactregistry.v1.IDockerImage>;

Equivalent to listDockerImages, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.devtools.artifactregistry.v1.IDockerImage>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [DockerImage]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the parent resource whose docker images will be listed.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of artifacts to return.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous list request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Artifactregistry library
  const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1;

  // Instantiates a client
  const artifactregistryClient = new ArtifactRegistryClient();

  async function callListDockerImages() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await artifactregistryClient.listDockerImagesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListDockerImages();

listDockerImagesStream(request, options)

listDockerImagesStream(request?: protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListDockerImagesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [DockerImage] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listDockerImagesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listRepositories(request, options)

listRepositories(request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, options?: CallOptions): Promise<[
        protos.google.devtools.artifactregistry.v1.IRepository[],
        protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest | null,
        protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse
    ]>;

Lists repositories.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.devtools.artifactregistry.v1.IRepository[], protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest | null, protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Repository]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listRepositoriesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listRepositories(request, options, callback)

listRepositories(request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, options: CallOptions, callback: PaginationCallback<protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IRepository>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest
options CallOptions
callback PaginationCallback<protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IRepository>
Returns
TypeDescription
void

listRepositories(request, callback)

listRepositories(request: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, callback: PaginationCallback<protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IRepository>): void;
Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest
callback PaginationCallback<protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, protos.google.devtools.artifactregistry.v1.IListRepositoriesResponse | null | undefined, protos.google.devtools.artifactregistry.v1.IRepository>
Returns
TypeDescription
void

listRepositoriesAsync(request, options)

listRepositoriesAsync(request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, options?: CallOptions): AsyncIterable<protos.google.devtools.artifactregistry.v1.IRepository>;

Equivalent to listRepositories, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.devtools.artifactregistry.v1.IRepository>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Repository]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the parent resource whose repositories will be listed.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of repositories to return.
   */
  // const pageSize = 1234
  /**
   *  The next_page_token value returned from a previous list request, if any.
   */
  // const pageToken = 'abc123'

  // Imports the Artifactregistry library
  const {ArtifactRegistryClient} = require('@google-cloud/artifact-registry').v1;

  // Instantiates a client
  const artifactregistryClient = new ArtifactRegistryClient();

  async function callListRepositories() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await artifactregistryClient.listRepositoriesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListRepositories();

listRepositoriesStream(request, options)

listRepositoriesStream(request?: protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.devtools.artifactregistry.v1.IListRepositoriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Repository] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listRepositoriesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

matchDockerImageFromDockerImageName(dockerImageName)

matchDockerImageFromDockerImageName(dockerImageName: string): string | number;

Parse the docker_image from DockerImage resource.

Parameter
NameDescription
dockerImageName string

A fully-qualified path representing DockerImage resource.

Returns
TypeDescription
string | number

{string} A string representing the docker_image.

matchLocationFromDockerImageName(dockerImageName)

matchLocationFromDockerImageName(dockerImageName: string): string | number;

Parse the location from DockerImage resource.

Parameter
NameDescription
dockerImageName string

A fully-qualified path representing DockerImage resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromRepositoryName(repositoryName)

matchLocationFromRepositoryName(repositoryName: string): string | number;

Parse the location from Repository resource.

Parameter
NameDescription
repositoryName string

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromDockerImageName(dockerImageName)

matchProjectFromDockerImageName(dockerImageName: string): string | number;

Parse the project from DockerImage resource.

Parameter
NameDescription
dockerImageName string

A fully-qualified path representing DockerImage resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromRepositoryName(repositoryName)

matchProjectFromRepositoryName(repositoryName: string): string | number;

Parse the project from Repository resource.

Parameter
NameDescription
repositoryName string

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchRepositoryFromDockerImageName(dockerImageName)

matchRepositoryFromDockerImageName(dockerImageName: string): string | number;

Parse the repository from DockerImage resource.

Parameter
NameDescription
dockerImageName string

A fully-qualified path representing DockerImage resource.

Returns
TypeDescription
string | number

{string} A string representing the repository.

matchRepositoryFromRepositoryName(repositoryName)

matchRepositoryFromRepositoryName(repositoryName: string): string | number;

Parse the repository from Repository resource.

Parameter
NameDescription
repositoryName string

A fully-qualified path representing Repository resource.

Returns
TypeDescription
string | number

{string} A string representing the repository.

repositoryPath(project, location, repository)

repositoryPath(project: string, location: string, repository: string): string;

Return a fully-qualified repository resource name string.

Parameters
NameDescription
project string
location string
repository string
Returns
TypeDescription
string

{string} Resource name string.