UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

131 lines 5.5 kB
"use strict"; // *** 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.Certificate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a WAF certificate resource within HuaweiCloud. * * > **NOTE:** All WAF resources depend on WAF instances, and the WAF instances need to be purchased before they can be * used. The certificate resource can be used in Cloud Mode and Dedicated Mode. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const enterpriseProjectId = config.requireObject("enterpriseProjectId"); * const test = new huaweicloud.waf.Certificate("test", { * enterpriseProjectId: enterpriseProjectId, * certificate: `-----BEGIN CERTIFICATE----- * MIIFmQl5dh2QUAeo39TIKtadgAgh4zHx09kSgayS9Wph9LEqq7MA+2042L3J9aOa * DAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUR+SosWwALt6PkP0J9iOIxA6RW8gVsLwq * ... * +HhDvD/VeOHytX3RAs2GeTOtxyAV5XpKY5r+PkyUqPJj04t3d0Fopi0gNtLpMF= * -----END CERTIFICATE----- * `, * privateKey: `-----BEGIN PRIVATE KEY----- * MIIJwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAM * ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu * ... * he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC * 1qoJFlcDyqSMo5iHq3HLjs * -----END PRIVATE KEY----- * `, * }); * ``` * * ## Import * * There are two ways to import WAF certificate state. * Using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Waf/certificate:Certificate test <id> * ``` * * * Using `id` and `enterprise_project_id`, separated by a slash, e.g. bash * * ```sh * $ pulumi import huaweicloud:Waf/certificate:Certificate test <id>/<enterprise_project_id> * ``` * * Note that the imported state is not identical to your resource definition, due to security reason. The missing attributes include `certificate`, and `private_key`. You can ignore changes as below. hcl resource "huaweicloud_waf_certificate" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * certificate, private_key * * ] * * } } */ class Certificate extends pulumi.CustomResource { /** * Get an existing Certificate 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 Certificate(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Certificate. 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'] === Certificate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["certificate"] = state ? state.certificate : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined; resourceInputs["expiration"] = state ? state.expiration : undefined; resourceInputs["expiredAt"] = state ? state.expiredAt : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["privateKey"] = state ? state.privateKey : undefined; resourceInputs["region"] = state ? state.region : undefined; } else { const args = argsOrState; if ((!args || args.certificate === undefined) && !opts.urn) { throw new Error("Missing required property 'certificate'"); } if ((!args || args.privateKey === undefined) && !opts.urn) { throw new Error("Missing required property 'privateKey'"); } resourceInputs["certificate"] = args ? args.certificate : undefined; resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["privateKey"] = args ? args.privateKey : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["expiration"] = undefined /*out*/; resourceInputs["expiredAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Certificate.__pulumiType, name, resourceInputs, opts); } } exports.Certificate = Certificate; /** @internal */ Certificate.__pulumiType = 'huaweicloud:Waf/certificate:Certificate'; //# sourceMappingURL=certificate.js.map