@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
130 lines • 5.6 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, { ...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?.apiEndpoint;
resourceInputs["apiKeySelectionExpression"] = state?.apiKeySelectionExpression;
resourceInputs["arn"] = state?.arn;
resourceInputs["body"] = state?.body;
resourceInputs["corsConfiguration"] = state?.corsConfiguration;
resourceInputs["credentialsArn"] = state?.credentialsArn;
resourceInputs["description"] = state?.description;
resourceInputs["disableExecuteApiEndpoint"] = state?.disableExecuteApiEndpoint;
resourceInputs["executionArn"] = state?.executionArn;
resourceInputs["failOnWarnings"] = state?.failOnWarnings;
resourceInputs["ipAddressType"] = state?.ipAddressType;
resourceInputs["name"] = state?.name;
resourceInputs["protocolType"] = state?.protocolType;
resourceInputs["region"] = state?.region;
resourceInputs["routeKey"] = state?.routeKey;
resourceInputs["routeSelectionExpression"] = state?.routeSelectionExpression;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["target"] = state?.target;
resourceInputs["version"] = state?.version;
}
else {
const args = argsOrState;
if (args?.protocolType === undefined && !opts.urn) {
throw new Error("Missing required property 'protocolType'");
}
resourceInputs["apiKeySelectionExpression"] = args?.apiKeySelectionExpression;
resourceInputs["body"] = args?.body;
resourceInputs["corsConfiguration"] = args?.corsConfiguration;
resourceInputs["credentialsArn"] = args?.credentialsArn;
resourceInputs["description"] = args?.description;
resourceInputs["disableExecuteApiEndpoint"] = args?.disableExecuteApiEndpoint;
resourceInputs["failOnWarnings"] = args?.failOnWarnings;
resourceInputs["ipAddressType"] = args?.ipAddressType;
resourceInputs["name"] = args?.name;
resourceInputs["protocolType"] = args?.protocolType;
resourceInputs["region"] = args?.region;
resourceInputs["routeKey"] = args?.routeKey;
resourceInputs["routeSelectionExpression"] = args?.routeSelectionExpression;
resourceInputs["tags"] = args?.tags;
resourceInputs["target"] = args?.target;
resourceInputs["version"] = args?.version;
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