@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
147 lines • 6.76 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.SourceRepresentationInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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}}
* ```
*
* ```sh
* $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{project}}/{{name}}
* ```
*
* ```sh
* $ 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.caCertificate : undefined;
resourceInputs["clientCertificate"] = state ? state.clientCertificate : undefined;
resourceInputs["clientKey"] = state ? state.clientKey : undefined;
resourceInputs["databaseVersion"] = state ? state.databaseVersion : undefined;
resourceInputs["dumpFilePath"] = state ? state.dumpFilePath : undefined;
resourceInputs["host"] = state ? state.host : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["username"] = state ? state.username : undefined;
}
else {
const args = argsOrState;
if ((!args || args.databaseVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'databaseVersion'");
}
if ((!args || args.host === undefined) && !opts.urn) {
throw new Error("Missing required property 'host'");
}
resourceInputs["caCertificate"] = args ? args.caCertificate : undefined;
resourceInputs["clientCertificate"] = args ? args.clientCertificate : undefined;
resourceInputs["clientKey"] = args ? args.clientKey : undefined;
resourceInputs["databaseVersion"] = args ? args.databaseVersion : undefined;
resourceInputs["dumpFilePath"] = args ? args.dumpFilePath : undefined;
resourceInputs["host"] = args ? args.host : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["password"] = (args === null || args === void 0 ? void 0 : args.password) ? pulumi.secret(args.password) : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["username"] = args ? args.username : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["password"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(SourceRepresentationInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.SourceRepresentationInstance = SourceRepresentationInstance;
/** @internal */
SourceRepresentationInstance.__pulumiType = 'gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance';
//# sourceMappingURL=sourceRepresentationInstance.js.map