{-# 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.DescribeAgentStatus
-- 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 an agent status.
module Amazonka.Connect.DescribeAgentStatus
  ( -- * Creating a Request
    DescribeAgentStatus (..),
    newDescribeAgentStatus,

    -- * Request Lenses
    describeAgentStatus_instanceId,
    describeAgentStatus_agentStatusId,

    -- * Destructuring the Response
    DescribeAgentStatusResponse (..),
    newDescribeAgentStatusResponse,

    -- * Response Lenses
    describeAgentStatusResponse_agentStatus,
    describeAgentStatusResponse_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:/ 'newDescribeAgentStatus' smart constructor.
data DescribeAgentStatus = DescribeAgentStatus'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    DescribeAgentStatus -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the agent status.
    DescribeAgentStatus -> Text
agentStatusId :: Prelude.Text
  }
  deriving (DescribeAgentStatus -> DescribeAgentStatus -> Bool
(DescribeAgentStatus -> DescribeAgentStatus -> Bool)
-> (DescribeAgentStatus -> DescribeAgentStatus -> Bool)
-> Eq DescribeAgentStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAgentStatus -> DescribeAgentStatus -> Bool
$c/= :: DescribeAgentStatus -> DescribeAgentStatus -> Bool
== :: DescribeAgentStatus -> DescribeAgentStatus -> Bool
$c== :: DescribeAgentStatus -> DescribeAgentStatus -> Bool
Prelude.Eq, ReadPrec [DescribeAgentStatus]
ReadPrec DescribeAgentStatus
Int -> ReadS DescribeAgentStatus
ReadS [DescribeAgentStatus]
(Int -> ReadS DescribeAgentStatus)
-> ReadS [DescribeAgentStatus]
-> ReadPrec DescribeAgentStatus
-> ReadPrec [DescribeAgentStatus]
-> Read DescribeAgentStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAgentStatus]
$creadListPrec :: ReadPrec [DescribeAgentStatus]
readPrec :: ReadPrec DescribeAgentStatus
$creadPrec :: ReadPrec DescribeAgentStatus
readList :: ReadS [DescribeAgentStatus]
$creadList :: ReadS [DescribeAgentStatus]
readsPrec :: Int -> ReadS DescribeAgentStatus
$creadsPrec :: Int -> ReadS DescribeAgentStatus
Prelude.Read, Int -> DescribeAgentStatus -> ShowS
[DescribeAgentStatus] -> ShowS
DescribeAgentStatus -> String
(Int -> DescribeAgentStatus -> ShowS)
-> (DescribeAgentStatus -> String)
-> ([DescribeAgentStatus] -> ShowS)
-> Show DescribeAgentStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAgentStatus] -> ShowS
$cshowList :: [DescribeAgentStatus] -> ShowS
show :: DescribeAgentStatus -> String
$cshow :: DescribeAgentStatus -> String
showsPrec :: Int -> DescribeAgentStatus -> ShowS
$cshowsPrec :: Int -> DescribeAgentStatus -> ShowS
Prelude.Show, (forall x. DescribeAgentStatus -> Rep DescribeAgentStatus x)
-> (forall x. Rep DescribeAgentStatus x -> DescribeAgentStatus)
-> Generic DescribeAgentStatus
forall x. Rep DescribeAgentStatus x -> DescribeAgentStatus
forall x. DescribeAgentStatus -> Rep DescribeAgentStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAgentStatus x -> DescribeAgentStatus
$cfrom :: forall x. DescribeAgentStatus -> Rep DescribeAgentStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAgentStatus' 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', 'describeAgentStatus_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'agentStatusId', 'describeAgentStatus_agentStatusId' - The identifier for the agent status.
newDescribeAgentStatus ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'agentStatusId'
  Prelude.Text ->
  DescribeAgentStatus
newDescribeAgentStatus :: Text -> Text -> DescribeAgentStatus
newDescribeAgentStatus Text
pInstanceId_ Text
pAgentStatusId_ =
  DescribeAgentStatus' :: Text -> Text -> DescribeAgentStatus
DescribeAgentStatus'
    { $sel:instanceId:DescribeAgentStatus' :: Text
instanceId = Text
pInstanceId_,
      $sel:agentStatusId:DescribeAgentStatus' :: Text
agentStatusId = Text
pAgentStatusId_
    }

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

-- | The identifier for the agent status.
describeAgentStatus_agentStatusId :: Lens.Lens' DescribeAgentStatus Prelude.Text
describeAgentStatus_agentStatusId :: (Text -> f Text) -> DescribeAgentStatus -> f DescribeAgentStatus
describeAgentStatus_agentStatusId = (DescribeAgentStatus -> Text)
-> (DescribeAgentStatus -> Text -> DescribeAgentStatus)
-> Lens DescribeAgentStatus DescribeAgentStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgentStatus' {Text
agentStatusId :: Text
$sel:agentStatusId:DescribeAgentStatus' :: DescribeAgentStatus -> Text
agentStatusId} -> Text
agentStatusId) (\s :: DescribeAgentStatus
s@DescribeAgentStatus' {} Text
a -> DescribeAgentStatus
s {$sel:agentStatusId:DescribeAgentStatus' :: Text
agentStatusId = Text
a} :: DescribeAgentStatus)

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

instance Prelude.NFData DescribeAgentStatus

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

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

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

-- |
-- Create a value of 'DescribeAgentStatusResponse' 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:
--
-- 'agentStatus', 'describeAgentStatusResponse_agentStatus' - The agent status.
--
-- 'httpStatus', 'describeAgentStatusResponse_httpStatus' - The response's http status code.
newDescribeAgentStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAgentStatusResponse
newDescribeAgentStatusResponse :: Int -> DescribeAgentStatusResponse
newDescribeAgentStatusResponse Int
pHttpStatus_ =
  DescribeAgentStatusResponse' :: Maybe AgentStatus -> Int -> DescribeAgentStatusResponse
DescribeAgentStatusResponse'
    { $sel:agentStatus:DescribeAgentStatusResponse' :: Maybe AgentStatus
agentStatus =
        Maybe AgentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAgentStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The agent status.
describeAgentStatusResponse_agentStatus :: Lens.Lens' DescribeAgentStatusResponse (Prelude.Maybe AgentStatus)
describeAgentStatusResponse_agentStatus :: (Maybe AgentStatus -> f (Maybe AgentStatus))
-> DescribeAgentStatusResponse -> f DescribeAgentStatusResponse
describeAgentStatusResponse_agentStatus = (DescribeAgentStatusResponse -> Maybe AgentStatus)
-> (DescribeAgentStatusResponse
    -> Maybe AgentStatus -> DescribeAgentStatusResponse)
-> Lens
     DescribeAgentStatusResponse
     DescribeAgentStatusResponse
     (Maybe AgentStatus)
     (Maybe AgentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgentStatusResponse' {Maybe AgentStatus
agentStatus :: Maybe AgentStatus
$sel:agentStatus:DescribeAgentStatusResponse' :: DescribeAgentStatusResponse -> Maybe AgentStatus
agentStatus} -> Maybe AgentStatus
agentStatus) (\s :: DescribeAgentStatusResponse
s@DescribeAgentStatusResponse' {} Maybe AgentStatus
a -> DescribeAgentStatusResponse
s {$sel:agentStatus:DescribeAgentStatusResponse' :: Maybe AgentStatus
agentStatus = Maybe AgentStatus
a} :: DescribeAgentStatusResponse)

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

instance Prelude.NFData DescribeAgentStatusResponse