{-# 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.Glue.UpdateTrigger
(
UpdateTrigger (..),
newUpdateTrigger,
updateTrigger_name,
updateTrigger_triggerUpdate,
UpdateTriggerResponse (..),
newUpdateTriggerResponse,
updateTriggerResponse_trigger,
updateTriggerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.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
data UpdateTrigger = UpdateTrigger'
{
UpdateTrigger -> Text
name :: Prelude.Text,
UpdateTrigger -> TriggerUpdate
triggerUpdate :: TriggerUpdate
}
deriving (UpdateTrigger -> UpdateTrigger -> Bool
(UpdateTrigger -> UpdateTrigger -> Bool)
-> (UpdateTrigger -> UpdateTrigger -> Bool) -> Eq UpdateTrigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrigger -> UpdateTrigger -> Bool
$c/= :: UpdateTrigger -> UpdateTrigger -> Bool
== :: UpdateTrigger -> UpdateTrigger -> Bool
$c== :: UpdateTrigger -> UpdateTrigger -> Bool
Prelude.Eq, ReadPrec [UpdateTrigger]
ReadPrec UpdateTrigger
Int -> ReadS UpdateTrigger
ReadS [UpdateTrigger]
(Int -> ReadS UpdateTrigger)
-> ReadS [UpdateTrigger]
-> ReadPrec UpdateTrigger
-> ReadPrec [UpdateTrigger]
-> Read UpdateTrigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrigger]
$creadListPrec :: ReadPrec [UpdateTrigger]
readPrec :: ReadPrec UpdateTrigger
$creadPrec :: ReadPrec UpdateTrigger
readList :: ReadS [UpdateTrigger]
$creadList :: ReadS [UpdateTrigger]
readsPrec :: Int -> ReadS UpdateTrigger
$creadsPrec :: Int -> ReadS UpdateTrigger
Prelude.Read, Int -> UpdateTrigger -> ShowS
[UpdateTrigger] -> ShowS
UpdateTrigger -> String
(Int -> UpdateTrigger -> ShowS)
-> (UpdateTrigger -> String)
-> ([UpdateTrigger] -> ShowS)
-> Show UpdateTrigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrigger] -> ShowS
$cshowList :: [UpdateTrigger] -> ShowS
show :: UpdateTrigger -> String
$cshow :: UpdateTrigger -> String
showsPrec :: Int -> UpdateTrigger -> ShowS
$cshowsPrec :: Int -> UpdateTrigger -> ShowS
Prelude.Show, (forall x. UpdateTrigger -> Rep UpdateTrigger x)
-> (forall x. Rep UpdateTrigger x -> UpdateTrigger)
-> Generic UpdateTrigger
forall x. Rep UpdateTrigger x -> UpdateTrigger
forall x. UpdateTrigger -> Rep UpdateTrigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrigger x -> UpdateTrigger
$cfrom :: forall x. UpdateTrigger -> Rep UpdateTrigger x
Prelude.Generic)
newUpdateTrigger ::
Prelude.Text ->
TriggerUpdate ->
UpdateTrigger
newUpdateTrigger :: Text -> TriggerUpdate -> UpdateTrigger
newUpdateTrigger Text
pName_ TriggerUpdate
pTriggerUpdate_ =
UpdateTrigger' :: Text -> TriggerUpdate -> UpdateTrigger
UpdateTrigger'
{ $sel:name:UpdateTrigger' :: Text
name = Text
pName_,
$sel:triggerUpdate:UpdateTrigger' :: TriggerUpdate
triggerUpdate = TriggerUpdate
pTriggerUpdate_
}
updateTrigger_name :: Lens.Lens' UpdateTrigger Prelude.Text
updateTrigger_name :: (Text -> f Text) -> UpdateTrigger -> f UpdateTrigger
updateTrigger_name = (UpdateTrigger -> Text)
-> (UpdateTrigger -> Text -> UpdateTrigger)
-> Lens UpdateTrigger UpdateTrigger Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrigger' {Text
name :: Text
$sel:name:UpdateTrigger' :: UpdateTrigger -> Text
name} -> Text
name) (\s :: UpdateTrigger
s@UpdateTrigger' {} Text
a -> UpdateTrigger
s {$sel:name:UpdateTrigger' :: Text
name = Text
a} :: UpdateTrigger)
updateTrigger_triggerUpdate :: Lens.Lens' UpdateTrigger TriggerUpdate
updateTrigger_triggerUpdate :: (TriggerUpdate -> f TriggerUpdate)
-> UpdateTrigger -> f UpdateTrigger
updateTrigger_triggerUpdate = (UpdateTrigger -> TriggerUpdate)
-> (UpdateTrigger -> TriggerUpdate -> UpdateTrigger)
-> Lens UpdateTrigger UpdateTrigger TriggerUpdate TriggerUpdate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrigger' {TriggerUpdate
triggerUpdate :: TriggerUpdate
$sel:triggerUpdate:UpdateTrigger' :: UpdateTrigger -> TriggerUpdate
triggerUpdate} -> TriggerUpdate
triggerUpdate) (\s :: UpdateTrigger
s@UpdateTrigger' {} TriggerUpdate
a -> UpdateTrigger
s {$sel:triggerUpdate:UpdateTrigger' :: TriggerUpdate
triggerUpdate = TriggerUpdate
a} :: UpdateTrigger)
instance Core.AWSRequest UpdateTrigger where
type
AWSResponse UpdateTrigger =
UpdateTriggerResponse
request :: UpdateTrigger -> Request UpdateTrigger
request = Service -> UpdateTrigger -> Request UpdateTrigger
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateTrigger
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrigger)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateTrigger))
-> Logger
-> Service
-> Proxy UpdateTrigger
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrigger)))
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 Trigger -> Int -> UpdateTriggerResponse
UpdateTriggerResponse'
(Maybe Trigger -> Int -> UpdateTriggerResponse)
-> Either String (Maybe Trigger)
-> Either String (Int -> UpdateTriggerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Trigger)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Trigger")
Either String (Int -> UpdateTriggerResponse)
-> Either String Int -> Either String UpdateTriggerResponse
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 UpdateTrigger
instance Prelude.NFData UpdateTrigger
instance Core.ToHeaders UpdateTrigger where
toHeaders :: UpdateTrigger -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateTrigger -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSGlue.UpdateTrigger" :: Prelude.ByteString),
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 UpdateTrigger where
toJSON :: UpdateTrigger -> Value
toJSON UpdateTrigger' {Text
TriggerUpdate
triggerUpdate :: TriggerUpdate
name :: Text
$sel:triggerUpdate:UpdateTrigger' :: UpdateTrigger -> TriggerUpdate
$sel:name:UpdateTrigger' :: UpdateTrigger -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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
"TriggerUpdate" Text -> TriggerUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TriggerUpdate
triggerUpdate)
]
)
instance Core.ToPath UpdateTrigger where
toPath :: UpdateTrigger -> ByteString
toPath = ByteString -> UpdateTrigger -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateTrigger where
toQuery :: UpdateTrigger -> QueryString
toQuery = QueryString -> UpdateTrigger -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateTriggerResponse = UpdateTriggerResponse'
{
UpdateTriggerResponse -> Maybe Trigger
trigger :: Prelude.Maybe Trigger,
UpdateTriggerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateTriggerResponse -> UpdateTriggerResponse -> Bool
(UpdateTriggerResponse -> UpdateTriggerResponse -> Bool)
-> (UpdateTriggerResponse -> UpdateTriggerResponse -> Bool)
-> Eq UpdateTriggerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTriggerResponse -> UpdateTriggerResponse -> Bool
$c/= :: UpdateTriggerResponse -> UpdateTriggerResponse -> Bool
== :: UpdateTriggerResponse -> UpdateTriggerResponse -> Bool
$c== :: UpdateTriggerResponse -> UpdateTriggerResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTriggerResponse]
ReadPrec UpdateTriggerResponse
Int -> ReadS UpdateTriggerResponse
ReadS [UpdateTriggerResponse]
(Int -> ReadS UpdateTriggerResponse)
-> ReadS [UpdateTriggerResponse]
-> ReadPrec UpdateTriggerResponse
-> ReadPrec [UpdateTriggerResponse]
-> Read UpdateTriggerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTriggerResponse]
$creadListPrec :: ReadPrec [UpdateTriggerResponse]
readPrec :: ReadPrec UpdateTriggerResponse
$creadPrec :: ReadPrec UpdateTriggerResponse
readList :: ReadS [UpdateTriggerResponse]
$creadList :: ReadS [UpdateTriggerResponse]
readsPrec :: Int -> ReadS UpdateTriggerResponse
$creadsPrec :: Int -> ReadS UpdateTriggerResponse
Prelude.Read, Int -> UpdateTriggerResponse -> ShowS
[UpdateTriggerResponse] -> ShowS
UpdateTriggerResponse -> String
(Int -> UpdateTriggerResponse -> ShowS)
-> (UpdateTriggerResponse -> String)
-> ([UpdateTriggerResponse] -> ShowS)
-> Show UpdateTriggerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTriggerResponse] -> ShowS
$cshowList :: [UpdateTriggerResponse] -> ShowS
show :: UpdateTriggerResponse -> String
$cshow :: UpdateTriggerResponse -> String
showsPrec :: Int -> UpdateTriggerResponse -> ShowS
$cshowsPrec :: Int -> UpdateTriggerResponse -> ShowS
Prelude.Show, (forall x. UpdateTriggerResponse -> Rep UpdateTriggerResponse x)
-> (forall x. Rep UpdateTriggerResponse x -> UpdateTriggerResponse)
-> Generic UpdateTriggerResponse
forall x. Rep UpdateTriggerResponse x -> UpdateTriggerResponse
forall x. UpdateTriggerResponse -> Rep UpdateTriggerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTriggerResponse x -> UpdateTriggerResponse
$cfrom :: forall x. UpdateTriggerResponse -> Rep UpdateTriggerResponse x
Prelude.Generic)
newUpdateTriggerResponse ::
Prelude.Int ->
UpdateTriggerResponse
newUpdateTriggerResponse :: Int -> UpdateTriggerResponse
newUpdateTriggerResponse Int
pHttpStatus_ =
UpdateTriggerResponse' :: Maybe Trigger -> Int -> UpdateTriggerResponse
UpdateTriggerResponse'
{ $sel:trigger:UpdateTriggerResponse' :: Maybe Trigger
trigger = Maybe Trigger
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateTriggerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateTriggerResponse_trigger :: Lens.Lens' UpdateTriggerResponse (Prelude.Maybe Trigger)
updateTriggerResponse_trigger :: (Maybe Trigger -> f (Maybe Trigger))
-> UpdateTriggerResponse -> f UpdateTriggerResponse
updateTriggerResponse_trigger = (UpdateTriggerResponse -> Maybe Trigger)
-> (UpdateTriggerResponse
-> Maybe Trigger -> UpdateTriggerResponse)
-> Lens
UpdateTriggerResponse
UpdateTriggerResponse
(Maybe Trigger)
(Maybe Trigger)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTriggerResponse' {Maybe Trigger
trigger :: Maybe Trigger
$sel:trigger:UpdateTriggerResponse' :: UpdateTriggerResponse -> Maybe Trigger
trigger} -> Maybe Trigger
trigger) (\s :: UpdateTriggerResponse
s@UpdateTriggerResponse' {} Maybe Trigger
a -> UpdateTriggerResponse
s {$sel:trigger:UpdateTriggerResponse' :: Maybe Trigger
trigger = Maybe Trigger
a} :: UpdateTriggerResponse)
updateTriggerResponse_httpStatus :: Lens.Lens' UpdateTriggerResponse Prelude.Int
updateTriggerResponse_httpStatus :: (Int -> f Int) -> UpdateTriggerResponse -> f UpdateTriggerResponse
updateTriggerResponse_httpStatus = (UpdateTriggerResponse -> Int)
-> (UpdateTriggerResponse -> Int -> UpdateTriggerResponse)
-> Lens UpdateTriggerResponse UpdateTriggerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTriggerResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTriggerResponse' :: UpdateTriggerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTriggerResponse
s@UpdateTriggerResponse' {} Int
a -> UpdateTriggerResponse
s {$sel:httpStatus:UpdateTriggerResponse' :: Int
httpStatus = Int
a} :: UpdateTriggerResponse)
instance Prelude.NFData UpdateTriggerResponse