Class v1p2beta1.AssetServiceClient (5.5.0)

Asset service definition. v1p2beta1

Package

@google-cloud/asset

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of AssetServiceClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof 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 AssetServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

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.

universeDomain

get universeDomain(): string;

warn

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

Methods

accessLevelPath(accessPolicy, accessLevel)

accessLevelPath(accessPolicy: string, accessLevel: string): string;

Return a fully-qualified accessLevel resource name string.

Parameters
NameDescription
accessPolicy string
accessLevel string
Returns
TypeDescription
string

{string} Resource name string.

accessPolicyPath(accessPolicy)

accessPolicyPath(accessPolicy: string): string;

Return a fully-qualified accessPolicy resource name string.

Parameter
NameDescription
accessPolicy string
Returns
TypeDescription
string

{string} Resource name string.

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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 IListFeedsRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, protos.google.cloud.asset.v1p2beta1.IListFeedsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

matchAccessLevelFromAccessLevelName(accessLevelName)

matchAccessLevelFromAccessLevelName(accessLevelName: string): string | number;

Parse the access_level from AccessLevel resource.

Parameter
NameDescription
accessLevelName string

A fully-qualified path representing AccessLevel resource.

Returns
TypeDescription
string | number

{string} A string representing the access_level.

matchAccessPolicyFromAccessLevelName(accessLevelName)

matchAccessPolicyFromAccessLevelName(accessLevelName: string): string | number;

Parse the access_policy from AccessLevel resource.

Parameter
NameDescription
accessLevelName string

A fully-qualified path representing AccessLevel resource.

Returns
TypeDescription
string | number

{string} A string representing the access_policy.

matchAccessPolicyFromAccessPolicyName(accessPolicyName)

matchAccessPolicyFromAccessPolicyName(accessPolicyName: string): string | number;

Parse the access_policy from AccessPolicy resource.

Parameter
NameDescription
accessPolicyName string

A fully-qualified path representing AccessPolicy resource.

Returns
TypeDescription
string | number

{string} A string representing the access_policy.

matchAccessPolicyFromServicePerimeterName(servicePerimeterName)

matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string): string | number;

Parse the access_policy from ServicePerimeter resource.

Parameter
NameDescription
servicePerimeterName string

A fully-qualified path representing ServicePerimeter resource.

Returns
TypeDescription
string | number

{string} A string representing the access_policy.

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.

matchServicePerimeterFromServicePerimeterName(servicePerimeterName)

matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string): string | number;

Parse the service_perimeter from ServicePerimeter resource.

Parameter
NameDescription
servicePerimeterName string

A fully-qualified path representing ServicePerimeter resource.

Returns
TypeDescription
string | number

{string} A string representing the service_perimeter.

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.

servicePerimeterPath(accessPolicy, servicePerimeter)

servicePerimeterPath(accessPolicy: string, servicePerimeter: string): string;

Return a fully-qualified servicePerimeter resource name string.

Parameters
NameDescription
accessPolicy string
servicePerimeter 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 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 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 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 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 IUpdateFeedRequest
callback Callback<protos.google.cloud.asset.v1p2beta1.IFeed, protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void