"use strict";
// *** 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.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.index.Id("db_name_suffix", {byteLength: 4});
 * const main = new gcp.sql.DatabaseInstance("main", {
 *     name: `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, { ...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?.cert;
            resourceInputs["certSerialNumber"] = state?.certSerialNumber;
            resourceInputs["commonName"] = state?.commonName;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["expirationTime"] = state?.expirationTime;
            resourceInputs["instance"] = state?.instance;
            resourceInputs["privateKey"] = state?.privateKey;
            resourceInputs["project"] = state?.project;
            resourceInputs["serverCaCert"] = state?.serverCaCert;
            resourceInputs["sha1Fingerprint"] = state?.sha1Fingerprint;
        }
        else {
            const args = argsOrState;
            if (args?.commonName === undefined && !opts.urn) {
                throw new Error("Missing required property 'commonName'");
            }
            if (args?.instance === undefined && !opts.urn) {
                throw new Error("Missing required property 'instance'");
            }
            resourceInputs["commonName"] = args?.commonName;
            resourceInputs["instance"] = args?.instance;
            resourceInputs["project"] = args?.project;
            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