@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
167 lines • 5.89 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 [AWS AppSync Event API](https://docs.aws.amazon.com/appsync/latest/eventapi/event-api-concepts.html#API). Event APIs enable real-time subscriptions and event-driven communication in AppSync applications.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.appsync.Api("example", {
* name: "example-event-api",
* eventConfig: {
* authProviders: [{
* authType: "API_KEY",
* }],
* connectionAuthModes: [{
* authType: "API_KEY",
* }],
* defaultPublishAuthModes: [{
* authType: "API_KEY",
* }],
* defaultSubscribeAuthModes: [{
* authType: "API_KEY",
* }],
* },
* });
* ```
*
* ### With Cognito Authentication
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cognito.UserPool("example", {name: "example-user-pool"});
* const current = aws.getRegion({});
* const exampleApi = new aws.appsync.Api("example", {
* name: "example-event-api",
* eventConfig: {
* authProviders: [{
* authType: "AMAZON_COGNITO_USER_POOLS",
* cognitoConfig: {
* userPoolId: example.id,
* awsRegion: current.then(current => current.name),
* },
* }],
* connectionAuthModes: [{
* authType: "AMAZON_COGNITO_USER_POOLS",
* }],
* defaultPublishAuthModes: [{
* authType: "AMAZON_COGNITO_USER_POOLS",
* }],
* defaultSubscribeAuthModes: [{
* authType: "AMAZON_COGNITO_USER_POOLS",
* }],
* },
* });
* ```
*
* ### With Lambda Authorizer
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.appsync.Api("example", {
* name: "example-event-api",
* eventConfig: {
* authProviders: [{
* authType: "AWS_LAMBDA",
* lambdaAuthorizerConfig: {
* authorizerUri: exampleAwsLambdaFunction.invokeArn,
* authorizerResultTtlInSeconds: 300,
* },
* }],
* connectionAuthModes: [{
* authType: "AWS_LAMBDA",
* }],
* defaultPublishAuthModes: [{
* authType: "AWS_LAMBDA",
* }],
* defaultSubscribeAuthModes: [{
* authType: "AWS_LAMBDA",
* }],
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import AppSync Event API using the `api_id`. For example:
*
* ```sh
* $ pulumi import aws:appsync/api:Api example example-api-id
* ```
*/
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["apiArn"] = state?.apiArn;
resourceInputs["apiId"] = state?.apiId;
resourceInputs["dns"] = state?.dns;
resourceInputs["eventConfig"] = state?.eventConfig;
resourceInputs["name"] = state?.name;
resourceInputs["ownerContact"] = state?.ownerContact;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["wafWebAclArn"] = state?.wafWebAclArn;
resourceInputs["xrayEnabled"] = state?.xrayEnabled;
}
else {
const args = argsOrState;
resourceInputs["eventConfig"] = args?.eventConfig;
resourceInputs["name"] = args?.name;
resourceInputs["ownerContact"] = args?.ownerContact;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["apiArn"] = undefined /*out*/;
resourceInputs["apiId"] = undefined /*out*/;
resourceInputs["dns"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["wafWebAclArn"] = undefined /*out*/;
resourceInputs["xrayEnabled"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Api.__pulumiType, name, resourceInputs, opts);
}
}
exports.Api = Api;
/** @internal */
Api.__pulumiType = 'aws:appsync/api:Api';
//# sourceMappingURL=api.js.map
;