Class FunctionUrl


  • public class FunctionUrl
    extends com.pulumi.resources.CustomResource
    Manages a Lambda function URL. Creates a dedicated HTTP(S) endpoint for a Lambda function to enable direct invocation via HTTP requests. > **NOTE:** When [`authorizationType` is `"NONE"`](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html#urls-auth-none) the `lambda:InvokeFunctionUrl` permission allowing a public endpoint and `lambda:InvokeFunction` permission with the `InvokedViaFunctionUrl` flag set to `true` are automatically added to the Lambda function on creation. These policies are NOT removed from AWS when the resource is destroyed. ## Example Usage ### Basic Function URL with No Authentication
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lambda.FunctionUrl;
     import com.pulumi.aws.lambda.FunctionUrlArgs;
     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 FunctionUrl("example", FunctionUrlArgs.builder()
                 .functionName(exampleAwsLambdaFunction.functionName())
                 .authorizationType("NONE")
                 .build());
     
         }
     }
     
     
    ### Function URL with IAM Authentication and CORS Configuration
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lambda.FunctionUrl;
     import com.pulumi.aws.lambda.FunctionUrlArgs;
     import com.pulumi.aws.lambda.inputs.FunctionUrlCorsArgs;
     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 FunctionUrl("example", FunctionUrlArgs.builder()
                 .cors(FunctionUrlCorsArgs.builder()
                     .allowCredentials(true)
                     .allowOrigins("https://example.com")
                     .allowMethods(                
                         "GET",
                         "POST")
                     .allowHeaders(                
                         "date",
                         "keep-alive")
                     .exposeHeaders(                
                         "keep-alive",
                         "date")
                     .maxAge(86400)
                     .build())
                 .functionName(exampleAwsLambdaFunction.functionName())
                 .qualifier("my_alias")
                 .authorizationType("AWS_IAM")
                 .invokeMode("RESPONSE_STREAM")
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Lambda function URLs using the `functionName` or `function_name/qualifier`. For example: ```sh $ pulumi import aws:lambda/functionUrl:FunctionUrl example example ```
    • 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> authorizationType()  
      com.pulumi.core.Output<java.util.Optional<FunctionUrlCors>> cors()  
      com.pulumi.core.Output<java.lang.String> functionArn()  
      com.pulumi.core.Output<java.lang.String> functionName()  
      com.pulumi.core.Output<java.lang.String> functionUrl()  
      static FunctionUrl get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, FunctionUrlState 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.lang.String>> invokeMode()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> qualifier()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> urlId()  
      • 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

      • FunctionUrl

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

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

        public FunctionUrl​(java.lang.String name,
                           FunctionUrlArgs 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

      • authorizationType

        public com.pulumi.core.Output<java.lang.String> authorizationType()
        Returns:
        Type of authentication that the function URL uses. Valid values are `AWS_IAM` and `NONE`.
      • cors

        public com.pulumi.core.Output<java.util.Optional<FunctionUrlCors>> cors()
        Returns:
        Cross-origin resource sharing (CORS) settings for the function URL. See below.
      • functionArn

        public com.pulumi.core.Output<java.lang.String> functionArn()
        Returns:
        ARN of the Lambda function.
      • functionName

        public com.pulumi.core.Output<java.lang.String> functionName()
        Returns:
        Name or ARN of the Lambda function. The following arguments are optional:
      • functionUrl

        public com.pulumi.core.Output<java.lang.String> functionUrl()
        Returns:
        HTTP URL endpoint for the function in the format `https://<url_id>.lambda-url.<region>.on.aws/`.
      • invokeMode

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> invokeMode()
        Returns:
        How the Lambda function responds to an invocation. Valid values are `BUFFERED` (default) and `RESPONSE_STREAM`.
      • qualifier

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> qualifier()
        Returns:
        Alias name or `$LATEST`.
      • 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.
      • urlId

        public com.pulumi.core.Output<java.lang.String> urlId()
        Returns:
        Generated ID for the endpoint.
      • get

        public static FunctionUrl get​(java.lang.String name,
                                      com.pulumi.core.Output<java.lang.String> id,
                                      @Nullable
                                      FunctionUrlState 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.