{-# 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.Greengrass.CreateFunctionDefinitionVersion
-- 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 version of a Lambda function definition that has already been
-- defined.
module Amazonka.Greengrass.CreateFunctionDefinitionVersion
  ( -- * Creating a Request
    CreateFunctionDefinitionVersion (..),
    newCreateFunctionDefinitionVersion,

    -- * Request Lenses
    createFunctionDefinitionVersion_amznClientToken,
    createFunctionDefinitionVersion_defaultConfig,
    createFunctionDefinitionVersion_functions,
    createFunctionDefinitionVersion_functionDefinitionId,

    -- * Destructuring the Response
    CreateFunctionDefinitionVersionResponse (..),
    newCreateFunctionDefinitionVersionResponse,

    -- * Response Lenses
    createFunctionDefinitionVersionResponse_arn,
    createFunctionDefinitionVersionResponse_creationTimestamp,
    createFunctionDefinitionVersionResponse_version,
    createFunctionDefinitionVersionResponse_id,
    createFunctionDefinitionVersionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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

-- | Information needed to create a function definition version.
--
-- /See:/ 'newCreateFunctionDefinitionVersion' smart constructor.
data CreateFunctionDefinitionVersion = CreateFunctionDefinitionVersion'
  { -- | A client token used to correlate requests and responses.
    CreateFunctionDefinitionVersion -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
    -- | The default configuration that applies to all Lambda functions in this
    -- function definition version. Individual Lambda functions can override
    -- these settings.
    CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig
defaultConfig :: Prelude.Maybe FunctionDefaultConfig,
    -- | A list of Lambda functions in this function definition version.
    CreateFunctionDefinitionVersion -> Maybe [Function]
functions :: Prelude.Maybe [Function],
    -- | The ID of the Lambda function definition.
    CreateFunctionDefinitionVersion -> Text
functionDefinitionId :: Prelude.Text
  }
  deriving (CreateFunctionDefinitionVersion
-> CreateFunctionDefinitionVersion -> Bool
(CreateFunctionDefinitionVersion
 -> CreateFunctionDefinitionVersion -> Bool)
-> (CreateFunctionDefinitionVersion
    -> CreateFunctionDefinitionVersion -> Bool)
-> Eq CreateFunctionDefinitionVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFunctionDefinitionVersion
-> CreateFunctionDefinitionVersion -> Bool
$c/= :: CreateFunctionDefinitionVersion
-> CreateFunctionDefinitionVersion -> Bool
== :: CreateFunctionDefinitionVersion
-> CreateFunctionDefinitionVersion -> Bool
$c== :: CreateFunctionDefinitionVersion
-> CreateFunctionDefinitionVersion -> Bool
Prelude.Eq, ReadPrec [CreateFunctionDefinitionVersion]
ReadPrec CreateFunctionDefinitionVersion
Int -> ReadS CreateFunctionDefinitionVersion
ReadS [CreateFunctionDefinitionVersion]
(Int -> ReadS CreateFunctionDefinitionVersion)
-> ReadS [CreateFunctionDefinitionVersion]
-> ReadPrec CreateFunctionDefinitionVersion
-> ReadPrec [CreateFunctionDefinitionVersion]
-> Read CreateFunctionDefinitionVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFunctionDefinitionVersion]
$creadListPrec :: ReadPrec [CreateFunctionDefinitionVersion]
readPrec :: ReadPrec CreateFunctionDefinitionVersion
$creadPrec :: ReadPrec CreateFunctionDefinitionVersion
readList :: ReadS [CreateFunctionDefinitionVersion]
$creadList :: ReadS [CreateFunctionDefinitionVersion]
readsPrec :: Int -> ReadS CreateFunctionDefinitionVersion
$creadsPrec :: Int -> ReadS CreateFunctionDefinitionVersion
Prelude.Read, Int -> CreateFunctionDefinitionVersion -> ShowS
[CreateFunctionDefinitionVersion] -> ShowS
CreateFunctionDefinitionVersion -> String
(Int -> CreateFunctionDefinitionVersion -> ShowS)
-> (CreateFunctionDefinitionVersion -> String)
-> ([CreateFunctionDefinitionVersion] -> ShowS)
-> Show CreateFunctionDefinitionVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFunctionDefinitionVersion] -> ShowS
$cshowList :: [CreateFunctionDefinitionVersion] -> ShowS
show :: CreateFunctionDefinitionVersion -> String
$cshow :: CreateFunctionDefinitionVersion -> String
showsPrec :: Int -> CreateFunctionDefinitionVersion -> ShowS
$cshowsPrec :: Int -> CreateFunctionDefinitionVersion -> ShowS
Prelude.Show, (forall x.
 CreateFunctionDefinitionVersion
 -> Rep CreateFunctionDefinitionVersion x)
-> (forall x.
    Rep CreateFunctionDefinitionVersion x
    -> CreateFunctionDefinitionVersion)
-> Generic CreateFunctionDefinitionVersion
forall x.
Rep CreateFunctionDefinitionVersion x
-> CreateFunctionDefinitionVersion
forall x.
CreateFunctionDefinitionVersion
-> Rep CreateFunctionDefinitionVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateFunctionDefinitionVersion x
-> CreateFunctionDefinitionVersion
$cfrom :: forall x.
CreateFunctionDefinitionVersion
-> Rep CreateFunctionDefinitionVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateFunctionDefinitionVersion' 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:
--
-- 'amznClientToken', 'createFunctionDefinitionVersion_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'defaultConfig', 'createFunctionDefinitionVersion_defaultConfig' - The default configuration that applies to all Lambda functions in this
-- function definition version. Individual Lambda functions can override
-- these settings.
--
-- 'functions', 'createFunctionDefinitionVersion_functions' - A list of Lambda functions in this function definition version.
--
-- 'functionDefinitionId', 'createFunctionDefinitionVersion_functionDefinitionId' - The ID of the Lambda function definition.
newCreateFunctionDefinitionVersion ::
  -- | 'functionDefinitionId'
  Prelude.Text ->
  CreateFunctionDefinitionVersion
newCreateFunctionDefinitionVersion :: Text -> CreateFunctionDefinitionVersion
newCreateFunctionDefinitionVersion
  Text
pFunctionDefinitionId_ =
    CreateFunctionDefinitionVersion' :: Maybe Text
-> Maybe FunctionDefaultConfig
-> Maybe [Function]
-> Text
-> CreateFunctionDefinitionVersion
CreateFunctionDefinitionVersion'
      { $sel:amznClientToken:CreateFunctionDefinitionVersion' :: Maybe Text
amznClientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultConfig:CreateFunctionDefinitionVersion' :: Maybe FunctionDefaultConfig
defaultConfig = Maybe FunctionDefaultConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:functions:CreateFunctionDefinitionVersion' :: Maybe [Function]
functions = Maybe [Function]
forall a. Maybe a
Prelude.Nothing,
        $sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: Text
functionDefinitionId =
          Text
pFunctionDefinitionId_
      }

-- | A client token used to correlate requests and responses.
createFunctionDefinitionVersion_amznClientToken :: Lens.Lens' CreateFunctionDefinitionVersion (Prelude.Maybe Prelude.Text)
createFunctionDefinitionVersion_amznClientToken :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionVersion
-> f CreateFunctionDefinitionVersion
createFunctionDefinitionVersion_amznClientToken = (CreateFunctionDefinitionVersion -> Maybe Text)
-> (CreateFunctionDefinitionVersion
    -> Maybe Text -> CreateFunctionDefinitionVersion)
-> Lens
     CreateFunctionDefinitionVersion
     CreateFunctionDefinitionVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersion' {Maybe Text
amznClientToken :: Maybe Text
$sel:amznClientToken:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe Text
amznClientToken} -> Maybe Text
amznClientToken) (\s :: CreateFunctionDefinitionVersion
s@CreateFunctionDefinitionVersion' {} Maybe Text
a -> CreateFunctionDefinitionVersion
s {$sel:amznClientToken:CreateFunctionDefinitionVersion' :: Maybe Text
amznClientToken = Maybe Text
a} :: CreateFunctionDefinitionVersion)

-- | The default configuration that applies to all Lambda functions in this
-- function definition version. Individual Lambda functions can override
-- these settings.
createFunctionDefinitionVersion_defaultConfig :: Lens.Lens' CreateFunctionDefinitionVersion (Prelude.Maybe FunctionDefaultConfig)
createFunctionDefinitionVersion_defaultConfig :: (Maybe FunctionDefaultConfig -> f (Maybe FunctionDefaultConfig))
-> CreateFunctionDefinitionVersion
-> f CreateFunctionDefinitionVersion
createFunctionDefinitionVersion_defaultConfig = (CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig)
-> (CreateFunctionDefinitionVersion
    -> Maybe FunctionDefaultConfig -> CreateFunctionDefinitionVersion)
-> Lens
     CreateFunctionDefinitionVersion
     CreateFunctionDefinitionVersion
     (Maybe FunctionDefaultConfig)
     (Maybe FunctionDefaultConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersion' {Maybe FunctionDefaultConfig
defaultConfig :: Maybe FunctionDefaultConfig
$sel:defaultConfig:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig
defaultConfig} -> Maybe FunctionDefaultConfig
defaultConfig) (\s :: CreateFunctionDefinitionVersion
s@CreateFunctionDefinitionVersion' {} Maybe FunctionDefaultConfig
a -> CreateFunctionDefinitionVersion
s {$sel:defaultConfig:CreateFunctionDefinitionVersion' :: Maybe FunctionDefaultConfig
defaultConfig = Maybe FunctionDefaultConfig
a} :: CreateFunctionDefinitionVersion)

-- | A list of Lambda functions in this function definition version.
createFunctionDefinitionVersion_functions :: Lens.Lens' CreateFunctionDefinitionVersion (Prelude.Maybe [Function])
createFunctionDefinitionVersion_functions :: (Maybe [Function] -> f (Maybe [Function]))
-> CreateFunctionDefinitionVersion
-> f CreateFunctionDefinitionVersion
createFunctionDefinitionVersion_functions = (CreateFunctionDefinitionVersion -> Maybe [Function])
-> (CreateFunctionDefinitionVersion
    -> Maybe [Function] -> CreateFunctionDefinitionVersion)
-> Lens
     CreateFunctionDefinitionVersion
     CreateFunctionDefinitionVersion
     (Maybe [Function])
     (Maybe [Function])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersion' {Maybe [Function]
functions :: Maybe [Function]
$sel:functions:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe [Function]
functions} -> Maybe [Function]
functions) (\s :: CreateFunctionDefinitionVersion
s@CreateFunctionDefinitionVersion' {} Maybe [Function]
a -> CreateFunctionDefinitionVersion
s {$sel:functions:CreateFunctionDefinitionVersion' :: Maybe [Function]
functions = Maybe [Function]
a} :: CreateFunctionDefinitionVersion) ((Maybe [Function] -> f (Maybe [Function]))
 -> CreateFunctionDefinitionVersion
 -> f CreateFunctionDefinitionVersion)
-> ((Maybe [Function] -> f (Maybe [Function]))
    -> Maybe [Function] -> f (Maybe [Function]))
-> (Maybe [Function] -> f (Maybe [Function]))
-> CreateFunctionDefinitionVersion
-> f CreateFunctionDefinitionVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Function] [Function] [Function] [Function]
-> Iso
     (Maybe [Function])
     (Maybe [Function])
     (Maybe [Function])
     (Maybe [Function])
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 [Function] [Function] [Function] [Function]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the Lambda function definition.
createFunctionDefinitionVersion_functionDefinitionId :: Lens.Lens' CreateFunctionDefinitionVersion Prelude.Text
createFunctionDefinitionVersion_functionDefinitionId :: (Text -> f Text)
-> CreateFunctionDefinitionVersion
-> f CreateFunctionDefinitionVersion
createFunctionDefinitionVersion_functionDefinitionId = (CreateFunctionDefinitionVersion -> Text)
-> (CreateFunctionDefinitionVersion
    -> Text -> CreateFunctionDefinitionVersion)
-> Lens
     CreateFunctionDefinitionVersion
     CreateFunctionDefinitionVersion
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersion' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Text
functionDefinitionId} -> Text
functionDefinitionId) (\s :: CreateFunctionDefinitionVersion
s@CreateFunctionDefinitionVersion' {} Text
a -> CreateFunctionDefinitionVersion
s {$sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: Text
functionDefinitionId = Text
a} :: CreateFunctionDefinitionVersion)

instance
  Core.AWSRequest
    CreateFunctionDefinitionVersion
  where
  type
    AWSResponse CreateFunctionDefinitionVersion =
      CreateFunctionDefinitionVersionResponse
  request :: CreateFunctionDefinitionVersion
-> Request CreateFunctionDefinitionVersion
request = Service
-> CreateFunctionDefinitionVersion
-> Request CreateFunctionDefinitionVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFunctionDefinitionVersion
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateFunctionDefinitionVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFunctionDefinitionVersion))
-> Logger
-> Service
-> Proxy CreateFunctionDefinitionVersion
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateFunctionDefinitionVersion)))
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 ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateFunctionDefinitionVersionResponse
CreateFunctionDefinitionVersionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateFunctionDefinitionVersionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateFunctionDefinitionVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateFunctionDefinitionVersionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> CreateFunctionDefinitionVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationTimestamp")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Int -> CreateFunctionDefinitionVersionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Int -> CreateFunctionDefinitionVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Version")
            Either
  String
  (Maybe Text -> Int -> CreateFunctionDefinitionVersionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateFunctionDefinitionVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Id")
            Either String (Int -> CreateFunctionDefinitionVersionResponse)
-> Either String Int
-> Either String CreateFunctionDefinitionVersionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateFunctionDefinitionVersion

instance
  Prelude.NFData
    CreateFunctionDefinitionVersion

instance
  Core.ToHeaders
    CreateFunctionDefinitionVersion
  where
  toHeaders :: CreateFunctionDefinitionVersion -> ResponseHeaders
toHeaders CreateFunctionDefinitionVersion' {Maybe [Function]
Maybe Text
Maybe FunctionDefaultConfig
Text
functionDefinitionId :: Text
functions :: Maybe [Function]
defaultConfig :: Maybe FunctionDefaultConfig
amznClientToken :: Maybe Text
$sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Text
$sel:functions:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe [Function]
$sel:defaultConfig:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig
$sel:amznClientToken:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amzn-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
amznClientToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.ToJSON CreateFunctionDefinitionVersion where
  toJSON :: CreateFunctionDefinitionVersion -> Value
toJSON CreateFunctionDefinitionVersion' {Maybe [Function]
Maybe Text
Maybe FunctionDefaultConfig
Text
functionDefinitionId :: Text
functions :: Maybe [Function]
defaultConfig :: Maybe FunctionDefaultConfig
amznClientToken :: Maybe Text
$sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Text
$sel:functions:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe [Function]
$sel:defaultConfig:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig
$sel:amznClientToken:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DefaultConfig" Text -> FunctionDefaultConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FunctionDefaultConfig -> Pair)
-> Maybe FunctionDefaultConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FunctionDefaultConfig
defaultConfig,
            (Text
"Functions" Text -> [Function] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Function] -> Pair) -> Maybe [Function] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Function]
functions
          ]
      )

instance Core.ToPath CreateFunctionDefinitionVersion where
  toPath :: CreateFunctionDefinitionVersion -> ByteString
toPath CreateFunctionDefinitionVersion' {Maybe [Function]
Maybe Text
Maybe FunctionDefaultConfig
Text
functionDefinitionId :: Text
functions :: Maybe [Function]
defaultConfig :: Maybe FunctionDefaultConfig
amznClientToken :: Maybe Text
$sel:functionDefinitionId:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Text
$sel:functions:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe [Function]
$sel:defaultConfig:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe FunctionDefaultConfig
$sel:amznClientToken:CreateFunctionDefinitionVersion' :: CreateFunctionDefinitionVersion -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/functions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionDefinitionId,
        ByteString
"/versions"
      ]

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

-- | /See:/ 'newCreateFunctionDefinitionVersionResponse' smart constructor.
data CreateFunctionDefinitionVersionResponse = CreateFunctionDefinitionVersionResponse'
  { -- | The ARN of the version.
    CreateFunctionDefinitionVersionResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the version was created.
    CreateFunctionDefinitionVersionResponse -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the version.
    CreateFunctionDefinitionVersionResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The ID of the parent definition that the version is associated with.
    CreateFunctionDefinitionVersionResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateFunctionDefinitionVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateFunctionDefinitionVersionResponse
-> CreateFunctionDefinitionVersionResponse -> Bool
(CreateFunctionDefinitionVersionResponse
 -> CreateFunctionDefinitionVersionResponse -> Bool)
-> (CreateFunctionDefinitionVersionResponse
    -> CreateFunctionDefinitionVersionResponse -> Bool)
-> Eq CreateFunctionDefinitionVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFunctionDefinitionVersionResponse
-> CreateFunctionDefinitionVersionResponse -> Bool
$c/= :: CreateFunctionDefinitionVersionResponse
-> CreateFunctionDefinitionVersionResponse -> Bool
== :: CreateFunctionDefinitionVersionResponse
-> CreateFunctionDefinitionVersionResponse -> Bool
$c== :: CreateFunctionDefinitionVersionResponse
-> CreateFunctionDefinitionVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreateFunctionDefinitionVersionResponse]
ReadPrec CreateFunctionDefinitionVersionResponse
Int -> ReadS CreateFunctionDefinitionVersionResponse
ReadS [CreateFunctionDefinitionVersionResponse]
(Int -> ReadS CreateFunctionDefinitionVersionResponse)
-> ReadS [CreateFunctionDefinitionVersionResponse]
-> ReadPrec CreateFunctionDefinitionVersionResponse
-> ReadPrec [CreateFunctionDefinitionVersionResponse]
-> Read CreateFunctionDefinitionVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFunctionDefinitionVersionResponse]
$creadListPrec :: ReadPrec [CreateFunctionDefinitionVersionResponse]
readPrec :: ReadPrec CreateFunctionDefinitionVersionResponse
$creadPrec :: ReadPrec CreateFunctionDefinitionVersionResponse
readList :: ReadS [CreateFunctionDefinitionVersionResponse]
$creadList :: ReadS [CreateFunctionDefinitionVersionResponse]
readsPrec :: Int -> ReadS CreateFunctionDefinitionVersionResponse
$creadsPrec :: Int -> ReadS CreateFunctionDefinitionVersionResponse
Prelude.Read, Int -> CreateFunctionDefinitionVersionResponse -> ShowS
[CreateFunctionDefinitionVersionResponse] -> ShowS
CreateFunctionDefinitionVersionResponse -> String
(Int -> CreateFunctionDefinitionVersionResponse -> ShowS)
-> (CreateFunctionDefinitionVersionResponse -> String)
-> ([CreateFunctionDefinitionVersionResponse] -> ShowS)
-> Show CreateFunctionDefinitionVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFunctionDefinitionVersionResponse] -> ShowS
$cshowList :: [CreateFunctionDefinitionVersionResponse] -> ShowS
show :: CreateFunctionDefinitionVersionResponse -> String
$cshow :: CreateFunctionDefinitionVersionResponse -> String
showsPrec :: Int -> CreateFunctionDefinitionVersionResponse -> ShowS
$cshowsPrec :: Int -> CreateFunctionDefinitionVersionResponse -> ShowS
Prelude.Show, (forall x.
 CreateFunctionDefinitionVersionResponse
 -> Rep CreateFunctionDefinitionVersionResponse x)
-> (forall x.
    Rep CreateFunctionDefinitionVersionResponse x
    -> CreateFunctionDefinitionVersionResponse)
-> Generic CreateFunctionDefinitionVersionResponse
forall x.
Rep CreateFunctionDefinitionVersionResponse x
-> CreateFunctionDefinitionVersionResponse
forall x.
CreateFunctionDefinitionVersionResponse
-> Rep CreateFunctionDefinitionVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateFunctionDefinitionVersionResponse x
-> CreateFunctionDefinitionVersionResponse
$cfrom :: forall x.
CreateFunctionDefinitionVersionResponse
-> Rep CreateFunctionDefinitionVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFunctionDefinitionVersionResponse' 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:
--
-- 'arn', 'createFunctionDefinitionVersionResponse_arn' - The ARN of the version.
--
-- 'creationTimestamp', 'createFunctionDefinitionVersionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the version was created.
--
-- 'version', 'createFunctionDefinitionVersionResponse_version' - The ID of the version.
--
-- 'id', 'createFunctionDefinitionVersionResponse_id' - The ID of the parent definition that the version is associated with.
--
-- 'httpStatus', 'createFunctionDefinitionVersionResponse_httpStatus' - The response's http status code.
newCreateFunctionDefinitionVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFunctionDefinitionVersionResponse
newCreateFunctionDefinitionVersionResponse :: Int -> CreateFunctionDefinitionVersionResponse
newCreateFunctionDefinitionVersionResponse
  Int
pHttpStatus_ =
    CreateFunctionDefinitionVersionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateFunctionDefinitionVersionResponse
CreateFunctionDefinitionVersionResponse'
      { $sel:arn:CreateFunctionDefinitionVersionResponse' :: Maybe Text
arn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:creationTimestamp:CreateFunctionDefinitionVersionResponse' :: Maybe Text
creationTimestamp =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:version:CreateFunctionDefinitionVersionResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:id:CreateFunctionDefinitionVersionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateFunctionDefinitionVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The ARN of the version.
createFunctionDefinitionVersionResponse_arn :: Lens.Lens' CreateFunctionDefinitionVersionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionVersionResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionVersionResponse
-> f CreateFunctionDefinitionVersionResponse
createFunctionDefinitionVersionResponse_arn = (CreateFunctionDefinitionVersionResponse -> Maybe Text)
-> (CreateFunctionDefinitionVersionResponse
    -> Maybe Text -> CreateFunctionDefinitionVersionResponse)
-> Lens
     CreateFunctionDefinitionVersionResponse
     CreateFunctionDefinitionVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersionResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateFunctionDefinitionVersionResponse' :: CreateFunctionDefinitionVersionResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateFunctionDefinitionVersionResponse
s@CreateFunctionDefinitionVersionResponse' {} Maybe Text
a -> CreateFunctionDefinitionVersionResponse
s {$sel:arn:CreateFunctionDefinitionVersionResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateFunctionDefinitionVersionResponse)

-- | The time, in milliseconds since the epoch, when the version was created.
createFunctionDefinitionVersionResponse_creationTimestamp :: Lens.Lens' CreateFunctionDefinitionVersionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionVersionResponse_creationTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionVersionResponse
-> f CreateFunctionDefinitionVersionResponse
createFunctionDefinitionVersionResponse_creationTimestamp = (CreateFunctionDefinitionVersionResponse -> Maybe Text)
-> (CreateFunctionDefinitionVersionResponse
    -> Maybe Text -> CreateFunctionDefinitionVersionResponse)
-> Lens
     CreateFunctionDefinitionVersionResponse
     CreateFunctionDefinitionVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersionResponse' {Maybe Text
creationTimestamp :: Maybe Text
$sel:creationTimestamp:CreateFunctionDefinitionVersionResponse' :: CreateFunctionDefinitionVersionResponse -> Maybe Text
creationTimestamp} -> Maybe Text
creationTimestamp) (\s :: CreateFunctionDefinitionVersionResponse
s@CreateFunctionDefinitionVersionResponse' {} Maybe Text
a -> CreateFunctionDefinitionVersionResponse
s {$sel:creationTimestamp:CreateFunctionDefinitionVersionResponse' :: Maybe Text
creationTimestamp = Maybe Text
a} :: CreateFunctionDefinitionVersionResponse)

-- | The ID of the version.
createFunctionDefinitionVersionResponse_version :: Lens.Lens' CreateFunctionDefinitionVersionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionVersionResponse_version :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionVersionResponse
-> f CreateFunctionDefinitionVersionResponse
createFunctionDefinitionVersionResponse_version = (CreateFunctionDefinitionVersionResponse -> Maybe Text)
-> (CreateFunctionDefinitionVersionResponse
    -> Maybe Text -> CreateFunctionDefinitionVersionResponse)
-> Lens
     CreateFunctionDefinitionVersionResponse
     CreateFunctionDefinitionVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersionResponse' {Maybe Text
version :: Maybe Text
$sel:version:CreateFunctionDefinitionVersionResponse' :: CreateFunctionDefinitionVersionResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateFunctionDefinitionVersionResponse
s@CreateFunctionDefinitionVersionResponse' {} Maybe Text
a -> CreateFunctionDefinitionVersionResponse
s {$sel:version:CreateFunctionDefinitionVersionResponse' :: Maybe Text
version = Maybe Text
a} :: CreateFunctionDefinitionVersionResponse)

-- | The ID of the parent definition that the version is associated with.
createFunctionDefinitionVersionResponse_id :: Lens.Lens' CreateFunctionDefinitionVersionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionVersionResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionVersionResponse
-> f CreateFunctionDefinitionVersionResponse
createFunctionDefinitionVersionResponse_id = (CreateFunctionDefinitionVersionResponse -> Maybe Text)
-> (CreateFunctionDefinitionVersionResponse
    -> Maybe Text -> CreateFunctionDefinitionVersionResponse)
-> Lens
     CreateFunctionDefinitionVersionResponse
     CreateFunctionDefinitionVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersionResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateFunctionDefinitionVersionResponse' :: CreateFunctionDefinitionVersionResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateFunctionDefinitionVersionResponse
s@CreateFunctionDefinitionVersionResponse' {} Maybe Text
a -> CreateFunctionDefinitionVersionResponse
s {$sel:id:CreateFunctionDefinitionVersionResponse' :: Maybe Text
id = Maybe Text
a} :: CreateFunctionDefinitionVersionResponse)

-- | The response's http status code.
createFunctionDefinitionVersionResponse_httpStatus :: Lens.Lens' CreateFunctionDefinitionVersionResponse Prelude.Int
createFunctionDefinitionVersionResponse_httpStatus :: (Int -> f Int)
-> CreateFunctionDefinitionVersionResponse
-> f CreateFunctionDefinitionVersionResponse
createFunctionDefinitionVersionResponse_httpStatus = (CreateFunctionDefinitionVersionResponse -> Int)
-> (CreateFunctionDefinitionVersionResponse
    -> Int -> CreateFunctionDefinitionVersionResponse)
-> Lens
     CreateFunctionDefinitionVersionResponse
     CreateFunctionDefinitionVersionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateFunctionDefinitionVersionResponse' :: CreateFunctionDefinitionVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateFunctionDefinitionVersionResponse
s@CreateFunctionDefinitionVersionResponse' {} Int
a -> CreateFunctionDefinitionVersionResponse
s {$sel:httpStatus:CreateFunctionDefinitionVersionResponse' :: Int
httpStatus = Int
a} :: CreateFunctionDefinitionVersionResponse)

instance
  Prelude.NFData
    CreateFunctionDefinitionVersionResponse