{-# 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.DescribeSchedule
(
DescribeSchedule (..),
newDescribeSchedule,
describeSchedule_maxResults,
describeSchedule_nextToken,
describeSchedule_channelId,
DescribeScheduleResponse (..),
newDescribeScheduleResponse,
describeScheduleResponse_nextToken,
describeScheduleResponse_scheduleActions,
describeScheduleResponse_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 DescribeSchedule = DescribeSchedule'
{ DescribeSchedule -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
DescribeSchedule -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeSchedule -> Text
channelId :: Prelude.Text
}
deriving (DescribeSchedule -> DescribeSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSchedule -> DescribeSchedule -> Bool
$c/= :: DescribeSchedule -> DescribeSchedule -> Bool
== :: DescribeSchedule -> DescribeSchedule -> Bool
$c== :: DescribeSchedule -> DescribeSchedule -> Bool
Prelude.Eq, ReadPrec [DescribeSchedule]
ReadPrec DescribeSchedule
Int -> ReadS DescribeSchedule
ReadS [DescribeSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSchedule]
$creadListPrec :: ReadPrec [DescribeSchedule]
readPrec :: ReadPrec DescribeSchedule
$creadPrec :: ReadPrec DescribeSchedule
readList :: ReadS [DescribeSchedule]
$creadList :: ReadS [DescribeSchedule]
readsPrec :: Int -> ReadS DescribeSchedule
$creadsPrec :: Int -> ReadS DescribeSchedule
Prelude.Read, Int -> DescribeSchedule -> ShowS
[DescribeSchedule] -> ShowS
DescribeSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSchedule] -> ShowS
$cshowList :: [DescribeSchedule] -> ShowS
show :: DescribeSchedule -> String
$cshow :: DescribeSchedule -> String
showsPrec :: Int -> DescribeSchedule -> ShowS
$cshowsPrec :: Int -> DescribeSchedule -> ShowS
Prelude.Show, forall x. Rep DescribeSchedule x -> DescribeSchedule
forall x. DescribeSchedule -> Rep DescribeSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSchedule x -> DescribeSchedule
$cfrom :: forall x. DescribeSchedule -> Rep DescribeSchedule x
Prelude.Generic)
newDescribeSchedule ::
Prelude.Text ->
DescribeSchedule
newDescribeSchedule :: Text -> DescribeSchedule
newDescribeSchedule Text
pChannelId_ =
DescribeSchedule'
{ $sel:maxResults:DescribeSchedule' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeSchedule' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:channelId:DescribeSchedule' :: Text
channelId = Text
pChannelId_
}
describeSchedule_maxResults :: Lens.Lens' DescribeSchedule (Prelude.Maybe Prelude.Natural)
describeSchedule_maxResults :: Lens' DescribeSchedule (Maybe Natural)
describeSchedule_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSchedule' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeSchedule' :: DescribeSchedule -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeSchedule
s@DescribeSchedule' {} Maybe Natural
a -> DescribeSchedule
s {$sel:maxResults:DescribeSchedule' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeSchedule)
describeSchedule_nextToken :: Lens.Lens' DescribeSchedule (Prelude.Maybe Prelude.Text)
describeSchedule_nextToken :: Lens' DescribeSchedule (Maybe Text)
describeSchedule_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSchedule' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSchedule' :: DescribeSchedule -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSchedule
s@DescribeSchedule' {} Maybe Text
a -> DescribeSchedule
s {$sel:nextToken:DescribeSchedule' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSchedule)
describeSchedule_channelId :: Lens.Lens' DescribeSchedule Prelude.Text
describeSchedule_channelId :: Lens' DescribeSchedule Text
describeSchedule_channelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSchedule' {Text
channelId :: Text
$sel:channelId:DescribeSchedule' :: DescribeSchedule -> Text
channelId} -> Text
channelId) (\s :: DescribeSchedule
s@DescribeSchedule' {} Text
a -> DescribeSchedule
s {$sel:channelId:DescribeSchedule' :: Text
channelId = Text
a} :: DescribeSchedule)
instance Core.AWSPager DescribeSchedule where
page :: DescribeSchedule
-> AWSResponse DescribeSchedule -> Maybe DescribeSchedule
page DescribeSchedule
rq AWSResponse DescribeSchedule
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeSchedule
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeScheduleResponse (Maybe Text)
describeScheduleResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeSchedule
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeScheduleResponse (Maybe [ScheduleAction])
describeScheduleResponse_scheduleActions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ DescribeSchedule
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeSchedule (Maybe Text)
describeSchedule_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeSchedule
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeScheduleResponse (Maybe Text)
describeScheduleResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest DescribeSchedule where
type
AWSResponse DescribeSchedule =
DescribeScheduleResponse
request :: (Service -> Service)
-> DescribeSchedule -> Request DescribeSchedule
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeSchedule)))
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 Text
-> Maybe [ScheduleAction] -> Int -> DescribeScheduleResponse
DescribeScheduleResponse'
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
"nextToken")
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
"scheduleActions"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
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 DescribeSchedule where
hashWithSalt :: Int -> DescribeSchedule -> Int
hashWithSalt Int
_salt DescribeSchedule' {Maybe Natural
Maybe Text
Text
channelId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:channelId:DescribeSchedule' :: DescribeSchedule -> Text
$sel:nextToken:DescribeSchedule' :: DescribeSchedule -> Maybe Text
$sel:maxResults:DescribeSchedule' :: DescribeSchedule -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelId
instance Prelude.NFData DescribeSchedule where
rnf :: DescribeSchedule -> ()
rnf DescribeSchedule' {Maybe Natural
Maybe Text
Text
channelId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:channelId:DescribeSchedule' :: DescribeSchedule -> Text
$sel:nextToken:DescribeSchedule' :: DescribeSchedule -> Maybe Text
$sel:maxResults:DescribeSchedule' :: DescribeSchedule -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
channelId
instance Data.ToHeaders DescribeSchedule where
toHeaders :: DescribeSchedule -> 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.ToPath DescribeSchedule where
toPath :: DescribeSchedule -> ByteString
toPath DescribeSchedule' {Maybe Natural
Maybe Text
Text
channelId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:channelId:DescribeSchedule' :: DescribeSchedule -> Text
$sel:nextToken:DescribeSchedule' :: DescribeSchedule -> Maybe Text
$sel:maxResults:DescribeSchedule' :: DescribeSchedule -> Maybe Natural
..} =
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 DescribeSchedule where
toQuery :: DescribeSchedule -> QueryString
toQuery DescribeSchedule' {Maybe Natural
Maybe Text
Text
channelId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:channelId:DescribeSchedule' :: DescribeSchedule -> Text
$sel:nextToken:DescribeSchedule' :: DescribeSchedule -> Maybe Text
$sel:maxResults:DescribeSchedule' :: DescribeSchedule -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data DescribeScheduleResponse = DescribeScheduleResponse'
{
DescribeScheduleResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeScheduleResponse -> Maybe [ScheduleAction]
scheduleActions :: Prelude.Maybe [ScheduleAction],
DescribeScheduleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeScheduleResponse -> DescribeScheduleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeScheduleResponse -> DescribeScheduleResponse -> Bool
$c/= :: DescribeScheduleResponse -> DescribeScheduleResponse -> Bool
== :: DescribeScheduleResponse -> DescribeScheduleResponse -> Bool
$c== :: DescribeScheduleResponse -> DescribeScheduleResponse -> Bool
Prelude.Eq, ReadPrec [DescribeScheduleResponse]
ReadPrec DescribeScheduleResponse
Int -> ReadS DescribeScheduleResponse
ReadS [DescribeScheduleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeScheduleResponse]
$creadListPrec :: ReadPrec [DescribeScheduleResponse]
readPrec :: ReadPrec DescribeScheduleResponse
$creadPrec :: ReadPrec DescribeScheduleResponse
readList :: ReadS [DescribeScheduleResponse]
$creadList :: ReadS [DescribeScheduleResponse]
readsPrec :: Int -> ReadS DescribeScheduleResponse
$creadsPrec :: Int -> ReadS DescribeScheduleResponse
Prelude.Read, Int -> DescribeScheduleResponse -> ShowS
[DescribeScheduleResponse] -> ShowS
DescribeScheduleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeScheduleResponse] -> ShowS
$cshowList :: [DescribeScheduleResponse] -> ShowS
show :: DescribeScheduleResponse -> String
$cshow :: DescribeScheduleResponse -> String
showsPrec :: Int -> DescribeScheduleResponse -> ShowS
$cshowsPrec :: Int -> DescribeScheduleResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeScheduleResponse x -> DescribeScheduleResponse
forall x.
DescribeScheduleResponse -> Rep DescribeScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeScheduleResponse x -> DescribeScheduleResponse
$cfrom :: forall x.
DescribeScheduleResponse -> Rep DescribeScheduleResponse x
Prelude.Generic)
newDescribeScheduleResponse ::
Prelude.Int ->
DescribeScheduleResponse
newDescribeScheduleResponse :: Int -> DescribeScheduleResponse
newDescribeScheduleResponse Int
pHttpStatus_ =
DescribeScheduleResponse'
{ $sel:nextToken:DescribeScheduleResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:scheduleActions:DescribeScheduleResponse' :: Maybe [ScheduleAction]
scheduleActions = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeScheduleResponse_nextToken :: Lens.Lens' DescribeScheduleResponse (Prelude.Maybe Prelude.Text)
describeScheduleResponse_nextToken :: Lens' DescribeScheduleResponse (Maybe Text)
describeScheduleResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduleResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeScheduleResponse' :: DescribeScheduleResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeScheduleResponse
s@DescribeScheduleResponse' {} Maybe Text
a -> DescribeScheduleResponse
s {$sel:nextToken:DescribeScheduleResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeScheduleResponse)
describeScheduleResponse_scheduleActions :: Lens.Lens' DescribeScheduleResponse (Prelude.Maybe [ScheduleAction])
describeScheduleResponse_scheduleActions :: Lens' DescribeScheduleResponse (Maybe [ScheduleAction])
describeScheduleResponse_scheduleActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduleResponse' {Maybe [ScheduleAction]
scheduleActions :: Maybe [ScheduleAction]
$sel:scheduleActions:DescribeScheduleResponse' :: DescribeScheduleResponse -> Maybe [ScheduleAction]
scheduleActions} -> Maybe [ScheduleAction]
scheduleActions) (\s :: DescribeScheduleResponse
s@DescribeScheduleResponse' {} Maybe [ScheduleAction]
a -> DescribeScheduleResponse
s {$sel:scheduleActions:DescribeScheduleResponse' :: Maybe [ScheduleAction]
scheduleActions = Maybe [ScheduleAction]
a} :: DescribeScheduleResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeScheduleResponse_httpStatus :: Lens.Lens' DescribeScheduleResponse Prelude.Int
describeScheduleResponse_httpStatus :: Lens' DescribeScheduleResponse Int
describeScheduleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeScheduleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeScheduleResponse' :: DescribeScheduleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeScheduleResponse
s@DescribeScheduleResponse' {} Int
a -> DescribeScheduleResponse
s {$sel:httpStatus:DescribeScheduleResponse' :: Int
httpStatus = Int
a} :: DescribeScheduleResponse)
instance Prelude.NFData DescribeScheduleResponse where
rnf :: DescribeScheduleResponse -> ()
rnf DescribeScheduleResponse' {Int
Maybe [ScheduleAction]
Maybe Text
httpStatus :: Int
scheduleActions :: Maybe [ScheduleAction]
nextToken :: Maybe Text
$sel:httpStatus:DescribeScheduleResponse' :: DescribeScheduleResponse -> Int
$sel:scheduleActions:DescribeScheduleResponse' :: DescribeScheduleResponse -> Maybe [ScheduleAction]
$sel:nextToken:DescribeScheduleResponse' :: DescribeScheduleResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ScheduleAction]
scheduleActions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus