{-# 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.DescribeClusterOperation
-- 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 cluster operation specified by the ARN.
module Amazonka.Kafka.DescribeClusterOperation
  ( -- * Creating a Request
    DescribeClusterOperation (..),
    newDescribeClusterOperation,

    -- * Request Lenses
    describeClusterOperation_clusterOperationArn,

    -- * Destructuring the Response
    DescribeClusterOperationResponse (..),
    newDescribeClusterOperationResponse,

    -- * Response Lenses
    describeClusterOperationResponse_clusterOperationInfo,
    describeClusterOperationResponse_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:/ 'newDescribeClusterOperation' smart constructor.
data DescribeClusterOperation = DescribeClusterOperation'
  { -- | The Amazon Resource Name (ARN) that uniquely identifies the MSK cluster
    -- operation.
    DescribeClusterOperation -> Text
clusterOperationArn :: Prelude.Text
  }
  deriving (DescribeClusterOperation -> DescribeClusterOperation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeClusterOperation -> DescribeClusterOperation -> Bool
$c/= :: DescribeClusterOperation -> DescribeClusterOperation -> Bool
== :: DescribeClusterOperation -> DescribeClusterOperation -> Bool
$c== :: DescribeClusterOperation -> DescribeClusterOperation -> Bool
Prelude.Eq, ReadPrec [DescribeClusterOperation]
ReadPrec DescribeClusterOperation
Int -> ReadS DescribeClusterOperation
ReadS [DescribeClusterOperation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeClusterOperation]
$creadListPrec :: ReadPrec [DescribeClusterOperation]
readPrec :: ReadPrec DescribeClusterOperation
$creadPrec :: ReadPrec DescribeClusterOperation
readList :: ReadS [DescribeClusterOperation]
$creadList :: ReadS [DescribeClusterOperation]
readsPrec :: Int -> ReadS DescribeClusterOperation
$creadsPrec :: Int -> ReadS DescribeClusterOperation
Prelude.Read, Int -> DescribeClusterOperation -> ShowS
[DescribeClusterOperation] -> ShowS
DescribeClusterOperation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeClusterOperation] -> ShowS
$cshowList :: [DescribeClusterOperation] -> ShowS
show :: DescribeClusterOperation -> String
$cshow :: DescribeClusterOperation -> String
showsPrec :: Int -> DescribeClusterOperation -> ShowS
$cshowsPrec :: Int -> DescribeClusterOperation -> ShowS
Prelude.Show, forall x.
Rep DescribeClusterOperation x -> DescribeClusterOperation
forall x.
DescribeClusterOperation -> Rep DescribeClusterOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeClusterOperation x -> DescribeClusterOperation
$cfrom :: forall x.
DescribeClusterOperation -> Rep DescribeClusterOperation x
Prelude.Generic)

-- |
-- Create a value of 'DescribeClusterOperation' 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:
--
-- 'clusterOperationArn', 'describeClusterOperation_clusterOperationArn' - The Amazon Resource Name (ARN) that uniquely identifies the MSK cluster
-- operation.
newDescribeClusterOperation ::
  -- | 'clusterOperationArn'
  Prelude.Text ->
  DescribeClusterOperation
newDescribeClusterOperation :: Text -> DescribeClusterOperation
newDescribeClusterOperation Text
pClusterOperationArn_ =
  DescribeClusterOperation'
    { $sel:clusterOperationArn:DescribeClusterOperation' :: Text
clusterOperationArn =
        Text
pClusterOperationArn_
    }

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

instance Core.AWSRequest DescribeClusterOperation where
  type
    AWSResponse DescribeClusterOperation =
      DescribeClusterOperationResponse
  request :: (Service -> Service)
-> DescribeClusterOperation -> Request DescribeClusterOperation
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 DescribeClusterOperation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterOperation)))
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 ClusterOperationInfo
-> Int -> DescribeClusterOperationResponse
DescribeClusterOperationResponse'
            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
"clusterOperationInfo")
            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 DescribeClusterOperation where
  hashWithSalt :: Int -> DescribeClusterOperation -> Int
hashWithSalt Int
_salt DescribeClusterOperation' {Text
clusterOperationArn :: Text
$sel:clusterOperationArn:DescribeClusterOperation' :: DescribeClusterOperation -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterOperationArn

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

instance Data.ToHeaders DescribeClusterOperation where
  toHeaders :: DescribeClusterOperation -> 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 DescribeClusterOperation where
  toPath :: DescribeClusterOperation -> ByteString
toPath DescribeClusterOperation' {Text
clusterOperationArn :: Text
$sel:clusterOperationArn:DescribeClusterOperation' :: DescribeClusterOperation -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/operations/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterOperationArn]

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

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

-- |
-- Create a value of 'DescribeClusterOperationResponse' 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:
--
-- 'clusterOperationInfo', 'describeClusterOperationResponse_clusterOperationInfo' - Cluster operation information
--
-- 'httpStatus', 'describeClusterOperationResponse_httpStatus' - The response's http status code.
newDescribeClusterOperationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeClusterOperationResponse
newDescribeClusterOperationResponse :: Int -> DescribeClusterOperationResponse
newDescribeClusterOperationResponse Int
pHttpStatus_ =
  DescribeClusterOperationResponse'
    { $sel:clusterOperationInfo:DescribeClusterOperationResponse' :: Maybe ClusterOperationInfo
clusterOperationInfo =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeClusterOperationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Cluster operation information
describeClusterOperationResponse_clusterOperationInfo :: Lens.Lens' DescribeClusterOperationResponse (Prelude.Maybe ClusterOperationInfo)
describeClusterOperationResponse_clusterOperationInfo :: Lens' DescribeClusterOperationResponse (Maybe ClusterOperationInfo)
describeClusterOperationResponse_clusterOperationInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterOperationResponse' {Maybe ClusterOperationInfo
clusterOperationInfo :: Maybe ClusterOperationInfo
$sel:clusterOperationInfo:DescribeClusterOperationResponse' :: DescribeClusterOperationResponse -> Maybe ClusterOperationInfo
clusterOperationInfo} -> Maybe ClusterOperationInfo
clusterOperationInfo) (\s :: DescribeClusterOperationResponse
s@DescribeClusterOperationResponse' {} Maybe ClusterOperationInfo
a -> DescribeClusterOperationResponse
s {$sel:clusterOperationInfo:DescribeClusterOperationResponse' :: Maybe ClusterOperationInfo
clusterOperationInfo = Maybe ClusterOperationInfo
a} :: DescribeClusterOperationResponse)

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

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