{-# 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.Kafka.DescribeClusterV2
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a description of the MSK cluster whose Amazon Resource Name
-- (ARN) is specified in the request.
module Amazonka.Kafka.DescribeClusterV2
  ( -- * Creating a Request
    DescribeClusterV2 (..),
    newDescribeClusterV2,

    -- * Request Lenses
    describeClusterV2_clusterArn,

    -- * Destructuring the Response
    DescribeClusterV2Response (..),
    newDescribeClusterV2Response,

    -- * Response Lenses
    describeClusterV2Response_clusterInfo,
    describeClusterV2Response_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeClusterV2' smart constructor.
data DescribeClusterV2 = DescribeClusterV2'
  { -- | The Amazon Resource Name (ARN) that uniquely identifies the cluster.
    DescribeClusterV2 -> Text
clusterArn :: Prelude.Text
  }
  deriving (DescribeClusterV2 -> DescribeClusterV2 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeClusterV2 -> DescribeClusterV2 -> Bool
$c/= :: DescribeClusterV2 -> DescribeClusterV2 -> Bool
== :: DescribeClusterV2 -> DescribeClusterV2 -> Bool
$c== :: DescribeClusterV2 -> DescribeClusterV2 -> Bool
Prelude.Eq, ReadPrec [DescribeClusterV2]
ReadPrec DescribeClusterV2
Int -> ReadS DescribeClusterV2
ReadS [DescribeClusterV2]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeClusterV2]
$creadListPrec :: ReadPrec [DescribeClusterV2]
readPrec :: ReadPrec DescribeClusterV2
$creadPrec :: ReadPrec DescribeClusterV2
readList :: ReadS [DescribeClusterV2]
$creadList :: ReadS [DescribeClusterV2]
readsPrec :: Int -> ReadS DescribeClusterV2
$creadsPrec :: Int -> ReadS DescribeClusterV2
Prelude.Read, Int -> DescribeClusterV2 -> ShowS
[DescribeClusterV2] -> ShowS
DescribeClusterV2 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeClusterV2] -> ShowS
$cshowList :: [DescribeClusterV2] -> ShowS
show :: DescribeClusterV2 -> String
$cshow :: DescribeClusterV2 -> String
showsPrec :: Int -> DescribeClusterV2 -> ShowS
$cshowsPrec :: Int -> DescribeClusterV2 -> ShowS
Prelude.Show, forall x. Rep DescribeClusterV2 x -> DescribeClusterV2
forall x. DescribeClusterV2 -> Rep DescribeClusterV2 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeClusterV2 x -> DescribeClusterV2
$cfrom :: forall x. DescribeClusterV2 -> Rep DescribeClusterV2 x
Prelude.Generic)

-- |
-- Create a value of 'DescribeClusterV2' 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:
--
-- 'clusterArn', 'describeClusterV2_clusterArn' - The Amazon Resource Name (ARN) that uniquely identifies the cluster.
newDescribeClusterV2 ::
  -- | 'clusterArn'
  Prelude.Text ->
  DescribeClusterV2
newDescribeClusterV2 :: Text -> DescribeClusterV2
newDescribeClusterV2 Text
pClusterArn_ =
  DescribeClusterV2' {$sel:clusterArn:DescribeClusterV2' :: Text
clusterArn = Text
pClusterArn_}

-- | The Amazon Resource Name (ARN) that uniquely identifies the cluster.
describeClusterV2_clusterArn :: Lens.Lens' DescribeClusterV2 Prelude.Text
describeClusterV2_clusterArn :: Lens' DescribeClusterV2 Text
describeClusterV2_clusterArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterV2' {Text
clusterArn :: Text
$sel:clusterArn:DescribeClusterV2' :: DescribeClusterV2 -> Text
clusterArn} -> Text
clusterArn) (\s :: DescribeClusterV2
s@DescribeClusterV2' {} Text
a -> DescribeClusterV2
s {$sel:clusterArn:DescribeClusterV2' :: Text
clusterArn = Text
a} :: DescribeClusterV2)

instance Core.AWSRequest DescribeClusterV2 where
  type
    AWSResponse DescribeClusterV2 =
      DescribeClusterV2Response
  request :: (Service -> Service)
-> DescribeClusterV2 -> Request DescribeClusterV2
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeClusterV2
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterV2)))
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 Cluster -> Int -> DescribeClusterV2Response
DescribeClusterV2Response'
            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
"clusterInfo")
            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 DescribeClusterV2 where
  hashWithSalt :: Int -> DescribeClusterV2 -> Int
hashWithSalt Int
_salt DescribeClusterV2' {Text
clusterArn :: Text
$sel:clusterArn:DescribeClusterV2' :: DescribeClusterV2 -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterArn

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

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

instance Data.ToPath DescribeClusterV2 where
  toPath :: DescribeClusterV2 -> ByteString
toPath DescribeClusterV2' {Text
clusterArn :: Text
$sel:clusterArn:DescribeClusterV2' :: DescribeClusterV2 -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/api/v2/clusters/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterArn]

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

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

-- |
-- Create a value of 'DescribeClusterV2Response' 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:
--
-- 'clusterInfo', 'describeClusterV2Response_clusterInfo' - The cluster information.
--
-- 'httpStatus', 'describeClusterV2Response_httpStatus' - The response's http status code.
newDescribeClusterV2Response ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeClusterV2Response
newDescribeClusterV2Response :: Int -> DescribeClusterV2Response
newDescribeClusterV2Response Int
pHttpStatus_ =
  DescribeClusterV2Response'
    { $sel:clusterInfo:DescribeClusterV2Response' :: Maybe Cluster
clusterInfo =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeClusterV2Response' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The cluster information.
describeClusterV2Response_clusterInfo :: Lens.Lens' DescribeClusterV2Response (Prelude.Maybe Cluster)
describeClusterV2Response_clusterInfo :: Lens' DescribeClusterV2Response (Maybe Cluster)
describeClusterV2Response_clusterInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterV2Response' {Maybe Cluster
clusterInfo :: Maybe Cluster
$sel:clusterInfo:DescribeClusterV2Response' :: DescribeClusterV2Response -> Maybe Cluster
clusterInfo} -> Maybe Cluster
clusterInfo) (\s :: DescribeClusterV2Response
s@DescribeClusterV2Response' {} Maybe Cluster
a -> DescribeClusterV2Response
s {$sel:clusterInfo:DescribeClusterV2Response' :: Maybe Cluster
clusterInfo = Maybe Cluster
a} :: DescribeClusterV2Response)

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

instance Prelude.NFData DescribeClusterV2Response where
  rnf :: DescribeClusterV2Response -> ()
rnf DescribeClusterV2Response' {Int
Maybe Cluster
httpStatus :: Int
clusterInfo :: Maybe Cluster
$sel:httpStatus:DescribeClusterV2Response' :: DescribeClusterV2Response -> Int
$sel:clusterInfo:DescribeClusterV2Response' :: DescribeClusterV2Response -> Maybe Cluster
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Cluster
clusterInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus