Class Authorizer


  • public class Authorizer
    extends com.pulumi.resources.CustomResource
    Manages an Amazon API Gateway Version 2 authorizer. More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html). ## Example Usage ### Basic WebSocket API
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.apigatewayv2.Authorizer;
     import com.pulumi.aws.apigatewayv2.AuthorizerArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new Authorizer("example", AuthorizerArgs.builder()
                 .apiId(exampleAwsApigatewayv2Api.id())
                 .authorizerType("REQUEST")
                 .authorizerUri(exampleAwsLambdaFunction.invokeArn())
                 .identitySources("route.request.header.Auth")
                 .name("example-authorizer")
                 .build());
     
         }
     }
     
     
    ### Basic HTTP API
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.apigatewayv2.Authorizer;
     import com.pulumi.aws.apigatewayv2.AuthorizerArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new Authorizer("example", AuthorizerArgs.builder()
                 .apiId(exampleAwsApigatewayv2Api.id())
                 .authorizerType("REQUEST")
                 .authorizerUri(exampleAwsLambdaFunction.invokeArn())
                 .identitySources("$request.header.Authorization")
                 .name("example-authorizer")
                 .authorizerPayloadFormatVersion("2.0")
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import `aws.apigatewayv2.Authorizer` using the API identifier and authorizer identifier. For example: ```sh $ pulumi import aws:apigatewayv2/authorizer:Authorizer example aabbccddee/1122334 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> apiId()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerCredentialsArn()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerPayloadFormatVersion()  
      com.pulumi.core.Output<java.lang.Integer> authorizerResultTtlInSeconds()  
      com.pulumi.core.Output<java.lang.String> authorizerType()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerUri()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableSimpleResponses()  
      static Authorizer get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AuthorizerState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> identitySources()  
      com.pulumi.core.Output<java.util.Optional<AuthorizerJwtConfiguration>> jwtConfiguration()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> region()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Authorizer

        public Authorizer​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Authorizer

        public Authorizer​(java.lang.String name,
                          AuthorizerArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Authorizer

        public Authorizer​(java.lang.String name,
                          AuthorizerArgs args,
                          @Nullable
                          com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • apiId

        public com.pulumi.core.Output<java.lang.String> apiId()
        Returns:
        API identifier.
      • authorizerCredentialsArn

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerCredentialsArn()
        Returns:
        Required credentials as an IAM role for API Gateway to invoke the authorizer. Supported only for `REQUEST` authorizers.
      • authorizerPayloadFormatVersion

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerPayloadFormatVersion()
        Returns:
        Format of the payload sent to an HTTP API Lambda authorizer. Required for HTTP API Lambda authorizers. Valid values: `1.0`, `2.0`.
      • authorizerResultTtlInSeconds

        public com.pulumi.core.Output<java.lang.Integer> authorizerResultTtlInSeconds()
        Returns:
        Time to live (TTL) for cached authorizer results, in seconds. If it equals 0, authorization caching is disabled. If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Defaults to `300`. Supported only for HTTP API Lambda authorizers.
      • authorizerType

        public com.pulumi.core.Output<java.lang.String> authorizerType()
        Returns:
        Authorizer type. Valid values: `JWT`, `REQUEST`. Specify `REQUEST` for a Lambda function using incoming request parameters. For HTTP APIs, specify `JWT` to use JSON Web Tokens.
      • authorizerUri

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerUri()
        Returns:
        Authorizer's URI. For `REQUEST` authorizers this must be a well-formed Lambda function URI, such as the `invokeArn` attribute of the `aws.lambda.Function` resource. Supported only for `REQUEST` authorizers. Must be between 1 and 2048 characters in length.
      • enableSimpleResponses

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enableSimpleResponses()
        Returns:
        Whether a Lambda authorizer returns a response in a simple format. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. Supported only for HTTP APIs.
      • identitySources

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> identitySources()
        Returns:
        Identity sources for which authorization is requested. For `REQUEST` authorizers the value is a list of one or more mapping expressions of the specified request parameters. For `JWT` authorizers the single entry specifies where to extract the JSON Web Token (JWT) from inbound requests.
      • jwtConfiguration

        public com.pulumi.core.Output<java.util.Optional<AuthorizerJwtConfiguration>> jwtConfiguration()
        Returns:
        Configuration of a JWT authorizer. Required for the `JWT` authorizer type. Supported only for HTTP APIs. See `jwtConfiguration` Block below.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the authorizer. Must be between 1 and 128 characters in length.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        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.
      • get

        public static Authorizer get​(java.lang.String name,
                                     com.pulumi.core.Output<java.lang.String> id,
                                     @Nullable
                                     AuthorizerState state,
                                     @Nullable
                                     com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.