{-# 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 #-}
module Amazonka.APIGateway.UpdateIntegration
(
UpdateIntegration (..),
newUpdateIntegration,
updateIntegration_patchOperations,
updateIntegration_restApiId,
updateIntegration_resourceId,
updateIntegration_httpMethod,
Integration (..),
newIntegration,
integration_httpMethod,
integration_requestTemplates,
integration_credentials,
integration_connectionId,
integration_requestParameters,
integration_contentHandling,
integration_passthroughBehavior,
integration_uri,
integration_integrationResponses,
integration_tlsConfig,
integration_cacheNamespace,
integration_timeoutInMillis,
integration_type,
integration_connectionType,
integration_cacheKeyParameters,
)
where
import Amazonka.APIGateway.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
data UpdateIntegration = UpdateIntegration'
{
UpdateIntegration -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateIntegration -> Text
restApiId :: Prelude.Text,
UpdateIntegration -> Text
resourceId :: Prelude.Text,
UpdateIntegration -> Text
httpMethod :: Prelude.Text
}
deriving (UpdateIntegration -> UpdateIntegration -> Bool
(UpdateIntegration -> UpdateIntegration -> Bool)
-> (UpdateIntegration -> UpdateIntegration -> Bool)
-> Eq UpdateIntegration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateIntegration -> UpdateIntegration -> Bool
$c/= :: UpdateIntegration -> UpdateIntegration -> Bool
== :: UpdateIntegration -> UpdateIntegration -> Bool
$c== :: UpdateIntegration -> UpdateIntegration -> Bool
Prelude.Eq, ReadPrec [UpdateIntegration]
ReadPrec UpdateIntegration
Int -> ReadS UpdateIntegration
ReadS [UpdateIntegration]
(Int -> ReadS UpdateIntegration)
-> ReadS [UpdateIntegration]
-> ReadPrec UpdateIntegration
-> ReadPrec [UpdateIntegration]
-> Read UpdateIntegration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateIntegration]
$creadListPrec :: ReadPrec [UpdateIntegration]
readPrec :: ReadPrec UpdateIntegration
$creadPrec :: ReadPrec UpdateIntegration
readList :: ReadS [UpdateIntegration]
$creadList :: ReadS [UpdateIntegration]
readsPrec :: Int -> ReadS UpdateIntegration
$creadsPrec :: Int -> ReadS UpdateIntegration
Prelude.Read, Int -> UpdateIntegration -> ShowS
[UpdateIntegration] -> ShowS
UpdateIntegration -> String
(Int -> UpdateIntegration -> ShowS)
-> (UpdateIntegration -> String)
-> ([UpdateIntegration] -> ShowS)
-> Show UpdateIntegration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateIntegration] -> ShowS
$cshowList :: [UpdateIntegration] -> ShowS
show :: UpdateIntegration -> String
$cshow :: UpdateIntegration -> String
showsPrec :: Int -> UpdateIntegration -> ShowS
$cshowsPrec :: Int -> UpdateIntegration -> ShowS
Prelude.Show, (forall x. UpdateIntegration -> Rep UpdateIntegration x)
-> (forall x. Rep UpdateIntegration x -> UpdateIntegration)
-> Generic UpdateIntegration
forall x. Rep UpdateIntegration x -> UpdateIntegration
forall x. UpdateIntegration -> Rep UpdateIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateIntegration x -> UpdateIntegration
$cfrom :: forall x. UpdateIntegration -> Rep UpdateIntegration x
Prelude.Generic)
newUpdateIntegration ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateIntegration
newUpdateIntegration :: Text -> Text -> Text -> UpdateIntegration
newUpdateIntegration
Text
pRestApiId_
Text
pResourceId_
Text
pHttpMethod_ =
UpdateIntegration' :: Maybe [PatchOperation] -> Text -> Text -> Text -> UpdateIntegration
UpdateIntegration'
{ $sel:patchOperations:UpdateIntegration' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateIntegration' :: Text
restApiId = Text
pRestApiId_,
$sel:resourceId:UpdateIntegration' :: Text
resourceId = Text
pResourceId_,
$sel:httpMethod:UpdateIntegration' :: Text
httpMethod = Text
pHttpMethod_
}
updateIntegration_patchOperations :: Lens.Lens' UpdateIntegration (Prelude.Maybe [PatchOperation])
updateIntegration_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateIntegration -> f UpdateIntegration
updateIntegration_patchOperations = (UpdateIntegration -> Maybe [PatchOperation])
-> (UpdateIntegration
-> Maybe [PatchOperation] -> UpdateIntegration)
-> Lens
UpdateIntegration
UpdateIntegration
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateIntegration' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateIntegration' :: UpdateIntegration -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateIntegration
s@UpdateIntegration' {} Maybe [PatchOperation]
a -> UpdateIntegration
s {$sel:patchOperations:UpdateIntegration' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateIntegration) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateIntegration -> f UpdateIntegration)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateIntegration
-> f UpdateIntegration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
-> Iso
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
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
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateIntegration_restApiId :: Lens.Lens' UpdateIntegration Prelude.Text
updateIntegration_restApiId :: (Text -> f Text) -> UpdateIntegration -> f UpdateIntegration
updateIntegration_restApiId = (UpdateIntegration -> Text)
-> (UpdateIntegration -> Text -> UpdateIntegration)
-> Lens UpdateIntegration UpdateIntegration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateIntegration' {Text
restApiId :: Text
$sel:restApiId:UpdateIntegration' :: UpdateIntegration -> Text
restApiId} -> Text
restApiId) (\s :: UpdateIntegration
s@UpdateIntegration' {} Text
a -> UpdateIntegration
s {$sel:restApiId:UpdateIntegration' :: Text
restApiId = Text
a} :: UpdateIntegration)
updateIntegration_resourceId :: Lens.Lens' UpdateIntegration Prelude.Text
updateIntegration_resourceId :: (Text -> f Text) -> UpdateIntegration -> f UpdateIntegration
updateIntegration_resourceId = (UpdateIntegration -> Text)
-> (UpdateIntegration -> Text -> UpdateIntegration)
-> Lens UpdateIntegration UpdateIntegration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateIntegration' {Text
resourceId :: Text
$sel:resourceId:UpdateIntegration' :: UpdateIntegration -> Text
resourceId} -> Text
resourceId) (\s :: UpdateIntegration
s@UpdateIntegration' {} Text
a -> UpdateIntegration
s {$sel:resourceId:UpdateIntegration' :: Text
resourceId = Text
a} :: UpdateIntegration)
updateIntegration_httpMethod :: Lens.Lens' UpdateIntegration Prelude.Text
updateIntegration_httpMethod :: (Text -> f Text) -> UpdateIntegration -> f UpdateIntegration
updateIntegration_httpMethod = (UpdateIntegration -> Text)
-> (UpdateIntegration -> Text -> UpdateIntegration)
-> Lens UpdateIntegration UpdateIntegration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateIntegration' {Text
httpMethod :: Text
$sel:httpMethod:UpdateIntegration' :: UpdateIntegration -> Text
httpMethod} -> Text
httpMethod) (\s :: UpdateIntegration
s@UpdateIntegration' {} Text
a -> UpdateIntegration
s {$sel:httpMethod:UpdateIntegration' :: Text
httpMethod = Text
a} :: UpdateIntegration)
instance Core.AWSRequest UpdateIntegration where
type AWSResponse UpdateIntegration = Integration
request :: UpdateIntegration -> Request UpdateIntegration
request = Service -> UpdateIntegration -> Request UpdateIntegration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateIntegration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateIntegration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateIntegration))
-> Logger
-> Service
-> Proxy UpdateIntegration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateIntegration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String Integration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateIntegration
instance Prelude.NFData UpdateIntegration
instance Core.ToHeaders UpdateIntegration where
toHeaders :: UpdateIntegration -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateIntegration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToJSON UpdateIntegration where
toJSON :: UpdateIntegration -> Value
toJSON UpdateIntegration' {Maybe [PatchOperation]
Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:httpMethod:UpdateIntegration' :: UpdateIntegration -> Text
$sel:resourceId:UpdateIntegration' :: UpdateIntegration -> Text
$sel:restApiId:UpdateIntegration' :: UpdateIntegration -> Text
$sel:patchOperations:UpdateIntegration' :: UpdateIntegration -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"patchOperations" Text -> [PatchOperation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PatchOperation] -> Pair) -> Maybe [PatchOperation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Core.ToPath UpdateIntegration where
toPath :: UpdateIntegration -> ByteString
toPath UpdateIntegration' {Maybe [PatchOperation]
Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:httpMethod:UpdateIntegration' :: UpdateIntegration -> Text
$sel:resourceId:UpdateIntegration' :: UpdateIntegration -> Text
$sel:restApiId:UpdateIntegration' :: UpdateIntegration -> Text
$sel:patchOperations:UpdateIntegration' :: UpdateIntegration -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
ByteString
"/resources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
ByteString
"/methods/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
httpMethod,
ByteString
"/integration"
]
instance Core.ToQuery UpdateIntegration where
toQuery :: UpdateIntegration -> QueryString
toQuery = QueryString -> UpdateIntegration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty