{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IVS.Types
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
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]
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
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. 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' {$sel:arn:GetStreamKey' :: Text
arn = Text
pArn_}
getStreamKey_arn :: Lens.Lens' GetStreamKey Prelude.Text
getStreamKey_arn :: Lens' GetStreamKey Text
getStreamKey_arn = 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 :: (Service -> Service) -> GetStreamKey -> Request GetStreamKey
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStreamKey)))
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 StreamKey -> Int -> GetStreamKeyResponse
GetStreamKeyResponse'
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
"streamKey")
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 GetStreamKey where
hashWithSalt :: Int -> GetStreamKey -> Int
hashWithSalt Int
_salt GetStreamKey' {Text
arn :: Text
$sel:arn:GetStreamKey' :: GetStreamKey -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData GetStreamKey where
rnf :: GetStreamKey -> ()
rnf GetStreamKey' {Text
arn :: Text
$sel:arn:GetStreamKey' :: GetStreamKey -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToHeaders GetStreamKey where
toHeaders :: GetStreamKey -> 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 GetStreamKey where
toJSON :: GetStreamKey -> Value
toJSON GetStreamKey' {Text
arn :: Text
$sel:arn:GetStreamKey' :: GetStreamKey -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
)
instance Data.ToPath GetStreamKey where
toPath :: GetStreamKey -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/GetStreamKey"
instance Data.ToQuery GetStreamKey where
toQuery :: GetStreamKey -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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. 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'
{ $sel:streamKey:GetStreamKeyResponse' :: Maybe StreamKey
streamKey = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStreamKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStreamKeyResponse_streamKey :: Lens.Lens' GetStreamKeyResponse (Prelude.Maybe StreamKey)
getStreamKeyResponse_streamKey :: Lens' GetStreamKeyResponse (Maybe StreamKey)
getStreamKeyResponse_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 :: Lens' GetStreamKeyResponse Int
getStreamKeyResponse_httpStatus = 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 where
rnf :: GetStreamKeyResponse -> ()
rnf GetStreamKeyResponse' {Int
Maybe StreamKey
httpStatus :: Int
streamKey :: Maybe StreamKey
$sel:httpStatus:GetStreamKeyResponse' :: GetStreamKeyResponse -> Int
$sel:streamKey:GetStreamKeyResponse' :: GetStreamKeyResponse -> Maybe StreamKey
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamKey
streamKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus