@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
93 lines • 3.96 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsageExportBucket = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Sets up a usage export bucket for a particular project. A usage export bucket
* is a pre-configured GCS bucket which is set up to receive daily and monthly
* reports of the GCE resources used.
*
* For more information see the [Docs](https://cloud.google.com/compute/docs/usage-export)
* and for further details, the
* [API Documentation](https://cloud.google.com/compute/docs/reference/rest/beta/projects/setUsageExportBucket).
*
* > **Note:** You should specify only one of these per project. If there are two or more
* they will fight over which bucket the reports should be stored in. It is
* safe to have multiple resources with the same backing bucket.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const usageExport = new gcp.projects.UsageExportBucket("usage_export", {
* project: "development-project",
* bucketName: "usage-tracking-bucket",
* });
* ```
*
* ## Import
*
* A project's Usage Export Bucket can be imported using this format:
*
* * `{{project_id}}`
*
* When using the `pulumi import` command, NAME_HERE can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:projects/usageExportBucket:UsageExportBucket default {{project_id}}
* ```
*/
class UsageExportBucket extends pulumi.CustomResource {
/**
* Get an existing UsageExportBucket resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new UsageExportBucket(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of UsageExportBucket. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === UsageExportBucket.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bucketName"] = state ? state.bucketName : undefined;
resourceInputs["prefix"] = state ? state.prefix : undefined;
resourceInputs["project"] = state ? state.project : undefined;
}
else {
const args = argsOrState;
if ((!args || args.bucketName === undefined) && !opts.urn) {
throw new Error("Missing required property 'bucketName'");
}
resourceInputs["bucketName"] = args ? args.bucketName : undefined;
resourceInputs["prefix"] = args ? args.prefix : undefined;
resourceInputs["project"] = args ? args.project : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(UsageExportBucket.__pulumiType, name, resourceInputs, opts);
}
}
exports.UsageExportBucket = UsageExportBucket;
/** @internal */
UsageExportBucket.__pulumiType = 'gcp:projects/usageExportBucket:UsageExportBucket';
//# sourceMappingURL=usageExportBucket.js.map