UNPKG

@pulumi/aws

Version:

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

136 lines 6.61 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.index.PrivateKey("ca", {algorithm: "RSA"}); * const ca = new tls.index.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.index.PrivateKey("verification", {algorithm: "RSA"}); * const example = aws.iot.getRegistrationCode({}); * const verification = new tls.index.CertRequest("verification", { * privateKeyPem: verificationPrivateKey.privateKeyPem, * subject: [{ * commonName: example.registrationCode, * }], * }); * const verificationLocallySignedCert = new tls.index.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, Object.assign(Object.assign({}, 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 ? state.active : undefined; resourceInputs["allowAutoRegistration"] = state ? state.allowAutoRegistration : undefined; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["caCertificatePem"] = state ? state.caCertificatePem : undefined; resourceInputs["certificateMode"] = state ? state.certificateMode : undefined; resourceInputs["customerVersion"] = state ? state.customerVersion : undefined; resourceInputs["generationId"] = state ? state.generationId : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["registrationConfig"] = state ? state.registrationConfig : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["validities"] = state ? state.validities : undefined; resourceInputs["verificationCertificatePem"] = state ? state.verificationCertificatePem : undefined; } else { const args = argsOrState; if ((!args || args.active === undefined) && !opts.urn) { throw new Error("Missing required property 'active'"); } if ((!args || args.allowAutoRegistration === undefined) && !opts.urn) { throw new Error("Missing required property 'allowAutoRegistration'"); } if ((!args || args.caCertificatePem === undefined) && !opts.urn) { throw new Error("Missing required property 'caCertificatePem'"); } resourceInputs["active"] = args ? args.active : undefined; resourceInputs["allowAutoRegistration"] = args ? args.allowAutoRegistration : undefined; resourceInputs["caCertificatePem"] = (args === null || args === void 0 ? void 0 : args.caCertificatePem) ? pulumi.secret(args.caCertificatePem) : undefined; resourceInputs["certificateMode"] = args ? args.certificateMode : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["registrationConfig"] = args ? args.registrationConfig : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["verificationCertificatePem"] = (args === null || args === void 0 ? void 0 : 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