@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
105 lines • 4.89 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.SslCert = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates a new Google SQL SSL Cert on a Google SQL Instance. For more information, see the [official documentation](https://cloud.google.com/sql/), or the [JSON API](https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts).
*
* ## Example Usage
*
* Example creating a SQL Client Certificate.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
* const main = new gcp.sql.DatabaseInstance("main", {
* name: pulumi.interpolate`main-instance-${dbNameSuffix.hex}`,
* databaseVersion: "MYSQL_5_7",
* settings: {
* tier: "db-f1-micro",
* },
* });
* const clientCert = new gcp.sql.SslCert("client_cert", {
* commonName: "client-name",
* instance: main.name,
* });
* ```
*
* ## Import
*
* Since the contents of the certificate cannot be accessed after its creation, this resource cannot be imported.
*/
class SslCert extends pulumi.CustomResource {
/**
* Get an existing SslCert 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 SslCert(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of SslCert. 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'] === SslCert.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cert"] = state ? state.cert : undefined;
resourceInputs["certSerialNumber"] = state ? state.certSerialNumber : undefined;
resourceInputs["commonName"] = state ? state.commonName : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["expirationTime"] = state ? state.expirationTime : undefined;
resourceInputs["instance"] = state ? state.instance : undefined;
resourceInputs["privateKey"] = state ? state.privateKey : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["serverCaCert"] = state ? state.serverCaCert : undefined;
resourceInputs["sha1Fingerprint"] = state ? state.sha1Fingerprint : undefined;
}
else {
const args = argsOrState;
if ((!args || args.commonName === undefined) && !opts.urn) {
throw new Error("Missing required property 'commonName'");
}
if ((!args || args.instance === undefined) && !opts.urn) {
throw new Error("Missing required property 'instance'");
}
resourceInputs["commonName"] = args ? args.commonName : undefined;
resourceInputs["instance"] = args ? args.instance : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["cert"] = undefined /*out*/;
resourceInputs["certSerialNumber"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["expirationTime"] = undefined /*out*/;
resourceInputs["privateKey"] = undefined /*out*/;
resourceInputs["serverCaCert"] = undefined /*out*/;
resourceInputs["sha1Fingerprint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["cert", "privateKey", "serverCaCert"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(SslCert.__pulumiType, name, resourceInputs, opts);
}
}
exports.SslCert = SslCert;
/** @internal */
SslCert.__pulumiType = 'gcp:sql/sslCert:SslCert';
//# sourceMappingURL=sslCert.js.map