{-# 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.UpdateFunction
-- 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)
--
-- Updates a @Function@ object.
module Amazonka.AppSync.UpdateFunction
  ( -- * Creating a Request
    UpdateFunction (..),
    newUpdateFunction,

    -- * Request Lenses
    updateFunction_requestMappingTemplate,
    updateFunction_responseMappingTemplate,
    updateFunction_syncConfig,
    updateFunction_description,
    updateFunction_apiId,
    updateFunction_name,
    updateFunction_functionId,
    updateFunction_dataSourceName,
    updateFunction_functionVersion,

    -- * Destructuring the Response
    UpdateFunctionResponse (..),
    newUpdateFunctionResponse,

    -- * Response Lenses
    updateFunctionResponse_functionConfiguration,
    updateFunctionResponse_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:/ 'newUpdateFunction' smart constructor.
data UpdateFunction = UpdateFunction'
  { -- | The @Function@ request mapping template. Functions support only the
    -- 2018-05-29 version of the request mapping template.
    UpdateFunction -> Maybe Text
requestMappingTemplate :: Prelude.Maybe Prelude.Text,
    -- | The @Function@ request mapping template.
    UpdateFunction -> Maybe Text
responseMappingTemplate :: Prelude.Maybe Prelude.Text,
    UpdateFunction -> Maybe SyncConfig
syncConfig :: Prelude.Maybe SyncConfig,
    -- | The @Function@ description.
    UpdateFunction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The GraphQL API ID.
    UpdateFunction -> Text
apiId :: Prelude.Text,
    -- | The @Function@ name.
    UpdateFunction -> Text
name :: Prelude.Text,
    -- | The function ID.
    UpdateFunction -> Text
functionId :: Prelude.Text,
    -- | The @Function@ @DataSource@ name.
    UpdateFunction -> Text
dataSourceName :: Prelude.Text,
    -- | The @version@ of the request mapping template. Currently the supported
    -- value is 2018-05-29.
    UpdateFunction -> Text
functionVersion :: Prelude.Text
  }
  deriving (UpdateFunction -> UpdateFunction -> Bool
(UpdateFunction -> UpdateFunction -> Bool)
-> (UpdateFunction -> UpdateFunction -> Bool) -> Eq UpdateFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFunction -> UpdateFunction -> Bool
$c/= :: UpdateFunction -> UpdateFunction -> Bool
== :: UpdateFunction -> UpdateFunction -> Bool
$c== :: UpdateFunction -> UpdateFunction -> Bool
Prelude.Eq, ReadPrec [UpdateFunction]
ReadPrec UpdateFunction
Int -> ReadS UpdateFunction
ReadS [UpdateFunction]
(Int -> ReadS UpdateFunction)
-> ReadS [UpdateFunction]
-> ReadPrec UpdateFunction
-> ReadPrec [UpdateFunction]
-> Read UpdateFunction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFunction]
$creadListPrec :: ReadPrec [UpdateFunction]
readPrec :: ReadPrec UpdateFunction
$creadPrec :: ReadPrec UpdateFunction
readList :: ReadS [UpdateFunction]
$creadList :: ReadS [UpdateFunction]
readsPrec :: Int -> ReadS UpdateFunction
$creadsPrec :: Int -> ReadS UpdateFunction
Prelude.Read, Int -> UpdateFunction -> ShowS
[UpdateFunction] -> ShowS
UpdateFunction -> String
(Int -> UpdateFunction -> ShowS)
-> (UpdateFunction -> String)
-> ([UpdateFunction] -> ShowS)
-> Show UpdateFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFunction] -> ShowS
$cshowList :: [UpdateFunction] -> ShowS
show :: UpdateFunction -> String
$cshow :: UpdateFunction -> String
showsPrec :: Int -> UpdateFunction -> ShowS
$cshowsPrec :: Int -> UpdateFunction -> ShowS
Prelude.Show, (forall x. UpdateFunction -> Rep UpdateFunction x)
-> (forall x. Rep UpdateFunction x -> UpdateFunction)
-> Generic UpdateFunction
forall x. Rep UpdateFunction x -> UpdateFunction
forall x. UpdateFunction -> Rep UpdateFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFunction x -> UpdateFunction
$cfrom :: forall x. UpdateFunction -> Rep UpdateFunction x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFunction' 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', 'updateFunction_requestMappingTemplate' - The @Function@ request mapping template. Functions support only the
-- 2018-05-29 version of the request mapping template.
--
-- 'responseMappingTemplate', 'updateFunction_responseMappingTemplate' - The @Function@ request mapping template.
--
-- 'syncConfig', 'updateFunction_syncConfig' - Undocumented member.
--
-- 'description', 'updateFunction_description' - The @Function@ description.
--
-- 'apiId', 'updateFunction_apiId' - The GraphQL API ID.
--
-- 'name', 'updateFunction_name' - The @Function@ name.
--
-- 'functionId', 'updateFunction_functionId' - The function ID.
--
-- 'dataSourceName', 'updateFunction_dataSourceName' - The @Function@ @DataSource@ name.
--
-- 'functionVersion', 'updateFunction_functionVersion' - The @version@ of the request mapping template. Currently the supported
-- value is 2018-05-29.
newUpdateFunction ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'functionId'
  Prelude.Text ->
  -- | 'dataSourceName'
  Prelude.Text ->
  -- | 'functionVersion'
  Prelude.Text ->
  UpdateFunction
newUpdateFunction :: Text -> Text -> Text -> Text -> Text -> UpdateFunction
newUpdateFunction
  Text
pApiId_
  Text
pName_
  Text
pFunctionId_
  Text
pDataSourceName_
  Text
pFunctionVersion_ =
    UpdateFunction' :: Maybe Text
-> Maybe Text
-> Maybe SyncConfig
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> UpdateFunction
UpdateFunction'
      { $sel:requestMappingTemplate:UpdateFunction' :: Maybe Text
requestMappingTemplate =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:responseMappingTemplate:UpdateFunction' :: Maybe Text
responseMappingTemplate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:syncConfig:UpdateFunction' :: Maybe SyncConfig
syncConfig = Maybe SyncConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:description:UpdateFunction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:apiId:UpdateFunction' :: Text
apiId = Text
pApiId_,
        $sel:name:UpdateFunction' :: Text
name = Text
pName_,
        $sel:functionId:UpdateFunction' :: Text
functionId = Text
pFunctionId_,
        $sel:dataSourceName:UpdateFunction' :: Text
dataSourceName = Text
pDataSourceName_,
        $sel:functionVersion:UpdateFunction' :: Text
functionVersion = Text
pFunctionVersion_
      }

-- | The @Function@ request mapping template. Functions support only the
-- 2018-05-29 version of the request mapping template.
updateFunction_requestMappingTemplate :: Lens.Lens' UpdateFunction (Prelude.Maybe Prelude.Text)
updateFunction_requestMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> UpdateFunction -> f UpdateFunction
updateFunction_requestMappingTemplate = (UpdateFunction -> Maybe Text)
-> (UpdateFunction -> Maybe Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Maybe Text
requestMappingTemplate :: Maybe Text
$sel:requestMappingTemplate:UpdateFunction' :: UpdateFunction -> Maybe Text
requestMappingTemplate} -> Maybe Text
requestMappingTemplate) (\s :: UpdateFunction
s@UpdateFunction' {} Maybe Text
a -> UpdateFunction
s {$sel:requestMappingTemplate:UpdateFunction' :: Maybe Text
requestMappingTemplate = Maybe Text
a} :: UpdateFunction)

-- | The @Function@ request mapping template.
updateFunction_responseMappingTemplate :: Lens.Lens' UpdateFunction (Prelude.Maybe Prelude.Text)
updateFunction_responseMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> UpdateFunction -> f UpdateFunction
updateFunction_responseMappingTemplate = (UpdateFunction -> Maybe Text)
-> (UpdateFunction -> Maybe Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Maybe Text
responseMappingTemplate :: Maybe Text
$sel:responseMappingTemplate:UpdateFunction' :: UpdateFunction -> Maybe Text
responseMappingTemplate} -> Maybe Text
responseMappingTemplate) (\s :: UpdateFunction
s@UpdateFunction' {} Maybe Text
a -> UpdateFunction
s {$sel:responseMappingTemplate:UpdateFunction' :: Maybe Text
responseMappingTemplate = Maybe Text
a} :: UpdateFunction)

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

-- | The @Function@ description.
updateFunction_description :: Lens.Lens' UpdateFunction (Prelude.Maybe Prelude.Text)
updateFunction_description :: (Maybe Text -> f (Maybe Text))
-> UpdateFunction -> f UpdateFunction
updateFunction_description = (UpdateFunction -> Maybe Text)
-> (UpdateFunction -> Maybe Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Maybe Text
description :: Maybe Text
$sel:description:UpdateFunction' :: UpdateFunction -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateFunction
s@UpdateFunction' {} Maybe Text
a -> UpdateFunction
s {$sel:description:UpdateFunction' :: Maybe Text
description = Maybe Text
a} :: UpdateFunction)

-- | The GraphQL API ID.
updateFunction_apiId :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_apiId :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_apiId = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
apiId :: Text
$sel:apiId:UpdateFunction' :: UpdateFunction -> Text
apiId} -> Text
apiId) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:apiId:UpdateFunction' :: Text
apiId = Text
a} :: UpdateFunction)

-- | The @Function@ name.
updateFunction_name :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_name :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_name = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
name :: Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
name} -> Text
name) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:name:UpdateFunction' :: Text
name = Text
a} :: UpdateFunction)

-- | The function ID.
updateFunction_functionId :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_functionId :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_functionId = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
functionId :: Text
$sel:functionId:UpdateFunction' :: UpdateFunction -> Text
functionId} -> Text
functionId) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:functionId:UpdateFunction' :: Text
functionId = Text
a} :: UpdateFunction)

-- | The @Function@ @DataSource@ name.
updateFunction_dataSourceName :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_dataSourceName :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_dataSourceName = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
dataSourceName :: Text
$sel:dataSourceName:UpdateFunction' :: UpdateFunction -> Text
dataSourceName} -> Text
dataSourceName) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:dataSourceName:UpdateFunction' :: Text
dataSourceName = Text
a} :: UpdateFunction)

-- | The @version@ of the request mapping template. Currently the supported
-- value is 2018-05-29.
updateFunction_functionVersion :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_functionVersion :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_functionVersion = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
functionVersion :: Text
$sel:functionVersion:UpdateFunction' :: UpdateFunction -> Text
functionVersion} -> Text
functionVersion) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:functionVersion:UpdateFunction' :: Text
functionVersion = Text
a} :: UpdateFunction)

instance Core.AWSRequest UpdateFunction where
  type
    AWSResponse UpdateFunction =
      UpdateFunctionResponse
  request :: UpdateFunction -> Request UpdateFunction
request = Service -> UpdateFunction -> Request UpdateFunction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFunction)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateFunction))
-> Logger
-> Service
-> Proxy UpdateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFunction)))
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 -> UpdateFunctionResponse
UpdateFunctionResponse'
            (Maybe FunctionConfiguration -> Int -> UpdateFunctionResponse)
-> Either String (Maybe FunctionConfiguration)
-> Either String (Int -> UpdateFunctionResponse)
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 -> UpdateFunctionResponse)
-> Either String Int -> Either String UpdateFunctionResponse
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 UpdateFunction

instance Prelude.NFData UpdateFunction

instance Core.ToHeaders UpdateFunction where
  toHeaders :: UpdateFunction -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateFunction -> 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 UpdateFunction where
  toJSON :: UpdateFunction -> Value
toJSON UpdateFunction' {Maybe Text
Maybe SyncConfig
Text
functionVersion :: Text
dataSourceName :: Text
functionId :: Text
name :: Text
apiId :: Text
description :: Maybe Text
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
requestMappingTemplate :: Maybe Text
$sel:functionVersion:UpdateFunction' :: UpdateFunction -> Text
$sel:dataSourceName:UpdateFunction' :: UpdateFunction -> Text
$sel:functionId:UpdateFunction' :: UpdateFunction -> Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
$sel:apiId:UpdateFunction' :: UpdateFunction -> Text
$sel:description:UpdateFunction' :: UpdateFunction -> Maybe Text
$sel:syncConfig:UpdateFunction' :: UpdateFunction -> Maybe SyncConfig
$sel:responseMappingTemplate:UpdateFunction' :: UpdateFunction -> Maybe Text
$sel:requestMappingTemplate:UpdateFunction' :: UpdateFunction -> 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 UpdateFunction where
  toPath :: UpdateFunction -> ByteString
toPath UpdateFunction' {Maybe Text
Maybe SyncConfig
Text
functionVersion :: Text
dataSourceName :: Text
functionId :: Text
name :: Text
apiId :: Text
description :: Maybe Text
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
requestMappingTemplate :: Maybe Text
$sel:functionVersion:UpdateFunction' :: UpdateFunction -> Text
$sel:dataSourceName:UpdateFunction' :: UpdateFunction -> Text
$sel:functionId:UpdateFunction' :: UpdateFunction -> Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
$sel:apiId:UpdateFunction' :: UpdateFunction -> Text
$sel:description:UpdateFunction' :: UpdateFunction -> Maybe Text
$sel:syncConfig:UpdateFunction' :: UpdateFunction -> Maybe SyncConfig
$sel:responseMappingTemplate:UpdateFunction' :: UpdateFunction -> Maybe Text
$sel:requestMappingTemplate:UpdateFunction' :: UpdateFunction -> 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/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionId
      ]

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

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

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

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

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

instance Prelude.NFData UpdateFunctionResponse