{-# 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 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 BatchGetChannel = BatchGetChannel'
{
BatchGetChannel -> NonEmpty Text
arns :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetChannel -> BatchGetChannel -> Bool
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]
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
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. 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' {$sel:arns:BatchGetChannel' :: NonEmpty Text
arns = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pArns_}
batchGetChannel_arns :: Lens.Lens' BatchGetChannel (Prelude.NonEmpty Prelude.Text)
batchGetChannel_arns :: Lens' BatchGetChannel (NonEmpty Text)
batchGetChannel_arns = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service) -> BatchGetChannel -> Request BatchGetChannel
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 BatchGetChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetChannel)))
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 [Channel]
-> Maybe [BatchError] -> Int -> BatchGetChannelResponse
BatchGetChannelResponse'
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
"channels" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"errors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 BatchGetChannel where
hashWithSalt :: Int -> BatchGetChannel -> Int
hashWithSalt Int
_salt BatchGetChannel' {NonEmpty Text
arns :: NonEmpty Text
$sel:arns:BatchGetChannel' :: BatchGetChannel -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
arns
instance Prelude.NFData BatchGetChannel where
rnf :: BatchGetChannel -> ()
rnf BatchGetChannel' {NonEmpty Text
arns :: NonEmpty Text
$sel:arns:BatchGetChannel' :: BatchGetChannel -> NonEmpty Text
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
arns
instance Data.ToHeaders BatchGetChannel where
toHeaders :: BatchGetChannel -> 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 BatchGetChannel where
toJSON :: BatchGetChannel -> Value
toJSON BatchGetChannel' {NonEmpty Text
arns :: NonEmpty Text
$sel:arns:BatchGetChannel' :: BatchGetChannel -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"arns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
arns)]
)
instance Data.ToPath BatchGetChannel where
toPath :: BatchGetChannel -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/BatchGetChannel"
instance Data.ToQuery BatchGetChannel where
toQuery :: BatchGetChannel -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:channels:BatchGetChannelResponse' :: Maybe [Channel]
channels =
forall a. Maybe a
Prelude.Nothing,
$sel:errors:BatchGetChannelResponse' :: Maybe [BatchError]
errors = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetChannelResponse_channels :: Lens.Lens' BatchGetChannelResponse (Prelude.Maybe [Channel])
batchGetChannelResponse_channels :: Lens' BatchGetChannelResponse (Maybe [Channel])
batchGetChannelResponse_channels = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' BatchGetChannelResponse (Maybe [BatchError])
batchGetChannelResponse_errors = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' BatchGetChannelResponse Int
batchGetChannelResponse_httpStatus = 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 where
rnf :: BatchGetChannelResponse -> ()
rnf BatchGetChannelResponse' {Int
Maybe [BatchError]
Maybe [Channel]
httpStatus :: Int
errors :: Maybe [BatchError]
channels :: Maybe [Channel]
$sel:httpStatus:BatchGetChannelResponse' :: BatchGetChannelResponse -> Int
$sel:errors:BatchGetChannelResponse' :: BatchGetChannelResponse -> Maybe [BatchError]
$sel:channels:BatchGetChannelResponse' :: BatchGetChannelResponse -> Maybe [Channel]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Channel]
channels
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [BatchError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus