Socket
Book a DemoInstallSign in
Socket

@google-cloud/asset

Package Overview
Dependencies
Maintainers
4
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/asset

Cloud Asset API client for Node.js

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
25K
128.09%
Maintainers
4
Weekly downloads
 
Created
Source

Google Cloud Platform logo

Google Cloud Asset Inventory: Node.js Client

release level npm version codecov

Cloud Asset Inventory is a storage service that keeps a five week history of Google Cloud Platform (GCP) asset metadata. It allows you to export all asset metadata at a certain timestamp or timeframe.

Using the client library

  • [Select or create a Cloud Platform project][projects].

  • [Enable billing for your project][billing].

  • [Enable the Google Cloud Asset Inventory API][enable_api].

  • [Set up authentication with a service account][auth] so you can access the API from your local workstation.

  • Install the client library:

     npm install --save @google-cloud/asset
    
  • Try an example:

  const asset = require('@google-cloud/asset');
  const client = new asset.v1beta1.AssetServiceClient({
    // optional auth parameters.
  });

  // Your Google Cloud Platform project ID
  const projectId = process.env.GCLOUD_PROJECT;
  const projectResource = client.projectPath(projectId);

  // var dumpFilePath = 'Dump file path, e.g.: gs://<my_bucket>/<my_asset_file>'
  const outputConfig = {
    gcsDestination: {
      uri: dumpFilePath,
    },
  };
  const request = {
    parent: projectResource,
    outputConfig: outputConfig,
  };

  // Handle the operation using the promise pattern.
  const [operation] = await client.exportAssets(request);
  // Operation#promise starts polling for the completion of the operation.
  const [result] = await operation.promise();
  // Do things with with the response.
  console.log(result);

The [Cloud Asset Node.js Client API Reference][client-docs] documentation also contains samples.

Versioning

This library follows Semantic Versioning.

This library is considered to be in alpha. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

What's Next

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

[client-docs]: [product-docs]: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com [auth]: https://cloud.google.com/docs/authentication/getting-started

Keywords

google apis client

FAQs

Package last updated on 04 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts