@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
164 lines • 7.35 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceRepresentationInstance = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* A source representation instance is a Cloud SQL instance that represents
* the source database server to the Cloud SQL replica. It is visible in the
* Cloud Console and appears the same as a regular Cloud SQL instance, but it
* contains no data, requires no configuration or maintenance, and does not
* affect billing. You cannot update the source representation instance.
*
* ## Example Usage
*
* ### Sql Source Representation Instance Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.sql.SourceRepresentationInstance("instance", {
* name: "my-instance",
* region: "us-central1",
* databaseVersion: "MYSQL_8_0",
* host: "10.20.30.40",
* port: 3306,
* username: "some-user",
* password: "password-for-the-user",
* dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
* });
* ```
* ### Sql Source Representation Instance Postgres
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.sql.SourceRepresentationInstance("instance", {
* name: "my-instance",
* region: "us-central1",
* databaseVersion: "POSTGRES_9_6",
* host: "10.20.30.40",
* port: 3306,
* username: "some-user",
* password: "password-for-the-user",
* dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
* });
* ```
*
* ## Import
*
* SourceRepresentationInstance can be imported using any of these accepted formats:
*
* * `projects/{{project}}/instances/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, SourceRepresentationInstance can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default projects/{{project}}/instances/{{name}}
* $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{project}}/{{name}}
* $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{name}}
* ```
*/
class SourceRepresentationInstance extends pulumi.CustomResource {
/**
* Get an existing SourceRepresentationInstance 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 SourceRepresentationInstance(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance';
/**
* Returns true if the given object is an instance of SourceRepresentationInstance. 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'] === SourceRepresentationInstance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["caCertificate"] = state?.caCertificate;
resourceInputs["clientCertificate"] = state?.clientCertificate;
resourceInputs["clientKey"] = state?.clientKey;
resourceInputs["databaseVersion"] = state?.databaseVersion;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["dumpFilePath"] = state?.dumpFilePath;
resourceInputs["host"] = state?.host;
resourceInputs["name"] = state?.name;
resourceInputs["password"] = state?.password;
resourceInputs["port"] = state?.port;
resourceInputs["project"] = state?.project;
resourceInputs["region"] = state?.region;
resourceInputs["username"] = state?.username;
}
else {
const args = argsOrState;
if (args?.databaseVersion === undefined && !opts.urn) {
throw new Error("Missing required property 'databaseVersion'");
}
if (args?.host === undefined && !opts.urn) {
throw new Error("Missing required property 'host'");
}
resourceInputs["caCertificate"] = args?.caCertificate;
resourceInputs["clientCertificate"] = args?.clientCertificate;
resourceInputs["clientKey"] = args?.clientKey;
resourceInputs["databaseVersion"] = args?.databaseVersion;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["dumpFilePath"] = args?.dumpFilePath;
resourceInputs["host"] = args?.host;
resourceInputs["name"] = args?.name;
resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined;
resourceInputs["port"] = args?.port;
resourceInputs["project"] = args?.project;
resourceInputs["region"] = args?.region;
resourceInputs["username"] = args?.username;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["password"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(SourceRepresentationInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.SourceRepresentationInstance = SourceRepresentationInstance;
//# sourceMappingURL=sourceRepresentationInstance.js.map