{-# 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.EMRContainers.DescribeVirtualCluster
-- 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 detailed information about a specified virtual cluster. Virtual
-- cluster is a managed entity on Amazon EMR on EKS. You can create,
-- describe, list and delete virtual clusters. They do not consume any
-- additional resource in your system. A single virtual cluster maps to a
-- single Kubernetes namespace. Given this relationship, you can model
-- virtual clusters the same way you model Kubernetes namespaces to meet
-- your requirements.
module Amazonka.EMRContainers.DescribeVirtualCluster
  ( -- * Creating a Request
    DescribeVirtualCluster (..),
    newDescribeVirtualCluster,

    -- * Request Lenses
    describeVirtualCluster_id,

    -- * Destructuring the Response
    DescribeVirtualClusterResponse (..),
    newDescribeVirtualClusterResponse,

    -- * Response Lenses
    describeVirtualClusterResponse_virtualCluster,
    describeVirtualClusterResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.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:/ 'newDescribeVirtualCluster' smart constructor.
data DescribeVirtualCluster = DescribeVirtualCluster'
  { -- | The ID of the virtual cluster that will be described.
    DescribeVirtualCluster -> Text
id :: Prelude.Text
  }
  deriving (DescribeVirtualCluster -> DescribeVirtualCluster -> Bool
(DescribeVirtualCluster -> DescribeVirtualCluster -> Bool)
-> (DescribeVirtualCluster -> DescribeVirtualCluster -> Bool)
-> Eq DescribeVirtualCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeVirtualCluster -> DescribeVirtualCluster -> Bool
$c/= :: DescribeVirtualCluster -> DescribeVirtualCluster -> Bool
== :: DescribeVirtualCluster -> DescribeVirtualCluster -> Bool
$c== :: DescribeVirtualCluster -> DescribeVirtualCluster -> Bool
Prelude.Eq, ReadPrec [DescribeVirtualCluster]
ReadPrec DescribeVirtualCluster
Int -> ReadS DescribeVirtualCluster
ReadS [DescribeVirtualCluster]
(Int -> ReadS DescribeVirtualCluster)
-> ReadS [DescribeVirtualCluster]
-> ReadPrec DescribeVirtualCluster
-> ReadPrec [DescribeVirtualCluster]
-> Read DescribeVirtualCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeVirtualCluster]
$creadListPrec :: ReadPrec [DescribeVirtualCluster]
readPrec :: ReadPrec DescribeVirtualCluster
$creadPrec :: ReadPrec DescribeVirtualCluster
readList :: ReadS [DescribeVirtualCluster]
$creadList :: ReadS [DescribeVirtualCluster]
readsPrec :: Int -> ReadS DescribeVirtualCluster
$creadsPrec :: Int -> ReadS DescribeVirtualCluster
Prelude.Read, Int -> DescribeVirtualCluster -> ShowS
[DescribeVirtualCluster] -> ShowS
DescribeVirtualCluster -> String
(Int -> DescribeVirtualCluster -> ShowS)
-> (DescribeVirtualCluster -> String)
-> ([DescribeVirtualCluster] -> ShowS)
-> Show DescribeVirtualCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeVirtualCluster] -> ShowS
$cshowList :: [DescribeVirtualCluster] -> ShowS
show :: DescribeVirtualCluster -> String
$cshow :: DescribeVirtualCluster -> String
showsPrec :: Int -> DescribeVirtualCluster -> ShowS
$cshowsPrec :: Int -> DescribeVirtualCluster -> ShowS
Prelude.Show, (forall x. DescribeVirtualCluster -> Rep DescribeVirtualCluster x)
-> (forall x.
    Rep DescribeVirtualCluster x -> DescribeVirtualCluster)
-> Generic DescribeVirtualCluster
forall x. Rep DescribeVirtualCluster x -> DescribeVirtualCluster
forall x. DescribeVirtualCluster -> Rep DescribeVirtualCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeVirtualCluster x -> DescribeVirtualCluster
$cfrom :: forall x. DescribeVirtualCluster -> Rep DescribeVirtualCluster x
Prelude.Generic)

-- |
-- Create a value of 'DescribeVirtualCluster' 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:
--
-- 'id', 'describeVirtualCluster_id' - The ID of the virtual cluster that will be described.
newDescribeVirtualCluster ::
  -- | 'id'
  Prelude.Text ->
  DescribeVirtualCluster
newDescribeVirtualCluster :: Text -> DescribeVirtualCluster
newDescribeVirtualCluster Text
pId_ =
  DescribeVirtualCluster' :: Text -> DescribeVirtualCluster
DescribeVirtualCluster' {$sel:id:DescribeVirtualCluster' :: Text
id = Text
pId_}

-- | The ID of the virtual cluster that will be described.
describeVirtualCluster_id :: Lens.Lens' DescribeVirtualCluster Prelude.Text
describeVirtualCluster_id :: (Text -> f Text)
-> DescribeVirtualCluster -> f DescribeVirtualCluster
describeVirtualCluster_id = (DescribeVirtualCluster -> Text)
-> (DescribeVirtualCluster -> Text -> DescribeVirtualCluster)
-> Lens DescribeVirtualCluster DescribeVirtualCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVirtualCluster' {Text
id :: Text
$sel:id:DescribeVirtualCluster' :: DescribeVirtualCluster -> Text
id} -> Text
id) (\s :: DescribeVirtualCluster
s@DescribeVirtualCluster' {} Text
a -> DescribeVirtualCluster
s {$sel:id:DescribeVirtualCluster' :: Text
id = Text
a} :: DescribeVirtualCluster)

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

instance Prelude.NFData DescribeVirtualCluster

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

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

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

-- |
-- Create a value of 'DescribeVirtualClusterResponse' 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:
--
-- 'virtualCluster', 'describeVirtualClusterResponse_virtualCluster' - This output displays information about the specified virtual cluster.
--
-- 'httpStatus', 'describeVirtualClusterResponse_httpStatus' - The response's http status code.
newDescribeVirtualClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeVirtualClusterResponse
newDescribeVirtualClusterResponse :: Int -> DescribeVirtualClusterResponse
newDescribeVirtualClusterResponse Int
pHttpStatus_ =
  DescribeVirtualClusterResponse' :: Maybe VirtualCluster -> Int -> DescribeVirtualClusterResponse
DescribeVirtualClusterResponse'
    { $sel:virtualCluster:DescribeVirtualClusterResponse' :: Maybe VirtualCluster
virtualCluster =
        Maybe VirtualCluster
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeVirtualClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output displays information about the specified virtual cluster.
describeVirtualClusterResponse_virtualCluster :: Lens.Lens' DescribeVirtualClusterResponse (Prelude.Maybe VirtualCluster)
describeVirtualClusterResponse_virtualCluster :: (Maybe VirtualCluster -> f (Maybe VirtualCluster))
-> DescribeVirtualClusterResponse
-> f DescribeVirtualClusterResponse
describeVirtualClusterResponse_virtualCluster = (DescribeVirtualClusterResponse -> Maybe VirtualCluster)
-> (DescribeVirtualClusterResponse
    -> Maybe VirtualCluster -> DescribeVirtualClusterResponse)
-> Lens
     DescribeVirtualClusterResponse
     DescribeVirtualClusterResponse
     (Maybe VirtualCluster)
     (Maybe VirtualCluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVirtualClusterResponse' {Maybe VirtualCluster
virtualCluster :: Maybe VirtualCluster
$sel:virtualCluster:DescribeVirtualClusterResponse' :: DescribeVirtualClusterResponse -> Maybe VirtualCluster
virtualCluster} -> Maybe VirtualCluster
virtualCluster) (\s :: DescribeVirtualClusterResponse
s@DescribeVirtualClusterResponse' {} Maybe VirtualCluster
a -> DescribeVirtualClusterResponse
s {$sel:virtualCluster:DescribeVirtualClusterResponse' :: Maybe VirtualCluster
virtualCluster = Maybe VirtualCluster
a} :: DescribeVirtualClusterResponse)

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

instance
  Prelude.NFData
    DescribeVirtualClusterResponse