@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
130 lines • 6.31 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.Api = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an Amazon API Gateway Version 2 API.
*
* > **Note:** Amazon API Gateway Version 2 resources are used for creating and deploying WebSocket and HTTP APIs. To create and deploy REST APIs, use Amazon API Gateway Version 1 resources.
*
* ## Example Usage
*
* ### Basic WebSocket API
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.apigatewayv2.Api("example", {
* name: "example-websocket-api",
* protocolType: "WEBSOCKET",
* routeSelectionExpression: "$request.body.action",
* });
* ```
*
* ### Basic HTTP API
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.apigatewayv2.Api("example", {
* name: "example-http-api",
* protocolType: "HTTP",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_apigatewayv2_api` using the API identifier. For example:
*
* ```sh
* $ pulumi import aws:apigatewayv2/api:Api example aabbccddee
* ```
*/
class Api extends pulumi.CustomResource {
/**
* Get an existing Api 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 Api(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Api. 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'] === Api.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiEndpoint"] = state ? state.apiEndpoint : undefined;
resourceInputs["apiKeySelectionExpression"] = state ? state.apiKeySelectionExpression : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["body"] = state ? state.body : undefined;
resourceInputs["corsConfiguration"] = state ? state.corsConfiguration : undefined;
resourceInputs["credentialsArn"] = state ? state.credentialsArn : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["disableExecuteApiEndpoint"] = state ? state.disableExecuteApiEndpoint : undefined;
resourceInputs["executionArn"] = state ? state.executionArn : undefined;
resourceInputs["failOnWarnings"] = state ? state.failOnWarnings : undefined;
resourceInputs["ipAddressType"] = state ? state.ipAddressType : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["protocolType"] = state ? state.protocolType : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["routeKey"] = state ? state.routeKey : undefined;
resourceInputs["routeSelectionExpression"] = state ? state.routeSelectionExpression : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["target"] = state ? state.target : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.protocolType === undefined) && !opts.urn) {
throw new Error("Missing required property 'protocolType'");
}
resourceInputs["apiKeySelectionExpression"] = args ? args.apiKeySelectionExpression : undefined;
resourceInputs["body"] = args ? args.body : undefined;
resourceInputs["corsConfiguration"] = args ? args.corsConfiguration : undefined;
resourceInputs["credentialsArn"] = args ? args.credentialsArn : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["disableExecuteApiEndpoint"] = args ? args.disableExecuteApiEndpoint : undefined;
resourceInputs["failOnWarnings"] = args ? args.failOnWarnings : undefined;
resourceInputs["ipAddressType"] = args ? args.ipAddressType : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["protocolType"] = args ? args.protocolType : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["routeKey"] = args ? args.routeKey : undefined;
resourceInputs["routeSelectionExpression"] = args ? args.routeSelectionExpression : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["version"] = args ? args.version : undefined;
resourceInputs["apiEndpoint"] = undefined /*out*/;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["executionArn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Api.__pulumiType, name, resourceInputs, opts);
}
}
exports.Api = Api;
/** @internal */
Api.__pulumiType = 'aws:apigatewayv2/api:Api';
//# sourceMappingURL=api.js.map