UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

259 lines (258 loc) • 8.59 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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 * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ApiState, opts?: pulumi.CustomResourceOptions): Api; /** * 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: any): obj is Api; /** * ARN of the Event API. */ readonly apiArn: pulumi.Output<string>; /** * ID of the Event API. */ readonly apiId: pulumi.Output<string>; /** * DNS configuration for the Event API. */ readonly dns: pulumi.Output<{ [key: string]: string; }>; /** * Configuration for the Event API. See Event Config below. */ readonly eventConfig: pulumi.Output<outputs.appsync.ApiEventConfig | undefined>; /** * Name of the Event API. * * The following arguments are optional: */ readonly name: pulumi.Output<string>; /** * Contact information for the owner of the Event API. */ readonly ownerContact: pulumi.Output<string | undefined>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * ARN of the associated WAF web ACL. */ readonly wafWebAclArn: pulumi.Output<string>; readonly xrayEnabled: pulumi.Output<boolean>; /** * Create a Api resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: ApiArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Api resources. */ export interface ApiState { /** * ARN of the Event API. */ apiArn?: pulumi.Input<string>; /** * ID of the Event API. */ apiId?: pulumi.Input<string>; /** * DNS configuration for the Event API. */ dns?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Configuration for the Event API. See Event Config below. */ eventConfig?: pulumi.Input<inputs.appsync.ApiEventConfig>; /** * Name of the Event API. * * The following arguments are optional: */ name?: pulumi.Input<string>; /** * Contact information for the owner of the Event API. */ ownerContact?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * ARN of the associated WAF web ACL. */ wafWebAclArn?: pulumi.Input<string>; xrayEnabled?: pulumi.Input<boolean>; } /** * The set of arguments for constructing a Api resource. */ export interface ApiArgs { /** * Configuration for the Event API. See Event Config below. */ eventConfig?: pulumi.Input<inputs.appsync.ApiEventConfig>; /** * Name of the Event API. * * The following arguments are optional: */ name?: pulumi.Input<string>; /** * Contact information for the owner of the Event API. */ ownerContact?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }