{-# 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.CreateStreamKey
(
CreateStreamKey (..),
newCreateStreamKey,
createStreamKey_tags,
createStreamKey_channelArn,
CreateStreamKeyResponse (..),
newCreateStreamKeyResponse,
createStreamKeyResponse_streamKey,
createStreamKeyResponse_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 CreateStreamKey = CreateStreamKey'
{
CreateStreamKey -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateStreamKey -> Text
channelArn :: Prelude.Text
}
deriving (CreateStreamKey -> CreateStreamKey -> Bool
(CreateStreamKey -> CreateStreamKey -> Bool)
-> (CreateStreamKey -> CreateStreamKey -> Bool)
-> Eq CreateStreamKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamKey -> CreateStreamKey -> Bool
$c/= :: CreateStreamKey -> CreateStreamKey -> Bool
== :: CreateStreamKey -> CreateStreamKey -> Bool
$c== :: CreateStreamKey -> CreateStreamKey -> Bool
Prelude.Eq, ReadPrec [CreateStreamKey]
ReadPrec CreateStreamKey
Int -> ReadS CreateStreamKey
ReadS [CreateStreamKey]
(Int -> ReadS CreateStreamKey)
-> ReadS [CreateStreamKey]
-> ReadPrec CreateStreamKey
-> ReadPrec [CreateStreamKey]
-> Read CreateStreamKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamKey]
$creadListPrec :: ReadPrec [CreateStreamKey]
readPrec :: ReadPrec CreateStreamKey
$creadPrec :: ReadPrec CreateStreamKey
readList :: ReadS [CreateStreamKey]
$creadList :: ReadS [CreateStreamKey]
readsPrec :: Int -> ReadS CreateStreamKey
$creadsPrec :: Int -> ReadS CreateStreamKey
Prelude.Read, Int -> CreateStreamKey -> ShowS
[CreateStreamKey] -> ShowS
CreateStreamKey -> String
(Int -> CreateStreamKey -> ShowS)
-> (CreateStreamKey -> String)
-> ([CreateStreamKey] -> ShowS)
-> Show CreateStreamKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamKey] -> ShowS
$cshowList :: [CreateStreamKey] -> ShowS
show :: CreateStreamKey -> String
$cshow :: CreateStreamKey -> String
showsPrec :: Int -> CreateStreamKey -> ShowS
$cshowsPrec :: Int -> CreateStreamKey -> ShowS
Prelude.Show, (forall x. CreateStreamKey -> Rep CreateStreamKey x)
-> (forall x. Rep CreateStreamKey x -> CreateStreamKey)
-> Generic CreateStreamKey
forall x. Rep CreateStreamKey x -> CreateStreamKey
forall x. CreateStreamKey -> Rep CreateStreamKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamKey x -> CreateStreamKey
$cfrom :: forall x. CreateStreamKey -> Rep CreateStreamKey x
Prelude.Generic)
newCreateStreamKey ::
Prelude.Text ->
CreateStreamKey
newCreateStreamKey :: Text -> CreateStreamKey
newCreateStreamKey Text
pChannelArn_ =
CreateStreamKey' :: Maybe (HashMap Text Text) -> Text -> CreateStreamKey
CreateStreamKey'
{ $sel:tags:CreateStreamKey' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:CreateStreamKey' :: Text
channelArn = Text
pChannelArn_
}
createStreamKey_tags :: Lens.Lens' CreateStreamKey (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStreamKey_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStreamKey -> f CreateStreamKey
createStreamKey_tags = (CreateStreamKey -> Maybe (HashMap Text Text))
-> (CreateStreamKey
-> Maybe (HashMap Text Text) -> CreateStreamKey)
-> Lens
CreateStreamKey
CreateStreamKey
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamKey' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStreamKey' :: CreateStreamKey -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStreamKey
s@CreateStreamKey' {} Maybe (HashMap Text Text)
a -> CreateStreamKey
s {$sel:tags:CreateStreamKey' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStreamKey) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStreamKey -> f CreateStreamKey)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStreamKey
-> f CreateStreamKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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 AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createStreamKey_channelArn :: Lens.Lens' CreateStreamKey Prelude.Text
createStreamKey_channelArn :: (Text -> f Text) -> CreateStreamKey -> f CreateStreamKey
createStreamKey_channelArn = (CreateStreamKey -> Text)
-> (CreateStreamKey -> Text -> CreateStreamKey)
-> Lens CreateStreamKey CreateStreamKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamKey' {Text
channelArn :: Text
$sel:channelArn:CreateStreamKey' :: CreateStreamKey -> Text
channelArn} -> Text
channelArn) (\s :: CreateStreamKey
s@CreateStreamKey' {} Text
a -> CreateStreamKey
s {$sel:channelArn:CreateStreamKey' :: Text
channelArn = Text
a} :: CreateStreamKey)
instance Core.AWSRequest CreateStreamKey where
type
AWSResponse CreateStreamKey =
CreateStreamKeyResponse
request :: CreateStreamKey -> Request CreateStreamKey
request = Service -> CreateStreamKey -> Request CreateStreamKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStreamKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateStreamKey))
-> Logger
-> Service
-> Proxy CreateStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStreamKey)))
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 -> CreateStreamKeyResponse
CreateStreamKeyResponse'
(Maybe StreamKey -> Int -> CreateStreamKeyResponse)
-> Either String (Maybe StreamKey)
-> Either String (Int -> CreateStreamKeyResponse)
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 -> CreateStreamKeyResponse)
-> Either String Int -> Either String CreateStreamKeyResponse
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 CreateStreamKey
instance Prelude.NFData CreateStreamKey
instance Core.ToHeaders CreateStreamKey where
toHeaders :: CreateStreamKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateStreamKey -> 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 CreateStreamKey where
toJSON :: CreateStreamKey -> Value
toJSON CreateStreamKey' {Maybe (HashMap Text Text)
Text
channelArn :: Text
tags :: Maybe (HashMap Text Text)
$sel:channelArn:CreateStreamKey' :: CreateStreamKey -> Text
$sel:tags:CreateStreamKey' :: CreateStreamKey -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"channelArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
channelArn)
]
)
instance Core.ToPath CreateStreamKey where
toPath :: CreateStreamKey -> ByteString
toPath = ByteString -> CreateStreamKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/CreateStreamKey"
instance Core.ToQuery CreateStreamKey where
toQuery :: CreateStreamKey -> QueryString
toQuery = QueryString -> CreateStreamKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateStreamKeyResponse = CreateStreamKeyResponse'
{
CreateStreamKeyResponse -> Maybe StreamKey
streamKey :: Prelude.Maybe StreamKey,
CreateStreamKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool
(CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool)
-> (CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool)
-> Eq CreateStreamKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool
$c/= :: CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool
== :: CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool
$c== :: CreateStreamKeyResponse -> CreateStreamKeyResponse -> Bool
Prelude.Eq, Int -> CreateStreamKeyResponse -> ShowS
[CreateStreamKeyResponse] -> ShowS
CreateStreamKeyResponse -> String
(Int -> CreateStreamKeyResponse -> ShowS)
-> (CreateStreamKeyResponse -> String)
-> ([CreateStreamKeyResponse] -> ShowS)
-> Show CreateStreamKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamKeyResponse] -> ShowS
$cshowList :: [CreateStreamKeyResponse] -> ShowS
show :: CreateStreamKeyResponse -> String
$cshow :: CreateStreamKeyResponse -> String
showsPrec :: Int -> CreateStreamKeyResponse -> ShowS
$cshowsPrec :: Int -> CreateStreamKeyResponse -> ShowS
Prelude.Show, (forall x.
CreateStreamKeyResponse -> Rep CreateStreamKeyResponse x)
-> (forall x.
Rep CreateStreamKeyResponse x -> CreateStreamKeyResponse)
-> Generic CreateStreamKeyResponse
forall x. Rep CreateStreamKeyResponse x -> CreateStreamKeyResponse
forall x. CreateStreamKeyResponse -> Rep CreateStreamKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStreamKeyResponse x -> CreateStreamKeyResponse
$cfrom :: forall x. CreateStreamKeyResponse -> Rep CreateStreamKeyResponse x
Prelude.Generic)
newCreateStreamKeyResponse ::
Prelude.Int ->
CreateStreamKeyResponse
newCreateStreamKeyResponse :: Int -> CreateStreamKeyResponse
newCreateStreamKeyResponse Int
pHttpStatus_ =
CreateStreamKeyResponse' :: Maybe StreamKey -> Int -> CreateStreamKeyResponse
CreateStreamKeyResponse'
{ $sel:streamKey:CreateStreamKeyResponse' :: Maybe StreamKey
streamKey =
Maybe StreamKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateStreamKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createStreamKeyResponse_streamKey :: Lens.Lens' CreateStreamKeyResponse (Prelude.Maybe StreamKey)
createStreamKeyResponse_streamKey :: (Maybe StreamKey -> f (Maybe StreamKey))
-> CreateStreamKeyResponse -> f CreateStreamKeyResponse
createStreamKeyResponse_streamKey = (CreateStreamKeyResponse -> Maybe StreamKey)
-> (CreateStreamKeyResponse
-> Maybe StreamKey -> CreateStreamKeyResponse)
-> Lens
CreateStreamKeyResponse
CreateStreamKeyResponse
(Maybe StreamKey)
(Maybe StreamKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamKeyResponse' {Maybe StreamKey
streamKey :: Maybe StreamKey
$sel:streamKey:CreateStreamKeyResponse' :: CreateStreamKeyResponse -> Maybe StreamKey
streamKey} -> Maybe StreamKey
streamKey) (\s :: CreateStreamKeyResponse
s@CreateStreamKeyResponse' {} Maybe StreamKey
a -> CreateStreamKeyResponse
s {$sel:streamKey:CreateStreamKeyResponse' :: Maybe StreamKey
streamKey = Maybe StreamKey
a} :: CreateStreamKeyResponse)
createStreamKeyResponse_httpStatus :: Lens.Lens' CreateStreamKeyResponse Prelude.Int
createStreamKeyResponse_httpStatus :: (Int -> f Int)
-> CreateStreamKeyResponse -> f CreateStreamKeyResponse
createStreamKeyResponse_httpStatus = (CreateStreamKeyResponse -> Int)
-> (CreateStreamKeyResponse -> Int -> CreateStreamKeyResponse)
-> Lens CreateStreamKeyResponse CreateStreamKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateStreamKeyResponse' :: CreateStreamKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateStreamKeyResponse
s@CreateStreamKeyResponse' {} Int
a -> CreateStreamKeyResponse
s {$sel:httpStatus:CreateStreamKeyResponse' :: Int
httpStatus = Int
a} :: CreateStreamKeyResponse)
instance Prelude.NFData CreateStreamKeyResponse