{-# 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-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)
--
-- 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 Amazonka.Kafka.Types
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:/ '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
(DescribeClusterOperation -> DescribeClusterOperation -> Bool)
-> (DescribeClusterOperation -> DescribeClusterOperation -> Bool)
-> Eq DescribeClusterOperation
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]
(Int -> ReadS DescribeClusterOperation)
-> ReadS [DescribeClusterOperation]
-> ReadPrec DescribeClusterOperation
-> ReadPrec [DescribeClusterOperation]
-> Read 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
(Int -> DescribeClusterOperation -> ShowS)
-> (DescribeClusterOperation -> String)
-> ([DescribeClusterOperation] -> ShowS)
-> Show DescribeClusterOperation
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.
 DescribeClusterOperation -> Rep DescribeClusterOperation x)
-> (forall x.
    Rep DescribeClusterOperation x -> DescribeClusterOperation)
-> Generic DescribeClusterOperation
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' :: Text -> DescribeClusterOperation
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 :: (Text -> f Text)
-> DescribeClusterOperation -> f DescribeClusterOperation
describeClusterOperation_clusterOperationArn = (DescribeClusterOperation -> Text)
-> (DescribeClusterOperation -> Text -> DescribeClusterOperation)
-> Lens DescribeClusterOperation DescribeClusterOperation Text Text
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 :: DescribeClusterOperation -> Request DescribeClusterOperation
request = Service
-> DescribeClusterOperation -> Request DescribeClusterOperation
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeClusterOperation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterOperation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeClusterOperation))
-> Logger
-> Service
-> Proxy DescribeClusterOperation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterOperation)))
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 ClusterOperationInfo
-> Int -> DescribeClusterOperationResponse
DescribeClusterOperationResponse'
            (Maybe ClusterOperationInfo
 -> Int -> DescribeClusterOperationResponse)
-> Either String (Maybe ClusterOperationInfo)
-> Either String (Int -> DescribeClusterOperationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ClusterOperationInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clusterOperationInfo")
            Either String (Int -> DescribeClusterOperationResponse)
-> Either String Int
-> Either String DescribeClusterOperationResponse
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 DescribeClusterOperation

instance Prelude.NFData DescribeClusterOperation

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

instance Core.ToQuery DescribeClusterOperation where
  toQuery :: DescribeClusterOperation -> QueryString
toQuery = QueryString -> DescribeClusterOperation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DescribeClusterOperationResponse
 -> DescribeClusterOperationResponse -> Bool)
-> (DescribeClusterOperationResponse
    -> DescribeClusterOperationResponse -> Bool)
-> Eq DescribeClusterOperationResponse
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]
(Int -> ReadS DescribeClusterOperationResponse)
-> ReadS [DescribeClusterOperationResponse]
-> ReadPrec DescribeClusterOperationResponse
-> ReadPrec [DescribeClusterOperationResponse]
-> Read 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
(Int -> DescribeClusterOperationResponse -> ShowS)
-> (DescribeClusterOperationResponse -> String)
-> ([DescribeClusterOperationResponse] -> ShowS)
-> Show DescribeClusterOperationResponse
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.
 DescribeClusterOperationResponse
 -> Rep DescribeClusterOperationResponse x)
-> (forall x.
    Rep DescribeClusterOperationResponse x
    -> DescribeClusterOperationResponse)
-> Generic DescribeClusterOperationResponse
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' :: Maybe ClusterOperationInfo
-> Int -> DescribeClusterOperationResponse
DescribeClusterOperationResponse'
    { $sel:clusterOperationInfo:DescribeClusterOperationResponse' :: Maybe ClusterOperationInfo
clusterOperationInfo =
        Maybe 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 :: (Maybe ClusterOperationInfo -> f (Maybe ClusterOperationInfo))
-> DescribeClusterOperationResponse
-> f DescribeClusterOperationResponse
describeClusterOperationResponse_clusterOperationInfo = (DescribeClusterOperationResponse -> Maybe ClusterOperationInfo)
-> (DescribeClusterOperationResponse
    -> Maybe ClusterOperationInfo -> DescribeClusterOperationResponse)
-> Lens
     DescribeClusterOperationResponse
     DescribeClusterOperationResponse
     (Maybe ClusterOperationInfo)
     (Maybe 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 :: (Int -> f Int)
-> DescribeClusterOperationResponse
-> f DescribeClusterOperationResponse
describeClusterOperationResponse_httpStatus = (DescribeClusterOperationResponse -> Int)
-> (DescribeClusterOperationResponse
    -> Int -> DescribeClusterOperationResponse)
-> Lens
     DescribeClusterOperationResponse
     DescribeClusterOperationResponse
     Int
     Int
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