{-# 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.IVS.GetStreamKey
(
GetStreamKey (..),
newGetStreamKey,
getStreamKey_arn,
GetStreamKeyResponse (..),
newGetStreamKeyResponse,
getStreamKeyResponse_streamKey,
getStreamKeyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IVS.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 GetStreamKey = GetStreamKey'
{
GetStreamKey -> Text
arn :: Prelude.Text
}
deriving (GetStreamKey -> GetStreamKey -> Bool
(GetStreamKey -> GetStreamKey -> Bool)
-> (GetStreamKey -> GetStreamKey -> Bool) -> Eq GetStreamKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamKey -> GetStreamKey -> Bool
$c/= :: GetStreamKey -> GetStreamKey -> Bool
== :: GetStreamKey -> GetStreamKey -> Bool
$c== :: GetStreamKey -> GetStreamKey -> Bool
Prelude.Eq, ReadPrec [GetStreamKey]
ReadPrec GetStreamKey
Int -> ReadS GetStreamKey
ReadS [GetStreamKey]
(Int -> ReadS GetStreamKey)
-> ReadS [GetStreamKey]
-> ReadPrec GetStreamKey
-> ReadPrec [GetStreamKey]
-> Read GetStreamKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStreamKey]
$creadListPrec :: ReadPrec [GetStreamKey]
readPrec :: ReadPrec GetStreamKey
$creadPrec :: ReadPrec GetStreamKey
readList :: ReadS [GetStreamKey]
$creadList :: ReadS [GetStreamKey]
readsPrec :: Int -> ReadS GetStreamKey
$creadsPrec :: Int -> ReadS GetStreamKey
Prelude.Read, Int -> GetStreamKey -> ShowS
[GetStreamKey] -> ShowS
GetStreamKey -> String
(Int -> GetStreamKey -> ShowS)
-> (GetStreamKey -> String)
-> ([GetStreamKey] -> ShowS)
-> Show GetStreamKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamKey] -> ShowS
$cshowList :: [GetStreamKey] -> ShowS
show :: GetStreamKey -> String
$cshow :: GetStreamKey -> String
showsPrec :: Int -> GetStreamKey -> ShowS
$cshowsPrec :: Int -> GetStreamKey -> ShowS
Prelude.Show, (forall x. GetStreamKey -> Rep GetStreamKey x)
-> (forall x. Rep GetStreamKey x -> GetStreamKey)
-> Generic GetStreamKey
forall x. Rep GetStreamKey x -> GetStreamKey
forall x. GetStreamKey -> Rep GetStreamKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStreamKey x -> GetStreamKey
$cfrom :: forall x. GetStreamKey -> Rep GetStreamKey x
Prelude.Generic)
newGetStreamKey ::
Prelude.Text ->
GetStreamKey
newGetStreamKey :: Text -> GetStreamKey
newGetStreamKey Text
pArn_ = GetStreamKey' :: Text -> GetStreamKey
GetStreamKey' {$sel:arn:GetStreamKey' :: Text
arn = Text
pArn_}
getStreamKey_arn :: Lens.Lens' GetStreamKey Prelude.Text
getStreamKey_arn :: (Text -> f Text) -> GetStreamKey -> f GetStreamKey
getStreamKey_arn = (GetStreamKey -> Text)
-> (GetStreamKey -> Text -> GetStreamKey)
-> Lens GetStreamKey GetStreamKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamKey' {Text
arn :: Text
$sel:arn:GetStreamKey' :: GetStreamKey -> Text
arn} -> Text
arn) (\s :: GetStreamKey
s@GetStreamKey' {} Text
a -> GetStreamKey
s {$sel:arn:GetStreamKey' :: Text
arn = Text
a} :: GetStreamKey)
instance Core.AWSRequest GetStreamKey where
type AWSResponse GetStreamKey = GetStreamKeyResponse
request :: GetStreamKey -> Request GetStreamKey
request = Service -> GetStreamKey -> Request GetStreamKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStreamKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStreamKey))
-> Logger
-> Service
-> Proxy GetStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStreamKey)))
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 ->
Maybe StreamKey -> Int -> GetStreamKeyResponse
GetStreamKeyResponse'
(Maybe StreamKey -> Int -> GetStreamKeyResponse)
-> Either String (Maybe StreamKey)
-> Either String (Int -> GetStreamKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StreamKey)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamKey")
Either String (Int -> GetStreamKeyResponse)
-> Either String Int -> Either String GetStreamKeyResponse
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))
)
instance Prelude.Hashable GetStreamKey
instance Prelude.NFData GetStreamKey
instance Core.ToHeaders GetStreamKey where
toHeaders :: GetStreamKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStreamKey -> 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 GetStreamKey where
toJSON :: GetStreamKey -> Value
toJSON GetStreamKey' {Text
arn :: Text
$sel:arn:GetStreamKey' :: GetStreamKey -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
)
instance Core.ToPath GetStreamKey where
toPath :: GetStreamKey -> ByteString
toPath = ByteString -> GetStreamKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetStreamKey"
instance Core.ToQuery GetStreamKey where
toQuery :: GetStreamKey -> QueryString
toQuery = QueryString -> GetStreamKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetStreamKeyResponse = GetStreamKeyResponse'
{ GetStreamKeyResponse -> Maybe StreamKey
streamKey :: Prelude.Maybe StreamKey,
GetStreamKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStreamKeyResponse -> GetStreamKeyResponse -> Bool
(GetStreamKeyResponse -> GetStreamKeyResponse -> Bool)
-> (GetStreamKeyResponse -> GetStreamKeyResponse -> Bool)
-> Eq GetStreamKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamKeyResponse -> GetStreamKeyResponse -> Bool
$c/= :: GetStreamKeyResponse -> GetStreamKeyResponse -> Bool
== :: GetStreamKeyResponse -> GetStreamKeyResponse -> Bool
$c== :: GetStreamKeyResponse -> GetStreamKeyResponse -> Bool
Prelude.Eq, Int -> GetStreamKeyResponse -> ShowS
[GetStreamKeyResponse] -> ShowS
GetStreamKeyResponse -> String
(Int -> GetStreamKeyResponse -> ShowS)
-> (GetStreamKeyResponse -> String)
-> ([GetStreamKeyResponse] -> ShowS)
-> Show GetStreamKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamKeyResponse] -> ShowS
$cshowList :: [GetStreamKeyResponse] -> ShowS
show :: GetStreamKeyResponse -> String
$cshow :: GetStreamKeyResponse -> String
showsPrec :: Int -> GetStreamKeyResponse -> ShowS
$cshowsPrec :: Int -> GetStreamKeyResponse -> ShowS
Prelude.Show, (forall x. GetStreamKeyResponse -> Rep GetStreamKeyResponse x)
-> (forall x. Rep GetStreamKeyResponse x -> GetStreamKeyResponse)
-> Generic GetStreamKeyResponse
forall x. Rep GetStreamKeyResponse x -> GetStreamKeyResponse
forall x. GetStreamKeyResponse -> Rep GetStreamKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStreamKeyResponse x -> GetStreamKeyResponse
$cfrom :: forall x. GetStreamKeyResponse -> Rep GetStreamKeyResponse x
Prelude.Generic)
newGetStreamKeyResponse ::
Prelude.Int ->
GetStreamKeyResponse
newGetStreamKeyResponse :: Int -> GetStreamKeyResponse
newGetStreamKeyResponse Int
pHttpStatus_ =
GetStreamKeyResponse' :: Maybe StreamKey -> Int -> GetStreamKeyResponse
GetStreamKeyResponse'
{ $sel:streamKey:GetStreamKeyResponse' :: Maybe StreamKey
streamKey = Maybe StreamKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStreamKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStreamKeyResponse_streamKey :: Lens.Lens' GetStreamKeyResponse (Prelude.Maybe StreamKey)
getStreamKeyResponse_streamKey :: (Maybe StreamKey -> f (Maybe StreamKey))
-> GetStreamKeyResponse -> f GetStreamKeyResponse
getStreamKeyResponse_streamKey = (GetStreamKeyResponse -> Maybe StreamKey)
-> (GetStreamKeyResponse
-> Maybe StreamKey -> GetStreamKeyResponse)
-> Lens
GetStreamKeyResponse
GetStreamKeyResponse
(Maybe StreamKey)
(Maybe StreamKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamKeyResponse' {Maybe StreamKey
streamKey :: Maybe StreamKey
$sel:streamKey:GetStreamKeyResponse' :: GetStreamKeyResponse -> Maybe StreamKey
streamKey} -> Maybe StreamKey
streamKey) (\s :: GetStreamKeyResponse
s@GetStreamKeyResponse' {} Maybe StreamKey
a -> GetStreamKeyResponse
s {$sel:streamKey:GetStreamKeyResponse' :: Maybe StreamKey
streamKey = Maybe StreamKey
a} :: GetStreamKeyResponse)
getStreamKeyResponse_httpStatus :: Lens.Lens' GetStreamKeyResponse Prelude.Int
getStreamKeyResponse_httpStatus :: (Int -> f Int) -> GetStreamKeyResponse -> f GetStreamKeyResponse
getStreamKeyResponse_httpStatus = (GetStreamKeyResponse -> Int)
-> (GetStreamKeyResponse -> Int -> GetStreamKeyResponse)
-> Lens GetStreamKeyResponse GetStreamKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStreamKeyResponse' :: GetStreamKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStreamKeyResponse
s@GetStreamKeyResponse' {} Int
a -> GetStreamKeyResponse
s {$sel:httpStatus:GetStreamKeyResponse' :: Int
httpStatus = Int
a} :: GetStreamKeyResponse)
instance Prelude.NFData GetStreamKeyResponse