{-# 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.CreateFunctionDefinition
-- 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 definition which contains a list of Lambda
-- functions and their configurations to be used in a group. You can create
-- an initial version of the definition by providing a list of Lambda
-- functions and their configurations now, or use
-- \'\'CreateFunctionDefinitionVersion\'\' later.
module Amazonka.Greengrass.CreateFunctionDefinition
  ( -- * Creating a Request
    CreateFunctionDefinition (..),
    newCreateFunctionDefinition,

    -- * Request Lenses
    createFunctionDefinition_amznClientToken,
    createFunctionDefinition_initialVersion,
    createFunctionDefinition_name,
    createFunctionDefinition_tags,

    -- * Destructuring the Response
    CreateFunctionDefinitionResponse (..),
    newCreateFunctionDefinitionResponse,

    -- * Response Lenses
    createFunctionDefinitionResponse_latestVersionArn,
    createFunctionDefinitionResponse_arn,
    createFunctionDefinitionResponse_name,
    createFunctionDefinitionResponse_creationTimestamp,
    createFunctionDefinitionResponse_id,
    createFunctionDefinitionResponse_latestVersion,
    createFunctionDefinitionResponse_lastUpdatedTimestamp,
    createFunctionDefinitionResponse_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

-- | /See:/ 'newCreateFunctionDefinition' smart constructor.
data CreateFunctionDefinition = CreateFunctionDefinition'
  { -- | A client token used to correlate requests and responses.
    CreateFunctionDefinition -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the initial version of the function definition.
    CreateFunctionDefinition -> Maybe FunctionDefinitionVersion
initialVersion :: Prelude.Maybe FunctionDefinitionVersion,
    -- | The name of the function definition.
    CreateFunctionDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Tag(s) to add to the new resource.
    CreateFunctionDefinition -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateFunctionDefinition -> CreateFunctionDefinition -> Bool
(CreateFunctionDefinition -> CreateFunctionDefinition -> Bool)
-> (CreateFunctionDefinition -> CreateFunctionDefinition -> Bool)
-> Eq CreateFunctionDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFunctionDefinition -> CreateFunctionDefinition -> Bool
$c/= :: CreateFunctionDefinition -> CreateFunctionDefinition -> Bool
== :: CreateFunctionDefinition -> CreateFunctionDefinition -> Bool
$c== :: CreateFunctionDefinition -> CreateFunctionDefinition -> Bool
Prelude.Eq, ReadPrec [CreateFunctionDefinition]
ReadPrec CreateFunctionDefinition
Int -> ReadS CreateFunctionDefinition
ReadS [CreateFunctionDefinition]
(Int -> ReadS CreateFunctionDefinition)
-> ReadS [CreateFunctionDefinition]
-> ReadPrec CreateFunctionDefinition
-> ReadPrec [CreateFunctionDefinition]
-> Read CreateFunctionDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFunctionDefinition]
$creadListPrec :: ReadPrec [CreateFunctionDefinition]
readPrec :: ReadPrec CreateFunctionDefinition
$creadPrec :: ReadPrec CreateFunctionDefinition
readList :: ReadS [CreateFunctionDefinition]
$creadList :: ReadS [CreateFunctionDefinition]
readsPrec :: Int -> ReadS CreateFunctionDefinition
$creadsPrec :: Int -> ReadS CreateFunctionDefinition
Prelude.Read, Int -> CreateFunctionDefinition -> ShowS
[CreateFunctionDefinition] -> ShowS
CreateFunctionDefinition -> String
(Int -> CreateFunctionDefinition -> ShowS)
-> (CreateFunctionDefinition -> String)
-> ([CreateFunctionDefinition] -> ShowS)
-> Show CreateFunctionDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFunctionDefinition] -> ShowS
$cshowList :: [CreateFunctionDefinition] -> ShowS
show :: CreateFunctionDefinition -> String
$cshow :: CreateFunctionDefinition -> String
showsPrec :: Int -> CreateFunctionDefinition -> ShowS
$cshowsPrec :: Int -> CreateFunctionDefinition -> ShowS
Prelude.Show, (forall x.
 CreateFunctionDefinition -> Rep CreateFunctionDefinition x)
-> (forall x.
    Rep CreateFunctionDefinition x -> CreateFunctionDefinition)
-> Generic CreateFunctionDefinition
forall x.
Rep CreateFunctionDefinition x -> CreateFunctionDefinition
forall x.
CreateFunctionDefinition -> Rep CreateFunctionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateFunctionDefinition x -> CreateFunctionDefinition
$cfrom :: forall x.
CreateFunctionDefinition -> Rep CreateFunctionDefinition x
Prelude.Generic)

-- |
-- Create a value of 'CreateFunctionDefinition' 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', 'createFunctionDefinition_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'initialVersion', 'createFunctionDefinition_initialVersion' - Information about the initial version of the function definition.
--
-- 'name', 'createFunctionDefinition_name' - The name of the function definition.
--
-- 'tags', 'createFunctionDefinition_tags' - Tag(s) to add to the new resource.
newCreateFunctionDefinition ::
  CreateFunctionDefinition
newCreateFunctionDefinition :: CreateFunctionDefinition
newCreateFunctionDefinition =
  CreateFunctionDefinition' :: Maybe Text
-> Maybe FunctionDefinitionVersion
-> Maybe Text
-> Maybe (HashMap Text Text)
-> CreateFunctionDefinition
CreateFunctionDefinition'
    { $sel:amznClientToken:CreateFunctionDefinition' :: Maybe Text
amznClientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialVersion:CreateFunctionDefinition' :: Maybe FunctionDefinitionVersion
initialVersion = Maybe FunctionDefinitionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateFunctionDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateFunctionDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Information about the initial version of the function definition.
createFunctionDefinition_initialVersion :: Lens.Lens' CreateFunctionDefinition (Prelude.Maybe FunctionDefinitionVersion)
createFunctionDefinition_initialVersion :: (Maybe FunctionDefinitionVersion
 -> f (Maybe FunctionDefinitionVersion))
-> CreateFunctionDefinition -> f CreateFunctionDefinition
createFunctionDefinition_initialVersion = (CreateFunctionDefinition -> Maybe FunctionDefinitionVersion)
-> (CreateFunctionDefinition
    -> Maybe FunctionDefinitionVersion -> CreateFunctionDefinition)
-> Lens
     CreateFunctionDefinition
     CreateFunctionDefinition
     (Maybe FunctionDefinitionVersion)
     (Maybe FunctionDefinitionVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinition' {Maybe FunctionDefinitionVersion
initialVersion :: Maybe FunctionDefinitionVersion
$sel:initialVersion:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe FunctionDefinitionVersion
initialVersion} -> Maybe FunctionDefinitionVersion
initialVersion) (\s :: CreateFunctionDefinition
s@CreateFunctionDefinition' {} Maybe FunctionDefinitionVersion
a -> CreateFunctionDefinition
s {$sel:initialVersion:CreateFunctionDefinition' :: Maybe FunctionDefinitionVersion
initialVersion = Maybe FunctionDefinitionVersion
a} :: CreateFunctionDefinition)

-- | The name of the function definition.
createFunctionDefinition_name :: Lens.Lens' CreateFunctionDefinition (Prelude.Maybe Prelude.Text)
createFunctionDefinition_name :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinition -> f CreateFunctionDefinition
createFunctionDefinition_name = (CreateFunctionDefinition -> Maybe Text)
-> (CreateFunctionDefinition
    -> Maybe Text -> CreateFunctionDefinition)
-> Lens
     CreateFunctionDefinition
     CreateFunctionDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinition' {Maybe Text
name :: Maybe Text
$sel:name:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateFunctionDefinition
s@CreateFunctionDefinition' {} Maybe Text
a -> CreateFunctionDefinition
s {$sel:name:CreateFunctionDefinition' :: Maybe Text
name = Maybe Text
a} :: CreateFunctionDefinition)

-- | Tag(s) to add to the new resource.
createFunctionDefinition_tags :: Lens.Lens' CreateFunctionDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createFunctionDefinition_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateFunctionDefinition -> f CreateFunctionDefinition
createFunctionDefinition_tags = (CreateFunctionDefinition -> Maybe (HashMap Text Text))
-> (CreateFunctionDefinition
    -> Maybe (HashMap Text Text) -> CreateFunctionDefinition)
-> Lens
     CreateFunctionDefinition
     CreateFunctionDefinition
     (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 (\CreateFunctionDefinition' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateFunctionDefinition
s@CreateFunctionDefinition' {} Maybe (HashMap Text Text)
a -> CreateFunctionDefinition
s {$sel:tags:CreateFunctionDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateFunctionDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateFunctionDefinition -> f CreateFunctionDefinition)
-> ((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)))
-> CreateFunctionDefinition
-> f CreateFunctionDefinition
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

instance Core.AWSRequest CreateFunctionDefinition where
  type
    AWSResponse CreateFunctionDefinition =
      CreateFunctionDefinitionResponse
  request :: CreateFunctionDefinition -> Request CreateFunctionDefinition
request = Service
-> CreateFunctionDefinition -> Request CreateFunctionDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFunctionDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFunctionDefinition))
-> Logger
-> Service
-> Proxy CreateFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFunctionDefinition)))
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
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateFunctionDefinitionResponse
CreateFunctionDefinitionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateFunctionDefinitionResponse)
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
"LatestVersionArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateFunctionDefinitionResponse)
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
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateFunctionDefinitionResponse)
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
"Name")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateFunctionDefinitionResponse)
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
   -> Maybe Text
   -> Int
   -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> CreateFunctionDefinitionResponse)
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
  (Maybe Text
   -> Maybe Text -> Int -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateFunctionDefinitionResponse)
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
"LatestVersion")
            Either
  String (Maybe Text -> Int -> CreateFunctionDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateFunctionDefinitionResponse)
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
"LastUpdatedTimestamp")
            Either String (Int -> CreateFunctionDefinitionResponse)
-> Either String Int
-> Either String CreateFunctionDefinitionResponse
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 CreateFunctionDefinition

instance Prelude.NFData CreateFunctionDefinition

instance Core.ToHeaders CreateFunctionDefinition where
  toHeaders :: CreateFunctionDefinition -> ResponseHeaders
toHeaders CreateFunctionDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe FunctionDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe FunctionDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe Text
$sel:initialVersion:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe FunctionDefinitionVersion
$sel:amznClientToken:CreateFunctionDefinition' :: CreateFunctionDefinition -> 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 CreateFunctionDefinition where
  toJSON :: CreateFunctionDefinition -> Value
toJSON CreateFunctionDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe FunctionDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe FunctionDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe Text
$sel:initialVersion:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe FunctionDefinitionVersion
$sel:amznClientToken:CreateFunctionDefinition' :: CreateFunctionDefinition -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InitialVersion" Text -> FunctionDefinitionVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FunctionDefinitionVersion -> Pair)
-> Maybe FunctionDefinitionVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FunctionDefinitionVersion
initialVersion,
            (Text
"Name" 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
name,
            (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
          ]
      )

instance Core.ToPath CreateFunctionDefinition where
  toPath :: CreateFunctionDefinition -> ByteString
toPath =
    ByteString -> CreateFunctionDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/definition/functions"

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

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

-- |
-- Create a value of 'CreateFunctionDefinitionResponse' 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:
--
-- 'latestVersionArn', 'createFunctionDefinitionResponse_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'createFunctionDefinitionResponse_arn' - The ARN of the definition.
--
-- 'name', 'createFunctionDefinitionResponse_name' - The name of the definition.
--
-- 'creationTimestamp', 'createFunctionDefinitionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'createFunctionDefinitionResponse_id' - The ID of the definition.
--
-- 'latestVersion', 'createFunctionDefinitionResponse_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'createFunctionDefinitionResponse_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
--
-- 'httpStatus', 'createFunctionDefinitionResponse_httpStatus' - The response's http status code.
newCreateFunctionDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFunctionDefinitionResponse
newCreateFunctionDefinitionResponse :: Int -> CreateFunctionDefinitionResponse
newCreateFunctionDefinitionResponse Int
pHttpStatus_ =
  CreateFunctionDefinitionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateFunctionDefinitionResponse
CreateFunctionDefinitionResponse'
    { $sel:latestVersionArn:CreateFunctionDefinitionResponse' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateFunctionDefinitionResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateFunctionDefinitionResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:CreateFunctionDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateFunctionDefinitionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:CreateFunctionDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:CreateFunctionDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateFunctionDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the latest version associated with the definition.
createFunctionDefinitionResponse_latestVersionArn :: Lens.Lens' CreateFunctionDefinitionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionResponse_latestVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionResponse
-> f CreateFunctionDefinitionResponse
createFunctionDefinitionResponse_latestVersionArn = (CreateFunctionDefinitionResponse -> Maybe Text)
-> (CreateFunctionDefinitionResponse
    -> Maybe Text -> CreateFunctionDefinitionResponse)
-> Lens
     CreateFunctionDefinitionResponse
     CreateFunctionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionResponse' {Maybe Text
latestVersionArn :: Maybe Text
$sel:latestVersionArn:CreateFunctionDefinitionResponse' :: CreateFunctionDefinitionResponse -> Maybe Text
latestVersionArn} -> Maybe Text
latestVersionArn) (\s :: CreateFunctionDefinitionResponse
s@CreateFunctionDefinitionResponse' {} Maybe Text
a -> CreateFunctionDefinitionResponse
s {$sel:latestVersionArn:CreateFunctionDefinitionResponse' :: Maybe Text
latestVersionArn = Maybe Text
a} :: CreateFunctionDefinitionResponse)

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

-- | The name of the definition.
createFunctionDefinitionResponse_name :: Lens.Lens' CreateFunctionDefinitionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionResponse
-> f CreateFunctionDefinitionResponse
createFunctionDefinitionResponse_name = (CreateFunctionDefinitionResponse -> Maybe Text)
-> (CreateFunctionDefinitionResponse
    -> Maybe Text -> CreateFunctionDefinitionResponse)
-> Lens
     CreateFunctionDefinitionResponse
     CreateFunctionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateFunctionDefinitionResponse' :: CreateFunctionDefinitionResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateFunctionDefinitionResponse
s@CreateFunctionDefinitionResponse' {} Maybe Text
a -> CreateFunctionDefinitionResponse
s {$sel:name:CreateFunctionDefinitionResponse' :: Maybe Text
name = Maybe Text
a} :: CreateFunctionDefinitionResponse)

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

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

-- | The ID of the latest version associated with the definition.
createFunctionDefinitionResponse_latestVersion :: Lens.Lens' CreateFunctionDefinitionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionResponse_latestVersion :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionResponse
-> f CreateFunctionDefinitionResponse
createFunctionDefinitionResponse_latestVersion = (CreateFunctionDefinitionResponse -> Maybe Text)
-> (CreateFunctionDefinitionResponse
    -> Maybe Text -> CreateFunctionDefinitionResponse)
-> Lens
     CreateFunctionDefinitionResponse
     CreateFunctionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionResponse' {Maybe Text
latestVersion :: Maybe Text
$sel:latestVersion:CreateFunctionDefinitionResponse' :: CreateFunctionDefinitionResponse -> Maybe Text
latestVersion} -> Maybe Text
latestVersion) (\s :: CreateFunctionDefinitionResponse
s@CreateFunctionDefinitionResponse' {} Maybe Text
a -> CreateFunctionDefinitionResponse
s {$sel:latestVersion:CreateFunctionDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
a} :: CreateFunctionDefinitionResponse)

-- | The time, in milliseconds since the epoch, when the definition was last
-- updated.
createFunctionDefinitionResponse_lastUpdatedTimestamp :: Lens.Lens' CreateFunctionDefinitionResponse (Prelude.Maybe Prelude.Text)
createFunctionDefinitionResponse_lastUpdatedTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateFunctionDefinitionResponse
-> f CreateFunctionDefinitionResponse
createFunctionDefinitionResponse_lastUpdatedTimestamp = (CreateFunctionDefinitionResponse -> Maybe Text)
-> (CreateFunctionDefinitionResponse
    -> Maybe Text -> CreateFunctionDefinitionResponse)
-> Lens
     CreateFunctionDefinitionResponse
     CreateFunctionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionDefinitionResponse' {Maybe Text
lastUpdatedTimestamp :: Maybe Text
$sel:lastUpdatedTimestamp:CreateFunctionDefinitionResponse' :: CreateFunctionDefinitionResponse -> Maybe Text
lastUpdatedTimestamp} -> Maybe Text
lastUpdatedTimestamp) (\s :: CreateFunctionDefinitionResponse
s@CreateFunctionDefinitionResponse' {} Maybe Text
a -> CreateFunctionDefinitionResponse
s {$sel:lastUpdatedTimestamp:CreateFunctionDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
a} :: CreateFunctionDefinitionResponse)

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

instance
  Prelude.NFData
    CreateFunctionDefinitionResponse