@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
102 lines • 3.94 kB
JavaScript
;
// *** 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.UsagePlanKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an API Gateway Usage Plan Key.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.apigateway.RestApi("test", {name: "MyDemoAPI"});
* // ...
* const myusageplan = new aws.apigateway.UsagePlan("myusageplan", {
* name: "my_usage_plan",
* apiStages: [{
* apiId: test.id,
* stage: foo.stageName,
* }],
* });
* const mykey = new aws.apigateway.ApiKey("mykey", {name: "my_key"});
* const main = new aws.apigateway.UsagePlanKey("main", {
* keyId: mykey.id,
* keyType: "API_KEY",
* usagePlanId: myusageplan.id,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import AWS API Gateway Usage Plan Key using the `USAGE-PLAN-ID/USAGE-PLAN-KEY-ID`. For example:
*
* ```sh
* $ pulumi import aws:apigateway/usagePlanKey:UsagePlanKey key 12345abcde/zzz
* ```
*/
class UsagePlanKey extends pulumi.CustomResource {
/**
* Get an existing UsagePlanKey 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 UsagePlanKey(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of UsagePlanKey. 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'] === UsagePlanKey.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["keyId"] = state?.keyId;
resourceInputs["keyType"] = state?.keyType;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["usagePlanId"] = state?.usagePlanId;
resourceInputs["value"] = state?.value;
}
else {
const args = argsOrState;
if (args?.keyId === undefined && !opts.urn) {
throw new Error("Missing required property 'keyId'");
}
if (args?.keyType === undefined && !opts.urn) {
throw new Error("Missing required property 'keyType'");
}
if (args?.usagePlanId === undefined && !opts.urn) {
throw new Error("Missing required property 'usagePlanId'");
}
resourceInputs["keyId"] = args?.keyId;
resourceInputs["keyType"] = args?.keyType;
resourceInputs["region"] = args?.region;
resourceInputs["usagePlanId"] = args?.usagePlanId;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["value"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(UsagePlanKey.__pulumiType, name, resourceInputs, opts);
}
}
exports.UsagePlanKey = UsagePlanKey;
/** @internal */
UsagePlanKey.__pulumiType = 'aws:apigateway/usagePlanKey:UsagePlanKey';
//# sourceMappingURL=usagePlanKey.js.map