{-# 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.Connect.DescribeInstanceAttribute
-- 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)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Describes the specified instance attribute.
module Amazonka.Connect.DescribeInstanceAttribute
  ( -- * Creating a Request
    DescribeInstanceAttribute (..),
    newDescribeInstanceAttribute,

    -- * Request Lenses
    describeInstanceAttribute_instanceId,
    describeInstanceAttribute_attributeType,

    -- * Destructuring the Response
    DescribeInstanceAttributeResponse (..),
    newDescribeInstanceAttributeResponse,

    -- * Response Lenses
    describeInstanceAttributeResponse_attribute,
    describeInstanceAttributeResponse_httpStatus,
  )
where

import Amazonka.Connect.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:/ 'newDescribeInstanceAttribute' smart constructor.
data DescribeInstanceAttribute = DescribeInstanceAttribute'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    DescribeInstanceAttribute -> Text
instanceId :: Prelude.Text,
    -- | The type of attribute.
    DescribeInstanceAttribute -> InstanceAttributeType
attributeType :: InstanceAttributeType
  }
  deriving (DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool
(DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool)
-> (DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool)
-> Eq DescribeInstanceAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool
$c/= :: DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool
== :: DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool
$c== :: DescribeInstanceAttribute -> DescribeInstanceAttribute -> Bool
Prelude.Eq, ReadPrec [DescribeInstanceAttribute]
ReadPrec DescribeInstanceAttribute
Int -> ReadS DescribeInstanceAttribute
ReadS [DescribeInstanceAttribute]
(Int -> ReadS DescribeInstanceAttribute)
-> ReadS [DescribeInstanceAttribute]
-> ReadPrec DescribeInstanceAttribute
-> ReadPrec [DescribeInstanceAttribute]
-> Read DescribeInstanceAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstanceAttribute]
$creadListPrec :: ReadPrec [DescribeInstanceAttribute]
readPrec :: ReadPrec DescribeInstanceAttribute
$creadPrec :: ReadPrec DescribeInstanceAttribute
readList :: ReadS [DescribeInstanceAttribute]
$creadList :: ReadS [DescribeInstanceAttribute]
readsPrec :: Int -> ReadS DescribeInstanceAttribute
$creadsPrec :: Int -> ReadS DescribeInstanceAttribute
Prelude.Read, Int -> DescribeInstanceAttribute -> ShowS
[DescribeInstanceAttribute] -> ShowS
DescribeInstanceAttribute -> String
(Int -> DescribeInstanceAttribute -> ShowS)
-> (DescribeInstanceAttribute -> String)
-> ([DescribeInstanceAttribute] -> ShowS)
-> Show DescribeInstanceAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstanceAttribute] -> ShowS
$cshowList :: [DescribeInstanceAttribute] -> ShowS
show :: DescribeInstanceAttribute -> String
$cshow :: DescribeInstanceAttribute -> String
showsPrec :: Int -> DescribeInstanceAttribute -> ShowS
$cshowsPrec :: Int -> DescribeInstanceAttribute -> ShowS
Prelude.Show, (forall x.
 DescribeInstanceAttribute -> Rep DescribeInstanceAttribute x)
-> (forall x.
    Rep DescribeInstanceAttribute x -> DescribeInstanceAttribute)
-> Generic DescribeInstanceAttribute
forall x.
Rep DescribeInstanceAttribute x -> DescribeInstanceAttribute
forall x.
DescribeInstanceAttribute -> Rep DescribeInstanceAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstanceAttribute x -> DescribeInstanceAttribute
$cfrom :: forall x.
DescribeInstanceAttribute -> Rep DescribeInstanceAttribute x
Prelude.Generic)

-- |
-- Create a value of 'DescribeInstanceAttribute' 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:
--
-- 'instanceId', 'describeInstanceAttribute_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'attributeType', 'describeInstanceAttribute_attributeType' - The type of attribute.
newDescribeInstanceAttribute ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'attributeType'
  InstanceAttributeType ->
  DescribeInstanceAttribute
newDescribeInstanceAttribute :: Text -> InstanceAttributeType -> DescribeInstanceAttribute
newDescribeInstanceAttribute
  Text
pInstanceId_
  InstanceAttributeType
pAttributeType_ =
    DescribeInstanceAttribute' :: Text -> InstanceAttributeType -> DescribeInstanceAttribute
DescribeInstanceAttribute'
      { $sel:instanceId:DescribeInstanceAttribute' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:attributeType:DescribeInstanceAttribute' :: InstanceAttributeType
attributeType = InstanceAttributeType
pAttributeType_
      }

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
describeInstanceAttribute_instanceId :: Lens.Lens' DescribeInstanceAttribute Prelude.Text
describeInstanceAttribute_instanceId :: (Text -> f Text)
-> DescribeInstanceAttribute -> f DescribeInstanceAttribute
describeInstanceAttribute_instanceId = (DescribeInstanceAttribute -> Text)
-> (DescribeInstanceAttribute -> Text -> DescribeInstanceAttribute)
-> Lens
     DescribeInstanceAttribute DescribeInstanceAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceAttribute' {Text
instanceId :: Text
$sel:instanceId:DescribeInstanceAttribute' :: DescribeInstanceAttribute -> Text
instanceId} -> Text
instanceId) (\s :: DescribeInstanceAttribute
s@DescribeInstanceAttribute' {} Text
a -> DescribeInstanceAttribute
s {$sel:instanceId:DescribeInstanceAttribute' :: Text
instanceId = Text
a} :: DescribeInstanceAttribute)

-- | The type of attribute.
describeInstanceAttribute_attributeType :: Lens.Lens' DescribeInstanceAttribute InstanceAttributeType
describeInstanceAttribute_attributeType :: (InstanceAttributeType -> f InstanceAttributeType)
-> DescribeInstanceAttribute -> f DescribeInstanceAttribute
describeInstanceAttribute_attributeType = (DescribeInstanceAttribute -> InstanceAttributeType)
-> (DescribeInstanceAttribute
    -> InstanceAttributeType -> DescribeInstanceAttribute)
-> Lens
     DescribeInstanceAttribute
     DescribeInstanceAttribute
     InstanceAttributeType
     InstanceAttributeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceAttribute' {InstanceAttributeType
attributeType :: InstanceAttributeType
$sel:attributeType:DescribeInstanceAttribute' :: DescribeInstanceAttribute -> InstanceAttributeType
attributeType} -> InstanceAttributeType
attributeType) (\s :: DescribeInstanceAttribute
s@DescribeInstanceAttribute' {} InstanceAttributeType
a -> DescribeInstanceAttribute
s {$sel:attributeType:DescribeInstanceAttribute' :: InstanceAttributeType
attributeType = InstanceAttributeType
a} :: DescribeInstanceAttribute)

instance Core.AWSRequest DescribeInstanceAttribute where
  type
    AWSResponse DescribeInstanceAttribute =
      DescribeInstanceAttributeResponse
  request :: DescribeInstanceAttribute -> Request DescribeInstanceAttribute
request = Service
-> DescribeInstanceAttribute -> Request DescribeInstanceAttribute
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeInstanceAttribute
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeInstanceAttribute)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeInstanceAttribute))
-> Logger
-> Service
-> Proxy DescribeInstanceAttribute
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeInstanceAttribute)))
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 Attribute -> Int -> DescribeInstanceAttributeResponse
DescribeInstanceAttributeResponse'
            (Maybe Attribute -> Int -> DescribeInstanceAttributeResponse)
-> Either String (Maybe Attribute)
-> Either String (Int -> DescribeInstanceAttributeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Attribute)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attribute")
            Either String (Int -> DescribeInstanceAttributeResponse)
-> Either String Int
-> Either String DescribeInstanceAttributeResponse
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 DescribeInstanceAttribute

instance Prelude.NFData DescribeInstanceAttribute

instance Core.ToHeaders DescribeInstanceAttribute where
  toHeaders :: DescribeInstanceAttribute -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeInstanceAttribute -> 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 DescribeInstanceAttribute where
  toPath :: DescribeInstanceAttribute -> ByteString
toPath DescribeInstanceAttribute' {Text
InstanceAttributeType
attributeType :: InstanceAttributeType
instanceId :: Text
$sel:attributeType:DescribeInstanceAttribute' :: DescribeInstanceAttribute -> InstanceAttributeType
$sel:instanceId:DescribeInstanceAttribute' :: DescribeInstanceAttribute -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/instance/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/attribute/",
        InstanceAttributeType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS InstanceAttributeType
attributeType
      ]

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

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

-- |
-- Create a value of 'DescribeInstanceAttributeResponse' 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:
--
-- 'attribute', 'describeInstanceAttributeResponse_attribute' - The type of attribute.
--
-- 'httpStatus', 'describeInstanceAttributeResponse_httpStatus' - The response's http status code.
newDescribeInstanceAttributeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeInstanceAttributeResponse
newDescribeInstanceAttributeResponse :: Int -> DescribeInstanceAttributeResponse
newDescribeInstanceAttributeResponse Int
pHttpStatus_ =
  DescribeInstanceAttributeResponse' :: Maybe Attribute -> Int -> DescribeInstanceAttributeResponse
DescribeInstanceAttributeResponse'
    { $sel:attribute:DescribeInstanceAttributeResponse' :: Maybe Attribute
attribute =
        Maybe Attribute
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeInstanceAttributeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The type of attribute.
describeInstanceAttributeResponse_attribute :: Lens.Lens' DescribeInstanceAttributeResponse (Prelude.Maybe Attribute)
describeInstanceAttributeResponse_attribute :: (Maybe Attribute -> f (Maybe Attribute))
-> DescribeInstanceAttributeResponse
-> f DescribeInstanceAttributeResponse
describeInstanceAttributeResponse_attribute = (DescribeInstanceAttributeResponse -> Maybe Attribute)
-> (DescribeInstanceAttributeResponse
    -> Maybe Attribute -> DescribeInstanceAttributeResponse)
-> Lens
     DescribeInstanceAttributeResponse
     DescribeInstanceAttributeResponse
     (Maybe Attribute)
     (Maybe Attribute)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstanceAttributeResponse' {Maybe Attribute
attribute :: Maybe Attribute
$sel:attribute:DescribeInstanceAttributeResponse' :: DescribeInstanceAttributeResponse -> Maybe Attribute
attribute} -> Maybe Attribute
attribute) (\s :: DescribeInstanceAttributeResponse
s@DescribeInstanceAttributeResponse' {} Maybe Attribute
a -> DescribeInstanceAttributeResponse
s {$sel:attribute:DescribeInstanceAttributeResponse' :: Maybe Attribute
attribute = Maybe Attribute
a} :: DescribeInstanceAttributeResponse)

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

instance
  Prelude.NFData
    DescribeInstanceAttributeResponse