Class v2.RevisionsClient (0.2.3)

Cloud Run Revision Control Plane API. v2

Package

@google-cloud/run

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of RevisionsClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new RevisionsClient({fallback: 'rest'}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

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

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

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

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

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

port

static get port(): number;

The port for this API service.

revisionsStub

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

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

checkDeleteRevisionProgress(name)

checkDeleteRevisionProgress(name: string): Promise<LROperation<protos.google.cloud.run.v2.Revision, protos.google.cloud.run.v2.Revision>>;

Check the status of the long running operation returned by deleteRevision().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.run.v2.Revision, protos.google.cloud.run.v2.Revision>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Revision to delete.
   *  Format:
   *  projects/{project}/locations/{location}/services/{service}/revisions/{revision}
   */
  // const name = 'abc123'
  /**
   *  Indicates that the request should be validated without actually
   *  deleting any resources.
   */
  // const validateOnly = true
  /**
   *  A system-generated fingerprint for this version of the
   *  resource. This may be used to detect modification conflict during updates.
   */
  // const etag = 'abc123'

  // Imports the Run library
  const {RevisionsClient} = require('@google-cloud/run').v2;

  // Instantiates a client
  const runClient = new RevisionsClient();

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

    // Run request
    const [operation] = await runClient.deleteRevision(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteRevision();

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.

cryptoKeyPath(project, location, keyRing, cryptoKey)

cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;

Return a fully-qualified cryptoKey resource name string.

Parameters
NameDescription
project string
location string
keyRing string
cryptoKey string
Returns
TypeDescription
string

{string} Resource name string.

deleteRevision(request, options)

deleteRevision(request?: protos.google.cloud.run.v2.IDeleteRevisionRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Delete a Revision.

Parameters
NameDescription
request protos.google.cloud.run.v2.IDeleteRevisionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Revision to delete.
   *  Format:
   *  projects/{project}/locations/{location}/services/{service}/revisions/{revision}
   */
  // const name = 'abc123'
  /**
   *  Indicates that the request should be validated without actually
   *  deleting any resources.
   */
  // const validateOnly = true
  /**
   *  A system-generated fingerprint for this version of the
   *  resource. This may be used to detect modification conflict during updates.
   */
  // const etag = 'abc123'

  // Imports the Run library
  const {RevisionsClient} = require('@google-cloud/run').v2;

  // Instantiates a client
  const runClient = new RevisionsClient();

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

    // Run request
    const [operation] = await runClient.deleteRevision(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteRevision();

deleteRevision(request, options, callback)

deleteRevision(request: protos.google.cloud.run.v2.IDeleteRevisionRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IDeleteRevisionRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteRevision(request, callback)

deleteRevision(request: protos.google.cloud.run.v2.IDeleteRevisionRequest, callback: Callback<LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IDeleteRevisionRequest
callback Callback<LROperation<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IRevision>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

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

getRevision(request, options)

getRevision(request?: protos.google.cloud.run.v2.IGetRevisionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.run.v2.IRevision,
        protos.google.cloud.run.v2.IGetRevisionRequest | undefined,
        {} | undefined
    ]>;

Gets information about a Revision.

Parameters
NameDescription
request protos.google.cloud.run.v2.IGetRevisionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IGetRevisionRequest | undefined, {} | undefined ]>

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

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The full name of the Revision.
   *  Format:
   *  projects/{project}/locations/{location}/services/{service}/revisions/{revision}
   */
  // const name = 'abc123'

  // Imports the Run library
  const {RevisionsClient} = require('@google-cloud/run').v2;

  // Instantiates a client
  const runClient = new RevisionsClient();

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

    // Run request
    const response = await runClient.getRevision(request);
    console.log(response);
  }

  callGetRevision();

getRevision(request, options, callback)

getRevision(request: protos.google.cloud.run.v2.IGetRevisionRequest, options: CallOptions, callback: Callback<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IGetRevisionRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IGetRevisionRequest
options CallOptions
callback Callback<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IGetRevisionRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getRevision(request, callback)

getRevision(request: protos.google.cloud.run.v2.IGetRevisionRequest, callback: Callback<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IGetRevisionRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IGetRevisionRequest
callback Callback<protos.google.cloud.run.v2.IRevision, protos.google.cloud.run.v2.IGetRevisionRequest | 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.

listRevisions(request, options)

listRevisions(request?: protos.google.cloud.run.v2.IListRevisionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.run.v2.IRevision[],
        protos.google.cloud.run.v2.IListRevisionsRequest | null,
        protos.google.cloud.run.v2.IListRevisionsResponse
    ]>;

List Revisions from a given Service, or from a given location.

Parameters
NameDescription
request protos.google.cloud.run.v2.IListRevisionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.run.v2.IRevision[], protos.google.cloud.run.v2.IListRevisionsRequest | null, protos.google.cloud.run.v2.IListRevisionsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Revision]. 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 listRevisionsAsync() 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.

listRevisions(request, options, callback)

listRevisions(request: protos.google.cloud.run.v2.IListRevisionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.run.v2.IListRevisionsRequest, protos.google.cloud.run.v2.IListRevisionsResponse | null | undefined, protos.google.cloud.run.v2.IRevision>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IListRevisionsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.run.v2.IListRevisionsRequest, protos.google.cloud.run.v2.IListRevisionsResponse | null | undefined, protos.google.cloud.run.v2.IRevision>
Returns
TypeDescription
void

listRevisions(request, callback)

listRevisions(request: protos.google.cloud.run.v2.IListRevisionsRequest, callback: PaginationCallback<protos.google.cloud.run.v2.IListRevisionsRequest, protos.google.cloud.run.v2.IListRevisionsResponse | null | undefined, protos.google.cloud.run.v2.IRevision>): void;
Parameters
NameDescription
request protos.google.cloud.run.v2.IListRevisionsRequest
callback PaginationCallback<protos.google.cloud.run.v2.IListRevisionsRequest, protos.google.cloud.run.v2.IListRevisionsResponse | null | undefined, protos.google.cloud.run.v2.IRevision>
Returns
TypeDescription
void

listRevisionsAsync(request, options)

listRevisionsAsync(request?: protos.google.cloud.run.v2.IListRevisionsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.run.v2.IRevision>;

Equivalent to listRevisions, 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.cloud.run.v2.IListRevisionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.run.v2.IRevision>

{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 [Revision]. 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

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Service from which the Revisions should be listed.
   *  To list all Revisions across Services, use "-" instead of Service name.
   *  Format:
   *  projects/{project}/locations/{location}/services/{service}
   */
  // const parent = 'abc123'
  /**
   *  Maximum number of revisions to return in this call.
   */
  // const pageSize = 1234
  /**
   *  A page token received from a previous call to ListRevisions.
   *  All other parameters must match.
   */
  // const pageToken = 'abc123'
  /**
   *  If true, returns deleted (but unexpired) resources along with active ones.
   */
  // const showDeleted = true

  // Imports the Run library
  const {RevisionsClient} = require('@google-cloud/run').v2;

  // Instantiates a client
  const runClient = new RevisionsClient();

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

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

  callListRevisions();

listRevisionsStream(request, options)

listRevisionsStream(request?: protos.google.cloud.run.v2.IListRevisionsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.run.v2.IListRevisionsRequest

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 [Revision] 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 listRevisionsAsync() 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.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the crypto_key from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the crypto_key.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key_ring from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the key_ring.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromRevisionName(revisionName)

matchLocationFromRevisionName(revisionName: string): string | number;

Parse the location from Revision resource.

Parameter
NameDescription
revisionName string

A fully-qualified path representing Revision resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromServiceName(serviceName)

matchLocationFromServiceName(serviceName: string): string | number;

Parse the location from Service resource.

Parameter
NameDescription
serviceName string

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromRevisionName(revisionName)

matchProjectFromRevisionName(revisionName: string): string | number;

Parse the project from Revision resource.

Parameter
NameDescription
revisionName string

A fully-qualified path representing Revision resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromServiceName(serviceName)

matchProjectFromServiceName(serviceName: string): string | number;

Parse the project from Service resource.

Parameter
NameDescription
serviceName string

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchRevisionFromRevisionName(revisionName)

matchRevisionFromRevisionName(revisionName: string): string | number;

Parse the revision from Revision resource.

Parameter
NameDescription
revisionName string

A fully-qualified path representing Revision resource.

Returns
TypeDescription
string | number

{string} A string representing the revision.

matchServiceFromRevisionName(revisionName)

matchServiceFromRevisionName(revisionName: string): string | number;

Parse the service from Revision resource.

Parameter
NameDescription
revisionName string

A fully-qualified path representing Revision resource.

Returns
TypeDescription
string | number

{string} A string representing the service.

matchServiceFromServiceName(serviceName)

matchServiceFromServiceName(serviceName: string): string | number;

Parse the service from Service resource.

Parameter
NameDescription
serviceName string

A fully-qualified path representing Service resource.

Returns
TypeDescription
string | number

{string} A string representing the service.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

revisionPath(project, location, service, revision)

revisionPath(project: string, location: string, service: string, revision: string): string;

Return a fully-qualified revision resource name string.

Parameters
NameDescription
project string
location string
service string
revision string
Returns
TypeDescription
string

{string} Resource name string.

servicePath(project, location, service)

servicePath(project: string, location: string, service: string): string;

Return a fully-qualified service resource name string.

Parameters
NameDescription
project string
location string
service string
Returns
TypeDescription
string

{string} Resource name string.