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