{-# 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.Route53RecoveryControlConfig.DescribeControlPanel
-- 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)
--
-- Displays details about a control panel.
module Amazonka.Route53RecoveryControlConfig.DescribeControlPanel
  ( -- * Creating a Request
    DescribeControlPanel (..),
    newDescribeControlPanel,

    -- * Request Lenses
    describeControlPanel_controlPanelArn,

    -- * Destructuring the Response
    DescribeControlPanelResponse (..),
    newDescribeControlPanelResponse,

    -- * Response Lenses
    describeControlPanelResponse_controlPanel,
    describeControlPanelResponse_httpStatus,
  )
where

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
import Amazonka.Route53RecoveryControlConfig.Types

-- | /See:/ 'newDescribeControlPanel' smart constructor.
data DescribeControlPanel = DescribeControlPanel'
  { -- | The Amazon Resource Name (ARN) of the control panel that you\'re getting
    -- details for.
    DescribeControlPanel -> Text
controlPanelArn :: Prelude.Text
  }
  deriving (DescribeControlPanel -> DescribeControlPanel -> Bool
(DescribeControlPanel -> DescribeControlPanel -> Bool)
-> (DescribeControlPanel -> DescribeControlPanel -> Bool)
-> Eq DescribeControlPanel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeControlPanel -> DescribeControlPanel -> Bool
$c/= :: DescribeControlPanel -> DescribeControlPanel -> Bool
== :: DescribeControlPanel -> DescribeControlPanel -> Bool
$c== :: DescribeControlPanel -> DescribeControlPanel -> Bool
Prelude.Eq, ReadPrec [DescribeControlPanel]
ReadPrec DescribeControlPanel
Int -> ReadS DescribeControlPanel
ReadS [DescribeControlPanel]
(Int -> ReadS DescribeControlPanel)
-> ReadS [DescribeControlPanel]
-> ReadPrec DescribeControlPanel
-> ReadPrec [DescribeControlPanel]
-> Read DescribeControlPanel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeControlPanel]
$creadListPrec :: ReadPrec [DescribeControlPanel]
readPrec :: ReadPrec DescribeControlPanel
$creadPrec :: ReadPrec DescribeControlPanel
readList :: ReadS [DescribeControlPanel]
$creadList :: ReadS [DescribeControlPanel]
readsPrec :: Int -> ReadS DescribeControlPanel
$creadsPrec :: Int -> ReadS DescribeControlPanel
Prelude.Read, Int -> DescribeControlPanel -> ShowS
[DescribeControlPanel] -> ShowS
DescribeControlPanel -> String
(Int -> DescribeControlPanel -> ShowS)
-> (DescribeControlPanel -> String)
-> ([DescribeControlPanel] -> ShowS)
-> Show DescribeControlPanel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeControlPanel] -> ShowS
$cshowList :: [DescribeControlPanel] -> ShowS
show :: DescribeControlPanel -> String
$cshow :: DescribeControlPanel -> String
showsPrec :: Int -> DescribeControlPanel -> ShowS
$cshowsPrec :: Int -> DescribeControlPanel -> ShowS
Prelude.Show, (forall x. DescribeControlPanel -> Rep DescribeControlPanel x)
-> (forall x. Rep DescribeControlPanel x -> DescribeControlPanel)
-> Generic DescribeControlPanel
forall x. Rep DescribeControlPanel x -> DescribeControlPanel
forall x. DescribeControlPanel -> Rep DescribeControlPanel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeControlPanel x -> DescribeControlPanel
$cfrom :: forall x. DescribeControlPanel -> Rep DescribeControlPanel x
Prelude.Generic)

-- |
-- Create a value of 'DescribeControlPanel' 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:
--
-- 'controlPanelArn', 'describeControlPanel_controlPanelArn' - The Amazon Resource Name (ARN) of the control panel that you\'re getting
-- details for.
newDescribeControlPanel ::
  -- | 'controlPanelArn'
  Prelude.Text ->
  DescribeControlPanel
newDescribeControlPanel :: Text -> DescribeControlPanel
newDescribeControlPanel Text
pControlPanelArn_ =
  DescribeControlPanel' :: Text -> DescribeControlPanel
DescribeControlPanel'
    { $sel:controlPanelArn:DescribeControlPanel' :: Text
controlPanelArn =
        Text
pControlPanelArn_
    }

-- | The Amazon Resource Name (ARN) of the control panel that you\'re getting
-- details for.
describeControlPanel_controlPanelArn :: Lens.Lens' DescribeControlPanel Prelude.Text
describeControlPanel_controlPanelArn :: (Text -> f Text) -> DescribeControlPanel -> f DescribeControlPanel
describeControlPanel_controlPanelArn = (DescribeControlPanel -> Text)
-> (DescribeControlPanel -> Text -> DescribeControlPanel)
-> Lens DescribeControlPanel DescribeControlPanel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeControlPanel' {Text
controlPanelArn :: Text
$sel:controlPanelArn:DescribeControlPanel' :: DescribeControlPanel -> Text
controlPanelArn} -> Text
controlPanelArn) (\s :: DescribeControlPanel
s@DescribeControlPanel' {} Text
a -> DescribeControlPanel
s {$sel:controlPanelArn:DescribeControlPanel' :: Text
controlPanelArn = Text
a} :: DescribeControlPanel)

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

instance Prelude.NFData DescribeControlPanel

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

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

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

-- |
-- Create a value of 'DescribeControlPanelResponse' 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:
--
-- 'controlPanel', 'describeControlPanelResponse_controlPanel' - Information about the control panel.
--
-- 'httpStatus', 'describeControlPanelResponse_httpStatus' - The response's http status code.
newDescribeControlPanelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeControlPanelResponse
newDescribeControlPanelResponse :: Int -> DescribeControlPanelResponse
newDescribeControlPanelResponse Int
pHttpStatus_ =
  DescribeControlPanelResponse' :: Maybe ControlPanel -> Int -> DescribeControlPanelResponse
DescribeControlPanelResponse'
    { $sel:controlPanel:DescribeControlPanelResponse' :: Maybe ControlPanel
controlPanel =
        Maybe ControlPanel
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeControlPanelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the control panel.
describeControlPanelResponse_controlPanel :: Lens.Lens' DescribeControlPanelResponse (Prelude.Maybe ControlPanel)
describeControlPanelResponse_controlPanel :: (Maybe ControlPanel -> f (Maybe ControlPanel))
-> DescribeControlPanelResponse -> f DescribeControlPanelResponse
describeControlPanelResponse_controlPanel = (DescribeControlPanelResponse -> Maybe ControlPanel)
-> (DescribeControlPanelResponse
    -> Maybe ControlPanel -> DescribeControlPanelResponse)
-> Lens
     DescribeControlPanelResponse
     DescribeControlPanelResponse
     (Maybe ControlPanel)
     (Maybe ControlPanel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeControlPanelResponse' {Maybe ControlPanel
controlPanel :: Maybe ControlPanel
$sel:controlPanel:DescribeControlPanelResponse' :: DescribeControlPanelResponse -> Maybe ControlPanel
controlPanel} -> Maybe ControlPanel
controlPanel) (\s :: DescribeControlPanelResponse
s@DescribeControlPanelResponse' {} Maybe ControlPanel
a -> DescribeControlPanelResponse
s {$sel:controlPanel:DescribeControlPanelResponse' :: Maybe ControlPanel
controlPanel = Maybe ControlPanel
a} :: DescribeControlPanelResponse)

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

instance Prelude.NFData DescribeControlPanelResponse