Class v1.AssetServiceClient (5.5.0)

Asset service definition. v1

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;
    };

operationsClient

operationsClient: gax.OperationsClient;

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.

analyzeIamPolicy(request, options)

analyzeIamPolicy(request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse,
        protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | undefined,
        {} | undefined
    ]>;

Analyzes IAM policies to answer which identities have what accesses on which resources.

Parameters
NameDescription
request IAnalyzeIamPolicyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 request query.
   */
  // const analysisQuery = {}
  /**
   *  Optional. The name of a saved query, which must be in the format of:
   *  * projects/project_number/savedQueries/saved_query_id
   *  * folders/folder_number/savedQueries/saved_query_id
   *  * organizations/organization_number/savedQueries/saved_query_id
   *  If both `analysis_query` and `saved_analysis_query` are provided, they
   *  will be merged together with the `saved_analysis_query` as base and
   *  the `analysis_query` as overrides. For more details of the merge behavior,
   *  refer to the
   *  MergeFrom (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
   *  page.
   *  Note that you cannot override primitive fields with default value, such as
   *  0 or empty string, etc., because we use proto3, which doesn't support field
   *  presence yet.
   */
  // const savedAnalysisQuery = 'abc123'
  /**
   *  Optional. Amount of time executable has to complete.  See JSON
   *  representation of
   *  Duration (https://developers.google.com/protocol-buffers/docs/proto3#json).
   *  If this field is set with a value less than the RPC deadline, and the
   *  execution of your query hasn't finished in the specified
   *  execution timeout,  you will get a response with partial result.
   *  Otherwise, your query's execution will continue until the RPC deadline.
   *  If it's not finished until then, you will get a  DEADLINE_EXCEEDED error.
   *  Default is empty.
   */
  // const executionTimeout = {}

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

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

  async function callAnalyzeIamPolicy() {
    // Construct request
    const request = {
      analysisQuery,
    };

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

  callAnalyzeIamPolicy();

analyzeIamPolicy(request, options, callback)

analyzeIamPolicy(request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeIamPolicyRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeIamPolicy(request, callback)

analyzeIamPolicy(request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, callback: Callback<protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeIamPolicyRequest
callback Callback<protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeIamPolicyLongrunning(request, options)

analyzeIamPolicyLongrunning(request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a . This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.

Parameters
NameDescription
request IAnalyzeIamPolicyLongrunningRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>, 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 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 request query.
   */
  // const analysisQuery = {}
  /**
   *  Optional. The name of a saved query, which must be in the format of:
   *  * projects/project_number/savedQueries/saved_query_id
   *  * folders/folder_number/savedQueries/saved_query_id
   *  * organizations/organization_number/savedQueries/saved_query_id
   *  If both `analysis_query` and `saved_analysis_query` are provided, they
   *  will be merged together with the `saved_analysis_query` as base and
   *  the `analysis_query` as overrides. For more details of the merge behavior,
   *  refer to the
   *  MergeFrom (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
   *  doc.
   *  Note that you cannot override primitive fields with default value, such as
   *  0 or empty string, etc., because we use proto3, which doesn't support field
   *  presence yet.
   */
  // const savedAnalysisQuery = 'abc123'
  /**
   *  Required. Output configuration indicating where the results will be output
   *  to.
   */
  // const outputConfig = {}

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

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

  async function callAnalyzeIamPolicyLongrunning() {
    // Construct request
    const request = {
      analysisQuery,
      outputConfig,
    };

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

  callAnalyzeIamPolicyLongrunning();

analyzeIamPolicyLongrunning(request, options, callback)

analyzeIamPolicyLongrunning(request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeIamPolicyLongrunningRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeIamPolicyLongrunning(request, callback)

analyzeIamPolicyLongrunning(request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, callback: Callback<LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeIamPolicyLongrunningRequest
callback Callback<LROperation<protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeMove(request, options)

analyzeMove(request?: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IAnalyzeMoveResponse,
        protos.google.cloud.asset.v1.IAnalyzeMoveRequest | undefined,
        {} | undefined
    ]>;

Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.

Parameters
NameDescription
request IAnalyzeMoveRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IAnalyzeMoveResponse, protos.google.cloud.asset.v1.IAnalyzeMoveRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyzeMoveResponse. 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. Name of the resource to perform the analysis against.
   *  Only Google Cloud projects are supported as of today. Hence, this can only
   *  be a project ID (such as "projects/my-project-id") or a project number
   *  (such as "projects/12345").
   */
  // const resource = 'abc123'
  /**
   *  Required. Name of the Google Cloud folder or organization to reparent the
   *  target resource. The analysis will be performed against hypothetically
   *  moving the resource to this specified desitination parent. This can only be
   *  a folder number (such as "folders/123") or an organization number (such as
   *  "organizations/123").
   */
  // const destinationParent = 'abc123'
  /**
   *  Analysis view indicating what information should be included in the
   *  analysis response. If unspecified, the default view is FULL.
   */
  // const view = {}

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

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

  async function callAnalyzeMove() {
    // Construct request
    const request = {
      resource,
      destinationParent,
    };

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

  callAnalyzeMove();

analyzeMove(request, options, callback)

analyzeMove(request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IAnalyzeMoveResponse, protos.google.cloud.asset.v1.IAnalyzeMoveRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeMoveRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IAnalyzeMoveResponse, protos.google.cloud.asset.v1.IAnalyzeMoveRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeMove(request, callback)

analyzeMove(request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, callback: Callback<protos.google.cloud.asset.v1.IAnalyzeMoveResponse, protos.google.cloud.asset.v1.IAnalyzeMoveRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IAnalyzeMoveRequest
callback Callback<protos.google.cloud.asset.v1.IAnalyzeMoveResponse, protos.google.cloud.asset.v1.IAnalyzeMoveRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

analyzeOrgPolicies(request, options)

analyzeOrgPolicies(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult[],
        protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest | null,
        protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse
    ]>;

Analyzes organization policies under a scope.

Parameters
NameDescription
request IAnalyzeOrgPoliciesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult[], protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest | null, protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 analyzeOrgPoliciesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

analyzeOrgPolicies(request, options, callback)

analyzeOrgPolicies(request: protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>): void;
Parameters
NameDescription
request IAnalyzeOrgPoliciesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>
Returns
TypeDescription
void

analyzeOrgPolicies(request, callback)

analyzeOrgPolicies(request: protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>): void;
Parameters
NameDescription
request IAnalyzeOrgPoliciesRequest
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>
Returns
TypeDescription
void

analyzeOrgPoliciesAsync(request, options)

analyzeOrgPoliciesAsync(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>;

Equivalent to analyzeOrgPolicies, but returns an iterable object.

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

Parameters
NameDescription
request IAnalyzeOrgPoliciesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.IOrgPolicyResult>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 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 organization to scope the request. Only organization
   *  policies within the scope will be analyzed.
   *  * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
   */
  // const scope = 'abc123'
  /**
   *  Required. The name of the constraint to analyze organization policies for.
   *  The response only contains analyzed organization policies for the provided
   *  constraint.
   */
  // const constraint = 'abc123'
  /**
   *  The expression to filter
   *  AnalyzeOrgPoliciesResponse.org_policy_results google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results.
   *  Filtering is currently available for bare literal values and the following
   *  fields:
   *  * consolidated_policy.attached_resource
   *  * consolidated_policy.rules.enforce
   *  When filtering by a specific field, the only supported operator is `=`.
   *  For example, filtering by
   *  consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001"
   *  will return all the Organization Policy results attached to "folders/001".
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of items to return per page. If unspecified,
   *  AnalyzeOrgPoliciesResponse.org_policy_results google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results 
   *  will contain 20 items with a maximum of 200.
   */
  // const pageSize = 1234
  /**
   *  The pagination token to retrieve the next page.
   */
  // const pageToken = 'abc123'

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

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

  async function callAnalyzeOrgPolicies() {
    // Construct request
    const request = {
      scope,
      constraint,
    };

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

  callAnalyzeOrgPolicies();

analyzeOrgPoliciesStream(request, options)

analyzeOrgPoliciesStream(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPoliciesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IAnalyzeOrgPoliciesRequest

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 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 analyzeOrgPoliciesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

analyzeOrgPolicyGovernedAssets(request, options)

analyzeOrgPolicyGovernedAssets(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset[],
        protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest | null,
        protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse
    ]>;

Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints:

* constraints/ainotebooks.accessMode * constraints/ainotebooks.disableFileDownloads * constraints/ainotebooks.disableRootAccess * constraints/ainotebooks.disableTerminal * constraints/ainotebooks.environmentOptions * constraints/ainotebooks.requireAutoUpgradeSchedule * constraints/ainotebooks.restrictVpcNetworks * constraints/compute.disableGuestAttributesAccess * constraints/compute.disableInstanceDataAccessApis * constraints/compute.disableNestedVirtualization * constraints/compute.disableSerialPortAccess * constraints/compute.disableSerialPortLogging * constraints/compute.disableVpcExternalIpv6 * constraints/compute.requireOsLogin * constraints/compute.requireShieldedVm * constraints/compute.restrictLoadBalancerCreationForTypes * constraints/compute.restrictProtocolForwardingCreationForTypes * constraints/compute.restrictXpnProjectLienRemoval * constraints/compute.setNewProjectDefaultToZonalDNSOnly * constraints/compute.skipDefaultNetworkCreation * constraints/compute.trustedImageProjects * constraints/compute.vmCanIpForward * constraints/compute.vmExternalIpAccess * constraints/gcp.detailedAuditLoggingMode * constraints/gcp.resourceLocations * constraints/iam.allowedPolicyMemberDomains * constraints/iam.automaticIamGrantsForDefaultServiceAccounts * constraints/iam.disableServiceAccountCreation * constraints/iam.disableServiceAccountKeyCreation * constraints/iam.disableServiceAccountKeyUpload * constraints/iam.restrictCrossProjectServiceAccountLienRemoval * constraints/iam.serviceAccountKeyExpiryHours * constraints/resourcemanager.accessBoundaries * constraints/resourcemanager.allowedExportDestinations * constraints/sql.restrictAuthorizedNetworks * constraints/sql.restrictNoncompliantDiagnosticDataAccess * constraints/sql.restrictNoncompliantResourceCreation * constraints/sql.restrictPublicIp * constraints/storage.publicAccessPrevention * constraints/storage.restrictAuthTypes * constraints/storage.uniformBucketLevelAccess

This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset[], protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest | null, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 analyzeOrgPolicyGovernedAssetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

analyzeOrgPolicyGovernedAssets(request, options, callback)

analyzeOrgPolicyGovernedAssets(request: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>): void;
Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedAssetsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>
Returns
TypeDescription
void

analyzeOrgPolicyGovernedAssets(request, callback)

analyzeOrgPolicyGovernedAssets(request: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>): void;
Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedAssetsRequest
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>
Returns
TypeDescription
void

analyzeOrgPolicyGovernedAssetsAsync(request, options)

analyzeOrgPolicyGovernedAssetsAsync(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>;

Equivalent to analyzeOrgPolicyGovernedAssets, but returns an iterable object.

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

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.IGovernedAsset>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 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 organization to scope the request. Only organization
   *  policies within the scope will be analyzed. The output assets will
   *  also be limited to the ones governed by those in-scope organization
   *  policies.
   *  * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
   */
  // const scope = 'abc123'
  /**
   *  Required. The name of the constraint to analyze governed assets for. The
   *  analysis only contains analyzed organization policies for the provided
   *  constraint.
   */
  // const constraint = 'abc123'
  /**
   *  The expression to filter
   *  AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets.
   *  For governed resources, filtering is currently available for bare literal
   *  values and the following fields:
   *  * governed_resource.project
   *  * governed_resource.folders
   *  * consolidated_policy.rules.enforce
   *  When filtering by `governed_resource.project` or
   *  `consolidated_policy.rules.enforce`, the only supported operator is `=`.
   *  When filtering by `governed_resource.folders`, the supported operators
   *  are `=` and `:`.
   *  For example, filtering by `governed_resource.project="projects/12345678"`
   *  will return all the governed resources under "projects/12345678",
   *  including the project itself if applicable.
   *  For governed IAM policies, filtering is currently available for bare
   *  literal values and the following fields:
   *  * governed_iam_policy.project
   *  * governed_iam_policy.folders
   *  * consolidated_policy.rules.enforce
   *  When filtering by `governed_iam_policy.project` or
   *  `consolidated_policy.rules.enforce`, the only supported operator is `=`.
   *  When filtering by `governed_iam_policy.folders`, the supported operators
   *  are `=` and `:`.
   *  For example, filtering by `governed_iam_policy.folders:"folders/12345678"`
   *  will return all the governed IAM policies under "folders/001".
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of items to return per page. If unspecified,
   *  AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets 
   *  will contain 100 items with a maximum of 200.
   */
  // const pageSize = 1234
  /**
   *  The pagination token to retrieve the next page.
   */
  // const pageToken = 'abc123'

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

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

  async function callAnalyzeOrgPolicyGovernedAssets() {
    // Construct request
    const request = {
      scope,
      constraint,
    };

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

  callAnalyzeOrgPolicyGovernedAssets();

analyzeOrgPolicyGovernedAssetsStream(request, options)

analyzeOrgPolicyGovernedAssetsStream(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedAssetsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedAssetsRequest

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 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 analyzeOrgPolicyGovernedAssetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

analyzeOrgPolicyGovernedContainers(request, options)

analyzeOrgPolicyGovernedContainers(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer[],
        protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest | null,
        protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse
    ]>;

Analyzes organization policies governed containers (projects, folders or organization) under a scope.

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedContainersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer[], protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest | null, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 analyzeOrgPolicyGovernedContainersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

analyzeOrgPolicyGovernedContainers(request, options, callback)

analyzeOrgPolicyGovernedContainers(request: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>): void;
Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedContainersRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>
Returns
TypeDescription
void

analyzeOrgPolicyGovernedContainers(request, callback)

analyzeOrgPolicyGovernedContainers(request: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>): void;
Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedContainersRequest
callback PaginationCallback<protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersResponse | null | undefined, protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>
Returns
TypeDescription
void

analyzeOrgPolicyGovernedContainersAsync(request, options)

analyzeOrgPolicyGovernedContainersAsync(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>;

Equivalent to analyzeOrgPolicyGovernedContainers, but returns an iterable object.

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

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedContainersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.IGovernedContainer>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 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 organization to scope the request. Only organization
   *  policies within the scope will be analyzed. The output containers will
   *  also be limited to the ones governed by those in-scope organization
   *  policies.
   *  * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
   */
  // const scope = 'abc123'
  /**
   *  Required. The name of the constraint to analyze governed containers for.
   *  The analysis only contains organization policies for the provided
   *  constraint.
   */
  // const constraint = 'abc123'
  /**
   *  The expression to filter
   *  AnalyzeOrgPolicyGovernedContainersResponse.governed_containers google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers.
   *  Filtering is currently available for bare literal values and the following
   *  fields:
   *  * parent
   *  * consolidated_policy.rules.enforce
   *  When filtering by a specific field, the only supported operator is `=`.
   *  For example, filtering by
   *  parent="//cloudresourcemanager.googleapis.com/folders/001"
   *  will return all the containers under "folders/001".
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of items to return per page. If unspecified,
   *  AnalyzeOrgPolicyGovernedContainersResponse.governed_containers google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers 
   *  will contain 100 items with a maximum of 200.
   */
  // const pageSize = 1234
  /**
   *  The pagination token to retrieve the next page.
   */
  // const pageToken = 'abc123'

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

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

  async function callAnalyzeOrgPolicyGovernedContainers() {
    // Construct request
    const request = {
      scope,
      constraint,
    };

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

  callAnalyzeOrgPolicyGovernedContainers();

analyzeOrgPolicyGovernedContainersStream(request, options)

analyzeOrgPolicyGovernedContainersStream(request?: protos.google.cloud.asset.v1.IAnalyzeOrgPolicyGovernedContainersRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IAnalyzeOrgPolicyGovernedContainersRequest

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 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 analyzeOrgPolicyGovernedContainersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

batchGetAssetsHistory(request, options)

batchGetAssetsHistory(request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse,
        protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | undefined,
        {} | undefined
    ]>;

Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.

Parameters
NameDescription
request IBatchGetAssetsHistoryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchGetAssetsHistoryResponse. 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 relative name of the root asset. It can only be an
   *  organization number (such as "organizations/123"), a project ID (such as
   *  "projects/my-project-id")", or a project number (such as "projects/12345").
   */
  // const parent = 'abc123'
  /**
   *  A list of the full names of the assets.
   *  See: https://cloud.google.com/asset-inventory/docs/resource-name-format
   *  Example:
   *  `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
   *  The request becomes a no-op if the asset name list is empty, and the max
   *  size of the asset name list is 100 in one request.
   */
  // const assetNames = ['abc','def']
  /**
   *  Optional. The content type.
   */
  // const contentType = {}
  /**
   *  Optional. The time window for the asset history. Both start_time and
   *  end_time are optional and if set, it must be after the current time minus
   *  35 days. If end_time is not set, it is default to current timestamp.
   *  If start_time is not set, the snapshot of the assets at end_time will be
   *  returned. The returned results contain all temporal assets whose time
   *  window overlap with read_time_window.
   */
  // const readTimeWindow = {}
  /**
   *  Optional. A list of relationship types to output, for example:
   *  `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
   *  content_type=RELATIONSHIP.
   *  * If specified:
   *  it outputs specified relationships' history on the asset_names. It
   *  returns an error if any of the relationship_types  doesn't belong to the
   *  supported relationship types of the asset_names  or if any of the
   *  asset_names's types doesn't belong to the source types of the
   *  relationship_types.
   *  * Otherwise:
   *  it outputs the supported relationships' history on the asset_names  or
   *  returns an error if any of the asset_names's types has no relationship
   *  support.
   *  See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all
   *  supported asset types and relationship types.
   */
  // const relationshipTypes = ['abc','def']

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

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

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

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

  callBatchGetAssetsHistory();

batchGetAssetsHistory(request, options, callback)

batchGetAssetsHistory(request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchGetAssetsHistoryRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchGetAssetsHistory(request, callback)

batchGetAssetsHistory(request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, callback: Callback<protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchGetAssetsHistoryRequest
callback Callback<protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchGetEffectiveIamPolicies(request, options)

batchGetEffectiveIamPolicies(request?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse,
        (protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | undefined),
        {} | undefined
    ]>;

Gets effective IAM policies for a batch of resources.

Parameters
NameDescription
request IBatchGetEffectiveIamPoliciesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, (protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. Only IAM policies on or below the scope will be returned.
   *  This 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").
   *  To know how to get organization id, visit here
   *   (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
   *  To know how to get folder or project id, visit here
   *   (https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
   */
  // const scope = 'abc123'
  /**
   *  Required. The names refer to the full_resource_names 
   *  (https://cloud.google.com/asset-inventory/docs/resource-name-format)
   *  of the asset types supported by search
   *  APIs (https://cloud.google.com/asset-inventory/docs/supported-asset-types).
   *  A maximum of 20 resources' effective policies can be retrieved in a batch.
   */
  // const names = ['abc','def']

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

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

  async function callBatchGetEffectiveIamPolicies() {
    // Construct request
    const request = {
      scope,
      names,
    };

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

  callBatchGetEffectiveIamPolicies();

batchGetEffectiveIamPolicies(request, options, callback)

batchGetEffectiveIamPolicies(request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchGetEffectiveIamPoliciesRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchGetEffectiveIamPolicies(request, callback)

batchGetEffectiveIamPolicies(request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, callback: Callback<protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchGetEffectiveIamPoliciesRequest
callback Callback<protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
NameDescription
request CancelOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkAnalyzeIamPolicyLongrunningProgress(name)

checkAnalyzeIamPolicyLongrunningProgress(name: string): Promise<LROperation<protos.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse, protos.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata>>

{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 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 request query.
   */
  // const analysisQuery = {}
  /**
   *  Optional. The name of a saved query, which must be in the format of:
   *  * projects/project_number/savedQueries/saved_query_id
   *  * folders/folder_number/savedQueries/saved_query_id
   *  * organizations/organization_number/savedQueries/saved_query_id
   *  If both `analysis_query` and `saved_analysis_query` are provided, they
   *  will be merged together with the `saved_analysis_query` as base and
   *  the `analysis_query` as overrides. For more details of the merge behavior,
   *  refer to the
   *  MergeFrom (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
   *  doc.
   *  Note that you cannot override primitive fields with default value, such as
   *  0 or empty string, etc., because we use proto3, which doesn't support field
   *  presence yet.
   */
  // const savedAnalysisQuery = 'abc123'
  /**
   *  Required. Output configuration indicating where the results will be output
   *  to.
   */
  // const outputConfig = {}

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

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

  async function callAnalyzeIamPolicyLongrunning() {
    // Construct request
    const request = {
      analysisQuery,
      outputConfig,
    };

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

  callAnalyzeIamPolicyLongrunning();

checkExportAssetsProgress(name)

checkExportAssetsProgress(name: string): Promise<LROperation<protos.google.cloud.asset.v1.ExportAssetsResponse, protos.google.cloud.asset.v1.ExportAssetsRequest>>;

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

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.asset.v1.ExportAssetsResponse, protos.google.cloud.asset.v1.ExportAssetsRequest>>

{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 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 relative name of the root asset. This can only be an
   *  organization number (such as "organizations/123"), a project ID (such as
   *  "projects/my-project-id"), or a project number (such as "projects/12345"),
   *  or a folder number (such as "folders/123").
   */
  // const parent = 'abc123'
  /**
   *  Timestamp to take an asset snapshot. This can only be set to a timestamp
   *  between the current time and the current time minus 35 days (inclusive).
   *  If not specified, the current time will be used. Due to delays in resource
   *  data collection and indexing, there is a volatile window during which
   *  running the same query may get different results.
   */
  // const readTime = {}
  /**
   *  A list of asset types to take a snapshot for. For example:
   *  "compute.googleapis.com/Disk".
   *  Regular expressions are also supported. For example:
   *  * "compute.googleapis.com.*" snapshots resources whose asset type starts
   *  with "compute.googleapis.com".
   *  * ".*Instance" snapshots resources whose asset type ends with "Instance".
   *  * ".*Instance.*" snapshots resources whose asset type contains "Instance".
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported asset type, an INVALID_ARGUMENT error will be returned.
   *  If specified, only matching assets will be returned, otherwise, it will
   *  snapshot all asset types. See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview)
   *  for all supported asset types.
   */
  // const assetTypes = ['abc','def']
  /**
   *  Asset content type. If not specified, no content but the asset name will be
   *  returned.
   */
  // const contentType = {}
  /**
   *  Required. Output configuration indicating where the results will be output
   *  to.
   */
  // const outputConfig = {}
  /**
   *  A list of relationship types to export, for example:
   *  `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
   *  content_type=RELATIONSHIP.
   *  * If specified:
   *  it snapshots specified relationships. It returns an error if
   *  any of the relationship_types  doesn't belong to the supported
   *  relationship types of the asset_types  or if any of the asset_types 
   *  doesn't belong to the source types of the relationship_types.
   *  * Otherwise:
   *  it snapshots the supported relationships for all asset_types  or returns
   *  an error if any of the asset_types  has no relationship support.
   *  An unspecified asset types field means all supported asset_types.
   *  See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all
   *  supported asset types and relationship types.
   */
  // const relationshipTypes = ['abc','def']

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

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

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

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

  callExportAssets();

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.v1.ICreateFeedRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IFeed,
        protos.google.cloud.asset.v1.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.v1.IFeed, protos.google.cloud.asset.v1.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').v1;

  // 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.v1.ICreateFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.ICreateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.ICreateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createFeed(request, callback)

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

createSavedQuery(request, options)

createSavedQuery(request?: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.ISavedQuery,
        protos.google.cloud.asset.v1.ICreateSavedQueryRequest | undefined,
        {} | undefined
    ]>;

Creates a saved query in a parent project/folder/organization.

Parameters
NameDescription
request ICreateSavedQueryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.ICreateSavedQueryRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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
   *  saved_query 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. The saved_query details. The `name` field must be empty as it
   *  will be generated based on the parent and saved_query_id.
   */
  // const savedQuery = {}
  /**
   *  Required. The ID to use for the saved query, which must be unique in the
   *  specified parent. It will become the final component of the saved query's
   *  resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are `[a-z][0-9]-`.
   *  Notice that this field is required in the saved query creation, and the
   *  `name` field of the `saved_query` will be ignored.
   */
  // const savedQueryId = 'abc123'

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

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

  async function callCreateSavedQuery() {
    // Construct request
    const request = {
      parent,
      savedQuery,
      savedQueryId,
    };

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

  callCreateSavedQuery();

createSavedQuery(request, options, callback)

createSavedQuery(request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.ICreateSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateSavedQueryRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.ICreateSavedQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createSavedQuery(request, callback)

createSavedQuery(request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.ICreateSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateSavedQueryRequest
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.ICreateSavedQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteFeed(request, options)

deleteFeed(request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.asset.v1.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.v1.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').v1;

  // 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.v1.IDeleteFeedRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1.IDeleteFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteFeedRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1.IDeleteFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteFeed(request, callback)

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

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
NameDescription
request DeleteOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

deleteSavedQuery(request, options)

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

Deletes a saved query.

Parameters
NameDescription
request IDeleteSavedQueryRequest

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.v1.IDeleteSavedQueryRequest | 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 saved query to delete. It must be in the format
   *  of:
   *  * projects/project_number/savedQueries/saved_query_id
   *  * folders/folder_number/savedQueries/saved_query_id
   *  * organizations/organization_number/savedQueries/saved_query_id
   */
  // const name = 'abc123'

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

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

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

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

  callDeleteSavedQuery();

deleteSavedQuery(request, options, callback)

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

deleteSavedQuery(request, callback)

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

exportAssets(request, options)

exportAssets(request?: protos.google.cloud.asset.v1.IExportAssetsRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a google.cloud.asset.v1.Asset in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the google.longrunning.Operation API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.

Parameters
NameDescription
request IExportAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>, 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 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 relative name of the root asset. This can only be an
   *  organization number (such as "organizations/123"), a project ID (such as
   *  "projects/my-project-id"), or a project number (such as "projects/12345"),
   *  or a folder number (such as "folders/123").
   */
  // const parent = 'abc123'
  /**
   *  Timestamp to take an asset snapshot. This can only be set to a timestamp
   *  between the current time and the current time minus 35 days (inclusive).
   *  If not specified, the current time will be used. Due to delays in resource
   *  data collection and indexing, there is a volatile window during which
   *  running the same query may get different results.
   */
  // const readTime = {}
  /**
   *  A list of asset types to take a snapshot for. For example:
   *  "compute.googleapis.com/Disk".
   *  Regular expressions are also supported. For example:
   *  * "compute.googleapis.com.*" snapshots resources whose asset type starts
   *  with "compute.googleapis.com".
   *  * ".*Instance" snapshots resources whose asset type ends with "Instance".
   *  * ".*Instance.*" snapshots resources whose asset type contains "Instance".
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported asset type, an INVALID_ARGUMENT error will be returned.
   *  If specified, only matching assets will be returned, otherwise, it will
   *  snapshot all asset types. See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview)
   *  for all supported asset types.
   */
  // const assetTypes = ['abc','def']
  /**
   *  Asset content type. If not specified, no content but the asset name will be
   *  returned.
   */
  // const contentType = {}
  /**
   *  Required. Output configuration indicating where the results will be output
   *  to.
   */
  // const outputConfig = {}
  /**
   *  A list of relationship types to export, for example:
   *  `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
   *  content_type=RELATIONSHIP.
   *  * If specified:
   *  it snapshots specified relationships. It returns an error if
   *  any of the relationship_types  doesn't belong to the supported
   *  relationship types of the asset_types  or if any of the asset_types 
   *  doesn't belong to the source types of the relationship_types.
   *  * Otherwise:
   *  it snapshots the supported relationships for all asset_types  or returns
   *  an error if any of the asset_types  has no relationship support.
   *  An unspecified asset types field means all supported asset_types.
   *  See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all
   *  supported asset types and relationship types.
   */
  // const relationshipTypes = ['abc','def']

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

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

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

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

  callExportAssets();

exportAssets(request, options, callback)

exportAssets(request: protos.google.cloud.asset.v1.IExportAssetsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IExportAssetsRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

exportAssets(request, callback)

exportAssets(request: protos.google.cloud.asset.v1.IExportAssetsRequest, callback: Callback<LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IExportAssetsRequest
callback Callback<LROperation<protos.google.cloud.asset.v1.IExportAssetsResponse, protos.google.cloud.asset.v1.IExportAssetsRequest>, protos.google.longrunning.IOperation | 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.

folderSavedQueryPath(folder, savedQuery)

folderSavedQueryPath(folder: string, savedQuery: string): string;

Return a fully-qualified folderSavedQuery resource name string.

Parameters
NameDescription
folder string
savedQuery string
Returns
TypeDescription
string

{string} Resource name string.

getFeed(request, options)

getFeed(request?: protos.google.cloud.asset.v1.IGetFeedRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IFeed,
        protos.google.cloud.asset.v1.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.v1.IFeed, protos.google.cloud.asset.v1.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').v1;

  // 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.v1.IGetFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.IGetFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.IGetFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFeed(request, callback)

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

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
NameDescription
request GetOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

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

getSavedQuery(request, options)

getSavedQuery(request?: protos.google.cloud.asset.v1.IGetSavedQueryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.ISavedQuery,
        protos.google.cloud.asset.v1.IGetSavedQueryRequest | undefined,
        {} | undefined
    ]>;

Gets details about a saved query.

Parameters
NameDescription
request IGetSavedQueryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IGetSavedQueryRequest | undefined, {} | undefined ]>

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

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

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

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

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

  callGetSavedQuery();

getSavedQuery(request, options, callback)

getSavedQuery(request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IGetSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetSavedQueryRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IGetSavedQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getSavedQuery(request, callback)

getSavedQuery(request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IGetSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetSavedQueryRequest
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IGetSavedQueryRequest | 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.

inventoryPath(project, location, instance)

inventoryPath(project: string, location: string, instance: string): string;

Return a fully-qualified inventory resource name string.

Parameters
NameDescription
project string
location string
instance string
Returns
TypeDescription
string

{string} Resource name string.

listAssets(request, options)

listAssets(request?: protos.google.cloud.asset.v1.IListAssetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IAsset[],
        protos.google.cloud.asset.v1.IListAssetsRequest | null,
        protos.google.cloud.asset.v1.IListAssetsResponse
    ]>;

Lists assets with time and resource types and returns paged results in response.

Parameters
NameDescription
request IListAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IAsset[], protos.google.cloud.asset.v1.IListAssetsRequest | null, protos.google.cloud.asset.v1.IListAssetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Asset. 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 listAssetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAssets(request, options, callback)

listAssets(request: protos.google.cloud.asset.v1.IListAssetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.IListAssetsRequest, protos.google.cloud.asset.v1.IListAssetsResponse | null | undefined, protos.google.cloud.asset.v1.IAsset>): void;
Parameters
NameDescription
request IListAssetsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.IListAssetsRequest, protos.google.cloud.asset.v1.IListAssetsResponse | null | undefined, protos.google.cloud.asset.v1.IAsset>
Returns
TypeDescription
void

listAssets(request, callback)

listAssets(request: protos.google.cloud.asset.v1.IListAssetsRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.IListAssetsRequest, protos.google.cloud.asset.v1.IListAssetsResponse | null | undefined, protos.google.cloud.asset.v1.IAsset>): void;
Parameters
NameDescription
request IListAssetsRequest
callback PaginationCallback<protos.google.cloud.asset.v1.IListAssetsRequest, protos.google.cloud.asset.v1.IListAssetsResponse | null | undefined, protos.google.cloud.asset.v1.IAsset>
Returns
TypeDescription
void

listAssetsAsync(request, options)

listAssetsAsync(request?: protos.google.cloud.asset.v1.IListAssetsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.IAsset>;

Equivalent to listAssets, but returns an iterable object.

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

Parameters
NameDescription
request IListAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.IAsset>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Asset. 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 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. Name of the organization, folder, or project the assets belong
   *  to. Format: "organizations/[organization-number]" (such as
   *  "organizations/123"), "projects/[project-id]" (such as
   *  "projects/my-project-id"), "projects/[project-number]" (such as
   *  "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
   */
  // const parent = 'abc123'
  /**
   *  Timestamp to take an asset snapshot. This can only be set to a timestamp
   *  between the current time and the current time minus 35 days (inclusive).
   *  If not specified, the current time will be used. Due to delays in resource
   *  data collection and indexing, there is a volatile window during which
   *  running the same query may get different results.
   */
  // const readTime = {}
  /**
   *  A list of asset types to take a snapshot for. For example:
   *  "compute.googleapis.com/Disk".
   *  Regular expression is also supported. For example:
   *  * "compute.googleapis.com.*" snapshots resources whose asset type starts
   *  with "compute.googleapis.com".
   *  * ".*Instance" snapshots resources whose asset type ends with "Instance".
   *  * ".*Instance.*" snapshots resources whose asset type contains "Instance".
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported asset type, an INVALID_ARGUMENT error will be returned.
   *  If specified, only matching assets will be returned, otherwise, it will
   *  snapshot all asset types. See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview)
   *  for all supported asset types.
   */
  // const assetTypes = ['abc','def']
  /**
   *  Asset content type. If not specified, no content but the asset name will
   *  be returned.
   */
  // const contentType = {}
  /**
   *  The maximum number of assets to be returned in a single response. Default
   *  is 100, minimum is 1, and maximum is 1000.
   */
  // const pageSize = 1234
  /**
   *  The `next_page_token` returned from the previous `ListAssetsResponse`, or
   *  unspecified for the first `ListAssetsRequest`. It is a continuation of a
   *  prior `ListAssets` call, and the API should return the next page of assets.
   */
  // const pageToken = 'abc123'
  /**
   *  A list of relationship types to output, for example:
   *  `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
   *  content_type=RELATIONSHIP.
   *  * If specified:
   *  it snapshots specified relationships. It returns an error if
   *  any of the relationship_types  doesn't belong to the supported
   *  relationship types of the asset_types  or if any of the asset_types 
   *  doesn't belong to the source types of the relationship_types.
   *  * Otherwise:
   *  it snapshots the supported relationships for all asset_types  or returns
   *  an error if any of the asset_types  has no relationship support.
   *  An unspecified asset types field means all supported asset_types.
   *  See Introduction to Cloud Asset
   *  Inventory (https://cloud.google.com/asset-inventory/docs/overview)
   *  for all supported asset types and relationship types.
   */
  // const relationshipTypes = ['abc','def']

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

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

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

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

  callListAssets();

listAssetsStream(request, options)

listAssetsStream(request?: protos.google.cloud.asset.v1.IListAssetsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListAssetsRequest

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 Asset 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 listAssetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listFeeds(request, options)

listFeeds(request?: protos.google.cloud.asset.v1.IListFeedsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IListFeedsResponse,
        protos.google.cloud.asset.v1.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.v1.IListFeedsResponse, protos.google.cloud.asset.v1.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').v1;

  // 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.v1.IListFeedsRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IListFeedsResponse, protos.google.cloud.asset.v1.IListFeedsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IListFeedsRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IListFeedsResponse, protos.google.cloud.asset.v1.IListFeedsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

listFeeds(request, callback)

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

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
NameDescription
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
TypeDescription
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

listSavedQueries(request, options)

listSavedQueries(request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.ISavedQuery[],
        protos.google.cloud.asset.v1.IListSavedQueriesRequest | null,
        protos.google.cloud.asset.v1.IListSavedQueriesResponse
    ]>;

Lists all saved queries in a parent project/folder/organization.

Parameters
NameDescription
request IListSavedQueriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.ISavedQuery[], protos.google.cloud.asset.v1.IListSavedQueriesRequest | null, protos.google.cloud.asset.v1.IListSavedQueriesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 listSavedQueriesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listSavedQueries(request, options, callback)

listSavedQueries(request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.IListSavedQueriesRequest, protos.google.cloud.asset.v1.IListSavedQueriesResponse | null | undefined, protos.google.cloud.asset.v1.ISavedQuery>): void;
Parameters
NameDescription
request IListSavedQueriesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.IListSavedQueriesRequest, protos.google.cloud.asset.v1.IListSavedQueriesResponse | null | undefined, protos.google.cloud.asset.v1.ISavedQuery>
Returns
TypeDescription
void

listSavedQueries(request, callback)

listSavedQueries(request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.IListSavedQueriesRequest, protos.google.cloud.asset.v1.IListSavedQueriesResponse | null | undefined, protos.google.cloud.asset.v1.ISavedQuery>): void;
Parameters
NameDescription
request IListSavedQueriesRequest
callback PaginationCallback<protos.google.cloud.asset.v1.IListSavedQueriesRequest, protos.google.cloud.asset.v1.IListSavedQueriesResponse | null | undefined, protos.google.cloud.asset.v1.ISavedQuery>
Returns
TypeDescription
void

listSavedQueriesAsync(request, options)

listSavedQueriesAsync(request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.ISavedQuery>;

Equivalent to listSavedQueries, but returns an iterable object.

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

Parameters
NameDescription
request IListSavedQueriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.ISavedQuery>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 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 savedQueries 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'
  /**
   *  Optional. The expression to filter resources.
   *  The expression is a list of zero or more restrictions combined via logical
   *  operators `AND` and `OR`. When `AND` and `OR` are both used in the
   *  expression, parentheses must be appropriately used to group the
   *  combinations. The expression may also contain regular expressions.
   *  See https://google.aip.dev/160 for more information on the grammar.
   */
  // const filter = 'abc123'
  /**
   *  Optional. The maximum number of saved queries to return per page. The
   *  service may return fewer than this value. If unspecified, at most 50 will
   *  be returned. The maximum value is 1000; values above 1000 will be coerced
   *  to 1000.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListSavedQueries` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListSavedQueries` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'

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

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

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

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

  callListSavedQueries();

listSavedQueriesStream(request, options)

listSavedQueriesStream(request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request IListSavedQueriesRequest

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 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 listSavedQueriesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

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.

matchFolderFromFolderSavedQueryName(folderSavedQueryName)

matchFolderFromFolderSavedQueryName(folderSavedQueryName: string): string | number;

Parse the folder from FolderSavedQuery resource.

Parameter
NameDescription
folderSavedQueryName string

A fully-qualified path representing folder_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the folder.

matchInstanceFromInventoryName(inventoryName)

matchInstanceFromInventoryName(inventoryName: string): string | number;

Parse the instance from Inventory resource.

Parameter
NameDescription
inventoryName string

A fully-qualified path representing Inventory resource.

Returns
TypeDescription
string | number

{string} A string representing the instance.

matchLocationFromInventoryName(inventoryName)

matchLocationFromInventoryName(inventoryName: string): string | number;

Parse the location from Inventory resource.

Parameter
NameDescription
inventoryName string

A fully-qualified path representing Inventory resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

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.

matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName)

matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName: string): string | number;

Parse the organization from OrganizationSavedQuery resource.

Parameter
NameDescription
organizationSavedQueryName string

A fully-qualified path representing organization_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectFromInventoryName(inventoryName)

matchProjectFromInventoryName(inventoryName: string): string | number;

Parse the project from Inventory resource.

Parameter
NameDescription
inventoryName string

A fully-qualified path representing Inventory resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

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.

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.

matchProjectFromProjectSavedQueryName(projectSavedQueryName)

matchProjectFromProjectSavedQueryName(projectSavedQueryName: string): string | number;

Parse the project from ProjectSavedQuery resource.

Parameter
NameDescription
projectSavedQueryName string

A fully-qualified path representing project_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName)

matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName: string): string | number;

Parse the saved_query from FolderSavedQuery resource.

Parameter
NameDescription
folderSavedQueryName string

A fully-qualified path representing folder_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the saved_query.

matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName)

matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName: string): string | number;

Parse the saved_query from OrganizationSavedQuery resource.

Parameter
NameDescription
organizationSavedQueryName string

A fully-qualified path representing organization_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the saved_query.

matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName)

matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName: string): string | number;

Parse the saved_query from ProjectSavedQuery resource.

Parameter
NameDescription
projectSavedQueryName string

A fully-qualified path representing project_saved_query resource.

Returns
TypeDescription
string | number

{string} A string representing the saved_query.

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.

organizationSavedQueryPath(organization, savedQuery)

organizationSavedQueryPath(organization: string, savedQuery: string): string;

Return a fully-qualified organizationSavedQuery resource name string.

Parameters
NameDescription
organization string
savedQuery 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.

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.

projectSavedQueryPath(project, savedQuery)

projectSavedQueryPath(project: string, savedQuery: string): string;

Return a fully-qualified projectSavedQuery resource name string.

Parameters
NameDescription
project string
savedQuery string
Returns
TypeDescription
string

{string} Resource name string.

queryAssets(request, options)

queryAssets(request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IQueryAssetsResponse,
        protos.google.cloud.asset.v1.IQueryAssetsRequest | undefined,
        {} | undefined
    ]>;

Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).

If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the QueryAssetsResponse.

Otherwise, full query results can be obtained by issuing extra requests with the job_reference from the a previous QueryAssets call.

Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.

Parameters
NameDescription
request IQueryAssetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IQueryAssetsResponse, protos.google.cloud.asset.v1.IQueryAssetsRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing QueryAssetsResponse. 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 relative name of the root asset. This can only be an
   *  organization number (such as "organizations/123"), a project ID (such as
   *  "projects/my-project-id"), or a project number (such as "projects/12345"),
   *  or a folder number (such as "folders/123").
   *  Only assets belonging to the `parent` will be returned.
   */
  // const parent = 'abc123'
  /**
   *  Optional. A SQL statement that's compatible with BigQuery
   *  SQL (https://cloud.google.com/bigquery/docs/introduction-sql).
   */
  // const statement = 'abc123'
  /**
   *  Optional. Reference to the query job, which is from the
   *  `QueryAssetsResponse` of previous `QueryAssets` call.
   */
  // const jobReference = 'abc123'
  /**
   *  Optional. The maximum number of rows to return in the results. Responses
   *  are limited to 10 MB and 1000 rows.
   *  By default, the maximum row count is 1000. When the byte or row count limit
   *  is reached, the rest of the query results will be paginated.
   *  The field will be ignored when output_config  is specified.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token received from previous `QueryAssets`.
   *  The field will be ignored when output_config  is specified.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Specifies the maximum amount of time that the client is willing
   *  to wait for the query to complete. By default, this limit is 5 min for the
   *  first query, and 1 minute for the following queries. If the query is
   *  complete, the `done` field in the `QueryAssetsResponse` is true, otherwise
   *  false.
   *  Like BigQuery jobs.query
   *  API (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest)
   *  The call is not guaranteed to wait for the specified timeout; it typically
   *  returns after around 200 seconds (200,000 milliseconds), even if the query
   *  is not complete.
   *  The field will be ignored when output_config  is specified.
   */
  // const timeout = {}
  /**
   *  Optional. start_time  is required. start_time  must be less than
   *  end_time  Defaults end_time  to now if start_time  is set and
   *  end_time  isn't. Maximum permitted time range is 7 days.
   */
  // const readTimeWindow = {}
  /**
   *  Optional. Queries cloud assets as they appeared at the specified point in
   *  time.
   */
  // const readTime = {}
  /**
   *  Optional. Destination where the query results will be saved.
   *  When this field is specified, the query results won't be saved in the
   *  QueryAssetsResponse.query_result. Instead
   *  QueryAssetsResponse.output_config  will be set.
   *  Meanwhile, QueryAssetsResponse.job_reference  will be set and can be used
   *  to check the status of the query job when passed to a following
   *  QueryAssets  API call.
   */
  // const outputConfig = {}

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

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

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

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

  callQueryAssets();

queryAssets(request, options, callback)

queryAssets(request: protos.google.cloud.asset.v1.IQueryAssetsRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IQueryAssetsResponse, protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IQueryAssetsRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IQueryAssetsResponse, protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

queryAssets(request, callback)

queryAssets(request: protos.google.cloud.asset.v1.IQueryAssetsRequest, callback: Callback<protos.google.cloud.asset.v1.IQueryAssetsResponse, protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IQueryAssetsRequest
callback Callback<protos.google.cloud.asset.v1.IQueryAssetsResponse, protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

searchAllIamPolicies(request, options)

searchAllIamPolicies(request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IIamPolicySearchResult[],
        protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest | null,
        protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse
    ]>;

Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the cloudasset.assets.searchAllIamPolicies permission on the desired scope, otherwise the request will be rejected.

Parameters
NameDescription
request ISearchAllIamPoliciesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IIamPolicySearchResult[], protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest | null, protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 searchAllIamPoliciesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAllIamPolicies(request, options, callback)

searchAllIamPolicies(request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.IIamPolicySearchResult>): void;
Parameters
NameDescription
request ISearchAllIamPoliciesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.IIamPolicySearchResult>
Returns
TypeDescription
void

searchAllIamPolicies(request, callback)

searchAllIamPolicies(request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.IIamPolicySearchResult>): void;
Parameters
NameDescription
request ISearchAllIamPoliciesRequest
callback PaginationCallback<protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse | null | undefined, protos.google.cloud.asset.v1.IIamPolicySearchResult>
Returns
TypeDescription
void

searchAllIamPoliciesAsync(request, options)

searchAllIamPoliciesAsync(request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.IIamPolicySearchResult>;

Equivalent to searchAllIamPolicies, but returns an iterable object.

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

Parameters
NameDescription
request ISearchAllIamPoliciesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.IIamPolicySearchResult>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . 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 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. A scope can be a project, a folder, or an organization. The
   *  search is limited to the IAM policies within the `scope`. The caller must
   *  be granted the
   *  `cloudasset.assets.searchAllIamPolicies` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
   *  permission on the desired scope.
   *  The allowed values are:
   *  * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
   *  * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
   *  * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
   *  * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
   */
  // const scope = 'abc123'
  /**
   *  Optional. The query statement. See how to construct a
   *  query (https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
   *  for more information. If not specified or empty, it will search all the
   *  IAM policies within the specified `scope`. Note that the query string is
   *  compared against each IAM policy binding, including its principals,
   *  roles, and IAM conditions. The returned IAM policies will only
   *  contain the bindings that match your query. To learn more about the IAM
   *  policy structure, see the IAM policy
   *  documentation (https://cloud.google.com/iam/help/allow-policies/structure).
   *  Examples:
   *  * `policy:amy@gmail.com` to find IAM policy bindings that specify user
   *    "amy@gmail.com".
   *  * `policy:roles/compute.admin` to find IAM policy bindings that specify
   *    the Compute Admin role.
   *  * `policy:comp*` to find IAM policy bindings that contain "comp" as a
   *    prefix of any word in the binding.
   *  * `policy.role.permissions:storage.buckets.update` to find IAM policy
   *    bindings that specify a role containing "storage.buckets.update"
   *    permission. Note that if callers don't have `iam.roles.get` access to a
   *    role's included permissions, policy bindings that specify this role will
   *    be dropped from the search results.
   *  * `policy.role.permissions:upd*` to find IAM policy bindings that specify a
   *    role containing "upd" as a prefix of any word in the role permission.
   *    Note that if callers don't have `iam.roles.get` access to a role's
   *    included permissions, policy bindings that specify this role will be
   *    dropped from the search results.
   *  * `resource:organizations/123456` to find IAM policy bindings
   *    that are set on "organizations/123456".
   *  * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to
   *    find IAM policy bindings that are set on the project named "myproject".
   *  * `Important` to find IAM policy bindings that contain "Important" as a
   *    word in any of the searchable fields (except for the included
   *    permissions).
   *  * `resource:(instance1 OR instance2) policy:amy` to find
   *    IAM policy bindings that are set on resources "instance1" or
   *    "instance2" and also specify user "amy".
   *  * `roles:roles/compute.admin` to find IAM policy bindings that specify the
   *    Compute Admin role.
   *  * `memberTypes:user` to find IAM policy bindings that contain the
   *    principal type "user".
   */
  // const query = 'abc123'
  /**
   *  Optional. The page size for search result pagination. Page size is capped
   *  at 500 even if a larger value is given. If set to zero or a negative value,
   *  server will pick an appropriate default. Returned results may be fewer than
   *  requested. When this happens, there could be more results as long as
   *  `next_page_token` is returned.
   */
  // const pageSize = 1234
  /**
   *  Optional. If present, retrieve the next batch of results from the preceding
   *  call to this method. `page_token` must be the value of `next_page_token`
   *  from the previous response. The values of all other method parameters must
   *  be identical to those in the previous call.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. A list of asset types that the IAM policies are attached to. If
   *  empty, it will search the IAM policies that are attached to all the asset
   *  types supported by search
   *  APIs (https://cloud.google.com/asset-inventory/docs/supported-asset-types)
   *  Regular expressions are also supported. For example:
   *  * "compute.googleapis.com.*" snapshots IAM policies attached to asset type
   *  starts with "compute.googleapis.com".
   *  * ".*Instance" snapshots IAM policies attached to asset type ends with
   *  "Instance".
   *  * ".*Instance.*" snapshots IAM policies attached to asset type contains
   *  "Instance".
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported asset type, an INVALID_ARGUMENT error will be returned.
   */
  // const assetTypes = ['abc','def']
  /**
   *  Optional. A comma-separated list of fields specifying the sorting order of
   *  the results. The default order is ascending. Add " DESC" after the field
   *  name to indicate descending order. Redundant space characters are ignored.
   *  Example: "assetType DESC, resource".
   *  Only singular primitive fields in the response are sortable:
   *    * resource
   *    * assetType
   *    * project
   *  All the other fields such as repeated fields (e.g., `folders`) and
   *  non-primitive fields (e.g., `policy`) are not supported.
   */
  // const orderBy = 'abc123'

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

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

  async function callSearchAllIamPolicies() {
    // Construct request
    const request = {
      scope,
    };

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

  callSearchAllIamPolicies();

searchAllIamPoliciesStream(request, options)

searchAllIamPoliciesStream(request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request ISearchAllIamPoliciesRequest

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 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 searchAllIamPoliciesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAllResources(request, options)

searchAllResources(request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IResourceSearchResult[],
        protos.google.cloud.asset.v1.ISearchAllResourcesRequest | null,
        protos.google.cloud.asset.v1.ISearchAllResourcesResponse
    ]>;

Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the cloudasset.assets.searchAllResources permission on the desired scope, otherwise the request will be rejected.

Parameters
NameDescription
request ISearchAllResourcesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.IResourceSearchResult[], protos.google.cloud.asset.v1.ISearchAllResourcesRequest | null, protos.google.cloud.asset.v1.ISearchAllResourcesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of ResourceSearchResult. 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 searchAllResourcesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchAllResources(request, options, callback)

searchAllResources(request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.asset.v1.ISearchAllResourcesRequest, protos.google.cloud.asset.v1.ISearchAllResourcesResponse | null | undefined, protos.google.cloud.asset.v1.IResourceSearchResult>): void;
Parameters
NameDescription
request ISearchAllResourcesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.asset.v1.ISearchAllResourcesRequest, protos.google.cloud.asset.v1.ISearchAllResourcesResponse | null | undefined, protos.google.cloud.asset.v1.IResourceSearchResult>
Returns
TypeDescription
void

searchAllResources(request, callback)

searchAllResources(request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, callback: PaginationCallback<protos.google.cloud.asset.v1.ISearchAllResourcesRequest, protos.google.cloud.asset.v1.ISearchAllResourcesResponse | null | undefined, protos.google.cloud.asset.v1.IResourceSearchResult>): void;
Parameters
NameDescription
request ISearchAllResourcesRequest
callback PaginationCallback<protos.google.cloud.asset.v1.ISearchAllResourcesRequest, protos.google.cloud.asset.v1.ISearchAllResourcesResponse | null | undefined, protos.google.cloud.asset.v1.IResourceSearchResult>
Returns
TypeDescription
void

searchAllResourcesAsync(request, options)

searchAllResourcesAsync(request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.asset.v1.IResourceSearchResult>;

Equivalent to searchAllResources, but returns an iterable object.

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

Parameters
NameDescription
request ISearchAllResourcesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.asset.v1.IResourceSearchResult>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ResourceSearchResult. 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 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. A scope can be a project, a folder, or an organization. The
   *  search is limited to the resources within the `scope`. The caller must be
   *  granted the
   *  `cloudasset.assets.searchAllResources` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
   *  permission on the desired scope.
   *  The allowed values are:
   *  * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
   *  * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
   *  * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
   *  * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
   */
  // const scope = 'abc123'
  /**
   *  Optional. The query statement. See how to construct a
   *  query (https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
   *  for more information. If not specified or empty, it will search all the
   *  resources within the specified `scope`.
   *  Examples:
   *  * `name:Important` to find Google Cloud resources whose name contains
   *    `Important` as a word.
   *  * `name=Important` to find the Google Cloud resource whose name is exactly
   *    `Important`.
   *  * `displayName:Impor*` to find Google Cloud resources whose display name
   *    contains `Impor` as a prefix of any word in the field.
   *  * `location:us-west*` to find Google Cloud resources whose location
   *    contains both `us` and `west` as prefixes.
   *  * `labels:prod` to find Google Cloud resources whose labels contain `prod`
   *    as a key or value.
   *  * `labels.env:prod` to find Google Cloud resources that have a label `env`
   *    and its value is `prod`.
   *  * `labels.env:*` to find Google Cloud resources that have a label `env`.
   *  * `tagKeys:env` to find Google Cloud resources that have directly
   *    attached tags where the
   *    `TagKey.namespacedName` (https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
   *    contains `env`.
   *  * `tagValues:prod*` to find Google Cloud resources that have directly
   *    attached tags where the
   *    `TagValue.namespacedName` (https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
   *    contains a word prefixed by `prod`.
   *  * `tagValueIds=tagValues/123` to find Google Cloud resources that have
   *    directly attached tags where the
   *    `TagValue.name` (https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
   *    is exactly `tagValues/123`.
   *  * `effectiveTagKeys:env` to find Google Cloud resources that have
   *    directly attached or inherited tags where the
   *    `TagKey.namespacedName` (https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
   *    contains `env`.
   *  * `effectiveTagValues:prod*` to find Google Cloud resources that have
   *    directly attached or inherited tags where the
   *    `TagValue.namespacedName` (https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
   *    contains a word prefixed by `prod`.
   *  * `effectiveTagValueIds=tagValues/123` to find Google Cloud resources that
   *     have directly attached or inherited tags where the
   *    `TagValue.name` (https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
   *    is exactly `tagValues/123`.
   *  * `kmsKey:key` to find Google Cloud resources encrypted with a
   *    customer-managed encryption key whose name contains `key` as a word. This
   *    field is deprecated. Use the `kmsKeys` field to retrieve Cloud KMS
   *    key information.
   *  * `kmsKeys:key` to find Google Cloud resources encrypted with
   *    customer-managed encryption keys whose name contains the word `key`.
   *  * `relationships:instance-group-1` to find Google Cloud resources that have
   *    relationships with `instance-group-1` in the related resource name.
   *  * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine
   *    instances that have relationships of type `INSTANCE_TO_INSTANCEGROUP`.
   *  * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find
   *    Compute Engine instances that have relationships with `instance-group-1`
   *    in the Compute Engine instance group resource name, for relationship type
   *    `INSTANCE_TO_INSTANCEGROUP`.
   *  * `sccSecurityMarks.key=value` to find Cloud resources that are attached
   *    with security marks whose key is `key` and value is `value`.
   *  * `sccSecurityMarks.key:*` to find Cloud resources that are attached with
   *    security marks whose key is `key`.
   *  * `state:ACTIVE` to find Google Cloud resources whose state contains
   *    `ACTIVE` as a word.
   *  * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't
   *    contain `ACTIVE` as a word.
   *  * `createTime<1609459200` to="" find="" google="" cloud="" resources="" that="" were="" created="" *="" before="" `2021-01-01="" 00:00:00="" utc`.="" `1609459200`="" is="" the="" epoch="" timestamp="" of="" *="" `2021-01-01="" 00:00:00="" utc`="" in="" seconds.="" *="" *="" `updatetime="">1609459200` to find Google Cloud resources that were updated
   *    after `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of
   *    `2021-01-01 00:00:00 UTC` in seconds.
   *  * `Important` to find Google Cloud resources that contain `Important` as a
   *    word in any of the searchable fields.
   *  * `Impor*` to find Google Cloud resources that contain `Impor` as a prefix
   *    of any word in any of the searchable fields.
   *  * `Important location:(us-west1 OR global)` to find Google Cloud
   *    resources that contain `Important` as a word in any of the searchable
   *    fields and are also located in the `us-west1` region or the `global`
   *    location.
   */
  // const query = 'abc123'
  /**
   *  Optional. A list of asset types that this request searches for. If empty,
   *  it will search all the asset types supported by search
   *  APIs (https://cloud.google.com/asset-inventory/docs/supported-asset-types).
   *  Regular expressions are also supported. For example:
   *  * "compute.googleapis.com.*" snapshots resources whose asset type starts
   *  with "compute.googleapis.com".
   *  * ".*Instance" snapshots resources whose asset type ends with "Instance".
   *  * ".*Instance.*" snapshots resources whose asset type contains "Instance".
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported asset type, an INVALID_ARGUMENT error will be returned.
   */
  // const assetTypes = ['abc','def']
  /**
   *  Optional. The page size for search result pagination. Page size is capped
   *  at 500 even if a larger value is given. If set to zero or a negative value,
   *  server will pick an appropriate default. Returned results may be fewer than
   *  requested. When this happens, there could be more results as long as
   *  `next_page_token` is returned.
   */
  // const pageSize = 1234
  /**
   *  Optional. If present, then retrieve the next batch of results from the
   *  preceding call to this method. `page_token` must be the value of
   *  `next_page_token` from the previous response. The values of all other
   *  method parameters, must be identical to those in the previous call.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. A comma-separated list of fields specifying the sorting order of
   *  the results. The default order is ascending. Add " DESC" after the field
   *  name to indicate descending order. Redundant space characters are ignored.
   *  Example: "location DESC, name".
   *  Only the following fields in the response are sortable:
   *    * name
   *    * assetType
   *    * project
   *    * displayName
   *    * description
   *    * location
   *    * createTime
   *    * updateTime
   *    * state
   *    * parentFullResourceName
   *    * parentAssetType
   */
  // const orderBy = 'abc123'
  /**
   *  Optional. A comma-separated list of fields that you want returned in the
   *  results. The following fields are returned by default if not specified:
   *    * `name`
   *    * `assetType`
   *    * `project`
   *    * `folders`
   *    * `organization`
   *    * `displayName`
   *    * `description`
   *    * `location`
   *    * `labels`
   *    * `tags`
   *    * `effectiveTags`
   *    * `networkTags`
   *    * `kmsKeys`
   *    * `createTime`
   *    * `updateTime`
   *    * `state`
   *    * `additionalAttributes`
   *    * `parentFullResourceName`
   *    * `parentAssetType`
   *  Some fields of large size, such as `versionedResources`,
   *  `attachedResources`, `effectiveTags` etc., are not returned by default, but
   *  you can specify them in the `read_mask` parameter if you want to include
   *  them. If `"*"` is specified, all available
   *  fields (https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources#resourcesearchresult)
   *  are returned.
   *  Examples: `"name,location"`, `"name,versionedResources"`, `"*"`.
   *  Any invalid field path will trigger INVALID_ARGUMENT error.
   */
  // const readMask = {}

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

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

  async function callSearchAllResources() {
    // Construct request
    const request = {
      scope,
    };

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

  callSearchAllResources();

searchAllResourcesStream(request, options)

searchAllResourcesStream(request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request ISearchAllResourcesRequest

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 ResourceSearchResult 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 searchAllResourcesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

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.v1.IUpdateFeedRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.IFeed,
        protos.google.cloud.asset.v1.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.v1.IFeed, protos.google.cloud.asset.v1.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').v1;

  // 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.v1.IUpdateFeedRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.IUpdateFeedRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateFeedRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.IFeed, protos.google.cloud.asset.v1.IUpdateFeedRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateFeed(request, callback)

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

updateSavedQuery(request, options)

updateSavedQuery(request?: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.asset.v1.ISavedQuery,
        protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | undefined,
        {} | undefined
    ]>;

Updates a saved query.

Parameters
NameDescription
request IUpdateSavedQueryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 saved query to update.
   *  The saved query's `name` field is used to identify the one to update,
   *  which has format as below:
   *  * projects/project_number/savedQueries/saved_query_id
   *  * folders/folder_number/savedQueries/saved_query_id
   *  * organizations/organization_number/savedQueries/saved_query_id
   */
  // const savedQuery = {}
  /**
   *  Required. The list of fields to update.
   */
  // const updateMask = {}

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

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

  async function callUpdateSavedQuery() {
    // Construct request
    const request = {
      savedQuery,
      updateMask,
    };

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

  callUpdateSavedQuery();

updateSavedQuery(request, options, callback)

updateSavedQuery(request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, options: CallOptions, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateSavedQueryRequest
options CallOptions
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateSavedQuery(request, callback)

updateSavedQuery(request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, callback: Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateSavedQueryRequest
callback Callback<protos.google.cloud.asset.v1.ISavedQuery, protos.google.cloud.asset.v1.IUpdateSavedQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void