Asset service definition. v1
Package
@google-cloud/assetConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of AssetServiceClient.
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof gax.fallback
: loaded instance of |
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
assetServiceStub
assetServiceStub?: Promise<{
[name: string]: Function;
}>;
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
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.
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.
Name | Description |
accessPolicy |
string
|
accessLevel |
string
|
Type | Description |
string | {string} Resource name string. |
accessPolicyPath(accessPolicy)
accessPolicyPath(accessPolicy: string): string;
Return a fully-qualified accessPolicy resource name string.
Name | Description |
accessPolicy |
string
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [AnalyzeIamPolicyResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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,
* please 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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 , 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.
Name | Description |
request |
protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
/**
* 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,
* please 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IAnalyzeMoveRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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 GCP Project are supported as of today. Hence, this can only be Project
* ID (such as "projects/my-project-id") or a Project Number (such as
* "projects/12345").
*/
// const resource = 'abc123'
/**
* Required. Name of the GCP 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
void |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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 = 'abc123'
/**
* 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 = 'abc123'
// 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [BatchGetEffectiveIamPoliciesResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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 searchable asset
* types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
* A maximum of 20 resources' effective policies can be retrieved in a batch.
*/
// const names = 'abc123'
// 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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
.
Name | Description |
request |
protos.google.longrunning.CancelOperationRequest
The request object that will be sent. |
options |
gax.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]https://googleapis.github.io/gax-nodejs/global.html#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. |
Type | Description |
Promise<protos.google.protobuf.Empty> |
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()
.
Name | Description |
name |
string
The operation name that will be passed. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* 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,
* please 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()
.
Name | Description |
name |
string
The operation name that will be passed. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* 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 = 'abc123'
/**
* 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 = 'abc123'
// 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.
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.ICreateFeedRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.ICreateSavedQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [SavedQuery]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IDeleteFeedRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
request |
protos.google.cloud.asset.v1.IDeleteFeedRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1.IDeleteFeedRequest | null | undefined, {} | null | undefined>
|
Type | Description |
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
.
Name | Description |
request |
protos.google.longrunning.DeleteOperationRequest
The request object that will be sent. |
options |
gax.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]https://googleapis.github.io/gax-nodejs/global.html#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. |
Type | Description |
Promise<protos.google.protobuf.Empty> |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IDeleteSavedQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
request |
protos.google.cloud.asset.v1.IDeleteSavedQueryRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.cloud.asset.v1.IDeleteSavedQueryRequest | null | undefined, {} | null | undefined>
|
Type | Description |
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 in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the 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.
Name | Description |
request |
protos.google.cloud.asset.v1.IExportAssetsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
/**
* 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 = 'abc123'
/**
* 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 = 'abc123'
// 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
void |
folderFeedPath(folder, feed)
folderFeedPath(folder: string, feed: string): string;
Return a fully-qualified folderFeed resource name string.
Name | Description |
folder |
string
|
feed |
string
|
Type | Description |
string | {string} Resource name string. |
folderSavedQueryPath(folder, savedQuery)
folderSavedQueryPath(folder: string, savedQuery: string): string;
Return a fully-qualified folderSavedQuery resource name string.
Name | Description |
folder |
string
|
savedQuery |
string
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IGetFeedRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.longrunning.GetOperationRequest
The request object that will be sent. |
options |
gax.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]https://googleapis.github.io/gax-nodejs/global.html#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 [google.longrunning.Operation]. {Promise} - The promise which resolves to an array. The first element of the array is an object representing [google.longrunning.Operation]. The promise has a method named "cancel" which cancels the ongoing API call. |
Type | Description |
Promise<[protos.google.longrunning.Operation]> |
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProjectId()
getProjectId(): Promise<string>;
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IGetSavedQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [SavedQuery]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Type | Description |
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.
Name | Description |
project |
string
|
location |
string
|
instance |
string
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListAssetsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListAssetsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.cloud.asset.v1.IAsset> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* 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 = 'abc123'
/**
* 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 = 'abc123'
// 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 = await 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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListAssetsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListFeedsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.longrunning.ListOperationsRequest
The request object that will be sent. |
options |
gax.CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See [gax.CallOptions]https://googleapis.github.io/gax-nodejs/global.html#CallOptions for the details. |
Type | Description |
AsyncIterable<protos.google.longrunning.ListOperationsResponse> | {Object} An iterable Object that conforms to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListSavedQueriesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [SavedQuery]. 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 |
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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListSavedQueriesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.cloud.asset.v1.ISavedQuery> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [SavedQuery]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* 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 = await 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.
Name | Description |
request |
protos.google.cloud.asset.v1.IListSavedQueriesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Transform | {Stream} An object stream which emits an object representing [SavedQuery] 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 |
matchAccessLevelFromAccessLevelName(accessLevelName)
matchAccessLevelFromAccessLevelName(accessLevelName: string): string | number;
Parse the access_level from AccessLevel resource.
Name | Description |
accessLevelName |
string
A fully-qualified path representing AccessLevel resource. |
Type | Description |
string | number | {string} A string representing the access_level. |
matchAccessPolicyFromAccessLevelName(accessLevelName)
matchAccessPolicyFromAccessLevelName(accessLevelName: string): string | number;
Parse the access_policy from AccessLevel resource.
Name | Description |
accessLevelName |
string
A fully-qualified path representing AccessLevel resource. |
Type | Description |
string | number | {string} A string representing the access_policy. |
matchAccessPolicyFromAccessPolicyName(accessPolicyName)
matchAccessPolicyFromAccessPolicyName(accessPolicyName: string): string | number;
Parse the access_policy from AccessPolicy resource.
Name | Description |
accessPolicyName |
string
A fully-qualified path representing AccessPolicy resource. |
Type | Description |
string | number | {string} A string representing the access_policy. |
matchAccessPolicyFromServicePerimeterName(servicePerimeterName)
matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string): string | number;
Parse the access_policy from ServicePerimeter resource.
Name | Description |
servicePerimeterName |
string
A fully-qualified path representing ServicePerimeter resource. |
Type | Description |
string | number | {string} A string representing the access_policy. |
matchFeedFromFolderFeedName(folderFeedName)
matchFeedFromFolderFeedName(folderFeedName: string): string | number;
Parse the feed from FolderFeed resource.
Name | Description |
folderFeedName |
string
A fully-qualified path representing folder_feed resource. |
Type | Description |
string | number | {string} A string representing the feed. |
matchFeedFromOrganizationFeedName(organizationFeedName)
matchFeedFromOrganizationFeedName(organizationFeedName: string): string | number;
Parse the feed from OrganizationFeed resource.
Name | Description |
organizationFeedName |
string
A fully-qualified path representing organization_feed resource. |
Type | Description |
string | number | {string} A string representing the feed. |
matchFeedFromProjectFeedName(projectFeedName)
matchFeedFromProjectFeedName(projectFeedName: string): string | number;
Parse the feed from ProjectFeed resource.
Name | Description |
projectFeedName |
string
A fully-qualified path representing project_feed resource. |
Type | Description |
string | number | {string} A string representing the feed. |
matchFolderFromFolderFeedName(folderFeedName)
matchFolderFromFolderFeedName(folderFeedName: string): string | number;
Parse the folder from FolderFeed resource.
Name | Description |
folderFeedName |
string
A fully-qualified path representing folder_feed resource. |
Type | Description |
string | number | {string} A string representing the folder. |
matchFolderFromFolderSavedQueryName(folderSavedQueryName)
matchFolderFromFolderSavedQueryName(folderSavedQueryName: string): string | number;
Parse the folder from FolderSavedQuery resource.
Name | Description |
folderSavedQueryName |
string
A fully-qualified path representing folder_saved_query resource. |
Type | Description |
string | number | {string} A string representing the folder. |
matchInstanceFromInventoryName(inventoryName)
matchInstanceFromInventoryName(inventoryName: string): string | number;
Parse the instance from Inventory resource.
Name | Description |
inventoryName |
string
A fully-qualified path representing Inventory resource. |
Type | Description |
string | number | {string} A string representing the instance. |
matchLocationFromInventoryName(inventoryName)
matchLocationFromInventoryName(inventoryName: string): string | number;
Parse the location from Inventory resource.
Name | Description |
inventoryName |
string
A fully-qualified path representing Inventory resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchOrganizationFromOrganizationFeedName(organizationFeedName)
matchOrganizationFromOrganizationFeedName(organizationFeedName: string): string | number;
Parse the organization from OrganizationFeed resource.
Name | Description |
organizationFeedName |
string
A fully-qualified path representing organization_feed resource. |
Type | Description |
string | number | {string} A string representing the organization. |
matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName)
matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName: string): string | number;
Parse the organization from OrganizationSavedQuery resource.
Name | Description |
organizationSavedQueryName |
string
A fully-qualified path representing organization_saved_query resource. |
Type | Description |
string | number | {string} A string representing the organization. |
matchProjectFromInventoryName(inventoryName)
matchProjectFromInventoryName(inventoryName: string): string | number;
Parse the project from Inventory resource.
Name | Description |
inventoryName |
string
A fully-qualified path representing Inventory resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromProjectFeedName(projectFeedName)
matchProjectFromProjectFeedName(projectFeedName: string): string | number;
Parse the project from ProjectFeed resource.
Name | Description |
projectFeedName |
string
A fully-qualified path representing project_feed resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;
Parse the project from Project resource.
Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromProjectSavedQueryName(projectSavedQueryName)
matchProjectFromProjectSavedQueryName(projectSavedQueryName: string): string | number;
Parse the project from ProjectSavedQuery resource.
Name | Description |
projectSavedQueryName |
string
A fully-qualified path representing project_saved_query resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName)
matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName: string): string | number;
Parse the saved_query from FolderSavedQuery resource.
Name | Description |
folderSavedQueryName |
string
A fully-qualified path representing folder_saved_query resource. |
Type | Description |
string | number | {string} A string representing the saved_query. |
matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName)
matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName: string): string | number;
Parse the saved_query from OrganizationSavedQuery resource.
Name | Description |
organizationSavedQueryName |
string
A fully-qualified path representing organization_saved_query resource. |
Type | Description |
string | number | {string} A string representing the saved_query. |
matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName)
matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName: string): string | number;
Parse the saved_query from ProjectSavedQuery resource.
Name | Description |
projectSavedQueryName |
string
A fully-qualified path representing project_saved_query resource. |
Type | Description |
string | number | {string} A string representing the saved_query. |
matchServicePerimeterFromServicePerimeterName(servicePerimeterName)
matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string): string | number;
Parse the service_perimeter from ServicePerimeter resource.
Name | Description |
servicePerimeterName |
string
A fully-qualified path representing ServicePerimeter resource. |
Type | Description |
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.
Name | Description |
organization |
string
|
feed |
string
|
Type | Description |
string | {string} Resource name string. |
organizationSavedQueryPath(organization, savedQuery)
organizationSavedQueryPath(organization: string, savedQuery: string): string;
Return a fully-qualified organizationSavedQuery resource name string.
Name | Description |
organization |
string
|
savedQuery |
string
|
Type | Description |
string | {string} Resource name string. |
projectFeedPath(project, feed)
projectFeedPath(project: string, feed: string): string;
Return a fully-qualified projectFeed resource name string.
Name | Description |
project |
string
|
feed |
string
|
Type | Description |
string | {string} Resource name string. |
projectPath(project)
projectPath(project: string): string;
Return a fully-qualified project resource name string.
Name | Description |
project |
string
|
Type | Description |
string | {string} Resource name string. |
projectSavedQueryPath(project, savedQuery)
projectSavedQueryPath(project: string, savedQuery: string): string;
Return a fully-qualified projectSavedQuery resource name string.
Name | Description |
project |
string
|
savedQuery |
string
|
Type | Description |
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 Standard SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-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.
Name | Description |
request |
protos.google.cloud.asset.v1.IQueryAssetsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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 Standard
* SQL (http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [IamPolicySearchResult]. 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 |
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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.cloud.asset.v1.IIamPolicySearchResult> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [IamPolicySearchResult]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* 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 Cloud IAM policy binding, including its principals,
* roles, and Cloud IAM conditions. The returned Cloud 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, 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
* searchable asset
* types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 = '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: "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 = await 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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Transform | {Stream} An object stream which emits an object representing [IamPolicySearchResult] 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 |
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 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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllResourcesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllResourcesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.cloud.asset.v1.IResourceSearchResult> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* 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 Cloud resources whose name contains
* "Important" as a word.
* * `name=Important` to find the Cloud resource whose name is exactly
* "Important".
* * `displayName:Impor*` to find Cloud resources whose display name
* contains "Impor" as a prefix of any word in the field.
* * `location:us-west*` to find Cloud resources whose location contains both
* "us" and "west" as prefixes.
* * `labels:prod` to find Cloud resources whose labels contain "prod" as
* a key or value.
* * `labels.env:prod` to find Cloud resources that have a label "env"
* and its value is "prod".
* * `labels.env:*` to find Cloud resources that have a label "env".
* * `kmsKey:key` to find Cloud resources encrypted with a customer-managed
* encryption key whose name contains the word "key".
* * `relationships:instance-group-1` to find Cloud resources that have
* relationships with "instance-group-1" in the related resource name.
* * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that
* have relationships of type "INSTANCE_TO_INSTANCEGROUP".
* * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find
* compute instances that have relationships with "instance-group-1" in the
* compute instance group resource name, for relationship type
* "INSTANCE_TO_INSTANCEGROUP".
* * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a
* word.
* * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain
* "ACTIVE" as a word.
* * `createTime<1609459200` to="" find="" 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 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 Cloud resources that contain "Important" as a word
* in any of the searchable fields.
* * `Impor*` to find 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 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 searchable asset
* types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 = '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, 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 singular primitive fields in the response are sortable:
* * name
* * assetType
* * project
* * displayName
* * description
* * location
* * kmsKey
* * createTime
* * updateTime
* * state
* * parentFullResourceName
* * parentAssetType
* All the other fields such as repeated fields (e.g., `networkTags`), map
* fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`)
* are not supported.
*/
// const orderBy = 'abc123'
/**
* Optional. A comma-separated list of fields specifying which fields to be
* returned in ResourceSearchResult. Only '*' or combination of top level
* fields can be specified. Field names of both snake_case and camelCase are
* supported. Examples: `"*"`, `"name,location"`, `"name,versionedResources"`.
* The read_mask paths must be valid field paths listed but not limited to
* (both snake_case and camelCase are supported):
* * name
* * assetType
* * project
* * displayName
* * description
* * location
* * tagKeys
* * tagValues
* * tagValueIds
* * labels
* * networkTags
* * kmsKey
* * createTime
* * updateTime
* * state
* * additionalAttributes
* * versionedResources
* If read_mask is not specified, all fields except versionedResources will
* be returned.
* If only '*' is specified, all fields including versionedResources will be
* returned.
* 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 = await 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.
Name | Description |
request |
protos.google.cloud.asset.v1.ISearchAllResourcesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 |
servicePerimeterPath(accessPolicy, servicePerimeter)
servicePerimeterPath(accessPolicy: string, servicePerimeter: string): string;
Return a fully-qualified servicePerimeter resource name string.
Name | Description |
accessPolicy |
string
|
servicePerimeter |
string
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IUpdateFeedRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
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.
Name | Description |
request |
protos.google.cloud.asset.v1.IUpdateSavedQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
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 [SavedQuery]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* 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;
Name | Description |
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>
|
Type | Description |
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;
Name | Description |
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>
|
Type | Description |
void |