@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
190 lines • 8.65 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.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A Google Cloud Memcache instance.
*
* To get more information about Instance, see:
*
* * [API documentation](https://cloud.google.com/memorystore/docs/memcached/reference/rest/v1/projects.locations.instances)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/memcache/docs/creating-instances)
*
* ## Example Usage
*
* ### Memcache Instance Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* // This example assumes this network already exists.
* // The API creates a tenant network per network authorized for a
* // Memcache instance and that network is not deleted when the user-created
* // network (authorized_network) is deleted, so this prevents issues
* // with tenant network quota.
* // If this network hasn't been created and you are using this example in your
* // config, add an additional network resource or change
* // this from "data"to "resource"
* const memcacheNetwork = new gcp.compute.Network("memcache_network", {name: "test-network"});
* const serviceRange = new gcp.compute.GlobalAddress("service_range", {
* name: "address",
* purpose: "VPC_PEERING",
* addressType: "INTERNAL",
* prefixLength: 16,
* network: memcacheNetwork.id,
* });
* const privateServiceConnection = new gcp.servicenetworking.Connection("private_service_connection", {
* network: memcacheNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [serviceRange.name],
* });
* const instance = new gcp.memcache.Instance("instance", {
* name: "test-instance",
* authorizedNetwork: privateServiceConnection.network,
* labels: {
* env: "test",
* },
* nodeConfig: {
* cpuCount: 1,
* memorySizeMb: 1024,
* },
* nodeCount: 1,
* memcacheVersion: "MEMCACHE_1_5",
* maintenancePolicy: {
* weeklyMaintenanceWindows: [{
* day: "SATURDAY",
* duration: "14400s",
* startTime: {
* hours: 0,
* minutes: 30,
* seconds: 0,
* nanos: 0,
* },
* }],
* },
* });
* ```
*
* ## Import
*
* Instance can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{region}}/instances/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:memcache/instance:Instance default projects/{{project}}/locations/{{region}}/instances/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:memcache/instance:Instance default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:memcache/instance:Instance default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:memcache/instance:Instance default {{name}}
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance 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 Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["authorizedNetwork"] = state ? state.authorizedNetwork : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["discoveryEndpoint"] = state ? state.discoveryEndpoint : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["maintenancePolicy"] = state ? state.maintenancePolicy : undefined;
resourceInputs["maintenanceSchedules"] = state ? state.maintenanceSchedules : undefined;
resourceInputs["memcacheFullVersion"] = state ? state.memcacheFullVersion : undefined;
resourceInputs["memcacheNodes"] = state ? state.memcacheNodes : undefined;
resourceInputs["memcacheParameters"] = state ? state.memcacheParameters : undefined;
resourceInputs["memcacheVersion"] = state ? state.memcacheVersion : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nodeConfig"] = state ? state.nodeConfig : undefined;
resourceInputs["nodeCount"] = state ? state.nodeCount : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["reservedIpRangeIds"] = state ? state.reservedIpRangeIds : undefined;
resourceInputs["zones"] = state ? state.zones : undefined;
}
else {
const args = argsOrState;
if ((!args || args.nodeConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeConfig'");
}
if ((!args || args.nodeCount === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeCount'");
}
resourceInputs["authorizedNetwork"] = args ? args.authorizedNetwork : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["maintenancePolicy"] = args ? args.maintenancePolicy : undefined;
resourceInputs["memcacheParameters"] = args ? args.memcacheParameters : undefined;
resourceInputs["memcacheVersion"] = args ? args.memcacheVersion : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["nodeConfig"] = args ? args.nodeConfig : undefined;
resourceInputs["nodeCount"] = args ? args.nodeCount : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["reservedIpRangeIds"] = args ? args.reservedIpRangeIds : undefined;
resourceInputs["zones"] = args ? args.zones : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["discoveryEndpoint"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["maintenanceSchedules"] = undefined /*out*/;
resourceInputs["memcacheFullVersion"] = undefined /*out*/;
resourceInputs["memcacheNodes"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'gcp:memcache/instance:Instance';
//# sourceMappingURL=instance.js.map