{-# 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.MediaLive.BatchUpdateSchedule
(
BatchUpdateSchedule (..),
newBatchUpdateSchedule,
batchUpdateSchedule_creates,
batchUpdateSchedule_deletes,
batchUpdateSchedule_channelId,
BatchUpdateScheduleResponse (..),
newBatchUpdateScheduleResponse,
batchUpdateScheduleResponse_creates,
batchUpdateScheduleResponse_deletes,
batchUpdateScheduleResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchUpdateSchedule = BatchUpdateSchedule'
{
BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
creates :: Prelude.Maybe BatchScheduleActionCreateRequest,
BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
deletes :: Prelude.Maybe BatchScheduleActionDeleteRequest,
BatchUpdateSchedule -> Text
channelId :: Prelude.Text
}
deriving (BatchUpdateSchedule -> BatchUpdateSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateSchedule -> BatchUpdateSchedule -> Bool
$c/= :: BatchUpdateSchedule -> BatchUpdateSchedule -> Bool
== :: BatchUpdateSchedule -> BatchUpdateSchedule -> Bool
$c== :: BatchUpdateSchedule -> BatchUpdateSchedule -> Bool
Prelude.Eq, ReadPrec [BatchUpdateSchedule]
ReadPrec BatchUpdateSchedule
Int -> ReadS BatchUpdateSchedule
ReadS [BatchUpdateSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateSchedule]
$creadListPrec :: ReadPrec [BatchUpdateSchedule]
readPrec :: ReadPrec BatchUpdateSchedule
$creadPrec :: ReadPrec BatchUpdateSchedule
readList :: ReadS [BatchUpdateSchedule]
$creadList :: ReadS [BatchUpdateSchedule]
readsPrec :: Int -> ReadS BatchUpdateSchedule
$creadsPrec :: Int -> ReadS BatchUpdateSchedule
Prelude.Read, Int -> BatchUpdateSchedule -> ShowS
[BatchUpdateSchedule] -> ShowS
BatchUpdateSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateSchedule] -> ShowS
$cshowList :: [BatchUpdateSchedule] -> ShowS
show :: BatchUpdateSchedule -> String
$cshow :: BatchUpdateSchedule -> String
showsPrec :: Int -> BatchUpdateSchedule -> ShowS
$cshowsPrec :: Int -> BatchUpdateSchedule -> ShowS
Prelude.Show, forall x. Rep BatchUpdateSchedule x -> BatchUpdateSchedule
forall x. BatchUpdateSchedule -> Rep BatchUpdateSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdateSchedule x -> BatchUpdateSchedule
$cfrom :: forall x. BatchUpdateSchedule -> Rep BatchUpdateSchedule x
Prelude.Generic)
newBatchUpdateSchedule ::
Prelude.Text ->
BatchUpdateSchedule
newBatchUpdateSchedule :: Text -> BatchUpdateSchedule
newBatchUpdateSchedule Text
pChannelId_ =
BatchUpdateSchedule'
{ $sel:creates:BatchUpdateSchedule' :: Maybe BatchScheduleActionCreateRequest
creates = forall a. Maybe a
Prelude.Nothing,
$sel:deletes:BatchUpdateSchedule' :: Maybe BatchScheduleActionDeleteRequest
deletes = forall a. Maybe a
Prelude.Nothing,
$sel:channelId:BatchUpdateSchedule' :: Text
channelId = Text
pChannelId_
}
batchUpdateSchedule_creates :: Lens.Lens' BatchUpdateSchedule (Prelude.Maybe BatchScheduleActionCreateRequest)
batchUpdateSchedule_creates :: Lens' BatchUpdateSchedule (Maybe BatchScheduleActionCreateRequest)
batchUpdateSchedule_creates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateSchedule' {Maybe BatchScheduleActionCreateRequest
creates :: Maybe BatchScheduleActionCreateRequest
$sel:creates:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
creates} -> Maybe BatchScheduleActionCreateRequest
creates) (\s :: BatchUpdateSchedule
s@BatchUpdateSchedule' {} Maybe BatchScheduleActionCreateRequest
a -> BatchUpdateSchedule
s {$sel:creates:BatchUpdateSchedule' :: Maybe BatchScheduleActionCreateRequest
creates = Maybe BatchScheduleActionCreateRequest
a} :: BatchUpdateSchedule)
batchUpdateSchedule_deletes :: Lens.Lens' BatchUpdateSchedule (Prelude.Maybe BatchScheduleActionDeleteRequest)
batchUpdateSchedule_deletes :: Lens' BatchUpdateSchedule (Maybe BatchScheduleActionDeleteRequest)
batchUpdateSchedule_deletes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateSchedule' {Maybe BatchScheduleActionDeleteRequest
deletes :: Maybe BatchScheduleActionDeleteRequest
$sel:deletes:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
deletes} -> Maybe BatchScheduleActionDeleteRequest
deletes) (\s :: BatchUpdateSchedule
s@BatchUpdateSchedule' {} Maybe BatchScheduleActionDeleteRequest
a -> BatchUpdateSchedule
s {$sel:deletes:BatchUpdateSchedule' :: Maybe BatchScheduleActionDeleteRequest
deletes = Maybe BatchScheduleActionDeleteRequest
a} :: BatchUpdateSchedule)
batchUpdateSchedule_channelId :: Lens.Lens' BatchUpdateSchedule Prelude.Text
batchUpdateSchedule_channelId :: Lens' BatchUpdateSchedule Text
batchUpdateSchedule_channelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateSchedule' {Text
channelId :: Text
$sel:channelId:BatchUpdateSchedule' :: BatchUpdateSchedule -> Text
channelId} -> Text
channelId) (\s :: BatchUpdateSchedule
s@BatchUpdateSchedule' {} Text
a -> BatchUpdateSchedule
s {$sel:channelId:BatchUpdateSchedule' :: Text
channelId = Text
a} :: BatchUpdateSchedule)
instance Core.AWSRequest BatchUpdateSchedule where
type
AWSResponse BatchUpdateSchedule =
BatchUpdateScheduleResponse
request :: (Service -> Service)
-> BatchUpdateSchedule -> Request BatchUpdateSchedule
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchUpdateSchedule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUpdateSchedule)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe BatchScheduleActionCreateResult
-> Maybe BatchScheduleActionDeleteResult
-> Int
-> BatchUpdateScheduleResponse
BatchUpdateScheduleResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"creates")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"deletes")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchUpdateSchedule where
hashWithSalt :: Int -> BatchUpdateSchedule -> Int
hashWithSalt Int
_salt BatchUpdateSchedule' {Maybe BatchScheduleActionDeleteRequest
Maybe BatchScheduleActionCreateRequest
Text
channelId :: Text
deletes :: Maybe BatchScheduleActionDeleteRequest
creates :: Maybe BatchScheduleActionCreateRequest
$sel:channelId:BatchUpdateSchedule' :: BatchUpdateSchedule -> Text
$sel:deletes:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
$sel:creates:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BatchScheduleActionCreateRequest
creates
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BatchScheduleActionDeleteRequest
deletes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelId
instance Prelude.NFData BatchUpdateSchedule where
rnf :: BatchUpdateSchedule -> ()
rnf BatchUpdateSchedule' {Maybe BatchScheduleActionDeleteRequest
Maybe BatchScheduleActionCreateRequest
Text
channelId :: Text
deletes :: Maybe BatchScheduleActionDeleteRequest
creates :: Maybe BatchScheduleActionCreateRequest
$sel:channelId:BatchUpdateSchedule' :: BatchUpdateSchedule -> Text
$sel:deletes:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
$sel:creates:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchScheduleActionCreateRequest
creates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchScheduleActionDeleteRequest
deletes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
channelId
instance Data.ToHeaders BatchUpdateSchedule where
toHeaders :: BatchUpdateSchedule -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchUpdateSchedule where
toJSON :: BatchUpdateSchedule -> Value
toJSON BatchUpdateSchedule' {Maybe BatchScheduleActionDeleteRequest
Maybe BatchScheduleActionCreateRequest
Text
channelId :: Text
deletes :: Maybe BatchScheduleActionDeleteRequest
creates :: Maybe BatchScheduleActionCreateRequest
$sel:channelId:BatchUpdateSchedule' :: BatchUpdateSchedule -> Text
$sel:deletes:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
$sel:creates:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"creates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BatchScheduleActionCreateRequest
creates,
(Key
"deletes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BatchScheduleActionDeleteRequest
deletes
]
)
instance Data.ToPath BatchUpdateSchedule where
toPath :: BatchUpdateSchedule -> ByteString
toPath BatchUpdateSchedule' {Maybe BatchScheduleActionDeleteRequest
Maybe BatchScheduleActionCreateRequest
Text
channelId :: Text
deletes :: Maybe BatchScheduleActionDeleteRequest
creates :: Maybe BatchScheduleActionCreateRequest
$sel:channelId:BatchUpdateSchedule' :: BatchUpdateSchedule -> Text
$sel:deletes:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionDeleteRequest
$sel:creates:BatchUpdateSchedule' :: BatchUpdateSchedule -> Maybe BatchScheduleActionCreateRequest
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/prod/channels/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelId, ByteString
"/schedule"]
instance Data.ToQuery BatchUpdateSchedule where
toQuery :: BatchUpdateSchedule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchUpdateScheduleResponse = BatchUpdateScheduleResponse'
{
BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionCreateResult
creates :: Prelude.Maybe BatchScheduleActionCreateResult,
BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionDeleteResult
deletes :: Prelude.Maybe BatchScheduleActionDeleteResult,
BatchUpdateScheduleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchUpdateScheduleResponse -> BatchUpdateScheduleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateScheduleResponse -> BatchUpdateScheduleResponse -> Bool
$c/= :: BatchUpdateScheduleResponse -> BatchUpdateScheduleResponse -> Bool
== :: BatchUpdateScheduleResponse -> BatchUpdateScheduleResponse -> Bool
$c== :: BatchUpdateScheduleResponse -> BatchUpdateScheduleResponse -> Bool
Prelude.Eq, ReadPrec [BatchUpdateScheduleResponse]
ReadPrec BatchUpdateScheduleResponse
Int -> ReadS BatchUpdateScheduleResponse
ReadS [BatchUpdateScheduleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateScheduleResponse]
$creadListPrec :: ReadPrec [BatchUpdateScheduleResponse]
readPrec :: ReadPrec BatchUpdateScheduleResponse
$creadPrec :: ReadPrec BatchUpdateScheduleResponse
readList :: ReadS [BatchUpdateScheduleResponse]
$creadList :: ReadS [BatchUpdateScheduleResponse]
readsPrec :: Int -> ReadS BatchUpdateScheduleResponse
$creadsPrec :: Int -> ReadS BatchUpdateScheduleResponse
Prelude.Read, Int -> BatchUpdateScheduleResponse -> ShowS
[BatchUpdateScheduleResponse] -> ShowS
BatchUpdateScheduleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateScheduleResponse] -> ShowS
$cshowList :: [BatchUpdateScheduleResponse] -> ShowS
show :: BatchUpdateScheduleResponse -> String
$cshow :: BatchUpdateScheduleResponse -> String
showsPrec :: Int -> BatchUpdateScheduleResponse -> ShowS
$cshowsPrec :: Int -> BatchUpdateScheduleResponse -> ShowS
Prelude.Show, forall x.
Rep BatchUpdateScheduleResponse x -> BatchUpdateScheduleResponse
forall x.
BatchUpdateScheduleResponse -> Rep BatchUpdateScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateScheduleResponse x -> BatchUpdateScheduleResponse
$cfrom :: forall x.
BatchUpdateScheduleResponse -> Rep BatchUpdateScheduleResponse x
Prelude.Generic)
newBatchUpdateScheduleResponse ::
Prelude.Int ->
BatchUpdateScheduleResponse
newBatchUpdateScheduleResponse :: Int -> BatchUpdateScheduleResponse
newBatchUpdateScheduleResponse Int
pHttpStatus_ =
BatchUpdateScheduleResponse'
{ $sel:creates:BatchUpdateScheduleResponse' :: Maybe BatchScheduleActionCreateResult
creates =
forall a. Maybe a
Prelude.Nothing,
$sel:deletes:BatchUpdateScheduleResponse' :: Maybe BatchScheduleActionDeleteResult
deletes = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUpdateScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUpdateScheduleResponse_creates :: Lens.Lens' BatchUpdateScheduleResponse (Prelude.Maybe BatchScheduleActionCreateResult)
batchUpdateScheduleResponse_creates :: Lens'
BatchUpdateScheduleResponse (Maybe BatchScheduleActionCreateResult)
batchUpdateScheduleResponse_creates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateScheduleResponse' {Maybe BatchScheduleActionCreateResult
creates :: Maybe BatchScheduleActionCreateResult
$sel:creates:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionCreateResult
creates} -> Maybe BatchScheduleActionCreateResult
creates) (\s :: BatchUpdateScheduleResponse
s@BatchUpdateScheduleResponse' {} Maybe BatchScheduleActionCreateResult
a -> BatchUpdateScheduleResponse
s {$sel:creates:BatchUpdateScheduleResponse' :: Maybe BatchScheduleActionCreateResult
creates = Maybe BatchScheduleActionCreateResult
a} :: BatchUpdateScheduleResponse)
batchUpdateScheduleResponse_deletes :: Lens.Lens' BatchUpdateScheduleResponse (Prelude.Maybe BatchScheduleActionDeleteResult)
batchUpdateScheduleResponse_deletes :: Lens'
BatchUpdateScheduleResponse (Maybe BatchScheduleActionDeleteResult)
batchUpdateScheduleResponse_deletes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateScheduleResponse' {Maybe BatchScheduleActionDeleteResult
deletes :: Maybe BatchScheduleActionDeleteResult
$sel:deletes:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionDeleteResult
deletes} -> Maybe BatchScheduleActionDeleteResult
deletes) (\s :: BatchUpdateScheduleResponse
s@BatchUpdateScheduleResponse' {} Maybe BatchScheduleActionDeleteResult
a -> BatchUpdateScheduleResponse
s {$sel:deletes:BatchUpdateScheduleResponse' :: Maybe BatchScheduleActionDeleteResult
deletes = Maybe BatchScheduleActionDeleteResult
a} :: BatchUpdateScheduleResponse)
batchUpdateScheduleResponse_httpStatus :: Lens.Lens' BatchUpdateScheduleResponse Prelude.Int
batchUpdateScheduleResponse_httpStatus :: Lens' BatchUpdateScheduleResponse Int
batchUpdateScheduleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateScheduleResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchUpdateScheduleResponse
s@BatchUpdateScheduleResponse' {} Int
a -> BatchUpdateScheduleResponse
s {$sel:httpStatus:BatchUpdateScheduleResponse' :: Int
httpStatus = Int
a} :: BatchUpdateScheduleResponse)
instance Prelude.NFData BatchUpdateScheduleResponse where
rnf :: BatchUpdateScheduleResponse -> ()
rnf BatchUpdateScheduleResponse' {Int
Maybe BatchScheduleActionDeleteResult
Maybe BatchScheduleActionCreateResult
httpStatus :: Int
deletes :: Maybe BatchScheduleActionDeleteResult
creates :: Maybe BatchScheduleActionCreateResult
$sel:httpStatus:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse -> Int
$sel:deletes:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionDeleteResult
$sel:creates:BatchUpdateScheduleResponse' :: BatchUpdateScheduleResponse
-> Maybe BatchScheduleActionCreateResult
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchScheduleActionCreateResult
creates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BatchScheduleActionDeleteResult
deletes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus