{-# 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.KinesisVideoArchivedMedia.GetMediaForFragmentList
(
GetMediaForFragmentList (..),
newGetMediaForFragmentList,
getMediaForFragmentList_streamARN,
getMediaForFragmentList_streamName,
getMediaForFragmentList_fragments,
GetMediaForFragmentListResponse (..),
newGetMediaForFragmentListResponse,
getMediaForFragmentListResponse_contentType,
getMediaForFragmentListResponse_httpStatus,
getMediaForFragmentListResponse_payload,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KinesisVideoArchivedMedia.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 GetMediaForFragmentList = GetMediaForFragmentList'
{
GetMediaForFragmentList -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
GetMediaForFragmentList -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text,
GetMediaForFragmentList -> NonEmpty Text
fragments :: Prelude.NonEmpty Prelude.Text
}
deriving (GetMediaForFragmentList -> GetMediaForFragmentList -> Bool
(GetMediaForFragmentList -> GetMediaForFragmentList -> Bool)
-> (GetMediaForFragmentList -> GetMediaForFragmentList -> Bool)
-> Eq GetMediaForFragmentList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMediaForFragmentList -> GetMediaForFragmentList -> Bool
$c/= :: GetMediaForFragmentList -> GetMediaForFragmentList -> Bool
== :: GetMediaForFragmentList -> GetMediaForFragmentList -> Bool
$c== :: GetMediaForFragmentList -> GetMediaForFragmentList -> Bool
Prelude.Eq, ReadPrec [GetMediaForFragmentList]
ReadPrec GetMediaForFragmentList
Int -> ReadS GetMediaForFragmentList
ReadS [GetMediaForFragmentList]
(Int -> ReadS GetMediaForFragmentList)
-> ReadS [GetMediaForFragmentList]
-> ReadPrec GetMediaForFragmentList
-> ReadPrec [GetMediaForFragmentList]
-> Read GetMediaForFragmentList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMediaForFragmentList]
$creadListPrec :: ReadPrec [GetMediaForFragmentList]
readPrec :: ReadPrec GetMediaForFragmentList
$creadPrec :: ReadPrec GetMediaForFragmentList
readList :: ReadS [GetMediaForFragmentList]
$creadList :: ReadS [GetMediaForFragmentList]
readsPrec :: Int -> ReadS GetMediaForFragmentList
$creadsPrec :: Int -> ReadS GetMediaForFragmentList
Prelude.Read, Int -> GetMediaForFragmentList -> ShowS
[GetMediaForFragmentList] -> ShowS
GetMediaForFragmentList -> String
(Int -> GetMediaForFragmentList -> ShowS)
-> (GetMediaForFragmentList -> String)
-> ([GetMediaForFragmentList] -> ShowS)
-> Show GetMediaForFragmentList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMediaForFragmentList] -> ShowS
$cshowList :: [GetMediaForFragmentList] -> ShowS
show :: GetMediaForFragmentList -> String
$cshow :: GetMediaForFragmentList -> String
showsPrec :: Int -> GetMediaForFragmentList -> ShowS
$cshowsPrec :: Int -> GetMediaForFragmentList -> ShowS
Prelude.Show, (forall x.
GetMediaForFragmentList -> Rep GetMediaForFragmentList x)
-> (forall x.
Rep GetMediaForFragmentList x -> GetMediaForFragmentList)
-> Generic GetMediaForFragmentList
forall x. Rep GetMediaForFragmentList x -> GetMediaForFragmentList
forall x. GetMediaForFragmentList -> Rep GetMediaForFragmentList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMediaForFragmentList x -> GetMediaForFragmentList
$cfrom :: forall x. GetMediaForFragmentList -> Rep GetMediaForFragmentList x
Prelude.Generic)
newGetMediaForFragmentList ::
Prelude.NonEmpty Prelude.Text ->
GetMediaForFragmentList
newGetMediaForFragmentList :: NonEmpty Text -> GetMediaForFragmentList
newGetMediaForFragmentList NonEmpty Text
pFragments_ =
GetMediaForFragmentList' :: Maybe Text
-> Maybe Text -> NonEmpty Text -> GetMediaForFragmentList
GetMediaForFragmentList'
{ $sel:streamARN:GetMediaForFragmentList' :: Maybe Text
streamARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:streamName:GetMediaForFragmentList' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fragments:GetMediaForFragmentList' :: NonEmpty Text
fragments = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pFragments_
}
getMediaForFragmentList_streamARN :: Lens.Lens' GetMediaForFragmentList (Prelude.Maybe Prelude.Text)
getMediaForFragmentList_streamARN :: (Maybe Text -> f (Maybe Text))
-> GetMediaForFragmentList -> f GetMediaForFragmentList
getMediaForFragmentList_streamARN = (GetMediaForFragmentList -> Maybe Text)
-> (GetMediaForFragmentList
-> Maybe Text -> GetMediaForFragmentList)
-> Lens
GetMediaForFragmentList
GetMediaForFragmentList
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentList' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:GetMediaForFragmentList' :: GetMediaForFragmentList -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: GetMediaForFragmentList
s@GetMediaForFragmentList' {} Maybe Text
a -> GetMediaForFragmentList
s {$sel:streamARN:GetMediaForFragmentList' :: Maybe Text
streamARN = Maybe Text
a} :: GetMediaForFragmentList)
getMediaForFragmentList_streamName :: Lens.Lens' GetMediaForFragmentList (Prelude.Maybe Prelude.Text)
getMediaForFragmentList_streamName :: (Maybe Text -> f (Maybe Text))
-> GetMediaForFragmentList -> f GetMediaForFragmentList
getMediaForFragmentList_streamName = (GetMediaForFragmentList -> Maybe Text)
-> (GetMediaForFragmentList
-> Maybe Text -> GetMediaForFragmentList)
-> Lens
GetMediaForFragmentList
GetMediaForFragmentList
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentList' {Maybe Text
streamName :: Maybe Text
$sel:streamName:GetMediaForFragmentList' :: GetMediaForFragmentList -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: GetMediaForFragmentList
s@GetMediaForFragmentList' {} Maybe Text
a -> GetMediaForFragmentList
s {$sel:streamName:GetMediaForFragmentList' :: Maybe Text
streamName = Maybe Text
a} :: GetMediaForFragmentList)
getMediaForFragmentList_fragments :: Lens.Lens' GetMediaForFragmentList (Prelude.NonEmpty Prelude.Text)
getMediaForFragmentList_fragments :: (NonEmpty Text -> f (NonEmpty Text))
-> GetMediaForFragmentList -> f GetMediaForFragmentList
getMediaForFragmentList_fragments = (GetMediaForFragmentList -> NonEmpty Text)
-> (GetMediaForFragmentList
-> NonEmpty Text -> GetMediaForFragmentList)
-> Lens
GetMediaForFragmentList
GetMediaForFragmentList
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentList' {NonEmpty Text
fragments :: NonEmpty Text
$sel:fragments:GetMediaForFragmentList' :: GetMediaForFragmentList -> NonEmpty Text
fragments} -> NonEmpty Text
fragments) (\s :: GetMediaForFragmentList
s@GetMediaForFragmentList' {} NonEmpty Text
a -> GetMediaForFragmentList
s {$sel:fragments:GetMediaForFragmentList' :: NonEmpty Text
fragments = NonEmpty Text
a} :: GetMediaForFragmentList) ((NonEmpty Text -> f (NonEmpty Text))
-> GetMediaForFragmentList -> f GetMediaForFragmentList)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> GetMediaForFragmentList
-> f GetMediaForFragmentList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetMediaForFragmentList where
type
AWSResponse GetMediaForFragmentList =
GetMediaForFragmentListResponse
request :: GetMediaForFragmentList -> Request GetMediaForFragmentList
request = Service
-> GetMediaForFragmentList -> Request GetMediaForFragmentList
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetMediaForFragmentList
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMediaForFragmentList)))
response =
(Int
-> ResponseHeaders
-> ResponseBody
-> Either String (AWSResponse GetMediaForFragmentList))
-> Logger
-> Service
-> Proxy GetMediaForFragmentList
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMediaForFragmentList)))
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders
-> ResponseBody
-> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBody
( \Int
s ResponseHeaders
h ResponseBody
x ->
Maybe Text
-> Int -> ResponseBody -> GetMediaForFragmentListResponse
GetMediaForFragmentListResponse'
(Maybe Text
-> Int -> ResponseBody -> GetMediaForFragmentListResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> ResponseBody -> GetMediaForFragmentListResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"Content-Type")
Either
String (Int -> ResponseBody -> GetMediaForFragmentListResponse)
-> Either String Int
-> Either String (ResponseBody -> GetMediaForFragmentListResponse)
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))
Either String (ResponseBody -> GetMediaForFragmentListResponse)
-> Either String ResponseBody
-> Either String GetMediaForFragmentListResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseBody -> Either String ResponseBody
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure ResponseBody
x)
)
instance Prelude.Hashable GetMediaForFragmentList
instance Prelude.NFData GetMediaForFragmentList
instance Core.ToHeaders GetMediaForFragmentList where
toHeaders :: GetMediaForFragmentList -> ResponseHeaders
toHeaders = ResponseHeaders -> GetMediaForFragmentList -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON GetMediaForFragmentList where
toJSON :: GetMediaForFragmentList -> Value
toJSON GetMediaForFragmentList' {Maybe Text
NonEmpty Text
fragments :: NonEmpty Text
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:fragments:GetMediaForFragmentList' :: GetMediaForFragmentList -> NonEmpty Text
$sel:streamName:GetMediaForFragmentList' :: GetMediaForFragmentList -> Maybe Text
$sel:streamARN:GetMediaForFragmentList' :: GetMediaForFragmentList -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StreamARN" 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
streamARN,
(Text
"StreamName" 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
streamName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Fragments" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
fragments)
]
)
instance Core.ToPath GetMediaForFragmentList where
toPath :: GetMediaForFragmentList -> ByteString
toPath = ByteString -> GetMediaForFragmentList -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/getMediaForFragmentList"
instance Core.ToQuery GetMediaForFragmentList where
toQuery :: GetMediaForFragmentList -> QueryString
toQuery = QueryString -> GetMediaForFragmentList -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMediaForFragmentListResponse = GetMediaForFragmentListResponse'
{
GetMediaForFragmentListResponse -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
GetMediaForFragmentListResponse -> Int
httpStatus :: Prelude.Int,
GetMediaForFragmentListResponse -> ResponseBody
payload :: Core.ResponseBody
}
deriving (Int -> GetMediaForFragmentListResponse -> ShowS
[GetMediaForFragmentListResponse] -> ShowS
GetMediaForFragmentListResponse -> String
(Int -> GetMediaForFragmentListResponse -> ShowS)
-> (GetMediaForFragmentListResponse -> String)
-> ([GetMediaForFragmentListResponse] -> ShowS)
-> Show GetMediaForFragmentListResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMediaForFragmentListResponse] -> ShowS
$cshowList :: [GetMediaForFragmentListResponse] -> ShowS
show :: GetMediaForFragmentListResponse -> String
$cshow :: GetMediaForFragmentListResponse -> String
showsPrec :: Int -> GetMediaForFragmentListResponse -> ShowS
$cshowsPrec :: Int -> GetMediaForFragmentListResponse -> ShowS
Prelude.Show, (forall x.
GetMediaForFragmentListResponse
-> Rep GetMediaForFragmentListResponse x)
-> (forall x.
Rep GetMediaForFragmentListResponse x
-> GetMediaForFragmentListResponse)
-> Generic GetMediaForFragmentListResponse
forall x.
Rep GetMediaForFragmentListResponse x
-> GetMediaForFragmentListResponse
forall x.
GetMediaForFragmentListResponse
-> Rep GetMediaForFragmentListResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMediaForFragmentListResponse x
-> GetMediaForFragmentListResponse
$cfrom :: forall x.
GetMediaForFragmentListResponse
-> Rep GetMediaForFragmentListResponse x
Prelude.Generic)
newGetMediaForFragmentListResponse ::
Prelude.Int ->
Core.ResponseBody ->
GetMediaForFragmentListResponse
newGetMediaForFragmentListResponse :: Int -> ResponseBody -> GetMediaForFragmentListResponse
newGetMediaForFragmentListResponse
Int
pHttpStatus_
ResponseBody
pPayload_ =
GetMediaForFragmentListResponse' :: Maybe Text
-> Int -> ResponseBody -> GetMediaForFragmentListResponse
GetMediaForFragmentListResponse'
{ $sel:contentType:GetMediaForFragmentListResponse' :: Maybe Text
contentType =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMediaForFragmentListResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:payload:GetMediaForFragmentListResponse' :: ResponseBody
payload = ResponseBody
pPayload_
}
getMediaForFragmentListResponse_contentType :: Lens.Lens' GetMediaForFragmentListResponse (Prelude.Maybe Prelude.Text)
getMediaForFragmentListResponse_contentType :: (Maybe Text -> f (Maybe Text))
-> GetMediaForFragmentListResponse
-> f GetMediaForFragmentListResponse
getMediaForFragmentListResponse_contentType = (GetMediaForFragmentListResponse -> Maybe Text)
-> (GetMediaForFragmentListResponse
-> Maybe Text -> GetMediaForFragmentListResponse)
-> Lens
GetMediaForFragmentListResponse
GetMediaForFragmentListResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentListResponse' {Maybe Text
contentType :: Maybe Text
$sel:contentType:GetMediaForFragmentListResponse' :: GetMediaForFragmentListResponse -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: GetMediaForFragmentListResponse
s@GetMediaForFragmentListResponse' {} Maybe Text
a -> GetMediaForFragmentListResponse
s {$sel:contentType:GetMediaForFragmentListResponse' :: Maybe Text
contentType = Maybe Text
a} :: GetMediaForFragmentListResponse)
getMediaForFragmentListResponse_httpStatus :: Lens.Lens' GetMediaForFragmentListResponse Prelude.Int
getMediaForFragmentListResponse_httpStatus :: (Int -> f Int)
-> GetMediaForFragmentListResponse
-> f GetMediaForFragmentListResponse
getMediaForFragmentListResponse_httpStatus = (GetMediaForFragmentListResponse -> Int)
-> (GetMediaForFragmentListResponse
-> Int -> GetMediaForFragmentListResponse)
-> Lens
GetMediaForFragmentListResponse
GetMediaForFragmentListResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentListResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMediaForFragmentListResponse' :: GetMediaForFragmentListResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMediaForFragmentListResponse
s@GetMediaForFragmentListResponse' {} Int
a -> GetMediaForFragmentListResponse
s {$sel:httpStatus:GetMediaForFragmentListResponse' :: Int
httpStatus = Int
a} :: GetMediaForFragmentListResponse)
getMediaForFragmentListResponse_payload :: Lens.Lens' GetMediaForFragmentListResponse Core.ResponseBody
getMediaForFragmentListResponse_payload :: (ResponseBody -> f ResponseBody)
-> GetMediaForFragmentListResponse
-> f GetMediaForFragmentListResponse
getMediaForFragmentListResponse_payload = (GetMediaForFragmentListResponse -> ResponseBody)
-> (GetMediaForFragmentListResponse
-> ResponseBody -> GetMediaForFragmentListResponse)
-> Lens
GetMediaForFragmentListResponse
GetMediaForFragmentListResponse
ResponseBody
ResponseBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMediaForFragmentListResponse' {ResponseBody
payload :: ResponseBody
$sel:payload:GetMediaForFragmentListResponse' :: GetMediaForFragmentListResponse -> ResponseBody
payload} -> ResponseBody
payload) (\s :: GetMediaForFragmentListResponse
s@GetMediaForFragmentListResponse' {} ResponseBody
a -> GetMediaForFragmentListResponse
s {$sel:payload:GetMediaForFragmentListResponse' :: ResponseBody
payload = ResponseBody
a} :: GetMediaForFragmentListResponse)