@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
120 lines • 4.76 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnywhereCache = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The Google Cloud Storage (GCS) Anywhere Cache feature allows users to
* create SSD backed zonal read cache for their buckets. These zonal
* caches are co-located with the customers compute engines to provide
* cost efficiency.
*
* ## Example Usage
*
* ### Storage Anywhere Cache Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumiverse/time";
*
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "bucket-name",
* location: "US",
* });
* const destroyWait5000Seconds = new time.index.Sleep("destroy_wait_5000_seconds", {destroyDuration: "5000s"}, {
* dependsOn: [bucket],
* });
* const cache = new gcp.storage.AnywhereCache("cache", {
* bucket: bucket.name,
* zone: "us-central1-f",
* ttl: "3601s",
* }, {
* dependsOn: [destroyWait5000Seconds],
* });
* ```
*
* ## Import
*
* AnywhereCache can be imported using any of these accepted formats:
*
* * `b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}`
*
* * `{{bucket}}/{{anywhere_cache_id}}`
*
* When using the `pulumi import` command, AnywhereCache can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:storage/anywhereCache:AnywhereCache default b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
* ```
*
* ```sh
* $ pulumi import gcp:storage/anywhereCache:AnywhereCache default {{bucket}}/{{anywhere_cache_id}}
* ```
*/
class AnywhereCache extends pulumi.CustomResource {
/**
* Get an existing AnywhereCache 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 AnywhereCache(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AnywhereCache. 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'] === AnywhereCache.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["admissionPolicy"] = state?.admissionPolicy;
resourceInputs["anywhereCacheId"] = state?.anywhereCacheId;
resourceInputs["bucket"] = state?.bucket;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["pendingUpdate"] = state?.pendingUpdate;
resourceInputs["state"] = state?.state;
resourceInputs["ttl"] = state?.ttl;
resourceInputs["updateTime"] = state?.updateTime;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
if (args?.zone === undefined && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["admissionPolicy"] = args?.admissionPolicy;
resourceInputs["bucket"] = args?.bucket;
resourceInputs["ttl"] = args?.ttl;
resourceInputs["zone"] = args?.zone;
resourceInputs["anywhereCacheId"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["pendingUpdate"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AnywhereCache.__pulumiType, name, resourceInputs, opts);
}
}
exports.AnywhereCache = AnywhereCache;
/** @internal */
AnywhereCache.__pulumiType = 'gcp:storage/anywhereCache:AnywhereCache';
//# sourceMappingURL=anywhereCache.js.map
;