{-# 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.DescribeManagedEndpoint
-- 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 managed endpoint. A managed
-- endpoint is a gateway that connects EMR Studio to Amazon EMR on EKS so
-- that EMR Studio can communicate with your virtual cluster.
module Amazonka.EMRContainers.DescribeManagedEndpoint
  ( -- * Creating a Request
    DescribeManagedEndpoint (..),
    newDescribeManagedEndpoint,

    -- * Request Lenses
    describeManagedEndpoint_id,
    describeManagedEndpoint_virtualClusterId,

    -- * Destructuring the Response
    DescribeManagedEndpointResponse (..),
    newDescribeManagedEndpointResponse,

    -- * Response Lenses
    describeManagedEndpointResponse_endpoint,
    describeManagedEndpointResponse_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:/ 'newDescribeManagedEndpoint' smart constructor.
data DescribeManagedEndpoint = DescribeManagedEndpoint'
  { -- | This output displays ID of the managed endpoint.
    DescribeManagedEndpoint -> Text
id :: Prelude.Text,
    -- | The ID of the endpoint\'s virtual cluster.
    DescribeManagedEndpoint -> Text
virtualClusterId :: Prelude.Text
  }
  deriving (DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool
(DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool)
-> (DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool)
-> Eq DescribeManagedEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool
$c/= :: DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool
== :: DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool
$c== :: DescribeManagedEndpoint -> DescribeManagedEndpoint -> Bool
Prelude.Eq, ReadPrec [DescribeManagedEndpoint]
ReadPrec DescribeManagedEndpoint
Int -> ReadS DescribeManagedEndpoint
ReadS [DescribeManagedEndpoint]
(Int -> ReadS DescribeManagedEndpoint)
-> ReadS [DescribeManagedEndpoint]
-> ReadPrec DescribeManagedEndpoint
-> ReadPrec [DescribeManagedEndpoint]
-> Read DescribeManagedEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeManagedEndpoint]
$creadListPrec :: ReadPrec [DescribeManagedEndpoint]
readPrec :: ReadPrec DescribeManagedEndpoint
$creadPrec :: ReadPrec DescribeManagedEndpoint
readList :: ReadS [DescribeManagedEndpoint]
$creadList :: ReadS [DescribeManagedEndpoint]
readsPrec :: Int -> ReadS DescribeManagedEndpoint
$creadsPrec :: Int -> ReadS DescribeManagedEndpoint
Prelude.Read, Int -> DescribeManagedEndpoint -> ShowS
[DescribeManagedEndpoint] -> ShowS
DescribeManagedEndpoint -> String
(Int -> DescribeManagedEndpoint -> ShowS)
-> (DescribeManagedEndpoint -> String)
-> ([DescribeManagedEndpoint] -> ShowS)
-> Show DescribeManagedEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeManagedEndpoint] -> ShowS
$cshowList :: [DescribeManagedEndpoint] -> ShowS
show :: DescribeManagedEndpoint -> String
$cshow :: DescribeManagedEndpoint -> String
showsPrec :: Int -> DescribeManagedEndpoint -> ShowS
$cshowsPrec :: Int -> DescribeManagedEndpoint -> ShowS
Prelude.Show, (forall x.
 DescribeManagedEndpoint -> Rep DescribeManagedEndpoint x)
-> (forall x.
    Rep DescribeManagedEndpoint x -> DescribeManagedEndpoint)
-> Generic DescribeManagedEndpoint
forall x. Rep DescribeManagedEndpoint x -> DescribeManagedEndpoint
forall x. DescribeManagedEndpoint -> Rep DescribeManagedEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeManagedEndpoint x -> DescribeManagedEndpoint
$cfrom :: forall x. DescribeManagedEndpoint -> Rep DescribeManagedEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'DescribeManagedEndpoint' 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', 'describeManagedEndpoint_id' - This output displays ID of the managed endpoint.
--
-- 'virtualClusterId', 'describeManagedEndpoint_virtualClusterId' - The ID of the endpoint\'s virtual cluster.
newDescribeManagedEndpoint ::
  -- | 'id'
  Prelude.Text ->
  -- | 'virtualClusterId'
  Prelude.Text ->
  DescribeManagedEndpoint
newDescribeManagedEndpoint :: Text -> Text -> DescribeManagedEndpoint
newDescribeManagedEndpoint Text
pId_ Text
pVirtualClusterId_ =
  DescribeManagedEndpoint' :: Text -> Text -> DescribeManagedEndpoint
DescribeManagedEndpoint'
    { $sel:id:DescribeManagedEndpoint' :: Text
id = Text
pId_,
      $sel:virtualClusterId:DescribeManagedEndpoint' :: Text
virtualClusterId = Text
pVirtualClusterId_
    }

-- | This output displays ID of the managed endpoint.
describeManagedEndpoint_id :: Lens.Lens' DescribeManagedEndpoint Prelude.Text
describeManagedEndpoint_id :: (Text -> f Text)
-> DescribeManagedEndpoint -> f DescribeManagedEndpoint
describeManagedEndpoint_id = (DescribeManagedEndpoint -> Text)
-> (DescribeManagedEndpoint -> Text -> DescribeManagedEndpoint)
-> Lens DescribeManagedEndpoint DescribeManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedEndpoint' {Text
id :: Text
$sel:id:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
id} -> Text
id) (\s :: DescribeManagedEndpoint
s@DescribeManagedEndpoint' {} Text
a -> DescribeManagedEndpoint
s {$sel:id:DescribeManagedEndpoint' :: Text
id = Text
a} :: DescribeManagedEndpoint)

-- | The ID of the endpoint\'s virtual cluster.
describeManagedEndpoint_virtualClusterId :: Lens.Lens' DescribeManagedEndpoint Prelude.Text
describeManagedEndpoint_virtualClusterId :: (Text -> f Text)
-> DescribeManagedEndpoint -> f DescribeManagedEndpoint
describeManagedEndpoint_virtualClusterId = (DescribeManagedEndpoint -> Text)
-> (DescribeManagedEndpoint -> Text -> DescribeManagedEndpoint)
-> Lens DescribeManagedEndpoint DescribeManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedEndpoint' {Text
virtualClusterId :: Text
$sel:virtualClusterId:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: DescribeManagedEndpoint
s@DescribeManagedEndpoint' {} Text
a -> DescribeManagedEndpoint
s {$sel:virtualClusterId:DescribeManagedEndpoint' :: Text
virtualClusterId = Text
a} :: DescribeManagedEndpoint)

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

instance Prelude.NFData DescribeManagedEndpoint

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

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

-- | /See:/ 'newDescribeManagedEndpointResponse' smart constructor.
data DescribeManagedEndpointResponse = DescribeManagedEndpointResponse'
  { -- | This output displays information about a managed endpoint.
    DescribeManagedEndpointResponse -> Maybe Endpoint
endpoint :: Prelude.Maybe Endpoint,
    -- | The response's http status code.
    DescribeManagedEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeManagedEndpointResponse
-> DescribeManagedEndpointResponse -> Bool
(DescribeManagedEndpointResponse
 -> DescribeManagedEndpointResponse -> Bool)
-> (DescribeManagedEndpointResponse
    -> DescribeManagedEndpointResponse -> Bool)
-> Eq DescribeManagedEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeManagedEndpointResponse
-> DescribeManagedEndpointResponse -> Bool
$c/= :: DescribeManagedEndpointResponse
-> DescribeManagedEndpointResponse -> Bool
== :: DescribeManagedEndpointResponse
-> DescribeManagedEndpointResponse -> Bool
$c== :: DescribeManagedEndpointResponse
-> DescribeManagedEndpointResponse -> Bool
Prelude.Eq, Int -> DescribeManagedEndpointResponse -> ShowS
[DescribeManagedEndpointResponse] -> ShowS
DescribeManagedEndpointResponse -> String
(Int -> DescribeManagedEndpointResponse -> ShowS)
-> (DescribeManagedEndpointResponse -> String)
-> ([DescribeManagedEndpointResponse] -> ShowS)
-> Show DescribeManagedEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeManagedEndpointResponse] -> ShowS
$cshowList :: [DescribeManagedEndpointResponse] -> ShowS
show :: DescribeManagedEndpointResponse -> String
$cshow :: DescribeManagedEndpointResponse -> String
showsPrec :: Int -> DescribeManagedEndpointResponse -> ShowS
$cshowsPrec :: Int -> DescribeManagedEndpointResponse -> ShowS
Prelude.Show, (forall x.
 DescribeManagedEndpointResponse
 -> Rep DescribeManagedEndpointResponse x)
-> (forall x.
    Rep DescribeManagedEndpointResponse x
    -> DescribeManagedEndpointResponse)
-> Generic DescribeManagedEndpointResponse
forall x.
Rep DescribeManagedEndpointResponse x
-> DescribeManagedEndpointResponse
forall x.
DescribeManagedEndpointResponse
-> Rep DescribeManagedEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeManagedEndpointResponse x
-> DescribeManagedEndpointResponse
$cfrom :: forall x.
DescribeManagedEndpointResponse
-> Rep DescribeManagedEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeManagedEndpointResponse' 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:
--
-- 'endpoint', 'describeManagedEndpointResponse_endpoint' - This output displays information about a managed endpoint.
--
-- 'httpStatus', 'describeManagedEndpointResponse_httpStatus' - The response's http status code.
newDescribeManagedEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeManagedEndpointResponse
newDescribeManagedEndpointResponse :: Int -> DescribeManagedEndpointResponse
newDescribeManagedEndpointResponse Int
pHttpStatus_ =
  DescribeManagedEndpointResponse' :: Maybe Endpoint -> Int -> DescribeManagedEndpointResponse
DescribeManagedEndpointResponse'
    { $sel:endpoint:DescribeManagedEndpointResponse' :: Maybe Endpoint
endpoint =
        Maybe Endpoint
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeManagedEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output displays information about a managed endpoint.
describeManagedEndpointResponse_endpoint :: Lens.Lens' DescribeManagedEndpointResponse (Prelude.Maybe Endpoint)
describeManagedEndpointResponse_endpoint :: (Maybe Endpoint -> f (Maybe Endpoint))
-> DescribeManagedEndpointResponse
-> f DescribeManagedEndpointResponse
describeManagedEndpointResponse_endpoint = (DescribeManagedEndpointResponse -> Maybe Endpoint)
-> (DescribeManagedEndpointResponse
    -> Maybe Endpoint -> DescribeManagedEndpointResponse)
-> Lens
     DescribeManagedEndpointResponse
     DescribeManagedEndpointResponse
     (Maybe Endpoint)
     (Maybe Endpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedEndpointResponse' {Maybe Endpoint
endpoint :: Maybe Endpoint
$sel:endpoint:DescribeManagedEndpointResponse' :: DescribeManagedEndpointResponse -> Maybe Endpoint
endpoint} -> Maybe Endpoint
endpoint) (\s :: DescribeManagedEndpointResponse
s@DescribeManagedEndpointResponse' {} Maybe Endpoint
a -> DescribeManagedEndpointResponse
s {$sel:endpoint:DescribeManagedEndpointResponse' :: Maybe Endpoint
endpoint = Maybe Endpoint
a} :: DescribeManagedEndpointResponse)

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

instance
  Prelude.NFData
    DescribeManagedEndpointResponse