UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

136 lines 6.09 kB
"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.CaCertificate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates and manages an AWS IoT CA Certificate. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as tls from "@pulumi/tls"; * * const caPrivateKey = new tls.PrivateKey("ca", {algorithm: "RSA"}); * const ca = new tls.SelfSignedCert("ca", { * privateKeyPem: caPrivateKey.privateKeyPem, * subject: [{ * commonName: "example.com", * organization: "ACME Examples, Inc", * }], * validityPeriodHours: 12, * allowedUses: [ * "key_encipherment", * "digital_signature", * "server_auth", * ], * isCaCertificate: true, * }); * const verificationPrivateKey = new tls.PrivateKey("verification", {algorithm: "RSA"}); * const example = aws.iot.getRegistrationCode({}); * const verification = new tls.CertRequest("verification", { * privateKeyPem: verificationPrivateKey.privateKeyPem, * subject: [{ * commonName: example.then(example => example.registrationCode), * }], * }); * const verificationLocallySignedCert = new tls.LocallySignedCert("verification", { * certRequestPem: verification.certRequestPem, * caPrivateKeyPem: caPrivateKey.privateKeyPem, * caCertPem: ca.certPem, * validityPeriodHours: 12, * allowedUses: [ * "key_encipherment", * "digital_signature", * "server_auth", * ], * }); * const exampleCaCertificate = new aws.iot.CaCertificate("example", { * active: true, * caCertificatePem: ca.certPem, * verificationCertificatePem: verificationLocallySignedCert.certPem, * allowAutoRegistration: true, * }); * ``` */ class CaCertificate extends pulumi.CustomResource { /** * Get an existing CaCertificate 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 CaCertificate(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of CaCertificate. 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'] === CaCertificate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["active"] = state?.active; resourceInputs["allowAutoRegistration"] = state?.allowAutoRegistration; resourceInputs["arn"] = state?.arn; resourceInputs["caCertificatePem"] = state?.caCertificatePem; resourceInputs["certificateMode"] = state?.certificateMode; resourceInputs["customerVersion"] = state?.customerVersion; resourceInputs["generationId"] = state?.generationId; resourceInputs["region"] = state?.region; resourceInputs["registrationConfig"] = state?.registrationConfig; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["validities"] = state?.validities; resourceInputs["verificationCertificatePem"] = state?.verificationCertificatePem; } else { const args = argsOrState; if (args?.active === undefined && !opts.urn) { throw new Error("Missing required property 'active'"); } if (args?.allowAutoRegistration === undefined && !opts.urn) { throw new Error("Missing required property 'allowAutoRegistration'"); } if (args?.caCertificatePem === undefined && !opts.urn) { throw new Error("Missing required property 'caCertificatePem'"); } resourceInputs["active"] = args?.active; resourceInputs["allowAutoRegistration"] = args?.allowAutoRegistration; resourceInputs["caCertificatePem"] = args?.caCertificatePem ? pulumi.secret(args.caCertificatePem) : undefined; resourceInputs["certificateMode"] = args?.certificateMode; resourceInputs["region"] = args?.region; resourceInputs["registrationConfig"] = args?.registrationConfig; resourceInputs["tags"] = args?.tags; resourceInputs["verificationCertificatePem"] = args?.verificationCertificatePem ? pulumi.secret(args.verificationCertificatePem) : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["customerVersion"] = undefined /*out*/; resourceInputs["generationId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["validities"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["caCertificatePem", "verificationCertificatePem"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(CaCertificate.__pulumiType, name, resourceInputs, opts); } } exports.CaCertificate = CaCertificate; /** @internal */ CaCertificate.__pulumiType = 'aws:iot/caCertificate:CaCertificate'; //# sourceMappingURL=caCertificate.js.map