{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.GetProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the details of a room profile by profile ARN.
module Amazonka.AlexaBusiness.GetProfile
  ( -- * Creating a Request
    GetProfile (..),
    newGetProfile,

    -- * Request Lenses
    getProfile_profileArn,

    -- * Destructuring the Response
    GetProfileResponse (..),
    newGetProfileResponse,

    -- * Response Lenses
    getProfileResponse_profile,
    getProfileResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetProfile' smart constructor.
data GetProfile = GetProfile'
  { -- | The ARN of the room profile for which to request details. Required.
    GetProfile -> Maybe Text
profileArn :: Prelude.Maybe Prelude.Text
  }
  deriving (GetProfile -> GetProfile -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'GetProfile' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'profileArn', 'getProfile_profileArn' - The ARN of the room profile for which to request details. Required.
newGetProfile ::
  GetProfile
newGetProfile :: GetProfile
newGetProfile =
  GetProfile' {$sel:profileArn:GetProfile' :: Maybe Text
profileArn = forall a. Maybe a
Prelude.Nothing}

-- | The ARN of the room profile for which to request details. Required.
getProfile_profileArn :: Lens.Lens' GetProfile (Prelude.Maybe Prelude.Text)
getProfile_profileArn :: Lens' GetProfile (Maybe Text)
getProfile_profileArn = 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 :: (Service -> Service) -> GetProfile -> Request GetProfile
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 GetProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProfile)))
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 Profile -> Int -> GetProfileResponse
GetProfileResponse'
            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
"Profile")
            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 GetProfile where
  hashWithSalt :: Int -> GetProfile -> Int
hashWithSalt Int
_salt GetProfile' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:GetProfile' :: GetProfile -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
profileArn

instance Prelude.NFData GetProfile where
  rnf :: GetProfile -> ()
rnf GetProfile' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:GetProfile' :: GetProfile -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
profileArn

instance Data.ToHeaders GetProfile where
  toHeaders :: GetProfile -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AlexaForBusiness.GetProfile" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetProfile where
  toJSON :: GetProfile -> Value
toJSON GetProfile' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:GetProfile' :: GetProfile -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"ProfileArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
profileArn]
      )

instance Data.ToPath GetProfile where
  toPath :: GetProfile -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetProfile where
  toQuery :: GetProfile -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetProfileResponse' smart constructor.
data GetProfileResponse = GetProfileResponse'
  { -- | The details of the room profile requested. Required.
    GetProfileResponse -> Maybe Profile
profile :: Prelude.Maybe Profile,
    -- | The response's http status code.
    GetProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetProfileResponse -> GetProfileResponse -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'GetProfileResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'profile', 'getProfileResponse_profile' - The details of the room profile requested. Required.
--
-- 'httpStatus', 'getProfileResponse_httpStatus' - The response's http status code.
newGetProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetProfileResponse
newGetProfileResponse :: Int -> GetProfileResponse
newGetProfileResponse Int
pHttpStatus_ =
  GetProfileResponse'
    { $sel:profile:GetProfileResponse' :: Maybe Profile
profile = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The details of the room profile requested. Required.
getProfileResponse_profile :: Lens.Lens' GetProfileResponse (Prelude.Maybe Profile)
getProfileResponse_profile :: Lens' GetProfileResponse (Maybe Profile)
getProfileResponse_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)

-- | The response's http status code.
getProfileResponse_httpStatus :: Lens.Lens' GetProfileResponse Prelude.Int
getProfileResponse_httpStatus :: Lens' GetProfileResponse Int
getProfileResponse_httpStatus = 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 where
  rnf :: GetProfileResponse -> ()
rnf GetProfileResponse' {Int
Maybe Profile
httpStatus :: Int
profile :: Maybe Profile
$sel:httpStatus:GetProfileResponse' :: GetProfileResponse -> Int
$sel:profile:GetProfileResponse' :: GetProfileResponse -> Maybe Profile
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Profile
profile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus