{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lambda.CreateFunction
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a Lambda function. To create a function, you need a
-- <https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html deployment package>
-- and an
-- <https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role execution role>.
-- The deployment package is a .zip file archive or container image that
-- contains your function code. The execution role grants the function
-- permission to use Amazon Web Services services, such as Amazon
-- CloudWatch Logs for log streaming and X-Ray for request tracing.
--
-- You set the package type to @Image@ if the deployment package is a
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html container image>.
-- For a container image, the code property must include the URI of a
-- container image in the Amazon ECR registry. You do not need to specify
-- the handler and runtime properties.
--
-- You set the package type to @Zip@ if the deployment package is a
-- <https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip .zip file archive>.
-- For a .zip file archive, the code property specifies the location of the
-- .zip file. You must also specify the handler and runtime properties. The
-- code in the deployment package must be compatible with the target
-- instruction set architecture of the function (@x86-64@ or @arm64@). If
-- you do not specify the architecture, the default value is @x86-64@.
--
-- When you create a function, Lambda provisions an instance of the
-- function and its supporting resources. If your function connects to a
-- VPC, this process can take a minute or so. During this time, you can\'t
-- invoke or modify the function. The @State@, @StateReason@, and
-- @StateReasonCode@ fields in the response from GetFunctionConfiguration
-- indicate when the function is ready to invoke. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html Function States>.
--
-- A function has an unpublished version, and can have published versions
-- and aliases. The unpublished version changes when you update your
-- function\'s code and configuration. A published version is a snapshot of
-- your function code and configuration that can\'t be changed. An alias is
-- a named resource that maps to a version, and can be changed to map to a
-- different version. Use the @Publish@ parameter to create version @1@ of
-- your function from its initial configuration.
--
-- The other parameters let you configure version-specific and
-- function-level settings. You can modify version-specific settings later
-- with UpdateFunctionConfiguration. Function-level settings apply to both
-- the unpublished and published versions of the function, and include tags
-- (TagResource) and per-function concurrency limits
-- (PutFunctionConcurrency).
--
-- You can use code signing if your deployment package is a .zip file
-- archive. To enable code signing for this function, specify the ARN of a
-- code-signing configuration. When a user attempts to deploy a code
-- package with UpdateFunctionCode, Lambda checks that the code package has
-- a valid signature from a trusted publisher. The code-signing
-- configuration includes set set of signing profiles, which define the
-- trusted publishers for this function.
--
-- If another account or an Amazon Web Services service invokes your
-- function, use AddPermission to grant permission by creating a
-- resource-based IAM policy. You can grant permissions at the function
-- level, on a version, or on an alias.
--
-- To invoke your function directly, use Invoke. To invoke your function in
-- response to events in other Amazon Web Services services, create an
-- event source mapping (CreateEventSourceMapping), or configure a function
-- trigger in the other service. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-invocation.html Invoking Functions>.
module Amazonka.Lambda.CreateFunction
  ( -- * Creating a Request
    CreateFunction (..),
    newCreateFunction,

    -- * Request Lenses
    createFunction_memorySize,
    createFunction_runtime,
    createFunction_kmsKeyArn,
    createFunction_packageType,
    createFunction_fileSystemConfigs,
    createFunction_environment,
    createFunction_imageConfig,
    createFunction_deadLetterConfig,
    createFunction_architectures,
    createFunction_codeSigningConfigArn,
    createFunction_vpcConfig,
    createFunction_layers,
    createFunction_handler,
    createFunction_timeout,
    createFunction_tracingConfig,
    createFunction_description,
    createFunction_tags,
    createFunction_publish,
    createFunction_functionName,
    createFunction_role,
    createFunction_code,

    -- * Destructuring the Response
    FunctionConfiguration (..),
    newFunctionConfiguration,

    -- * Response Lenses
    functionConfiguration_memorySize,
    functionConfiguration_runtime,
    functionConfiguration_state,
    functionConfiguration_signingProfileVersionArn,
    functionConfiguration_lastUpdateStatus,
    functionConfiguration_functionArn,
    functionConfiguration_kmsKeyArn,
    functionConfiguration_packageType,
    functionConfiguration_fileSystemConfigs,
    functionConfiguration_environment,
    functionConfiguration_deadLetterConfig,
    functionConfiguration_architectures,
    functionConfiguration_signingJobArn,
    functionConfiguration_role,
    functionConfiguration_vpcConfig,
    functionConfiguration_version,
    functionConfiguration_functionName,
    functionConfiguration_layers,
    functionConfiguration_codeSize,
    functionConfiguration_handler,
    functionConfiguration_timeout,
    functionConfiguration_lastUpdateStatusReason,
    functionConfiguration_stateReason,
    functionConfiguration_lastModified,
    functionConfiguration_codeSha256,
    functionConfiguration_tracingConfig,
    functionConfiguration_stateReasonCode,
    functionConfiguration_imageConfigResponse,
    functionConfiguration_description,
    functionConfiguration_lastUpdateStatusReasonCode,
    functionConfiguration_revisionId,
    functionConfiguration_masterArn,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateFunction' smart constructor.
data CreateFunction = CreateFunction'
  { -- | The amount of
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html memory available to the function>
    -- at runtime. Increasing the function memory also increases its CPU
    -- allocation. The default value is 128 MB. The value can be any multiple
    -- of 1 MB.
    CreateFunction -> Maybe Natural
memorySize :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the function\'s
    -- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html runtime>.
    CreateFunction -> Maybe Runtime
runtime :: Prelude.Maybe Runtime,
    -- | The ARN of the Amazon Web Services Key Management Service (KMS) key
    -- that\'s used to encrypt your function\'s environment variables. If it\'s
    -- not provided, Lambda uses a default service key.
    CreateFunction -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text,
    -- | The type of deployment package. Set to @Image@ for container image and
    -- set @Zip@ for ZIP archive.
    CreateFunction -> Maybe PackageType
packageType :: Prelude.Maybe PackageType,
    -- | Connection settings for an Amazon EFS file system.
    CreateFunction -> Maybe [FileSystemConfig]
fileSystemConfigs :: Prelude.Maybe [FileSystemConfig],
    -- | Environment variables that are accessible from function code during
    -- execution.
    CreateFunction -> Maybe Environment
environment :: Prelude.Maybe Environment,
    -- | Container image
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-images.html#configuration-images-settings configuration values>
    -- that override the values in the container image Dockerfile.
    CreateFunction -> Maybe ImageConfig
imageConfig :: Prelude.Maybe ImageConfig,
    -- | A dead letter queue configuration that specifies the queue or topic
    -- where Lambda sends asynchronous events when they fail processing. For
    -- more information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#dlq Dead Letter Queues>.
    CreateFunction -> Maybe DeadLetterConfig
deadLetterConfig :: Prelude.Maybe DeadLetterConfig,
    -- | The instruction set architecture that the function supports. Enter a
    -- string array with one of the valid values. The default value is
    -- @x86_64@.
    CreateFunction -> Maybe (NonEmpty Architecture)
architectures :: Prelude.Maybe (Prelude.NonEmpty Architecture),
    -- | To enable code signing for this function, specify the ARN of a
    -- code-signing configuration. A code-signing configuration includes a set
    -- of signing profiles, which define the trusted publishers for this
    -- function.
    CreateFunction -> Maybe Text
codeSigningConfigArn :: Prelude.Maybe Prelude.Text,
    -- | For network connectivity to Amazon Web Services resources in a VPC,
    -- specify a list of security groups and subnets in the VPC. When you
    -- connect a function to a VPC, it can only access resources and the
    -- internet through that VPC. For more information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html VPC Settings>.
    CreateFunction -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig,
    -- | A list of
    -- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html function layers>
    -- to add to the function\'s execution environment. Specify each layer by
    -- its ARN, including the version.
    CreateFunction -> Maybe [Text]
layers :: Prelude.Maybe [Prelude.Text],
    -- | The name of the method within your code that Lambda calls to execute
    -- your function. The format includes the file name. It can also include
    -- namespaces and other qualifiers, depending on the runtime. For more
    -- information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/programming-model-v2.html Programming Model>.
    CreateFunction -> Maybe Text
handler :: Prelude.Maybe Prelude.Text,
    -- | The amount of time that Lambda allows a function to run before stopping
    -- it. The default is 3 seconds. The maximum allowed value is 900 seconds.
    -- For additional information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html Lambda execution environment>.
    CreateFunction -> Maybe Natural
timeout :: Prelude.Maybe Prelude.Natural,
    -- | Set @Mode@ to @Active@ to sample and trace a subset of incoming requests
    -- with
    -- <https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html X-Ray>.
    CreateFunction -> Maybe TracingConfig
tracingConfig :: Prelude.Maybe TracingConfig,
    -- | A description of the function.
    CreateFunction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of
    -- <https://docs.aws.amazon.com/lambda/latest/dg/tagging.html tags> to
    -- apply to the function.
    CreateFunction -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Set to true to publish the first version of the function during
    -- creation.
    CreateFunction -> Maybe Bool
publish :: Prelude.Maybe Prelude.Bool,
    -- | The name of the Lambda function.
    --
    -- __Name formats__
    --
    -- -   __Function name__ - @my-function@.
    --
    -- -   __Function ARN__ -
    --     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
    --
    -- -   __Partial ARN__ - @123456789012:function:my-function@.
    --
    -- The length constraint applies only to the full ARN. If you specify only
    -- the function name, it is limited to 64 characters in length.
    CreateFunction -> Text
functionName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the function\'s execution role.
    CreateFunction -> Text
role' :: Prelude.Text,
    -- | The code for the function.
    CreateFunction -> FunctionCode
code :: FunctionCode
  }
  deriving (CreateFunction -> CreateFunction -> Bool
(CreateFunction -> CreateFunction -> Bool)
-> (CreateFunction -> CreateFunction -> Bool) -> Eq CreateFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFunction -> CreateFunction -> Bool
$c/= :: CreateFunction -> CreateFunction -> Bool
== :: CreateFunction -> CreateFunction -> Bool
$c== :: CreateFunction -> CreateFunction -> Bool
Prelude.Eq, Int -> CreateFunction -> ShowS
[CreateFunction] -> ShowS
CreateFunction -> String
(Int -> CreateFunction -> ShowS)
-> (CreateFunction -> String)
-> ([CreateFunction] -> ShowS)
-> Show CreateFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFunction] -> ShowS
$cshowList :: [CreateFunction] -> ShowS
show :: CreateFunction -> String
$cshow :: CreateFunction -> String
showsPrec :: Int -> CreateFunction -> ShowS
$cshowsPrec :: Int -> CreateFunction -> ShowS
Prelude.Show, (forall x. CreateFunction -> Rep CreateFunction x)
-> (forall x. Rep CreateFunction x -> CreateFunction)
-> Generic CreateFunction
forall x. Rep CreateFunction x -> CreateFunction
forall x. CreateFunction -> Rep CreateFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFunction x -> CreateFunction
$cfrom :: forall x. CreateFunction -> Rep CreateFunction x
Prelude.Generic)

-- |
-- Create a value of 'CreateFunction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'memorySize', 'createFunction_memorySize' - The amount of
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html memory available to the function>
-- at runtime. Increasing the function memory also increases its CPU
-- allocation. The default value is 128 MB. The value can be any multiple
-- of 1 MB.
--
-- 'runtime', 'createFunction_runtime' - The identifier of the function\'s
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html runtime>.
--
-- 'kmsKeyArn', 'createFunction_kmsKeyArn' - The ARN of the Amazon Web Services Key Management Service (KMS) key
-- that\'s used to encrypt your function\'s environment variables. If it\'s
-- not provided, Lambda uses a default service key.
--
-- 'packageType', 'createFunction_packageType' - The type of deployment package. Set to @Image@ for container image and
-- set @Zip@ for ZIP archive.
--
-- 'fileSystemConfigs', 'createFunction_fileSystemConfigs' - Connection settings for an Amazon EFS file system.
--
-- 'environment', 'createFunction_environment' - Environment variables that are accessible from function code during
-- execution.
--
-- 'imageConfig', 'createFunction_imageConfig' - Container image
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-images.html#configuration-images-settings configuration values>
-- that override the values in the container image Dockerfile.
--
-- 'deadLetterConfig', 'createFunction_deadLetterConfig' - A dead letter queue configuration that specifies the queue or topic
-- where Lambda sends asynchronous events when they fail processing. For
-- more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#dlq Dead Letter Queues>.
--
-- 'architectures', 'createFunction_architectures' - The instruction set architecture that the function supports. Enter a
-- string array with one of the valid values. The default value is
-- @x86_64@.
--
-- 'codeSigningConfigArn', 'createFunction_codeSigningConfigArn' - To enable code signing for this function, specify the ARN of a
-- code-signing configuration. A code-signing configuration includes a set
-- of signing profiles, which define the trusted publishers for this
-- function.
--
-- 'vpcConfig', 'createFunction_vpcConfig' - For network connectivity to Amazon Web Services resources in a VPC,
-- specify a list of security groups and subnets in the VPC. When you
-- connect a function to a VPC, it can only access resources and the
-- internet through that VPC. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html VPC Settings>.
--
-- 'layers', 'createFunction_layers' - A list of
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html function layers>
-- to add to the function\'s execution environment. Specify each layer by
-- its ARN, including the version.
--
-- 'handler', 'createFunction_handler' - The name of the method within your code that Lambda calls to execute
-- your function. The format includes the file name. It can also include
-- namespaces and other qualifiers, depending on the runtime. For more
-- information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/programming-model-v2.html Programming Model>.
--
-- 'timeout', 'createFunction_timeout' - The amount of time that Lambda allows a function to run before stopping
-- it. The default is 3 seconds. The maximum allowed value is 900 seconds.
-- For additional information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html Lambda execution environment>.
--
-- 'tracingConfig', 'createFunction_tracingConfig' - Set @Mode@ to @Active@ to sample and trace a subset of incoming requests
-- with
-- <https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html X-Ray>.
--
-- 'description', 'createFunction_description' - A description of the function.
--
-- 'tags', 'createFunction_tags' - A list of
-- <https://docs.aws.amazon.com/lambda/latest/dg/tagging.html tags> to
-- apply to the function.
--
-- 'publish', 'createFunction_publish' - Set to true to publish the first version of the function during
-- creation.
--
-- 'functionName', 'createFunction_functionName' - The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ - @my-function@.
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ - @123456789012:function:my-function@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it is limited to 64 characters in length.
--
-- 'role'', 'createFunction_role' - The Amazon Resource Name (ARN) of the function\'s execution role.
--
-- 'code', 'createFunction_code' - The code for the function.
newCreateFunction ::
  -- | 'functionName'
  Prelude.Text ->
  -- | 'role''
  Prelude.Text ->
  -- | 'code'
  FunctionCode ->
  CreateFunction
newCreateFunction :: Text -> Text -> FunctionCode -> CreateFunction
newCreateFunction Text
pFunctionName_ Text
pRole_ FunctionCode
pCode_ =
  CreateFunction' :: Maybe Natural
-> Maybe Runtime
-> Maybe Text
-> Maybe PackageType
-> Maybe [FileSystemConfig]
-> Maybe Environment
-> Maybe ImageConfig
-> Maybe DeadLetterConfig
-> Maybe (NonEmpty Architecture)
-> Maybe Text
-> Maybe VpcConfig
-> Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> Maybe TracingConfig
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> Text
-> Text
-> FunctionCode
-> CreateFunction
CreateFunction'
    { $sel:memorySize:CreateFunction' :: Maybe Natural
memorySize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:runtime:CreateFunction' :: Maybe Runtime
runtime = Maybe Runtime
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyArn:CreateFunction' :: Maybe Text
kmsKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:packageType:CreateFunction' :: Maybe PackageType
packageType = Maybe PackageType
forall a. Maybe a
Prelude.Nothing,
      $sel:fileSystemConfigs:CreateFunction' :: Maybe [FileSystemConfig]
fileSystemConfigs = Maybe [FileSystemConfig]
forall a. Maybe a
Prelude.Nothing,
      $sel:environment:CreateFunction' :: Maybe Environment
environment = Maybe Environment
forall a. Maybe a
Prelude.Nothing,
      $sel:imageConfig:CreateFunction' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:deadLetterConfig:CreateFunction' :: Maybe DeadLetterConfig
deadLetterConfig = Maybe DeadLetterConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:architectures:CreateFunction' :: Maybe (NonEmpty Architecture)
architectures = Maybe (NonEmpty Architecture)
forall a. Maybe a
Prelude.Nothing,
      $sel:codeSigningConfigArn:CreateFunction' :: Maybe Text
codeSigningConfigArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:CreateFunction' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:layers:CreateFunction' :: Maybe [Text]
layers = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:handler:CreateFunction' :: Maybe Text
handler = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeout:CreateFunction' :: Maybe Natural
timeout = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:tracingConfig:CreateFunction' :: Maybe TracingConfig
tracingConfig = Maybe TracingConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateFunction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateFunction' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:publish:CreateFunction' :: Maybe Bool
publish = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:functionName:CreateFunction' :: Text
functionName = Text
pFunctionName_,
      $sel:role':CreateFunction' :: Text
role' = Text
pRole_,
      $sel:code:CreateFunction' :: FunctionCode
code = FunctionCode
pCode_
    }

-- | The amount of
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html memory available to the function>
-- at runtime. Increasing the function memory also increases its CPU
-- allocation. The default value is 128 MB. The value can be any multiple
-- of 1 MB.
createFunction_memorySize :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Natural)
createFunction_memorySize :: (Maybe Natural -> f (Maybe Natural))
-> CreateFunction -> f CreateFunction
createFunction_memorySize = (CreateFunction -> Maybe Natural)
-> (CreateFunction -> Maybe Natural -> CreateFunction)
-> Lens
     CreateFunction CreateFunction (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Natural
memorySize :: Maybe Natural
$sel:memorySize:CreateFunction' :: CreateFunction -> Maybe Natural
memorySize} -> Maybe Natural
memorySize) (\s :: CreateFunction
s@CreateFunction' {} Maybe Natural
a -> CreateFunction
s {$sel:memorySize:CreateFunction' :: Maybe Natural
memorySize = Maybe Natural
a} :: CreateFunction)

-- | The identifier of the function\'s
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html runtime>.
createFunction_runtime :: Lens.Lens' CreateFunction (Prelude.Maybe Runtime)
createFunction_runtime :: (Maybe Runtime -> f (Maybe Runtime))
-> CreateFunction -> f CreateFunction
createFunction_runtime = (CreateFunction -> Maybe Runtime)
-> (CreateFunction -> Maybe Runtime -> CreateFunction)
-> Lens
     CreateFunction CreateFunction (Maybe Runtime) (Maybe Runtime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Runtime
runtime :: Maybe Runtime
$sel:runtime:CreateFunction' :: CreateFunction -> Maybe Runtime
runtime} -> Maybe Runtime
runtime) (\s :: CreateFunction
s@CreateFunction' {} Maybe Runtime
a -> CreateFunction
s {$sel:runtime:CreateFunction' :: Maybe Runtime
runtime = Maybe Runtime
a} :: CreateFunction)

-- | The ARN of the Amazon Web Services Key Management Service (KMS) key
-- that\'s used to encrypt your function\'s environment variables. If it\'s
-- not provided, Lambda uses a default service key.
createFunction_kmsKeyArn :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_kmsKeyArn :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_kmsKeyArn = (CreateFunction -> Maybe Text)
-> (CreateFunction -> Maybe Text -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:CreateFunction' :: CreateFunction -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:kmsKeyArn:CreateFunction' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: CreateFunction)

-- | The type of deployment package. Set to @Image@ for container image and
-- set @Zip@ for ZIP archive.
createFunction_packageType :: Lens.Lens' CreateFunction (Prelude.Maybe PackageType)
createFunction_packageType :: (Maybe PackageType -> f (Maybe PackageType))
-> CreateFunction -> f CreateFunction
createFunction_packageType = (CreateFunction -> Maybe PackageType)
-> (CreateFunction -> Maybe PackageType -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe PackageType)
     (Maybe PackageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe PackageType
packageType :: Maybe PackageType
$sel:packageType:CreateFunction' :: CreateFunction -> Maybe PackageType
packageType} -> Maybe PackageType
packageType) (\s :: CreateFunction
s@CreateFunction' {} Maybe PackageType
a -> CreateFunction
s {$sel:packageType:CreateFunction' :: Maybe PackageType
packageType = Maybe PackageType
a} :: CreateFunction)

-- | Connection settings for an Amazon EFS file system.
createFunction_fileSystemConfigs :: Lens.Lens' CreateFunction (Prelude.Maybe [FileSystemConfig])
createFunction_fileSystemConfigs :: (Maybe [FileSystemConfig] -> f (Maybe [FileSystemConfig]))
-> CreateFunction -> f CreateFunction
createFunction_fileSystemConfigs = (CreateFunction -> Maybe [FileSystemConfig])
-> (CreateFunction -> Maybe [FileSystemConfig] -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe [FileSystemConfig])
     (Maybe [FileSystemConfig])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe [FileSystemConfig]
fileSystemConfigs :: Maybe [FileSystemConfig]
$sel:fileSystemConfigs:CreateFunction' :: CreateFunction -> Maybe [FileSystemConfig]
fileSystemConfigs} -> Maybe [FileSystemConfig]
fileSystemConfigs) (\s :: CreateFunction
s@CreateFunction' {} Maybe [FileSystemConfig]
a -> CreateFunction
s {$sel:fileSystemConfigs:CreateFunction' :: Maybe [FileSystemConfig]
fileSystemConfigs = Maybe [FileSystemConfig]
a} :: CreateFunction) ((Maybe [FileSystemConfig] -> f (Maybe [FileSystemConfig]))
 -> CreateFunction -> f CreateFunction)
-> ((Maybe [FileSystemConfig] -> f (Maybe [FileSystemConfig]))
    -> Maybe [FileSystemConfig] -> f (Maybe [FileSystemConfig]))
-> (Maybe [FileSystemConfig] -> f (Maybe [FileSystemConfig]))
-> CreateFunction
-> f CreateFunction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FileSystemConfig]
  [FileSystemConfig]
  [FileSystemConfig]
  [FileSystemConfig]
-> Iso
     (Maybe [FileSystemConfig])
     (Maybe [FileSystemConfig])
     (Maybe [FileSystemConfig])
     (Maybe [FileSystemConfig])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [FileSystemConfig]
  [FileSystemConfig]
  [FileSystemConfig]
  [FileSystemConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Environment variables that are accessible from function code during
-- execution.
createFunction_environment :: Lens.Lens' CreateFunction (Prelude.Maybe Environment)
createFunction_environment :: (Maybe Environment -> f (Maybe Environment))
-> CreateFunction -> f CreateFunction
createFunction_environment = (CreateFunction -> Maybe Environment)
-> (CreateFunction -> Maybe Environment -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe Environment)
     (Maybe Environment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Environment
environment :: Maybe Environment
$sel:environment:CreateFunction' :: CreateFunction -> Maybe Environment
environment} -> Maybe Environment
environment) (\s :: CreateFunction
s@CreateFunction' {} Maybe Environment
a -> CreateFunction
s {$sel:environment:CreateFunction' :: Maybe Environment
environment = Maybe Environment
a} :: CreateFunction)

-- | Container image
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-images.html#configuration-images-settings configuration values>
-- that override the values in the container image Dockerfile.
createFunction_imageConfig :: Lens.Lens' CreateFunction (Prelude.Maybe ImageConfig)
createFunction_imageConfig :: (Maybe ImageConfig -> f (Maybe ImageConfig))
-> CreateFunction -> f CreateFunction
createFunction_imageConfig = (CreateFunction -> Maybe ImageConfig)
-> (CreateFunction -> Maybe ImageConfig -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe ImageConfig)
     (Maybe ImageConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe ImageConfig
imageConfig :: Maybe ImageConfig
$sel:imageConfig:CreateFunction' :: CreateFunction -> Maybe ImageConfig
imageConfig} -> Maybe ImageConfig
imageConfig) (\s :: CreateFunction
s@CreateFunction' {} Maybe ImageConfig
a -> CreateFunction
s {$sel:imageConfig:CreateFunction' :: Maybe ImageConfig
imageConfig = Maybe ImageConfig
a} :: CreateFunction)

-- | A dead letter queue configuration that specifies the queue or topic
-- where Lambda sends asynchronous events when they fail processing. For
-- more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#dlq Dead Letter Queues>.
createFunction_deadLetterConfig :: Lens.Lens' CreateFunction (Prelude.Maybe DeadLetterConfig)
createFunction_deadLetterConfig :: (Maybe DeadLetterConfig -> f (Maybe DeadLetterConfig))
-> CreateFunction -> f CreateFunction
createFunction_deadLetterConfig = (CreateFunction -> Maybe DeadLetterConfig)
-> (CreateFunction -> Maybe DeadLetterConfig -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe DeadLetterConfig)
     (Maybe DeadLetterConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe DeadLetterConfig
deadLetterConfig :: Maybe DeadLetterConfig
$sel:deadLetterConfig:CreateFunction' :: CreateFunction -> Maybe DeadLetterConfig
deadLetterConfig} -> Maybe DeadLetterConfig
deadLetterConfig) (\s :: CreateFunction
s@CreateFunction' {} Maybe DeadLetterConfig
a -> CreateFunction
s {$sel:deadLetterConfig:CreateFunction' :: Maybe DeadLetterConfig
deadLetterConfig = Maybe DeadLetterConfig
a} :: CreateFunction)

-- | The instruction set architecture that the function supports. Enter a
-- string array with one of the valid values. The default value is
-- @x86_64@.
createFunction_architectures :: Lens.Lens' CreateFunction (Prelude.Maybe (Prelude.NonEmpty Architecture))
createFunction_architectures :: (Maybe (NonEmpty Architecture)
 -> f (Maybe (NonEmpty Architecture)))
-> CreateFunction -> f CreateFunction
createFunction_architectures = (CreateFunction -> Maybe (NonEmpty Architecture))
-> (CreateFunction
    -> Maybe (NonEmpty Architecture) -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe (NonEmpty Architecture))
     (Maybe (NonEmpty Architecture))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe (NonEmpty Architecture)
architectures :: Maybe (NonEmpty Architecture)
$sel:architectures:CreateFunction' :: CreateFunction -> Maybe (NonEmpty Architecture)
architectures} -> Maybe (NonEmpty Architecture)
architectures) (\s :: CreateFunction
s@CreateFunction' {} Maybe (NonEmpty Architecture)
a -> CreateFunction
s {$sel:architectures:CreateFunction' :: Maybe (NonEmpty Architecture)
architectures = Maybe (NonEmpty Architecture)
a} :: CreateFunction) ((Maybe (NonEmpty Architecture)
  -> f (Maybe (NonEmpty Architecture)))
 -> CreateFunction -> f CreateFunction)
-> ((Maybe (NonEmpty Architecture)
     -> f (Maybe (NonEmpty Architecture)))
    -> Maybe (NonEmpty Architecture)
    -> f (Maybe (NonEmpty Architecture)))
-> (Maybe (NonEmpty Architecture)
    -> f (Maybe (NonEmpty Architecture)))
-> CreateFunction
-> f CreateFunction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Architecture)
  (NonEmpty Architecture)
  (NonEmpty Architecture)
  (NonEmpty Architecture)
-> Iso
     (Maybe (NonEmpty Architecture))
     (Maybe (NonEmpty Architecture))
     (Maybe (NonEmpty Architecture))
     (Maybe (NonEmpty Architecture))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Architecture)
  (NonEmpty Architecture)
  (NonEmpty Architecture)
  (NonEmpty Architecture)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | To enable code signing for this function, specify the ARN of a
-- code-signing configuration. A code-signing configuration includes a set
-- of signing profiles, which define the trusted publishers for this
-- function.
createFunction_codeSigningConfigArn :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_codeSigningConfigArn :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_codeSigningConfigArn = (CreateFunction -> Maybe Text)
-> (CreateFunction -> Maybe Text -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Text
codeSigningConfigArn :: Maybe Text
$sel:codeSigningConfigArn:CreateFunction' :: CreateFunction -> Maybe Text
codeSigningConfigArn} -> Maybe Text
codeSigningConfigArn) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:codeSigningConfigArn:CreateFunction' :: Maybe Text
codeSigningConfigArn = Maybe Text
a} :: CreateFunction)

-- | For network connectivity to Amazon Web Services resources in a VPC,
-- specify a list of security groups and subnets in the VPC. When you
-- connect a function to a VPC, it can only access resources and the
-- internet through that VPC. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html VPC Settings>.
createFunction_vpcConfig :: Lens.Lens' CreateFunction (Prelude.Maybe VpcConfig)
createFunction_vpcConfig :: (Maybe VpcConfig -> f (Maybe VpcConfig))
-> CreateFunction -> f CreateFunction
createFunction_vpcConfig = (CreateFunction -> Maybe VpcConfig)
-> (CreateFunction -> Maybe VpcConfig -> CreateFunction)
-> Lens
     CreateFunction CreateFunction (Maybe VpcConfig) (Maybe VpcConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
$sel:vpcConfig:CreateFunction' :: CreateFunction -> Maybe VpcConfig
vpcConfig} -> Maybe VpcConfig
vpcConfig) (\s :: CreateFunction
s@CreateFunction' {} Maybe VpcConfig
a -> CreateFunction
s {$sel:vpcConfig:CreateFunction' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
a} :: CreateFunction)

-- | A list of
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html function layers>
-- to add to the function\'s execution environment. Specify each layer by
-- its ARN, including the version.
createFunction_layers :: Lens.Lens' CreateFunction (Prelude.Maybe [Prelude.Text])
createFunction_layers :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateFunction -> f CreateFunction
createFunction_layers = (CreateFunction -> Maybe [Text])
-> (CreateFunction -> Maybe [Text] -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe [Text]
layers :: Maybe [Text]
$sel:layers:CreateFunction' :: CreateFunction -> Maybe [Text]
layers} -> Maybe [Text]
layers) (\s :: CreateFunction
s@CreateFunction' {} Maybe [Text]
a -> CreateFunction
s {$sel:layers:CreateFunction' :: Maybe [Text]
layers = Maybe [Text]
a} :: CreateFunction) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateFunction -> f CreateFunction)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateFunction
-> f CreateFunction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the method within your code that Lambda calls to execute
-- your function. The format includes the file name. It can also include
-- namespaces and other qualifiers, depending on the runtime. For more
-- information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/programming-model-v2.html Programming Model>.
createFunction_handler :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_handler :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_handler = (CreateFunction -> Maybe Text)
-> (CreateFunction -> Maybe Text -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Text
handler :: Maybe Text
$sel:handler:CreateFunction' :: CreateFunction -> Maybe Text
handler} -> Maybe Text
handler) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:handler:CreateFunction' :: Maybe Text
handler = Maybe Text
a} :: CreateFunction)

-- | The amount of time that Lambda allows a function to run before stopping
-- it. The default is 3 seconds. The maximum allowed value is 900 seconds.
-- For additional information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html Lambda execution environment>.
createFunction_timeout :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Natural)
createFunction_timeout :: (Maybe Natural -> f (Maybe Natural))
-> CreateFunction -> f CreateFunction
createFunction_timeout = (CreateFunction -> Maybe Natural)
-> (CreateFunction -> Maybe Natural -> CreateFunction)
-> Lens
     CreateFunction CreateFunction (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Natural
timeout :: Maybe Natural
$sel:timeout:CreateFunction' :: CreateFunction -> Maybe Natural
timeout} -> Maybe Natural
timeout) (\s :: CreateFunction
s@CreateFunction' {} Maybe Natural
a -> CreateFunction
s {$sel:timeout:CreateFunction' :: Maybe Natural
timeout = Maybe Natural
a} :: CreateFunction)

-- | Set @Mode@ to @Active@ to sample and trace a subset of incoming requests
-- with
-- <https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html X-Ray>.
createFunction_tracingConfig :: Lens.Lens' CreateFunction (Prelude.Maybe TracingConfig)
createFunction_tracingConfig :: (Maybe TracingConfig -> f (Maybe TracingConfig))
-> CreateFunction -> f CreateFunction
createFunction_tracingConfig = (CreateFunction -> Maybe TracingConfig)
-> (CreateFunction -> Maybe TracingConfig -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe TracingConfig)
     (Maybe TracingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe TracingConfig
tracingConfig :: Maybe TracingConfig
$sel:tracingConfig:CreateFunction' :: CreateFunction -> Maybe TracingConfig
tracingConfig} -> Maybe TracingConfig
tracingConfig) (\s :: CreateFunction
s@CreateFunction' {} Maybe TracingConfig
a -> CreateFunction
s {$sel:tracingConfig:CreateFunction' :: Maybe TracingConfig
tracingConfig = Maybe TracingConfig
a} :: CreateFunction)

-- | A description of the function.
createFunction_description :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_description :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_description = (CreateFunction -> Maybe Text)
-> (CreateFunction -> Maybe Text -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Text
description :: Maybe Text
$sel:description:CreateFunction' :: CreateFunction -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:description:CreateFunction' :: Maybe Text
description = Maybe Text
a} :: CreateFunction)

-- | A list of
-- <https://docs.aws.amazon.com/lambda/latest/dg/tagging.html tags> to
-- apply to the function.
createFunction_tags :: Lens.Lens' CreateFunction (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createFunction_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateFunction -> f CreateFunction
createFunction_tags = (CreateFunction -> Maybe (HashMap Text Text))
-> (CreateFunction -> Maybe (HashMap Text Text) -> CreateFunction)
-> Lens
     CreateFunction
     CreateFunction
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateFunction' :: CreateFunction -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateFunction
s@CreateFunction' {} Maybe (HashMap Text Text)
a -> CreateFunction
s {$sel:tags:CreateFunction' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateFunction) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateFunction -> f CreateFunction)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateFunction
-> f CreateFunction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Set to true to publish the first version of the function during
-- creation.
createFunction_publish :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Bool)
createFunction_publish :: (Maybe Bool -> f (Maybe Bool))
-> CreateFunction -> f CreateFunction
createFunction_publish = (CreateFunction -> Maybe Bool)
-> (CreateFunction -> Maybe Bool -> CreateFunction)
-> Lens CreateFunction CreateFunction (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe Bool
publish :: Maybe Bool
$sel:publish:CreateFunction' :: CreateFunction -> Maybe Bool
publish} -> Maybe Bool
publish) (\s :: CreateFunction
s@CreateFunction' {} Maybe Bool
a -> CreateFunction
s {$sel:publish:CreateFunction' :: Maybe Bool
publish = Maybe Bool
a} :: CreateFunction)

-- | The name of the Lambda function.
--
-- __Name formats__
--
-- -   __Function name__ - @my-function@.
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ - @123456789012:function:my-function@.
--
-- The length constraint applies only to the full ARN. If you specify only
-- the function name, it is limited to 64 characters in length.
createFunction_functionName :: Lens.Lens' CreateFunction Prelude.Text
createFunction_functionName :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_functionName = (CreateFunction -> Text)
-> (CreateFunction -> Text -> CreateFunction)
-> Lens CreateFunction CreateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Text
functionName :: Text
$sel:functionName:CreateFunction' :: CreateFunction -> Text
functionName} -> Text
functionName) (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:functionName:CreateFunction' :: Text
functionName = Text
a} :: CreateFunction)

-- | The Amazon Resource Name (ARN) of the function\'s execution role.
createFunction_role :: Lens.Lens' CreateFunction Prelude.Text
createFunction_role :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_role = (CreateFunction -> Text)
-> (CreateFunction -> Text -> CreateFunction)
-> Lens CreateFunction CreateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Text
role' :: Text
$sel:role':CreateFunction' :: CreateFunction -> Text
role'} -> Text
role') (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:role':CreateFunction' :: Text
role' = Text
a} :: CreateFunction)

-- | The code for the function.
createFunction_code :: Lens.Lens' CreateFunction FunctionCode
createFunction_code :: (FunctionCode -> f FunctionCode)
-> CreateFunction -> f CreateFunction
createFunction_code = (CreateFunction -> FunctionCode)
-> (CreateFunction -> FunctionCode -> CreateFunction)
-> Lens CreateFunction CreateFunction FunctionCode FunctionCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {FunctionCode
code :: FunctionCode
$sel:code:CreateFunction' :: CreateFunction -> FunctionCode
code} -> FunctionCode
code) (\s :: CreateFunction
s@CreateFunction' {} FunctionCode
a -> CreateFunction
s {$sel:code:CreateFunction' :: FunctionCode
code = FunctionCode
a} :: CreateFunction)

instance Core.AWSRequest CreateFunction where
  type
    AWSResponse CreateFunction =
      FunctionConfiguration
  request :: CreateFunction -> Request CreateFunction
request = Service -> CreateFunction -> Request CreateFunction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFunction)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFunction))
-> Logger
-> Service
-> Proxy CreateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFunction)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String FunctionConfiguration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateFunction

instance Prelude.NFData CreateFunction

instance Core.ToHeaders CreateFunction where
  toHeaders :: CreateFunction -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateFunction -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateFunction where
  toJSON :: CreateFunction -> Value
toJSON CreateFunction' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [FileSystemConfig]
Maybe (NonEmpty Architecture)
Maybe Text
Maybe (HashMap Text Text)
Maybe DeadLetterConfig
Maybe Environment
Maybe ImageConfig
Maybe PackageType
Maybe Runtime
Maybe TracingConfig
Maybe VpcConfig
Text
FunctionCode
code :: FunctionCode
role' :: Text
functionName :: Text
publish :: Maybe Bool
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
tracingConfig :: Maybe TracingConfig
timeout :: Maybe Natural
handler :: Maybe Text
layers :: Maybe [Text]
vpcConfig :: Maybe VpcConfig
codeSigningConfigArn :: Maybe Text
architectures :: Maybe (NonEmpty Architecture)
deadLetterConfig :: Maybe DeadLetterConfig
imageConfig :: Maybe ImageConfig
environment :: Maybe Environment
fileSystemConfigs :: Maybe [FileSystemConfig]
packageType :: Maybe PackageType
kmsKeyArn :: Maybe Text
runtime :: Maybe Runtime
memorySize :: Maybe Natural
$sel:code:CreateFunction' :: CreateFunction -> FunctionCode
$sel:role':CreateFunction' :: CreateFunction -> Text
$sel:functionName:CreateFunction' :: CreateFunction -> Text
$sel:publish:CreateFunction' :: CreateFunction -> Maybe Bool
$sel:tags:CreateFunction' :: CreateFunction -> Maybe (HashMap Text Text)
$sel:description:CreateFunction' :: CreateFunction -> Maybe Text
$sel:tracingConfig:CreateFunction' :: CreateFunction -> Maybe TracingConfig
$sel:timeout:CreateFunction' :: CreateFunction -> Maybe Natural
$sel:handler:CreateFunction' :: CreateFunction -> Maybe Text
$sel:layers:CreateFunction' :: CreateFunction -> Maybe [Text]
$sel:vpcConfig:CreateFunction' :: CreateFunction -> Maybe VpcConfig
$sel:codeSigningConfigArn:CreateFunction' :: CreateFunction -> Maybe Text
$sel:architectures:CreateFunction' :: CreateFunction -> Maybe (NonEmpty Architecture)
$sel:deadLetterConfig:CreateFunction' :: CreateFunction -> Maybe DeadLetterConfig
$sel:imageConfig:CreateFunction' :: CreateFunction -> Maybe ImageConfig
$sel:environment:CreateFunction' :: CreateFunction -> Maybe Environment
$sel:fileSystemConfigs:CreateFunction' :: CreateFunction -> Maybe [FileSystemConfig]
$sel:packageType:CreateFunction' :: CreateFunction -> Maybe PackageType
$sel:kmsKeyArn:CreateFunction' :: CreateFunction -> Maybe Text
$sel:runtime:CreateFunction' :: CreateFunction -> Maybe Runtime
$sel:memorySize:CreateFunction' :: CreateFunction -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MemorySize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
memorySize,
            (Text
"Runtime" Text -> Runtime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Runtime -> Pair) -> Maybe Runtime -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Runtime
runtime,
            (Text
"KMSKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn,
            (Text
"PackageType" Text -> PackageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PackageType -> Pair) -> Maybe PackageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PackageType
packageType,
            (Text
"FileSystemConfigs" Text -> [FileSystemConfig] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([FileSystemConfig] -> Pair)
-> Maybe [FileSystemConfig] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FileSystemConfig]
fileSystemConfigs,
            (Text
"Environment" Text -> Environment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Environment -> Pair) -> Maybe Environment -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Environment
environment,
            (Text
"ImageConfig" Text -> ImageConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ImageConfig -> Pair) -> Maybe ImageConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageConfig
imageConfig,
            (Text
"DeadLetterConfig" Text -> DeadLetterConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeadLetterConfig -> Pair) -> Maybe DeadLetterConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeadLetterConfig
deadLetterConfig,
            (Text
"Architectures" Text -> NonEmpty Architecture -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Architecture -> Pair)
-> Maybe (NonEmpty Architecture) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Architecture)
architectures,
            (Text
"CodeSigningConfigArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
codeSigningConfigArn,
            (Text
"VpcConfig" Text -> VpcConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VpcConfig -> Pair) -> Maybe VpcConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VpcConfig
vpcConfig,
            (Text
"Layers" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
layers,
            (Text
"Handler" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
handler,
            (Text
"Timeout" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeout,
            (Text
"TracingConfig" Text -> TracingConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TracingConfig -> Pair) -> Maybe TracingConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TracingConfig
tracingConfig,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            (Text
"Publish" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
publish,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FunctionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
functionName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Role" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
role'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Code" Text -> FunctionCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FunctionCode
code)
          ]
      )

instance Core.ToPath CreateFunction where
  toPath :: CreateFunction -> ByteString
toPath = ByteString -> CreateFunction -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2015-03-31/functions"

instance Core.ToQuery CreateFunction where
  toQuery :: CreateFunction -> QueryString
toQuery = QueryString -> CreateFunction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty