{-# 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.GetClip
(
GetClip (..),
newGetClip,
getClip_streamARN,
getClip_streamName,
getClip_clipFragmentSelector,
GetClipResponse (..),
newGetClipResponse,
getClipResponse_contentType,
getClipResponse_httpStatus,
getClipResponse_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 GetClip = GetClip'
{
GetClip -> Maybe Text
streamARN :: Prelude.Maybe Prelude.Text,
GetClip -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text,
GetClip -> ClipFragmentSelector
clipFragmentSelector :: ClipFragmentSelector
}
deriving (GetClip -> GetClip -> Bool
(GetClip -> GetClip -> Bool)
-> (GetClip -> GetClip -> Bool) -> Eq GetClip
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetClip -> GetClip -> Bool
$c/= :: GetClip -> GetClip -> Bool
== :: GetClip -> GetClip -> Bool
$c== :: GetClip -> GetClip -> Bool
Prelude.Eq, ReadPrec [GetClip]
ReadPrec GetClip
Int -> ReadS GetClip
ReadS [GetClip]
(Int -> ReadS GetClip)
-> ReadS [GetClip]
-> ReadPrec GetClip
-> ReadPrec [GetClip]
-> Read GetClip
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetClip]
$creadListPrec :: ReadPrec [GetClip]
readPrec :: ReadPrec GetClip
$creadPrec :: ReadPrec GetClip
readList :: ReadS [GetClip]
$creadList :: ReadS [GetClip]
readsPrec :: Int -> ReadS GetClip
$creadsPrec :: Int -> ReadS GetClip
Prelude.Read, Int -> GetClip -> ShowS
[GetClip] -> ShowS
GetClip -> String
(Int -> GetClip -> ShowS)
-> (GetClip -> String) -> ([GetClip] -> ShowS) -> Show GetClip
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClip] -> ShowS
$cshowList :: [GetClip] -> ShowS
show :: GetClip -> String
$cshow :: GetClip -> String
showsPrec :: Int -> GetClip -> ShowS
$cshowsPrec :: Int -> GetClip -> ShowS
Prelude.Show, (forall x. GetClip -> Rep GetClip x)
-> (forall x. Rep GetClip x -> GetClip) -> Generic GetClip
forall x. Rep GetClip x -> GetClip
forall x. GetClip -> Rep GetClip x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetClip x -> GetClip
$cfrom :: forall x. GetClip -> Rep GetClip x
Prelude.Generic)
newGetClip ::
ClipFragmentSelector ->
GetClip
newGetClip :: ClipFragmentSelector -> GetClip
newGetClip ClipFragmentSelector
pClipFragmentSelector_ =
GetClip' :: Maybe Text -> Maybe Text -> ClipFragmentSelector -> GetClip
GetClip'
{ $sel:streamARN:GetClip' :: Maybe Text
streamARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:streamName:GetClip' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clipFragmentSelector:GetClip' :: ClipFragmentSelector
clipFragmentSelector = ClipFragmentSelector
pClipFragmentSelector_
}
getClip_streamARN :: Lens.Lens' GetClip (Prelude.Maybe Prelude.Text)
getClip_streamARN :: (Maybe Text -> f (Maybe Text)) -> GetClip -> f GetClip
getClip_streamARN = (GetClip -> Maybe Text)
-> (GetClip -> Maybe Text -> GetClip)
-> Lens GetClip GetClip (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClip' {Maybe Text
streamARN :: Maybe Text
$sel:streamARN:GetClip' :: GetClip -> Maybe Text
streamARN} -> Maybe Text
streamARN) (\s :: GetClip
s@GetClip' {} Maybe Text
a -> GetClip
s {$sel:streamARN:GetClip' :: Maybe Text
streamARN = Maybe Text
a} :: GetClip)
getClip_streamName :: Lens.Lens' GetClip (Prelude.Maybe Prelude.Text)
getClip_streamName :: (Maybe Text -> f (Maybe Text)) -> GetClip -> f GetClip
getClip_streamName = (GetClip -> Maybe Text)
-> (GetClip -> Maybe Text -> GetClip)
-> Lens GetClip GetClip (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClip' {Maybe Text
streamName :: Maybe Text
$sel:streamName:GetClip' :: GetClip -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: GetClip
s@GetClip' {} Maybe Text
a -> GetClip
s {$sel:streamName:GetClip' :: Maybe Text
streamName = Maybe Text
a} :: GetClip)
getClip_clipFragmentSelector :: Lens.Lens' GetClip ClipFragmentSelector
getClip_clipFragmentSelector :: (ClipFragmentSelector -> f ClipFragmentSelector)
-> GetClip -> f GetClip
getClip_clipFragmentSelector = (GetClip -> ClipFragmentSelector)
-> (GetClip -> ClipFragmentSelector -> GetClip)
-> Lens GetClip GetClip ClipFragmentSelector ClipFragmentSelector
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClip' {ClipFragmentSelector
clipFragmentSelector :: ClipFragmentSelector
$sel:clipFragmentSelector:GetClip' :: GetClip -> ClipFragmentSelector
clipFragmentSelector} -> ClipFragmentSelector
clipFragmentSelector) (\s :: GetClip
s@GetClip' {} ClipFragmentSelector
a -> GetClip
s {$sel:clipFragmentSelector:GetClip' :: ClipFragmentSelector
clipFragmentSelector = ClipFragmentSelector
a} :: GetClip)
instance Core.AWSRequest GetClip where
type AWSResponse GetClip = GetClipResponse
request :: GetClip -> Request GetClip
request = Service -> GetClip -> Request GetClip
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetClip
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetClip)))
response =
(Int
-> ResponseHeaders
-> ResponseBody
-> Either String (AWSResponse GetClip))
-> Logger
-> Service
-> Proxy GetClip
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetClip)))
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 -> GetClipResponse
GetClipResponse'
(Maybe Text -> Int -> ResponseBody -> GetClipResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResponseBody -> GetClipResponse)
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 -> GetClipResponse)
-> Either String Int
-> Either String (ResponseBody -> GetClipResponse)
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 -> GetClipResponse)
-> Either String ResponseBody -> Either String GetClipResponse
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 GetClip
instance Prelude.NFData GetClip
instance Core.ToHeaders GetClip where
toHeaders :: GetClip -> ResponseHeaders
toHeaders = ResponseHeaders -> GetClip -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON GetClip where
toJSON :: GetClip -> Value
toJSON GetClip' {Maybe Text
ClipFragmentSelector
clipFragmentSelector :: ClipFragmentSelector
streamName :: Maybe Text
streamARN :: Maybe Text
$sel:clipFragmentSelector:GetClip' :: GetClip -> ClipFragmentSelector
$sel:streamName:GetClip' :: GetClip -> Maybe Text
$sel:streamARN:GetClip' :: GetClip -> 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
"ClipFragmentSelector"
Text -> ClipFragmentSelector -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ClipFragmentSelector
clipFragmentSelector
)
]
)
instance Core.ToPath GetClip where
toPath :: GetClip -> ByteString
toPath = ByteString -> GetClip -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/getClip"
instance Core.ToQuery GetClip where
toQuery :: GetClip -> QueryString
toQuery = QueryString -> GetClip -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetClipResponse = GetClipResponse'
{
GetClipResponse -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
GetClipResponse -> Int
httpStatus :: Prelude.Int,
GetClipResponse -> ResponseBody
payload :: Core.ResponseBody
}
deriving (Int -> GetClipResponse -> ShowS
[GetClipResponse] -> ShowS
GetClipResponse -> String
(Int -> GetClipResponse -> ShowS)
-> (GetClipResponse -> String)
-> ([GetClipResponse] -> ShowS)
-> Show GetClipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClipResponse] -> ShowS
$cshowList :: [GetClipResponse] -> ShowS
show :: GetClipResponse -> String
$cshow :: GetClipResponse -> String
showsPrec :: Int -> GetClipResponse -> ShowS
$cshowsPrec :: Int -> GetClipResponse -> ShowS
Prelude.Show, (forall x. GetClipResponse -> Rep GetClipResponse x)
-> (forall x. Rep GetClipResponse x -> GetClipResponse)
-> Generic GetClipResponse
forall x. Rep GetClipResponse x -> GetClipResponse
forall x. GetClipResponse -> Rep GetClipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetClipResponse x -> GetClipResponse
$cfrom :: forall x. GetClipResponse -> Rep GetClipResponse x
Prelude.Generic)
newGetClipResponse ::
Prelude.Int ->
Core.ResponseBody ->
GetClipResponse
newGetClipResponse :: Int -> ResponseBody -> GetClipResponse
newGetClipResponse Int
pHttpStatus_ ResponseBody
pPayload_ =
GetClipResponse' :: Maybe Text -> Int -> ResponseBody -> GetClipResponse
GetClipResponse'
{ $sel:contentType:GetClipResponse' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetClipResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:payload:GetClipResponse' :: ResponseBody
payload = ResponseBody
pPayload_
}
getClipResponse_contentType :: Lens.Lens' GetClipResponse (Prelude.Maybe Prelude.Text)
getClipResponse_contentType :: (Maybe Text -> f (Maybe Text))
-> GetClipResponse -> f GetClipResponse
getClipResponse_contentType = (GetClipResponse -> Maybe Text)
-> (GetClipResponse -> Maybe Text -> GetClipResponse)
-> Lens GetClipResponse GetClipResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClipResponse' {Maybe Text
contentType :: Maybe Text
$sel:contentType:GetClipResponse' :: GetClipResponse -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: GetClipResponse
s@GetClipResponse' {} Maybe Text
a -> GetClipResponse
s {$sel:contentType:GetClipResponse' :: Maybe Text
contentType = Maybe Text
a} :: GetClipResponse)
getClipResponse_httpStatus :: Lens.Lens' GetClipResponse Prelude.Int
getClipResponse_httpStatus :: (Int -> f Int) -> GetClipResponse -> f GetClipResponse
getClipResponse_httpStatus = (GetClipResponse -> Int)
-> (GetClipResponse -> Int -> GetClipResponse)
-> Lens GetClipResponse GetClipResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClipResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetClipResponse' :: GetClipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetClipResponse
s@GetClipResponse' {} Int
a -> GetClipResponse
s {$sel:httpStatus:GetClipResponse' :: Int
httpStatus = Int
a} :: GetClipResponse)
getClipResponse_payload :: Lens.Lens' GetClipResponse Core.ResponseBody
getClipResponse_payload :: (ResponseBody -> f ResponseBody)
-> GetClipResponse -> f GetClipResponse
getClipResponse_payload = (GetClipResponse -> ResponseBody)
-> (GetClipResponse -> ResponseBody -> GetClipResponse)
-> Lens GetClipResponse GetClipResponse ResponseBody ResponseBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClipResponse' {ResponseBody
payload :: ResponseBody
$sel:payload:GetClipResponse' :: GetClipResponse -> ResponseBody
payload} -> ResponseBody
payload) (\s :: GetClipResponse
s@GetClipResponse' {} ResponseBody
a -> GetClipResponse
s {$sel:payload:GetClipResponse' :: ResponseBody
payload = ResponseBody
a} :: GetClipResponse)