1.0.20220805 • Published 2 years ago

@maxim_mazurok/gapi.client.cloudasset v1.0.20220805

Weekly downloads
71
License
MIT
Repository
github
Last release
2 years ago

TypeScript typings for Cloud Asset API v1

The cloud asset API manages the history and inventory of cloud resources. For detailed description please check documentation.

Installing

Install typings for Cloud Asset API:

npm install @types/gapi.client.cloudasset@v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load('cloudasset', 'v1', () => {
  // now we can use gapi.client.cloudasset
  // ...
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [ 
      // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
      'https://www.googleapis.com/auth/cloud-platform',
    ],
    immediate = true;
// ...

gapi.auth.authorize(
  { client_id: client_id, scope: scope, immediate: immediate },
  authResult => {
    if (authResult && !authResult.error) {
        /* handle successful authorization */
    } else {
        /* handle authorization error */
    }
});

After that you can use Cloud Asset API resources:

/*
Lists assets with time and resource types and returns paged results in response.
*/
await gapi.client.cloudasset.assets.list({ parent: "parent",  });

/*
Gets effective IAM policies for a batch of resources.
*/
await gapi.client.cloudasset.effectiveIamPolicies.batchGet({ scope: "scope",  });

/*
Creates a feed in a parent project/folder/organization to listen to its asset updates.
*/
await gapi.client.cloudasset.feeds.create({ parent: "parent",  });

/*
Deletes an asset feed.
*/
await gapi.client.cloudasset.feeds.delete({ name: "name",  });

/*
Gets details about an asset feed.
*/
await gapi.client.cloudasset.feeds.get({ name: "name",  });

/*
Lists all asset feeds in a parent project/folder/organization.
*/
await gapi.client.cloudasset.feeds.list({ parent: "parent",  });

/*
Updates an asset feed configuration.
*/
await gapi.client.cloudasset.feeds.patch({ name: "name",  });

/*
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.
*/
await gapi.client.cloudasset.operations.get({ name: "name",  });

/*
Creates a saved query in a parent project/folder/organization.
*/
await gapi.client.cloudasset.savedQueries.create({ parent: "parent",  });

/*
Deletes a saved query.
*/
await gapi.client.cloudasset.savedQueries.delete({ name: "name",  });

/*
Gets details about a saved query.
*/
await gapi.client.cloudasset.savedQueries.get({ name: "name",  });

/*
Lists all saved queries in a parent project/folder/organization.
*/
await gapi.client.cloudasset.savedQueries.list({ parent: "parent",  });

/*
Updates a saved query.
*/
await gapi.client.cloudasset.savedQueries.patch({ name: "name",  });

/*
Analyzes IAM policies to answer which identities have what accesses on which resources.
*/
await gapi.client.cloudasset.v1.analyzeIamPolicy({ scope: "scope",  });

/*
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 AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.
*/
await gapi.client.cloudasset.v1.analyzeIamPolicyLongrunning({ scope: "scope",  });

/*
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.
*/
await gapi.client.cloudasset.v1.analyzeMove({ resource: "resource",  });

/*
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.
*/
await gapi.client.cloudasset.v1.batchGetAssetsHistory({ parent: "parent",  });

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

/*
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.
*/
await gapi.client.cloudasset.v1.searchAllIamPolicies({ scope: "scope",  });

/*
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.
*/
await gapi.client.cloudasset.v1.searchAllResources({ scope: "scope",  });
1.0.20220617

2 years ago

1.0.20220625

2 years ago

1.0.20220701

2 years ago

1.0.20220708

2 years ago

1.0.20220715

2 years ago

1.0.20220805

2 years ago

1.0.20220722

2 years ago

1.0.20220610

2 years ago

1.0.20220730

2 years ago

1.0.20220429

2 years ago

1.0.20220507

2 years ago

1.0.20220430

2 years ago

1.0.20220513

2 years ago

1.0.20220520

2 years ago

1.0.20220528

2 years ago

1.0.20220604

2 years ago

1.0.20220415

2 years ago

1.0.20220422

2 years ago

1.0.20220319

2 years ago

1.0.20220318

2 years ago

1.0.20220401

2 years ago

1.0.20220325

2 years ago

1.0.20220412

2 years ago

1.0.20220225

2 years ago

1.0.20220304

2 years ago

1.0.20220312

2 years ago

1.0.20220114

2 years ago

1.0.20220110

2 years ago

1.0.20220204

2 years ago

1.0.20220121

2 years ago

1.0.20220211

2 years ago

1.0.20220131

2 years ago

1.0.20211112

3 years ago

1.0.20211203

2 years ago

1.0.20211125

2 years ago

1.0.20211210

2 years ago

1.0.20211105

3 years ago

1.0.20211022

3 years ago

1.0.20211029

3 years ago

1.0.20211015

3 years ago

1.0.20210924

3 years ago

1.0.20210917

3 years ago

1.0.20210910

3 years ago

1.0.20210903

3 years ago

1.0.20210827

3 years ago

1.0.20210820

3 years ago

1.0.20210813

3 years ago

1.0.20210806

3 years ago

1.0.20210802

3 years ago

1.0.20210723

3 years ago

1.0.20210716

3 years ago

1.0.20210709

3 years ago

1.0.20210625

3 years ago

1.0.20210618

3 years ago

1.0.20210611

3 years ago

1.0.20210604

3 years ago

1.0.20210527

3 years ago

1.0.20210521

3 years ago

1.0.20210518

3 years ago

1.0.20210507

3 years ago

1.0.20210430

3 years ago

1.0.20210426

3 years ago

1.0.20210416

3 years ago

1.0.20210409

3 years ago

1.0.20210402

3 years ago

1.0.20210326

3 years ago

1.0.20210319

3 years ago

1.0.20210312

3 years ago

1.0.20210305

3 years ago

1.0.20210226

3 years ago

1.0.20210219

3 years ago

1.0.20210212

3 years ago

1.0.20210209

3 years ago

1.0.20210129

3 years ago

1.0.20210122

3 years ago

1.0.20210119

3 years ago

1.0.20210108

3 years ago

1.0.20210101

3 years ago

1.0.20201211

3 years ago

1.0.20201204

3 years ago

1.0.20201127

3 years ago

1.0.20201115

4 years ago

1.0.20201106

4 years ago