{-# 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.Pinpoint.GetAdmChannel
(
GetAdmChannel (..),
newGetAdmChannel,
getAdmChannel_applicationId,
GetAdmChannelResponse (..),
newGetAdmChannelResponse,
getAdmChannelResponse_httpStatus,
getAdmChannelResponse_aDMChannelResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAdmChannel = GetAdmChannel'
{
GetAdmChannel -> Text
applicationId :: Prelude.Text
}
deriving (GetAdmChannel -> GetAdmChannel -> Bool
(GetAdmChannel -> GetAdmChannel -> Bool)
-> (GetAdmChannel -> GetAdmChannel -> Bool) -> Eq GetAdmChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAdmChannel -> GetAdmChannel -> Bool
$c/= :: GetAdmChannel -> GetAdmChannel -> Bool
== :: GetAdmChannel -> GetAdmChannel -> Bool
$c== :: GetAdmChannel -> GetAdmChannel -> Bool
Prelude.Eq, ReadPrec [GetAdmChannel]
ReadPrec GetAdmChannel
Int -> ReadS GetAdmChannel
ReadS [GetAdmChannel]
(Int -> ReadS GetAdmChannel)
-> ReadS [GetAdmChannel]
-> ReadPrec GetAdmChannel
-> ReadPrec [GetAdmChannel]
-> Read GetAdmChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAdmChannel]
$creadListPrec :: ReadPrec [GetAdmChannel]
readPrec :: ReadPrec GetAdmChannel
$creadPrec :: ReadPrec GetAdmChannel
readList :: ReadS [GetAdmChannel]
$creadList :: ReadS [GetAdmChannel]
readsPrec :: Int -> ReadS GetAdmChannel
$creadsPrec :: Int -> ReadS GetAdmChannel
Prelude.Read, Int -> GetAdmChannel -> ShowS
[GetAdmChannel] -> ShowS
GetAdmChannel -> String
(Int -> GetAdmChannel -> ShowS)
-> (GetAdmChannel -> String)
-> ([GetAdmChannel] -> ShowS)
-> Show GetAdmChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAdmChannel] -> ShowS
$cshowList :: [GetAdmChannel] -> ShowS
show :: GetAdmChannel -> String
$cshow :: GetAdmChannel -> String
showsPrec :: Int -> GetAdmChannel -> ShowS
$cshowsPrec :: Int -> GetAdmChannel -> ShowS
Prelude.Show, (forall x. GetAdmChannel -> Rep GetAdmChannel x)
-> (forall x. Rep GetAdmChannel x -> GetAdmChannel)
-> Generic GetAdmChannel
forall x. Rep GetAdmChannel x -> GetAdmChannel
forall x. GetAdmChannel -> Rep GetAdmChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAdmChannel x -> GetAdmChannel
$cfrom :: forall x. GetAdmChannel -> Rep GetAdmChannel x
Prelude.Generic)
newGetAdmChannel ::
Prelude.Text ->
GetAdmChannel
newGetAdmChannel :: Text -> GetAdmChannel
newGetAdmChannel Text
pApplicationId_ =
GetAdmChannel' :: Text -> GetAdmChannel
GetAdmChannel' {$sel:applicationId:GetAdmChannel' :: Text
applicationId = Text
pApplicationId_}
getAdmChannel_applicationId :: Lens.Lens' GetAdmChannel Prelude.Text
getAdmChannel_applicationId :: (Text -> f Text) -> GetAdmChannel -> f GetAdmChannel
getAdmChannel_applicationId = (GetAdmChannel -> Text)
-> (GetAdmChannel -> Text -> GetAdmChannel)
-> Lens GetAdmChannel GetAdmChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAdmChannel' {Text
applicationId :: Text
$sel:applicationId:GetAdmChannel' :: GetAdmChannel -> Text
applicationId} -> Text
applicationId) (\s :: GetAdmChannel
s@GetAdmChannel' {} Text
a -> GetAdmChannel
s {$sel:applicationId:GetAdmChannel' :: Text
applicationId = Text
a} :: GetAdmChannel)
instance Core.AWSRequest GetAdmChannel where
type
AWSResponse GetAdmChannel =
GetAdmChannelResponse
request :: GetAdmChannel -> Request GetAdmChannel
request = Service -> GetAdmChannel -> Request GetAdmChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetAdmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAdmChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAdmChannel))
-> Logger
-> Service
-> Proxy GetAdmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAdmChannel)))
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 ->
Int -> ADMChannelResponse -> GetAdmChannelResponse
GetAdmChannelResponse'
(Int -> ADMChannelResponse -> GetAdmChannelResponse)
-> Either String Int
-> Either String (ADMChannelResponse -> GetAdmChannelResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (ADMChannelResponse -> GetAdmChannelResponse)
-> Either String ADMChannelResponse
-> Either String GetAdmChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ADMChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetAdmChannel
instance Prelude.NFData GetAdmChannel
instance Core.ToHeaders GetAdmChannel where
toHeaders :: GetAdmChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAdmChannel -> 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.ToPath GetAdmChannel where
toPath :: GetAdmChannel -> ByteString
toPath GetAdmChannel' {Text
applicationId :: Text
$sel:applicationId:GetAdmChannel' :: GetAdmChannel -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/channels/adm"
]
instance Core.ToQuery GetAdmChannel where
toQuery :: GetAdmChannel -> QueryString
toQuery = QueryString -> GetAdmChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetAdmChannelResponse = GetAdmChannelResponse'
{
GetAdmChannelResponse -> Int
httpStatus :: Prelude.Int,
GetAdmChannelResponse -> ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
}
deriving (GetAdmChannelResponse -> GetAdmChannelResponse -> Bool
(GetAdmChannelResponse -> GetAdmChannelResponse -> Bool)
-> (GetAdmChannelResponse -> GetAdmChannelResponse -> Bool)
-> Eq GetAdmChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAdmChannelResponse -> GetAdmChannelResponse -> Bool
$c/= :: GetAdmChannelResponse -> GetAdmChannelResponse -> Bool
== :: GetAdmChannelResponse -> GetAdmChannelResponse -> Bool
$c== :: GetAdmChannelResponse -> GetAdmChannelResponse -> Bool
Prelude.Eq, ReadPrec [GetAdmChannelResponse]
ReadPrec GetAdmChannelResponse
Int -> ReadS GetAdmChannelResponse
ReadS [GetAdmChannelResponse]
(Int -> ReadS GetAdmChannelResponse)
-> ReadS [GetAdmChannelResponse]
-> ReadPrec GetAdmChannelResponse
-> ReadPrec [GetAdmChannelResponse]
-> Read GetAdmChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAdmChannelResponse]
$creadListPrec :: ReadPrec [GetAdmChannelResponse]
readPrec :: ReadPrec GetAdmChannelResponse
$creadPrec :: ReadPrec GetAdmChannelResponse
readList :: ReadS [GetAdmChannelResponse]
$creadList :: ReadS [GetAdmChannelResponse]
readsPrec :: Int -> ReadS GetAdmChannelResponse
$creadsPrec :: Int -> ReadS GetAdmChannelResponse
Prelude.Read, Int -> GetAdmChannelResponse -> ShowS
[GetAdmChannelResponse] -> ShowS
GetAdmChannelResponse -> String
(Int -> GetAdmChannelResponse -> ShowS)
-> (GetAdmChannelResponse -> String)
-> ([GetAdmChannelResponse] -> ShowS)
-> Show GetAdmChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAdmChannelResponse] -> ShowS
$cshowList :: [GetAdmChannelResponse] -> ShowS
show :: GetAdmChannelResponse -> String
$cshow :: GetAdmChannelResponse -> String
showsPrec :: Int -> GetAdmChannelResponse -> ShowS
$cshowsPrec :: Int -> GetAdmChannelResponse -> ShowS
Prelude.Show, (forall x. GetAdmChannelResponse -> Rep GetAdmChannelResponse x)
-> (forall x. Rep GetAdmChannelResponse x -> GetAdmChannelResponse)
-> Generic GetAdmChannelResponse
forall x. Rep GetAdmChannelResponse x -> GetAdmChannelResponse
forall x. GetAdmChannelResponse -> Rep GetAdmChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAdmChannelResponse x -> GetAdmChannelResponse
$cfrom :: forall x. GetAdmChannelResponse -> Rep GetAdmChannelResponse x
Prelude.Generic)
newGetAdmChannelResponse ::
Prelude.Int ->
ADMChannelResponse ->
GetAdmChannelResponse
newGetAdmChannelResponse :: Int -> ADMChannelResponse -> GetAdmChannelResponse
newGetAdmChannelResponse
Int
pHttpStatus_
ADMChannelResponse
pADMChannelResponse_ =
GetAdmChannelResponse' :: Int -> ADMChannelResponse -> GetAdmChannelResponse
GetAdmChannelResponse'
{ $sel:httpStatus:GetAdmChannelResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:aDMChannelResponse:GetAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
pADMChannelResponse_
}
getAdmChannelResponse_httpStatus :: Lens.Lens' GetAdmChannelResponse Prelude.Int
getAdmChannelResponse_httpStatus :: (Int -> f Int) -> GetAdmChannelResponse -> f GetAdmChannelResponse
getAdmChannelResponse_httpStatus = (GetAdmChannelResponse -> Int)
-> (GetAdmChannelResponse -> Int -> GetAdmChannelResponse)
-> Lens GetAdmChannelResponse GetAdmChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAdmChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAdmChannelResponse' :: GetAdmChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAdmChannelResponse
s@GetAdmChannelResponse' {} Int
a -> GetAdmChannelResponse
s {$sel:httpStatus:GetAdmChannelResponse' :: Int
httpStatus = Int
a} :: GetAdmChannelResponse)
getAdmChannelResponse_aDMChannelResponse :: Lens.Lens' GetAdmChannelResponse ADMChannelResponse
getAdmChannelResponse_aDMChannelResponse :: (ADMChannelResponse -> f ADMChannelResponse)
-> GetAdmChannelResponse -> f GetAdmChannelResponse
getAdmChannelResponse_aDMChannelResponse = (GetAdmChannelResponse -> ADMChannelResponse)
-> (GetAdmChannelResponse
-> ADMChannelResponse -> GetAdmChannelResponse)
-> Lens
GetAdmChannelResponse
GetAdmChannelResponse
ADMChannelResponse
ADMChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAdmChannelResponse' {ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
$sel:aDMChannelResponse:GetAdmChannelResponse' :: GetAdmChannelResponse -> ADMChannelResponse
aDMChannelResponse} -> ADMChannelResponse
aDMChannelResponse) (\s :: GetAdmChannelResponse
s@GetAdmChannelResponse' {} ADMChannelResponse
a -> GetAdmChannelResponse
s {$sel:aDMChannelResponse:GetAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
a} :: GetAdmChannelResponse)
instance Prelude.NFData GetAdmChannelResponse