Class v1p2beta1.AssetServiceClient (3.22.0)

Asset service definition. v1p2beta1

Package

@google-cloud/asset

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of AssetServiceClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

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

assetServiceStub

assetServiceStub?: 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.

createFeed(request, options)

createFeed(request?: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, options?: CallOptions): Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | undefined, {} | undefined]>;

Creates a feed in a parent project/folder/organization to listen to its asset updates.

Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Feed]. 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 project/folder/organization where this feed
   *  should be created in. It can only be an organization number (such as
   *  "organizations/123"), a folder number (such as "folders/123"), a project ID
   *  (such as "projects/my-project-id")", or a project number (such as
   *  "projects/12345").
   */
  // const parent = 'abc123'
  /**
   *  Required. This is the client-assigned asset feed identifier and it needs to
   *  be unique under a specific parent project/folder/organization.
   */
  // const feedId = 'abc123'
  /**
   *  Required. The feed details. The field `name` must be empty and it will be generated
   *  in the format of:
   *  projects/project_number/feeds/feed_id
   *  folders/folder_number/feeds/feed_id
   *  organizations/organization_number/feeds/feed_id
   */
  // const feed = {}

  // Imports the Asset library
  const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1;

  // Instantiates a client
  const assetClient = new AssetServiceClient();

  async function callCreateFeed() {
    // Construct request
    const request = {
      parent,
      feedId,
      feed,
    };

    // Run request
    const response = await assetClient.createFeed(request);
    console.log(response);
  }

  callCreateFeed();

createFeed(request, options, callback)

createFeed(request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createFeed(request, callback)

createFeed(request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteFeed(request, options)

deleteFeed(request?: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | undefined, {} | undefined]>;

Deletes an asset feed.

Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. 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 feed and it must be in the format of:
   *  projects/project_number/feeds/feed_id
   *  folders/folder_number/feeds/feed_id
   *  organizations/organization_number/feeds/feed_id
   */
  // const name = 'abc123'

  // Imports the Asset library
  const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1;

  // Instantiates a client
  const assetClient = new AssetServiceClient();

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

    // Run request
    const response = await assetClient.deleteFeed(request);
    console.log(response);
  }

  callDeleteFeed();

deleteFeed(request, options, callback)

deleteFeed(request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteFeed(request, callback)

deleteFeed(request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

folderFeedPath(folder, feed)

folderFeedPath(folder: string, feed: string): string;

Return a fully-qualified folderFeed resource name string.

Parameters
NameDescription
folder string
feed string
Returns
TypeDescription
string

{string} Resource name string.

getFeed(request, options)

getFeed(request?: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, options?: CallOptions): Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | undefined, {} | undefined]>;

Gets details about an asset feed.

Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IGetFeedRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Feed]. 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 Feed and it must be in the format of:
   *  projects/project_number/feeds/feed_id
   *  folders/folder_number/feeds/feed_id
   *  organizations/organization_number/feeds/feed_id
   */
  // const name = 'abc123'

  // Imports the Asset library
  const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1;

  // Instantiates a client
  const assetClient = new AssetServiceClient();

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

    // Run request
    const response = await assetClient.getFeed(request);
    console.log(response);
  }

  callGetFeed();

getFeed(request, options, callback)

getFeed(request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IGetFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFeed(request, callback)

getFeed(request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IGetFeedRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IGetFeedRequest | 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

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.

listFeeds(request, options)

listFeeds(request?: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, options?: CallOptions): Promise<[protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | undefined, {} | undefined]>;

Lists all asset feeds in a parent project/folder/organization.

Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IListFeedsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [ListFeedsResponse]. 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 parent project/folder/organization whose feeds are to be
   *  listed. It can only be using project/folder/organization number (such as
   *  "folders/12345")", or a project ID (such as "projects/my-project-id").
   */
  // const parent = 'abc123'

  // Imports the Asset library
  const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1;

  // Instantiates a client
  const assetClient = new AssetServiceClient();

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

    // Run request
    const response = await assetClient.listFeeds(request);
    console.log(response);
  }

  callListFeeds();

listFeeds(request, options, callback)

listFeeds(request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IListFeedsRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

listFeeds(request, callback)

listFeeds(request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, callback: Callback<protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IListFeedsRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

matchFeedFromFolderFeedName(folderFeedName)

matchFeedFromFolderFeedName(folderFeedName: string): string | number;

Parse the feed from FolderFeed resource.

Parameter
NameDescription
folderFeedName string

A fully-qualified path representing folder_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the feed.

matchFeedFromOrganizationFeedName(organizationFeedName)

matchFeedFromOrganizationFeedName(organizationFeedName: string): string | number;

Parse the feed from OrganizationFeed resource.

Parameter
NameDescription
organizationFeedName string

A fully-qualified path representing organization_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the feed.

matchFeedFromProjectFeedName(projectFeedName)

matchFeedFromProjectFeedName(projectFeedName: string): string | number;

Parse the feed from ProjectFeed resource.

Parameter
NameDescription
projectFeedName string

A fully-qualified path representing project_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the feed.

matchFolderFromFolderFeedName(folderFeedName)

matchFolderFromFolderFeedName(folderFeedName: string): string | number;

Parse the folder from FolderFeed resource.

Parameter
NameDescription
folderFeedName string

A fully-qualified path representing folder_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the folder.

matchOrganizationFromOrganizationFeedName(organizationFeedName)

matchOrganizationFromOrganizationFeedName(organizationFeedName: string): string | number;

Parse the organization from OrganizationFeed resource.

Parameter
NameDescription
organizationFeedName string

A fully-qualified path representing organization_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectFromProjectFeedName(projectFeedName)

matchProjectFromProjectFeedName(projectFeedName: string): string | number;

Parse the project from ProjectFeed resource.

Parameter
NameDescription
projectFeedName string

A fully-qualified path representing project_feed resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

organizationFeedPath(organization, feed)

organizationFeedPath(organization: string, feed: string): string;

Return a fully-qualified organizationFeed resource name string.

Parameters
NameDescription
organization string
feed string
Returns
TypeDescription
string

{string} Resource name string.

projectFeedPath(project, feed)

projectFeedPath(project: string, feed: string): string;

Return a fully-qualified projectFeed resource name string.

Parameters
NameDescription
project string
feed string
Returns
TypeDescription
string

{string} Resource name string.

updateFeed(request, options)

updateFeed(request?: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, options?: CallOptions): Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | undefined, {} | undefined]>;

Updates an asset feed configuration.

Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Feed]. 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 new values of feed details. It must match an existing feed and the
   *  field `name` must be in the format of:
   *  projects/project_number/feeds/feed_id or
   *  folders/folder_number/feeds/feed_id or
   *  organizations/organization_number/feeds/feed_id.
   */
  // const feed = {}
  /**
   *  Required. Only updates the `feed` fields indicated by this mask.
   *  The field mask must not be empty, and it must not contain fields that
   *  are immutable or only set by the server.
   */
  // const updateMask = {}

  // Imports the Asset library
  const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1;

  // Instantiates a client
  const assetClient = new AssetServiceClient();

  async function callUpdateFeed() {
    // Construct request
    const request = {
      feed,
      updateMask,
    };

    // Run request
    const response = await assetClient.updateFeed(request);
    console.log(response);
  }

  callUpdateFeed();

updateFeed(request, options, callback)

updateFeed(request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateFeed(request, callback)

updateFeed(request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, callback: Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void