{-# 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.BatchGetStreamKey
(
BatchGetStreamKey (..),
newBatchGetStreamKey,
batchGetStreamKey_arns,
BatchGetStreamKeyResponse (..),
newBatchGetStreamKeyResponse,
batchGetStreamKeyResponse_streamKeys,
batchGetStreamKeyResponse_errors,
batchGetStreamKeyResponse_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 BatchGetStreamKey = BatchGetStreamKey'
{
BatchGetStreamKey -> NonEmpty Text
arns :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetStreamKey -> BatchGetStreamKey -> Bool
(BatchGetStreamKey -> BatchGetStreamKey -> Bool)
-> (BatchGetStreamKey -> BatchGetStreamKey -> Bool)
-> Eq BatchGetStreamKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetStreamKey -> BatchGetStreamKey -> Bool
$c/= :: BatchGetStreamKey -> BatchGetStreamKey -> Bool
== :: BatchGetStreamKey -> BatchGetStreamKey -> Bool
$c== :: BatchGetStreamKey -> BatchGetStreamKey -> Bool
Prelude.Eq, ReadPrec [BatchGetStreamKey]
ReadPrec BatchGetStreamKey
Int -> ReadS BatchGetStreamKey
ReadS [BatchGetStreamKey]
(Int -> ReadS BatchGetStreamKey)
-> ReadS [BatchGetStreamKey]
-> ReadPrec BatchGetStreamKey
-> ReadPrec [BatchGetStreamKey]
-> Read BatchGetStreamKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetStreamKey]
$creadListPrec :: ReadPrec [BatchGetStreamKey]
readPrec :: ReadPrec BatchGetStreamKey
$creadPrec :: ReadPrec BatchGetStreamKey
readList :: ReadS [BatchGetStreamKey]
$creadList :: ReadS [BatchGetStreamKey]
readsPrec :: Int -> ReadS BatchGetStreamKey
$creadsPrec :: Int -> ReadS BatchGetStreamKey
Prelude.Read, Int -> BatchGetStreamKey -> ShowS
[BatchGetStreamKey] -> ShowS
BatchGetStreamKey -> String
(Int -> BatchGetStreamKey -> ShowS)
-> (BatchGetStreamKey -> String)
-> ([BatchGetStreamKey] -> ShowS)
-> Show BatchGetStreamKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetStreamKey] -> ShowS
$cshowList :: [BatchGetStreamKey] -> ShowS
show :: BatchGetStreamKey -> String
$cshow :: BatchGetStreamKey -> String
showsPrec :: Int -> BatchGetStreamKey -> ShowS
$cshowsPrec :: Int -> BatchGetStreamKey -> ShowS
Prelude.Show, (forall x. BatchGetStreamKey -> Rep BatchGetStreamKey x)
-> (forall x. Rep BatchGetStreamKey x -> BatchGetStreamKey)
-> Generic BatchGetStreamKey
forall x. Rep BatchGetStreamKey x -> BatchGetStreamKey
forall x. BatchGetStreamKey -> Rep BatchGetStreamKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetStreamKey x -> BatchGetStreamKey
$cfrom :: forall x. BatchGetStreamKey -> Rep BatchGetStreamKey x
Prelude.Generic)
newBatchGetStreamKey ::
Prelude.NonEmpty Prelude.Text ->
BatchGetStreamKey
newBatchGetStreamKey :: NonEmpty Text -> BatchGetStreamKey
newBatchGetStreamKey NonEmpty Text
pArns_ =
BatchGetStreamKey' :: NonEmpty Text -> BatchGetStreamKey
BatchGetStreamKey'
{ $sel:arns:BatchGetStreamKey' :: NonEmpty Text
arns =
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
pArns_
}
batchGetStreamKey_arns :: Lens.Lens' BatchGetStreamKey (Prelude.NonEmpty Prelude.Text)
batchGetStreamKey_arns :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetStreamKey -> f BatchGetStreamKey
batchGetStreamKey_arns = (BatchGetStreamKey -> NonEmpty Text)
-> (BatchGetStreamKey -> NonEmpty Text -> BatchGetStreamKey)
-> Lens
BatchGetStreamKey BatchGetStreamKey (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetStreamKey' {NonEmpty Text
arns :: NonEmpty Text
$sel:arns:BatchGetStreamKey' :: BatchGetStreamKey -> NonEmpty Text
arns} -> NonEmpty Text
arns) (\s :: BatchGetStreamKey
s@BatchGetStreamKey' {} NonEmpty Text
a -> BatchGetStreamKey
s {$sel:arns:BatchGetStreamKey' :: NonEmpty Text
arns = NonEmpty Text
a} :: BatchGetStreamKey) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchGetStreamKey -> f BatchGetStreamKey)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchGetStreamKey
-> f BatchGetStreamKey
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 BatchGetStreamKey where
type
AWSResponse BatchGetStreamKey =
BatchGetStreamKeyResponse
request :: BatchGetStreamKey -> Request BatchGetStreamKey
request = Service -> BatchGetStreamKey -> Request BatchGetStreamKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGetStreamKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetStreamKey)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGetStreamKey))
-> Logger
-> Service
-> Proxy BatchGetStreamKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetStreamKey)))
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]
-> Maybe [BatchError] -> Int -> BatchGetStreamKeyResponse
BatchGetStreamKeyResponse'
(Maybe [StreamKey]
-> Maybe [BatchError] -> Int -> BatchGetStreamKeyResponse)
-> Either String (Maybe [StreamKey])
-> Either
String (Maybe [BatchError] -> Int -> BatchGetStreamKeyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [StreamKey]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamKeys" Either String (Maybe (Maybe [StreamKey]))
-> Maybe [StreamKey] -> Either String (Maybe [StreamKey])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [StreamKey]
forall a. Monoid a => a
Prelude.mempty)
Either
String (Maybe [BatchError] -> Int -> BatchGetStreamKeyResponse)
-> Either String (Maybe [BatchError])
-> Either String (Int -> BatchGetStreamKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [BatchError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"errors" Either String (Maybe (Maybe [BatchError]))
-> Maybe [BatchError] -> Either String (Maybe [BatchError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchGetStreamKeyResponse)
-> Either String Int -> Either String BatchGetStreamKeyResponse
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 BatchGetStreamKey
instance Prelude.NFData BatchGetStreamKey
instance Core.ToHeaders BatchGetStreamKey where
toHeaders :: BatchGetStreamKey -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGetStreamKey -> 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 BatchGetStreamKey where
toJSON :: BatchGetStreamKey -> Value
toJSON BatchGetStreamKey' {NonEmpty Text
arns :: NonEmpty Text
$sel:arns:BatchGetStreamKey' :: BatchGetStreamKey -> NonEmpty 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
"arns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
arns)]
)
instance Core.ToPath BatchGetStreamKey where
toPath :: BatchGetStreamKey -> ByteString
toPath = ByteString -> BatchGetStreamKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/BatchGetStreamKey"
instance Core.ToQuery BatchGetStreamKey where
toQuery :: BatchGetStreamKey -> QueryString
toQuery = QueryString -> BatchGetStreamKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGetStreamKeyResponse = BatchGetStreamKeyResponse'
{ BatchGetStreamKeyResponse -> Maybe [StreamKey]
streamKeys :: Prelude.Maybe [StreamKey],
BatchGetStreamKeyResponse -> Maybe [BatchError]
errors :: Prelude.Maybe [BatchError],
BatchGetStreamKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool
(BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool)
-> (BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool)
-> Eq BatchGetStreamKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool
$c/= :: BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool
== :: BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool
$c== :: BatchGetStreamKeyResponse -> BatchGetStreamKeyResponse -> Bool
Prelude.Eq, Int -> BatchGetStreamKeyResponse -> ShowS
[BatchGetStreamKeyResponse] -> ShowS
BatchGetStreamKeyResponse -> String
(Int -> BatchGetStreamKeyResponse -> ShowS)
-> (BatchGetStreamKeyResponse -> String)
-> ([BatchGetStreamKeyResponse] -> ShowS)
-> Show BatchGetStreamKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetStreamKeyResponse] -> ShowS
$cshowList :: [BatchGetStreamKeyResponse] -> ShowS
show :: BatchGetStreamKeyResponse -> String
$cshow :: BatchGetStreamKeyResponse -> String
showsPrec :: Int -> BatchGetStreamKeyResponse -> ShowS
$cshowsPrec :: Int -> BatchGetStreamKeyResponse -> ShowS
Prelude.Show, (forall x.
BatchGetStreamKeyResponse -> Rep BatchGetStreamKeyResponse x)
-> (forall x.
Rep BatchGetStreamKeyResponse x -> BatchGetStreamKeyResponse)
-> Generic BatchGetStreamKeyResponse
forall x.
Rep BatchGetStreamKeyResponse x -> BatchGetStreamKeyResponse
forall x.
BatchGetStreamKeyResponse -> Rep BatchGetStreamKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetStreamKeyResponse x -> BatchGetStreamKeyResponse
$cfrom :: forall x.
BatchGetStreamKeyResponse -> Rep BatchGetStreamKeyResponse x
Prelude.Generic)
newBatchGetStreamKeyResponse ::
Prelude.Int ->
BatchGetStreamKeyResponse
newBatchGetStreamKeyResponse :: Int -> BatchGetStreamKeyResponse
newBatchGetStreamKeyResponse Int
pHttpStatus_ =
BatchGetStreamKeyResponse' :: Maybe [StreamKey]
-> Maybe [BatchError] -> Int -> BatchGetStreamKeyResponse
BatchGetStreamKeyResponse'
{ $sel:streamKeys:BatchGetStreamKeyResponse' :: Maybe [StreamKey]
streamKeys =
Maybe [StreamKey]
forall a. Maybe a
Prelude.Nothing,
$sel:errors:BatchGetStreamKeyResponse' :: Maybe [BatchError]
errors = Maybe [BatchError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetStreamKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetStreamKeyResponse_streamKeys :: Lens.Lens' BatchGetStreamKeyResponse (Prelude.Maybe [StreamKey])
batchGetStreamKeyResponse_streamKeys :: (Maybe [StreamKey] -> f (Maybe [StreamKey]))
-> BatchGetStreamKeyResponse -> f BatchGetStreamKeyResponse
batchGetStreamKeyResponse_streamKeys = (BatchGetStreamKeyResponse -> Maybe [StreamKey])
-> (BatchGetStreamKeyResponse
-> Maybe [StreamKey] -> BatchGetStreamKeyResponse)
-> Lens
BatchGetStreamKeyResponse
BatchGetStreamKeyResponse
(Maybe [StreamKey])
(Maybe [StreamKey])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetStreamKeyResponse' {Maybe [StreamKey]
streamKeys :: Maybe [StreamKey]
$sel:streamKeys:BatchGetStreamKeyResponse' :: BatchGetStreamKeyResponse -> Maybe [StreamKey]
streamKeys} -> Maybe [StreamKey]
streamKeys) (\s :: BatchGetStreamKeyResponse
s@BatchGetStreamKeyResponse' {} Maybe [StreamKey]
a -> BatchGetStreamKeyResponse
s {$sel:streamKeys:BatchGetStreamKeyResponse' :: Maybe [StreamKey]
streamKeys = Maybe [StreamKey]
a} :: BatchGetStreamKeyResponse) ((Maybe [StreamKey] -> f (Maybe [StreamKey]))
-> BatchGetStreamKeyResponse -> f BatchGetStreamKeyResponse)
-> ((Maybe [StreamKey] -> f (Maybe [StreamKey]))
-> Maybe [StreamKey] -> f (Maybe [StreamKey]))
-> (Maybe [StreamKey] -> f (Maybe [StreamKey]))
-> BatchGetStreamKeyResponse
-> f BatchGetStreamKeyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [StreamKey] [StreamKey] [StreamKey] [StreamKey]
-> Iso
(Maybe [StreamKey])
(Maybe [StreamKey])
(Maybe [StreamKey])
(Maybe [StreamKey])
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 [StreamKey] [StreamKey] [StreamKey] [StreamKey]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetStreamKeyResponse_errors :: Lens.Lens' BatchGetStreamKeyResponse (Prelude.Maybe [BatchError])
batchGetStreamKeyResponse_errors :: (Maybe [BatchError] -> f (Maybe [BatchError]))
-> BatchGetStreamKeyResponse -> f BatchGetStreamKeyResponse
batchGetStreamKeyResponse_errors = (BatchGetStreamKeyResponse -> Maybe [BatchError])
-> (BatchGetStreamKeyResponse
-> Maybe [BatchError] -> BatchGetStreamKeyResponse)
-> Lens
BatchGetStreamKeyResponse
BatchGetStreamKeyResponse
(Maybe [BatchError])
(Maybe [BatchError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetStreamKeyResponse' {Maybe [BatchError]
errors :: Maybe [BatchError]
$sel:errors:BatchGetStreamKeyResponse' :: BatchGetStreamKeyResponse -> Maybe [BatchError]
errors} -> Maybe [BatchError]
errors) (\s :: BatchGetStreamKeyResponse
s@BatchGetStreamKeyResponse' {} Maybe [BatchError]
a -> BatchGetStreamKeyResponse
s {$sel:errors:BatchGetStreamKeyResponse' :: Maybe [BatchError]
errors = Maybe [BatchError]
a} :: BatchGetStreamKeyResponse) ((Maybe [BatchError] -> f (Maybe [BatchError]))
-> BatchGetStreamKeyResponse -> f BatchGetStreamKeyResponse)
-> ((Maybe [BatchError] -> f (Maybe [BatchError]))
-> Maybe [BatchError] -> f (Maybe [BatchError]))
-> (Maybe [BatchError] -> f (Maybe [BatchError]))
-> BatchGetStreamKeyResponse
-> f BatchGetStreamKeyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [BatchError] [BatchError] [BatchError] [BatchError]
-> Iso
(Maybe [BatchError])
(Maybe [BatchError])
(Maybe [BatchError])
(Maybe [BatchError])
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 [BatchError] [BatchError] [BatchError] [BatchError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetStreamKeyResponse_httpStatus :: Lens.Lens' BatchGetStreamKeyResponse Prelude.Int
batchGetStreamKeyResponse_httpStatus :: (Int -> f Int)
-> BatchGetStreamKeyResponse -> f BatchGetStreamKeyResponse
batchGetStreamKeyResponse_httpStatus = (BatchGetStreamKeyResponse -> Int)
-> (BatchGetStreamKeyResponse -> Int -> BatchGetStreamKeyResponse)
-> Lens BatchGetStreamKeyResponse BatchGetStreamKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetStreamKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetStreamKeyResponse' :: BatchGetStreamKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetStreamKeyResponse
s@BatchGetStreamKeyResponse' {} Int
a -> BatchGetStreamKeyResponse
s {$sel:httpStatus:BatchGetStreamKeyResponse' :: Int
httpStatus = Int
a} :: BatchGetStreamKeyResponse)
instance Prelude.NFData BatchGetStreamKeyResponse