{-# 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.AlexaBusiness.GetProfile
(
GetProfile (..),
newGetProfile,
getProfile_profileArn,
GetProfileResponse (..),
newGetProfileResponse,
getProfileResponse_profile,
getProfileResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
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 GetProfile = GetProfile'
{
GetProfile -> Maybe Text
profileArn :: Prelude.Maybe Prelude.Text
}
deriving (GetProfile -> GetProfile -> Bool
(GetProfile -> GetProfile -> Bool)
-> (GetProfile -> GetProfile -> Bool) -> Eq GetProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProfile -> GetProfile -> Bool
$c/= :: GetProfile -> GetProfile -> Bool
== :: GetProfile -> GetProfile -> Bool
$c== :: GetProfile -> GetProfile -> Bool
Prelude.Eq, ReadPrec [GetProfile]
ReadPrec GetProfile
Int -> ReadS GetProfile
ReadS [GetProfile]
(Int -> ReadS GetProfile)
-> ReadS [GetProfile]
-> ReadPrec GetProfile
-> ReadPrec [GetProfile]
-> Read GetProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProfile]
$creadListPrec :: ReadPrec [GetProfile]
readPrec :: ReadPrec GetProfile
$creadPrec :: ReadPrec GetProfile
readList :: ReadS [GetProfile]
$creadList :: ReadS [GetProfile]
readsPrec :: Int -> ReadS GetProfile
$creadsPrec :: Int -> ReadS GetProfile
Prelude.Read, Int -> GetProfile -> ShowS
[GetProfile] -> ShowS
GetProfile -> String
(Int -> GetProfile -> ShowS)
-> (GetProfile -> String)
-> ([GetProfile] -> ShowS)
-> Show GetProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProfile] -> ShowS
$cshowList :: [GetProfile] -> ShowS
show :: GetProfile -> String
$cshow :: GetProfile -> String
showsPrec :: Int -> GetProfile -> ShowS
$cshowsPrec :: Int -> GetProfile -> ShowS
Prelude.Show, (forall x. GetProfile -> Rep GetProfile x)
-> (forall x. Rep GetProfile x -> GetProfile) -> Generic GetProfile
forall x. Rep GetProfile x -> GetProfile
forall x. GetProfile -> Rep GetProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProfile x -> GetProfile
$cfrom :: forall x. GetProfile -> Rep GetProfile x
Prelude.Generic)
newGetProfile ::
GetProfile
newGetProfile :: GetProfile
newGetProfile =
GetProfile' :: Maybe Text -> GetProfile
GetProfile' {$sel:profileArn:GetProfile' :: Maybe Text
profileArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}
getProfile_profileArn :: Lens.Lens' GetProfile (Prelude.Maybe Prelude.Text)
getProfile_profileArn :: (Maybe Text -> f (Maybe Text)) -> GetProfile -> f GetProfile
getProfile_profileArn = (GetProfile -> Maybe Text)
-> (GetProfile -> Maybe Text -> GetProfile)
-> Lens GetProfile GetProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProfile' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:GetProfile' :: GetProfile -> Maybe Text
profileArn} -> Maybe Text
profileArn) (\s :: GetProfile
s@GetProfile' {} Maybe Text
a -> GetProfile
s {$sel:profileArn:GetProfile' :: Maybe Text
profileArn = Maybe Text
a} :: GetProfile)
instance Core.AWSRequest GetProfile where
type AWSResponse GetProfile = GetProfileResponse
request :: GetProfile -> Request GetProfile
request = Service -> GetProfile -> Request GetProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProfile)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetProfile))
-> Logger
-> Service
-> Proxy GetProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProfile)))
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 Profile -> Int -> GetProfileResponse
GetProfileResponse'
(Maybe Profile -> Int -> GetProfileResponse)
-> Either String (Maybe Profile)
-> Either String (Int -> GetProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Profile)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Profile")
Either String (Int -> GetProfileResponse)
-> Either String Int -> Either String GetProfileResponse
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 GetProfile
instance Prelude.NFData GetProfile
instance Core.ToHeaders GetProfile where
toHeaders :: GetProfile -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetProfile -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.GetProfile" ::
Prelude.ByteString
),
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 GetProfile where
toJSON :: GetProfile -> Value
toJSON GetProfile' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:GetProfile' :: GetProfile -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"ProfileArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
profileArn]
)
instance Core.ToPath GetProfile where
toPath :: GetProfile -> ByteString
toPath = ByteString -> GetProfile -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetProfile where
toQuery :: GetProfile -> QueryString
toQuery = QueryString -> GetProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetProfileResponse = GetProfileResponse'
{
GetProfileResponse -> Maybe Profile
profile :: Prelude.Maybe Profile,
GetProfileResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetProfileResponse -> GetProfileResponse -> Bool
(GetProfileResponse -> GetProfileResponse -> Bool)
-> (GetProfileResponse -> GetProfileResponse -> Bool)
-> Eq GetProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProfileResponse -> GetProfileResponse -> Bool
$c/= :: GetProfileResponse -> GetProfileResponse -> Bool
== :: GetProfileResponse -> GetProfileResponse -> Bool
$c== :: GetProfileResponse -> GetProfileResponse -> Bool
Prelude.Eq, ReadPrec [GetProfileResponse]
ReadPrec GetProfileResponse
Int -> ReadS GetProfileResponse
ReadS [GetProfileResponse]
(Int -> ReadS GetProfileResponse)
-> ReadS [GetProfileResponse]
-> ReadPrec GetProfileResponse
-> ReadPrec [GetProfileResponse]
-> Read GetProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProfileResponse]
$creadListPrec :: ReadPrec [GetProfileResponse]
readPrec :: ReadPrec GetProfileResponse
$creadPrec :: ReadPrec GetProfileResponse
readList :: ReadS [GetProfileResponse]
$creadList :: ReadS [GetProfileResponse]
readsPrec :: Int -> ReadS GetProfileResponse
$creadsPrec :: Int -> ReadS GetProfileResponse
Prelude.Read, Int -> GetProfileResponse -> ShowS
[GetProfileResponse] -> ShowS
GetProfileResponse -> String
(Int -> GetProfileResponse -> ShowS)
-> (GetProfileResponse -> String)
-> ([GetProfileResponse] -> ShowS)
-> Show GetProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProfileResponse] -> ShowS
$cshowList :: [GetProfileResponse] -> ShowS
show :: GetProfileResponse -> String
$cshow :: GetProfileResponse -> String
showsPrec :: Int -> GetProfileResponse -> ShowS
$cshowsPrec :: Int -> GetProfileResponse -> ShowS
Prelude.Show, (forall x. GetProfileResponse -> Rep GetProfileResponse x)
-> (forall x. Rep GetProfileResponse x -> GetProfileResponse)
-> Generic GetProfileResponse
forall x. Rep GetProfileResponse x -> GetProfileResponse
forall x. GetProfileResponse -> Rep GetProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProfileResponse x -> GetProfileResponse
$cfrom :: forall x. GetProfileResponse -> Rep GetProfileResponse x
Prelude.Generic)
newGetProfileResponse ::
Prelude.Int ->
GetProfileResponse
newGetProfileResponse :: Int -> GetProfileResponse
newGetProfileResponse Int
pHttpStatus_ =
GetProfileResponse' :: Maybe Profile -> Int -> GetProfileResponse
GetProfileResponse'
{ $sel:profile:GetProfileResponse' :: Maybe Profile
profile = Maybe Profile
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getProfileResponse_profile :: Lens.Lens' GetProfileResponse (Prelude.Maybe Profile)
getProfileResponse_profile :: (Maybe Profile -> f (Maybe Profile))
-> GetProfileResponse -> f GetProfileResponse
getProfileResponse_profile = (GetProfileResponse -> Maybe Profile)
-> (GetProfileResponse -> Maybe Profile -> GetProfileResponse)
-> Lens
GetProfileResponse
GetProfileResponse
(Maybe Profile)
(Maybe Profile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProfileResponse' {Maybe Profile
profile :: Maybe Profile
$sel:profile:GetProfileResponse' :: GetProfileResponse -> Maybe Profile
profile} -> Maybe Profile
profile) (\s :: GetProfileResponse
s@GetProfileResponse' {} Maybe Profile
a -> GetProfileResponse
s {$sel:profile:GetProfileResponse' :: Maybe Profile
profile = Maybe Profile
a} :: GetProfileResponse)
getProfileResponse_httpStatus :: Lens.Lens' GetProfileResponse Prelude.Int
getProfileResponse_httpStatus :: (Int -> f Int) -> GetProfileResponse -> f GetProfileResponse
getProfileResponse_httpStatus = (GetProfileResponse -> Int)
-> (GetProfileResponse -> Int -> GetProfileResponse)
-> Lens GetProfileResponse GetProfileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetProfileResponse' :: GetProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetProfileResponse
s@GetProfileResponse' {} Int
a -> GetProfileResponse
s {$sel:httpStatus:GetProfileResponse' :: Int
httpStatus = Int
a} :: GetProfileResponse)
instance Prelude.NFData GetProfileResponse