@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
103 lines • 3.92 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.RestApiPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an API Gateway REST API Policy.
*
* > **Note:** Amazon API Gateway Version 1 resources are used for creating and deploying REST APIs. To create and deploy WebSocket and HTTP APIs, use Amazon API Gateway Version 2 resources.
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const testRestApi = new aws.apigateway.RestApi("test", {name: "example-rest-api"});
* const test = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: ["*"],
* }],
* actions: ["execute-api:Invoke"],
* resources: [pulumi.interpolate`${testRestApi.executionArn}/*`],
* conditions: [{
* test: "IpAddress",
* variable: "aws:SourceIp",
* values: ["123.123.123.123/32"],
* }],
* }],
* });
* const testRestApiPolicy = new aws.apigateway.RestApiPolicy("test", {
* restApiId: testRestApi.id,
* policy: test.apply(test => test.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_api_gateway_rest_api_policy` using the REST API ID. For example:
*
* ```sh
* $ pulumi import aws:apigateway/restApiPolicy:RestApiPolicy example 12345abcde
* ```
*/
class RestApiPolicy extends pulumi.CustomResource {
/**
* Get an existing RestApiPolicy 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 RestApiPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of RestApiPolicy. 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'] === RestApiPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["policy"] = state?.policy;
resourceInputs["region"] = state?.region;
resourceInputs["restApiId"] = state?.restApiId;
}
else {
const args = argsOrState;
if (args?.policy === undefined && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if (args?.restApiId === undefined && !opts.urn) {
throw new Error("Missing required property 'restApiId'");
}
resourceInputs["policy"] = args?.policy;
resourceInputs["region"] = args?.region;
resourceInputs["restApiId"] = args?.restApiId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RestApiPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.RestApiPolicy = RestApiPolicy;
/** @internal */
RestApiPolicy.__pulumiType = 'aws:apigateway/restApiPolicy:RestApiPolicy';
//# sourceMappingURL=restApiPolicy.js.map
;