{-# 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.GetConferencePreference
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the existing conference preferences.
module Amazonka.AlexaBusiness.GetConferencePreference
  ( -- * Creating a Request
    GetConferencePreference (..),
    newGetConferencePreference,

    -- * Destructuring the Response
    GetConferencePreferenceResponse (..),
    newGetConferencePreferenceResponse,

    -- * Response Lenses
    getConferencePreferenceResponse_preference,
    getConferencePreferenceResponse_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

-- | /See:/ 'newGetConferencePreference' smart constructor.
data GetConferencePreference = GetConferencePreference'
  {
  }
  deriving (GetConferencePreference -> GetConferencePreference -> Bool
(GetConferencePreference -> GetConferencePreference -> Bool)
-> (GetConferencePreference -> GetConferencePreference -> Bool)
-> Eq GetConferencePreference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConferencePreference -> GetConferencePreference -> Bool
$c/= :: GetConferencePreference -> GetConferencePreference -> Bool
== :: GetConferencePreference -> GetConferencePreference -> Bool
$c== :: GetConferencePreference -> GetConferencePreference -> Bool
Prelude.Eq, ReadPrec [GetConferencePreference]
ReadPrec GetConferencePreference
Int -> ReadS GetConferencePreference
ReadS [GetConferencePreference]
(Int -> ReadS GetConferencePreference)
-> ReadS [GetConferencePreference]
-> ReadPrec GetConferencePreference
-> ReadPrec [GetConferencePreference]
-> Read GetConferencePreference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConferencePreference]
$creadListPrec :: ReadPrec [GetConferencePreference]
readPrec :: ReadPrec GetConferencePreference
$creadPrec :: ReadPrec GetConferencePreference
readList :: ReadS [GetConferencePreference]
$creadList :: ReadS [GetConferencePreference]
readsPrec :: Int -> ReadS GetConferencePreference
$creadsPrec :: Int -> ReadS GetConferencePreference
Prelude.Read, Int -> GetConferencePreference -> ShowS
[GetConferencePreference] -> ShowS
GetConferencePreference -> String
(Int -> GetConferencePreference -> ShowS)
-> (GetConferencePreference -> String)
-> ([GetConferencePreference] -> ShowS)
-> Show GetConferencePreference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConferencePreference] -> ShowS
$cshowList :: [GetConferencePreference] -> ShowS
show :: GetConferencePreference -> String
$cshow :: GetConferencePreference -> String
showsPrec :: Int -> GetConferencePreference -> ShowS
$cshowsPrec :: Int -> GetConferencePreference -> ShowS
Prelude.Show, (forall x.
 GetConferencePreference -> Rep GetConferencePreference x)
-> (forall x.
    Rep GetConferencePreference x -> GetConferencePreference)
-> Generic GetConferencePreference
forall x. Rep GetConferencePreference x -> GetConferencePreference
forall x. GetConferencePreference -> Rep GetConferencePreference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConferencePreference x -> GetConferencePreference
$cfrom :: forall x. GetConferencePreference -> Rep GetConferencePreference x
Prelude.Generic)

-- |
-- Create a value of 'GetConferencePreference' 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.
newGetConferencePreference ::
  GetConferencePreference
newGetConferencePreference :: GetConferencePreference
newGetConferencePreference = GetConferencePreference
GetConferencePreference'

instance Core.AWSRequest GetConferencePreference where
  type
    AWSResponse GetConferencePreference =
      GetConferencePreferenceResponse
  request :: GetConferencePreference -> Request GetConferencePreference
request = Service
-> GetConferencePreference -> Request GetConferencePreference
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetConferencePreference
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetConferencePreference)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetConferencePreference))
-> Logger
-> Service
-> Proxy GetConferencePreference
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetConferencePreference)))
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 ConferencePreference
-> Int -> GetConferencePreferenceResponse
GetConferencePreferenceResponse'
            (Maybe ConferencePreference
 -> Int -> GetConferencePreferenceResponse)
-> Either String (Maybe ConferencePreference)
-> Either String (Int -> GetConferencePreferenceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe ConferencePreference)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"Preference")
            Either String (Int -> GetConferencePreferenceResponse)
-> Either String Int
-> Either String GetConferencePreferenceResponse
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 GetConferencePreference

instance Prelude.NFData GetConferencePreference

instance Core.ToHeaders GetConferencePreference where
  toHeaders :: GetConferencePreference -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetConferencePreference -> 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.GetConferencePreference" ::
                          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 GetConferencePreference where
  toJSON :: GetConferencePreference -> Value
toJSON = Value -> GetConferencePreference -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetConferencePreferenceResponse' smart constructor.
data GetConferencePreferenceResponse = GetConferencePreferenceResponse'
  { -- | The conference preference.
    GetConferencePreferenceResponse -> Maybe ConferencePreference
preference :: Prelude.Maybe ConferencePreference,
    -- | The response's http status code.
    GetConferencePreferenceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetConferencePreferenceResponse
-> GetConferencePreferenceResponse -> Bool
(GetConferencePreferenceResponse
 -> GetConferencePreferenceResponse -> Bool)
-> (GetConferencePreferenceResponse
    -> GetConferencePreferenceResponse -> Bool)
-> Eq GetConferencePreferenceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConferencePreferenceResponse
-> GetConferencePreferenceResponse -> Bool
$c/= :: GetConferencePreferenceResponse
-> GetConferencePreferenceResponse -> Bool
== :: GetConferencePreferenceResponse
-> GetConferencePreferenceResponse -> Bool
$c== :: GetConferencePreferenceResponse
-> GetConferencePreferenceResponse -> Bool
Prelude.Eq, ReadPrec [GetConferencePreferenceResponse]
ReadPrec GetConferencePreferenceResponse
Int -> ReadS GetConferencePreferenceResponse
ReadS [GetConferencePreferenceResponse]
(Int -> ReadS GetConferencePreferenceResponse)
-> ReadS [GetConferencePreferenceResponse]
-> ReadPrec GetConferencePreferenceResponse
-> ReadPrec [GetConferencePreferenceResponse]
-> Read GetConferencePreferenceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConferencePreferenceResponse]
$creadListPrec :: ReadPrec [GetConferencePreferenceResponse]
readPrec :: ReadPrec GetConferencePreferenceResponse
$creadPrec :: ReadPrec GetConferencePreferenceResponse
readList :: ReadS [GetConferencePreferenceResponse]
$creadList :: ReadS [GetConferencePreferenceResponse]
readsPrec :: Int -> ReadS GetConferencePreferenceResponse
$creadsPrec :: Int -> ReadS GetConferencePreferenceResponse
Prelude.Read, Int -> GetConferencePreferenceResponse -> ShowS
[GetConferencePreferenceResponse] -> ShowS
GetConferencePreferenceResponse -> String
(Int -> GetConferencePreferenceResponse -> ShowS)
-> (GetConferencePreferenceResponse -> String)
-> ([GetConferencePreferenceResponse] -> ShowS)
-> Show GetConferencePreferenceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConferencePreferenceResponse] -> ShowS
$cshowList :: [GetConferencePreferenceResponse] -> ShowS
show :: GetConferencePreferenceResponse -> String
$cshow :: GetConferencePreferenceResponse -> String
showsPrec :: Int -> GetConferencePreferenceResponse -> ShowS
$cshowsPrec :: Int -> GetConferencePreferenceResponse -> ShowS
Prelude.Show, (forall x.
 GetConferencePreferenceResponse
 -> Rep GetConferencePreferenceResponse x)
-> (forall x.
    Rep GetConferencePreferenceResponse x
    -> GetConferencePreferenceResponse)
-> Generic GetConferencePreferenceResponse
forall x.
Rep GetConferencePreferenceResponse x
-> GetConferencePreferenceResponse
forall x.
GetConferencePreferenceResponse
-> Rep GetConferencePreferenceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConferencePreferenceResponse x
-> GetConferencePreferenceResponse
$cfrom :: forall x.
GetConferencePreferenceResponse
-> Rep GetConferencePreferenceResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetConferencePreferenceResponse' 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:
--
-- 'preference', 'getConferencePreferenceResponse_preference' - The conference preference.
--
-- 'httpStatus', 'getConferencePreferenceResponse_httpStatus' - The response's http status code.
newGetConferencePreferenceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetConferencePreferenceResponse
newGetConferencePreferenceResponse :: Int -> GetConferencePreferenceResponse
newGetConferencePreferenceResponse Int
pHttpStatus_ =
  GetConferencePreferenceResponse' :: Maybe ConferencePreference
-> Int -> GetConferencePreferenceResponse
GetConferencePreferenceResponse'
    { $sel:preference:GetConferencePreferenceResponse' :: Maybe ConferencePreference
preference =
        Maybe ConferencePreference
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetConferencePreferenceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The conference preference.
getConferencePreferenceResponse_preference :: Lens.Lens' GetConferencePreferenceResponse (Prelude.Maybe ConferencePreference)
getConferencePreferenceResponse_preference :: (Maybe ConferencePreference -> f (Maybe ConferencePreference))
-> GetConferencePreferenceResponse
-> f GetConferencePreferenceResponse
getConferencePreferenceResponse_preference = (GetConferencePreferenceResponse -> Maybe ConferencePreference)
-> (GetConferencePreferenceResponse
    -> Maybe ConferencePreference -> GetConferencePreferenceResponse)
-> Lens
     GetConferencePreferenceResponse
     GetConferencePreferenceResponse
     (Maybe ConferencePreference)
     (Maybe ConferencePreference)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConferencePreferenceResponse' {Maybe ConferencePreference
preference :: Maybe ConferencePreference
$sel:preference:GetConferencePreferenceResponse' :: GetConferencePreferenceResponse -> Maybe ConferencePreference
preference} -> Maybe ConferencePreference
preference) (\s :: GetConferencePreferenceResponse
s@GetConferencePreferenceResponse' {} Maybe ConferencePreference
a -> GetConferencePreferenceResponse
s {$sel:preference:GetConferencePreferenceResponse' :: Maybe ConferencePreference
preference = Maybe ConferencePreference
a} :: GetConferencePreferenceResponse)

-- | The response's http status code.
getConferencePreferenceResponse_httpStatus :: Lens.Lens' GetConferencePreferenceResponse Prelude.Int
getConferencePreferenceResponse_httpStatus :: (Int -> f Int)
-> GetConferencePreferenceResponse
-> f GetConferencePreferenceResponse
getConferencePreferenceResponse_httpStatus = (GetConferencePreferenceResponse -> Int)
-> (GetConferencePreferenceResponse
    -> Int -> GetConferencePreferenceResponse)
-> Lens
     GetConferencePreferenceResponse
     GetConferencePreferenceResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConferencePreferenceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConferencePreferenceResponse' :: GetConferencePreferenceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConferencePreferenceResponse
s@GetConferencePreferenceResponse' {} Int
a -> GetConferencePreferenceResponse
s {$sel:httpStatus:GetConferencePreferenceResponse' :: Int
httpStatus = Int
a} :: GetConferencePreferenceResponse)

instance
  Prelude.NFData
    GetConferencePreferenceResponse