{-# 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.DataBrew.UpdateSchedule
(
UpdateSchedule (..),
newUpdateSchedule,
updateSchedule_jobNames,
updateSchedule_cronExpression,
updateSchedule_name,
UpdateScheduleResponse (..),
newUpdateScheduleResponse,
updateScheduleResponse_httpStatus,
updateScheduleResponse_name,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.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 UpdateSchedule = UpdateSchedule'
{
UpdateSchedule -> Maybe [Text]
jobNames :: Prelude.Maybe [Prelude.Text],
UpdateSchedule -> Text
cronExpression :: Prelude.Text,
UpdateSchedule -> Text
name :: Prelude.Text
}
deriving (UpdateSchedule -> UpdateSchedule -> Bool
(UpdateSchedule -> UpdateSchedule -> Bool)
-> (UpdateSchedule -> UpdateSchedule -> Bool) -> Eq UpdateSchedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSchedule -> UpdateSchedule -> Bool
$c/= :: UpdateSchedule -> UpdateSchedule -> Bool
== :: UpdateSchedule -> UpdateSchedule -> Bool
$c== :: UpdateSchedule -> UpdateSchedule -> Bool
Prelude.Eq, ReadPrec [UpdateSchedule]
ReadPrec UpdateSchedule
Int -> ReadS UpdateSchedule
ReadS [UpdateSchedule]
(Int -> ReadS UpdateSchedule)
-> ReadS [UpdateSchedule]
-> ReadPrec UpdateSchedule
-> ReadPrec [UpdateSchedule]
-> Read UpdateSchedule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSchedule]
$creadListPrec :: ReadPrec [UpdateSchedule]
readPrec :: ReadPrec UpdateSchedule
$creadPrec :: ReadPrec UpdateSchedule
readList :: ReadS [UpdateSchedule]
$creadList :: ReadS [UpdateSchedule]
readsPrec :: Int -> ReadS UpdateSchedule
$creadsPrec :: Int -> ReadS UpdateSchedule
Prelude.Read, Int -> UpdateSchedule -> ShowS
[UpdateSchedule] -> ShowS
UpdateSchedule -> String
(Int -> UpdateSchedule -> ShowS)
-> (UpdateSchedule -> String)
-> ([UpdateSchedule] -> ShowS)
-> Show UpdateSchedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSchedule] -> ShowS
$cshowList :: [UpdateSchedule] -> ShowS
show :: UpdateSchedule -> String
$cshow :: UpdateSchedule -> String
showsPrec :: Int -> UpdateSchedule -> ShowS
$cshowsPrec :: Int -> UpdateSchedule -> ShowS
Prelude.Show, (forall x. UpdateSchedule -> Rep UpdateSchedule x)
-> (forall x. Rep UpdateSchedule x -> UpdateSchedule)
-> Generic UpdateSchedule
forall x. Rep UpdateSchedule x -> UpdateSchedule
forall x. UpdateSchedule -> Rep UpdateSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSchedule x -> UpdateSchedule
$cfrom :: forall x. UpdateSchedule -> Rep UpdateSchedule x
Prelude.Generic)
newUpdateSchedule ::
Prelude.Text ->
Prelude.Text ->
UpdateSchedule
newUpdateSchedule :: Text -> Text -> UpdateSchedule
newUpdateSchedule Text
pCronExpression_ Text
pName_ =
UpdateSchedule' :: Maybe [Text] -> Text -> Text -> UpdateSchedule
UpdateSchedule'
{ $sel:jobNames:UpdateSchedule' :: Maybe [Text]
jobNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:cronExpression:UpdateSchedule' :: Text
cronExpression = Text
pCronExpression_,
$sel:name:UpdateSchedule' :: Text
name = Text
pName_
}
updateSchedule_jobNames :: Lens.Lens' UpdateSchedule (Prelude.Maybe [Prelude.Text])
updateSchedule_jobNames :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateSchedule -> f UpdateSchedule
updateSchedule_jobNames = (UpdateSchedule -> Maybe [Text])
-> (UpdateSchedule -> Maybe [Text] -> UpdateSchedule)
-> Lens UpdateSchedule UpdateSchedule (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchedule' {Maybe [Text]
jobNames :: Maybe [Text]
$sel:jobNames:UpdateSchedule' :: UpdateSchedule -> Maybe [Text]
jobNames} -> Maybe [Text]
jobNames) (\s :: UpdateSchedule
s@UpdateSchedule' {} Maybe [Text]
a -> UpdateSchedule
s {$sel:jobNames:UpdateSchedule' :: Maybe [Text]
jobNames = Maybe [Text]
a} :: UpdateSchedule) ((Maybe [Text] -> f (Maybe [Text]))
-> UpdateSchedule -> f UpdateSchedule)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateSchedule
-> f UpdateSchedule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateSchedule_cronExpression :: Lens.Lens' UpdateSchedule Prelude.Text
updateSchedule_cronExpression :: (Text -> f Text) -> UpdateSchedule -> f UpdateSchedule
updateSchedule_cronExpression = (UpdateSchedule -> Text)
-> (UpdateSchedule -> Text -> UpdateSchedule)
-> Lens UpdateSchedule UpdateSchedule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchedule' {Text
cronExpression :: Text
$sel:cronExpression:UpdateSchedule' :: UpdateSchedule -> Text
cronExpression} -> Text
cronExpression) (\s :: UpdateSchedule
s@UpdateSchedule' {} Text
a -> UpdateSchedule
s {$sel:cronExpression:UpdateSchedule' :: Text
cronExpression = Text
a} :: UpdateSchedule)
updateSchedule_name :: Lens.Lens' UpdateSchedule Prelude.Text
updateSchedule_name :: (Text -> f Text) -> UpdateSchedule -> f UpdateSchedule
updateSchedule_name = (UpdateSchedule -> Text)
-> (UpdateSchedule -> Text -> UpdateSchedule)
-> Lens UpdateSchedule UpdateSchedule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchedule' {Text
name :: Text
$sel:name:UpdateSchedule' :: UpdateSchedule -> Text
name} -> Text
name) (\s :: UpdateSchedule
s@UpdateSchedule' {} Text
a -> UpdateSchedule
s {$sel:name:UpdateSchedule' :: Text
name = Text
a} :: UpdateSchedule)
instance Core.AWSRequest UpdateSchedule where
type
AWSResponse UpdateSchedule =
UpdateScheduleResponse
request :: UpdateSchedule -> Request UpdateSchedule
request = Service -> UpdateSchedule -> Request UpdateSchedule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSchedule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSchedule))
-> Logger
-> Service
-> Proxy UpdateSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSchedule)))
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 ->
Int -> Text -> UpdateScheduleResponse
UpdateScheduleResponse'
(Int -> Text -> UpdateScheduleResponse)
-> Either String Int
-> Either String (Text -> UpdateScheduleResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> UpdateScheduleResponse)
-> Either String Text -> Either String UpdateScheduleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
)
instance Prelude.Hashable UpdateSchedule
instance Prelude.NFData UpdateSchedule
instance Core.ToHeaders UpdateSchedule where
toHeaders :: UpdateSchedule -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSchedule -> 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 UpdateSchedule where
toJSON :: UpdateSchedule -> Value
toJSON UpdateSchedule' {Maybe [Text]
Text
name :: Text
cronExpression :: Text
jobNames :: Maybe [Text]
$sel:name:UpdateSchedule' :: UpdateSchedule -> Text
$sel:cronExpression:UpdateSchedule' :: UpdateSchedule -> Text
$sel:jobNames:UpdateSchedule' :: UpdateSchedule -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"JobNames" 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]
jobNames,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CronExpression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
cronExpression)
]
)
instance Core.ToPath UpdateSchedule where
toPath :: UpdateSchedule -> ByteString
toPath UpdateSchedule' {Maybe [Text]
Text
name :: Text
cronExpression :: Text
jobNames :: Maybe [Text]
$sel:name:UpdateSchedule' :: UpdateSchedule -> Text
$sel:cronExpression:UpdateSchedule' :: UpdateSchedule -> Text
$sel:jobNames:UpdateSchedule' :: UpdateSchedule -> Maybe [Text]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/schedules/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery UpdateSchedule where
toQuery :: UpdateSchedule -> QueryString
toQuery = QueryString -> UpdateSchedule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateScheduleResponse = UpdateScheduleResponse'
{
UpdateScheduleResponse -> Int
httpStatus :: Prelude.Int,
UpdateScheduleResponse -> Text
name :: Prelude.Text
}
deriving (UpdateScheduleResponse -> UpdateScheduleResponse -> Bool
(UpdateScheduleResponse -> UpdateScheduleResponse -> Bool)
-> (UpdateScheduleResponse -> UpdateScheduleResponse -> Bool)
-> Eq UpdateScheduleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScheduleResponse -> UpdateScheduleResponse -> Bool
$c/= :: UpdateScheduleResponse -> UpdateScheduleResponse -> Bool
== :: UpdateScheduleResponse -> UpdateScheduleResponse -> Bool
$c== :: UpdateScheduleResponse -> UpdateScheduleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateScheduleResponse]
ReadPrec UpdateScheduleResponse
Int -> ReadS UpdateScheduleResponse
ReadS [UpdateScheduleResponse]
(Int -> ReadS UpdateScheduleResponse)
-> ReadS [UpdateScheduleResponse]
-> ReadPrec UpdateScheduleResponse
-> ReadPrec [UpdateScheduleResponse]
-> Read UpdateScheduleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScheduleResponse]
$creadListPrec :: ReadPrec [UpdateScheduleResponse]
readPrec :: ReadPrec UpdateScheduleResponse
$creadPrec :: ReadPrec UpdateScheduleResponse
readList :: ReadS [UpdateScheduleResponse]
$creadList :: ReadS [UpdateScheduleResponse]
readsPrec :: Int -> ReadS UpdateScheduleResponse
$creadsPrec :: Int -> ReadS UpdateScheduleResponse
Prelude.Read, Int -> UpdateScheduleResponse -> ShowS
[UpdateScheduleResponse] -> ShowS
UpdateScheduleResponse -> String
(Int -> UpdateScheduleResponse -> ShowS)
-> (UpdateScheduleResponse -> String)
-> ([UpdateScheduleResponse] -> ShowS)
-> Show UpdateScheduleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScheduleResponse] -> ShowS
$cshowList :: [UpdateScheduleResponse] -> ShowS
show :: UpdateScheduleResponse -> String
$cshow :: UpdateScheduleResponse -> String
showsPrec :: Int -> UpdateScheduleResponse -> ShowS
$cshowsPrec :: Int -> UpdateScheduleResponse -> ShowS
Prelude.Show, (forall x. UpdateScheduleResponse -> Rep UpdateScheduleResponse x)
-> (forall x.
Rep UpdateScheduleResponse x -> UpdateScheduleResponse)
-> Generic UpdateScheduleResponse
forall x. Rep UpdateScheduleResponse x -> UpdateScheduleResponse
forall x. UpdateScheduleResponse -> Rep UpdateScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScheduleResponse x -> UpdateScheduleResponse
$cfrom :: forall x. UpdateScheduleResponse -> Rep UpdateScheduleResponse x
Prelude.Generic)
newUpdateScheduleResponse ::
Prelude.Int ->
Prelude.Text ->
UpdateScheduleResponse
newUpdateScheduleResponse :: Int -> Text -> UpdateScheduleResponse
newUpdateScheduleResponse Int
pHttpStatus_ Text
pName_ =
UpdateScheduleResponse' :: Int -> Text -> UpdateScheduleResponse
UpdateScheduleResponse'
{ $sel:httpStatus:UpdateScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:UpdateScheduleResponse' :: Text
name = Text
pName_
}
updateScheduleResponse_httpStatus :: Lens.Lens' UpdateScheduleResponse Prelude.Int
updateScheduleResponse_httpStatus :: (Int -> f Int)
-> UpdateScheduleResponse -> f UpdateScheduleResponse
updateScheduleResponse_httpStatus = (UpdateScheduleResponse -> Int)
-> (UpdateScheduleResponse -> Int -> UpdateScheduleResponse)
-> Lens UpdateScheduleResponse UpdateScheduleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScheduleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateScheduleResponse' :: UpdateScheduleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateScheduleResponse
s@UpdateScheduleResponse' {} Int
a -> UpdateScheduleResponse
s {$sel:httpStatus:UpdateScheduleResponse' :: Int
httpStatus = Int
a} :: UpdateScheduleResponse)
updateScheduleResponse_name :: Lens.Lens' UpdateScheduleResponse Prelude.Text
updateScheduleResponse_name :: (Text -> f Text)
-> UpdateScheduleResponse -> f UpdateScheduleResponse
updateScheduleResponse_name = (UpdateScheduleResponse -> Text)
-> (UpdateScheduleResponse -> Text -> UpdateScheduleResponse)
-> Lens UpdateScheduleResponse UpdateScheduleResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScheduleResponse' {Text
name :: Text
$sel:name:UpdateScheduleResponse' :: UpdateScheduleResponse -> Text
name} -> Text
name) (\s :: UpdateScheduleResponse
s@UpdateScheduleResponse' {} Text
a -> UpdateScheduleResponse
s {$sel:name:UpdateScheduleResponse' :: Text
name = Text
a} :: UpdateScheduleResponse)
instance Prelude.NFData UpdateScheduleResponse