{-# 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.AppSync.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 @Function@ object.
--
-- A function is a reusable entity. Multiple functions can be used to
-- compose the resolver logic.
module Amazonka.AppSync.CreateFunction
  ( -- * Creating a Request
    CreateFunction (..),
    newCreateFunction,

    -- * Request Lenses
    createFunction_requestMappingTemplate,
    createFunction_responseMappingTemplate,
    createFunction_syncConfig,
    createFunction_description,
    createFunction_apiId,
    createFunction_name,
    createFunction_dataSourceName,
    createFunction_functionVersion,

    -- * Destructuring the Response
    CreateFunctionResponse (..),
    newCreateFunctionResponse,

    -- * Response Lenses
    createFunctionResponse_functionConfiguration,
    createFunctionResponse_httpStatus,
  )
where

import Amazonka.AppSync.Types
import qualified Amazonka.Core as Core
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 @Function@ request mapping template. Functions support only the
    -- 2018-05-29 version of the request mapping template.
    CreateFunction -> Maybe Text
requestMappingTemplate :: Prelude.Maybe Prelude.Text,
    -- | The @Function@ response mapping template.
    CreateFunction -> Maybe Text
responseMappingTemplate :: Prelude.Maybe Prelude.Text,
    CreateFunction -> Maybe SyncConfig
syncConfig :: Prelude.Maybe SyncConfig,
    -- | The @Function@ description.
    CreateFunction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The GraphQL API ID.
    CreateFunction -> Text
apiId :: Prelude.Text,
    -- | The @Function@ name. The function name does not have to be unique.
    CreateFunction -> Text
name :: Prelude.Text,
    -- | The @Function@ @DataSource@ name.
    CreateFunction -> Text
dataSourceName :: Prelude.Text,
    -- | The @version@ of the request mapping template. Currently the supported
    -- value is 2018-05-29.
    CreateFunction -> Text
functionVersion :: Prelude.Text
  }
  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, ReadPrec [CreateFunction]
ReadPrec CreateFunction
Int -> ReadS CreateFunction
ReadS [CreateFunction]
(Int -> ReadS CreateFunction)
-> ReadS [CreateFunction]
-> ReadPrec CreateFunction
-> ReadPrec [CreateFunction]
-> Read CreateFunction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFunction]
$creadListPrec :: ReadPrec [CreateFunction]
readPrec :: ReadPrec CreateFunction
$creadPrec :: ReadPrec CreateFunction
readList :: ReadS [CreateFunction]
$creadList :: ReadS [CreateFunction]
readsPrec :: Int -> ReadS CreateFunction
$creadsPrec :: Int -> ReadS CreateFunction
Prelude.Read, 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:
--
-- 'requestMappingTemplate', 'createFunction_requestMappingTemplate' - The @Function@ request mapping template. Functions support only the
-- 2018-05-29 version of the request mapping template.
--
-- 'responseMappingTemplate', 'createFunction_responseMappingTemplate' - The @Function@ response mapping template.
--
-- 'syncConfig', 'createFunction_syncConfig' - Undocumented member.
--
-- 'description', 'createFunction_description' - The @Function@ description.
--
-- 'apiId', 'createFunction_apiId' - The GraphQL API ID.
--
-- 'name', 'createFunction_name' - The @Function@ name. The function name does not have to be unique.
--
-- 'dataSourceName', 'createFunction_dataSourceName' - The @Function@ @DataSource@ name.
--
-- 'functionVersion', 'createFunction_functionVersion' - The @version@ of the request mapping template. Currently the supported
-- value is 2018-05-29.
newCreateFunction ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'dataSourceName'
  Prelude.Text ->
  -- | 'functionVersion'
  Prelude.Text ->
  CreateFunction
newCreateFunction :: Text -> Text -> Text -> Text -> CreateFunction
newCreateFunction
  Text
pApiId_
  Text
pName_
  Text
pDataSourceName_
  Text
pFunctionVersion_ =
    CreateFunction' :: Maybe Text
-> Maybe Text
-> Maybe SyncConfig
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> CreateFunction
CreateFunction'
      { $sel:requestMappingTemplate:CreateFunction' :: Maybe Text
requestMappingTemplate =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:responseMappingTemplate:CreateFunction' :: Maybe Text
responseMappingTemplate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:syncConfig:CreateFunction' :: Maybe SyncConfig
syncConfig = Maybe SyncConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateFunction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:apiId:CreateFunction' :: Text
apiId = Text
pApiId_,
        $sel:name:CreateFunction' :: Text
name = Text
pName_,
        $sel:dataSourceName:CreateFunction' :: Text
dataSourceName = Text
pDataSourceName_,
        $sel:functionVersion:CreateFunction' :: Text
functionVersion = Text
pFunctionVersion_
      }

-- | The @Function@ request mapping template. Functions support only the
-- 2018-05-29 version of the request mapping template.
createFunction_requestMappingTemplate :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_requestMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_requestMappingTemplate = (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
requestMappingTemplate :: Maybe Text
$sel:requestMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
requestMappingTemplate} -> Maybe Text
requestMappingTemplate) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:requestMappingTemplate:CreateFunction' :: Maybe Text
requestMappingTemplate = Maybe Text
a} :: CreateFunction)

-- | The @Function@ response mapping template.
createFunction_responseMappingTemplate :: Lens.Lens' CreateFunction (Prelude.Maybe Prelude.Text)
createFunction_responseMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> CreateFunction -> f CreateFunction
createFunction_responseMappingTemplate = (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
responseMappingTemplate :: Maybe Text
$sel:responseMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
responseMappingTemplate} -> Maybe Text
responseMappingTemplate) (\s :: CreateFunction
s@CreateFunction' {} Maybe Text
a -> CreateFunction
s {$sel:responseMappingTemplate:CreateFunction' :: Maybe Text
responseMappingTemplate = Maybe Text
a} :: CreateFunction)

-- | Undocumented member.
createFunction_syncConfig :: Lens.Lens' CreateFunction (Prelude.Maybe SyncConfig)
createFunction_syncConfig :: (Maybe SyncConfig -> f (Maybe SyncConfig))
-> CreateFunction -> f CreateFunction
createFunction_syncConfig = (CreateFunction -> Maybe SyncConfig)
-> (CreateFunction -> Maybe SyncConfig -> CreateFunction)
-> Lens
     CreateFunction CreateFunction (Maybe SyncConfig) (Maybe SyncConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunction' {Maybe SyncConfig
syncConfig :: Maybe SyncConfig
$sel:syncConfig:CreateFunction' :: CreateFunction -> Maybe SyncConfig
syncConfig} -> Maybe SyncConfig
syncConfig) (\s :: CreateFunction
s@CreateFunction' {} Maybe SyncConfig
a -> CreateFunction
s {$sel:syncConfig:CreateFunction' :: Maybe SyncConfig
syncConfig = Maybe SyncConfig
a} :: CreateFunction)

-- | The @Function@ description.
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)

-- | The GraphQL API ID.
createFunction_apiId :: Lens.Lens' CreateFunction Prelude.Text
createFunction_apiId :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_apiId = (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
apiId :: Text
$sel:apiId:CreateFunction' :: CreateFunction -> Text
apiId} -> Text
apiId) (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:apiId:CreateFunction' :: Text
apiId = Text
a} :: CreateFunction)

-- | The @Function@ name. The function name does not have to be unique.
createFunction_name :: Lens.Lens' CreateFunction Prelude.Text
createFunction_name :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_name = (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
name :: Text
$sel:name:CreateFunction' :: CreateFunction -> Text
name} -> Text
name) (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:name:CreateFunction' :: Text
name = Text
a} :: CreateFunction)

-- | The @Function@ @DataSource@ name.
createFunction_dataSourceName :: Lens.Lens' CreateFunction Prelude.Text
createFunction_dataSourceName :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_dataSourceName = (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
dataSourceName :: Text
$sel:dataSourceName:CreateFunction' :: CreateFunction -> Text
dataSourceName} -> Text
dataSourceName) (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:dataSourceName:CreateFunction' :: Text
dataSourceName = Text
a} :: CreateFunction)

-- | The @version@ of the request mapping template. Currently the supported
-- value is 2018-05-29.
createFunction_functionVersion :: Lens.Lens' CreateFunction Prelude.Text
createFunction_functionVersion :: (Text -> f Text) -> CreateFunction -> f CreateFunction
createFunction_functionVersion = (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
functionVersion :: Text
$sel:functionVersion:CreateFunction' :: CreateFunction -> Text
functionVersion} -> Text
functionVersion) (\s :: CreateFunction
s@CreateFunction' {} Text
a -> CreateFunction
s {$sel:functionVersion:CreateFunction' :: Text
functionVersion = Text
a} :: CreateFunction)

instance Core.AWSRequest CreateFunction where
  type
    AWSResponse CreateFunction =
      CreateFunctionResponse
  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 ->
          Maybe FunctionConfiguration -> Int -> CreateFunctionResponse
CreateFunctionResponse'
            (Maybe FunctionConfiguration -> Int -> CreateFunctionResponse)
-> Either String (Maybe FunctionConfiguration)
-> Either String (Int -> CreateFunctionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FunctionConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"functionConfiguration")
            Either String (Int -> CreateFunctionResponse)
-> Either String Int -> Either String CreateFunctionResponse
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 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] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateFunction where
  toJSON :: CreateFunction -> Value
toJSON CreateFunction' {Maybe Text
Maybe SyncConfig
Text
functionVersion :: Text
dataSourceName :: Text
name :: Text
apiId :: Text
description :: Maybe Text
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
requestMappingTemplate :: Maybe Text
$sel:functionVersion:CreateFunction' :: CreateFunction -> Text
$sel:dataSourceName:CreateFunction' :: CreateFunction -> Text
$sel:name:CreateFunction' :: CreateFunction -> Text
$sel:apiId:CreateFunction' :: CreateFunction -> Text
$sel:description:CreateFunction' :: CreateFunction -> Maybe Text
$sel:syncConfig:CreateFunction' :: CreateFunction -> Maybe SyncConfig
$sel:responseMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
$sel:requestMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"requestMappingTemplate" 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
requestMappingTemplate,
            (Text
"responseMappingTemplate" 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
responseMappingTemplate,
            (Text
"syncConfig" Text -> SyncConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SyncConfig -> Pair) -> Maybe SyncConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SyncConfig
syncConfig,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"dataSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSourceName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"functionVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
functionVersion)
          ]
      )

instance Core.ToPath CreateFunction where
  toPath :: CreateFunction -> ByteString
toPath CreateFunction' {Maybe Text
Maybe SyncConfig
Text
functionVersion :: Text
dataSourceName :: Text
name :: Text
apiId :: Text
description :: Maybe Text
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
requestMappingTemplate :: Maybe Text
$sel:functionVersion:CreateFunction' :: CreateFunction -> Text
$sel:dataSourceName:CreateFunction' :: CreateFunction -> Text
$sel:name:CreateFunction' :: CreateFunction -> Text
$sel:apiId:CreateFunction' :: CreateFunction -> Text
$sel:description:CreateFunction' :: CreateFunction -> Maybe Text
$sel:syncConfig:CreateFunction' :: CreateFunction -> Maybe SyncConfig
$sel:responseMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
$sel:requestMappingTemplate:CreateFunction' :: CreateFunction -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/apis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId, ByteString
"/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

-- | /See:/ 'newCreateFunctionResponse' smart constructor.
data CreateFunctionResponse = CreateFunctionResponse'
  { -- | The @Function@ object.
    CreateFunctionResponse -> Maybe FunctionConfiguration
functionConfiguration :: Prelude.Maybe FunctionConfiguration,
    -- | The response's http status code.
    CreateFunctionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateFunctionResponse -> CreateFunctionResponse -> Bool
(CreateFunctionResponse -> CreateFunctionResponse -> Bool)
-> (CreateFunctionResponse -> CreateFunctionResponse -> Bool)
-> Eq CreateFunctionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFunctionResponse -> CreateFunctionResponse -> Bool
$c/= :: CreateFunctionResponse -> CreateFunctionResponse -> Bool
== :: CreateFunctionResponse -> CreateFunctionResponse -> Bool
$c== :: CreateFunctionResponse -> CreateFunctionResponse -> Bool
Prelude.Eq, ReadPrec [CreateFunctionResponse]
ReadPrec CreateFunctionResponse
Int -> ReadS CreateFunctionResponse
ReadS [CreateFunctionResponse]
(Int -> ReadS CreateFunctionResponse)
-> ReadS [CreateFunctionResponse]
-> ReadPrec CreateFunctionResponse
-> ReadPrec [CreateFunctionResponse]
-> Read CreateFunctionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFunctionResponse]
$creadListPrec :: ReadPrec [CreateFunctionResponse]
readPrec :: ReadPrec CreateFunctionResponse
$creadPrec :: ReadPrec CreateFunctionResponse
readList :: ReadS [CreateFunctionResponse]
$creadList :: ReadS [CreateFunctionResponse]
readsPrec :: Int -> ReadS CreateFunctionResponse
$creadsPrec :: Int -> ReadS CreateFunctionResponse
Prelude.Read, Int -> CreateFunctionResponse -> ShowS
[CreateFunctionResponse] -> ShowS
CreateFunctionResponse -> String
(Int -> CreateFunctionResponse -> ShowS)
-> (CreateFunctionResponse -> String)
-> ([CreateFunctionResponse] -> ShowS)
-> Show CreateFunctionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFunctionResponse] -> ShowS
$cshowList :: [CreateFunctionResponse] -> ShowS
show :: CreateFunctionResponse -> String
$cshow :: CreateFunctionResponse -> String
showsPrec :: Int -> CreateFunctionResponse -> ShowS
$cshowsPrec :: Int -> CreateFunctionResponse -> ShowS
Prelude.Show, (forall x. CreateFunctionResponse -> Rep CreateFunctionResponse x)
-> (forall x.
    Rep CreateFunctionResponse x -> CreateFunctionResponse)
-> Generic CreateFunctionResponse
forall x. Rep CreateFunctionResponse x -> CreateFunctionResponse
forall x. CreateFunctionResponse -> Rep CreateFunctionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFunctionResponse x -> CreateFunctionResponse
$cfrom :: forall x. CreateFunctionResponse -> Rep CreateFunctionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFunctionResponse' 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:
--
-- 'functionConfiguration', 'createFunctionResponse_functionConfiguration' - The @Function@ object.
--
-- 'httpStatus', 'createFunctionResponse_httpStatus' - The response's http status code.
newCreateFunctionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFunctionResponse
newCreateFunctionResponse :: Int -> CreateFunctionResponse
newCreateFunctionResponse Int
pHttpStatus_ =
  CreateFunctionResponse' :: Maybe FunctionConfiguration -> Int -> CreateFunctionResponse
CreateFunctionResponse'
    { $sel:functionConfiguration:CreateFunctionResponse' :: Maybe FunctionConfiguration
functionConfiguration =
        Maybe FunctionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateFunctionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @Function@ object.
createFunctionResponse_functionConfiguration :: Lens.Lens' CreateFunctionResponse (Prelude.Maybe FunctionConfiguration)
createFunctionResponse_functionConfiguration :: (Maybe FunctionConfiguration -> f (Maybe FunctionConfiguration))
-> CreateFunctionResponse -> f CreateFunctionResponse
createFunctionResponse_functionConfiguration = (CreateFunctionResponse -> Maybe FunctionConfiguration)
-> (CreateFunctionResponse
    -> Maybe FunctionConfiguration -> CreateFunctionResponse)
-> Lens
     CreateFunctionResponse
     CreateFunctionResponse
     (Maybe FunctionConfiguration)
     (Maybe FunctionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFunctionResponse' {Maybe FunctionConfiguration
functionConfiguration :: Maybe FunctionConfiguration
$sel:functionConfiguration:CreateFunctionResponse' :: CreateFunctionResponse -> Maybe FunctionConfiguration
functionConfiguration} -> Maybe FunctionConfiguration
functionConfiguration) (\s :: CreateFunctionResponse
s@CreateFunctionResponse' {} Maybe FunctionConfiguration
a -> CreateFunctionResponse
s {$sel:functionConfiguration:CreateFunctionResponse' :: Maybe FunctionConfiguration
functionConfiguration = Maybe FunctionConfiguration
a} :: CreateFunctionResponse)

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

instance Prelude.NFData CreateFunctionResponse