{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMRContainers.Types
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
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]
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
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. 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'
    { $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 :: Lens' DescribeManagedEndpoint Text
describeManagedEndpoint_id = 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 :: Lens' DescribeManagedEndpoint Text
describeManagedEndpoint_virtualClusterId = 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 :: (Service -> Service)
-> DescribeManagedEndpoint -> Request DescribeManagedEndpoint
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 DescribeManagedEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeManagedEndpoint)))
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 Endpoint -> Int -> DescribeManagedEndpointResponse
DescribeManagedEndpointResponse'
            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
"endpoint")
            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 DescribeManagedEndpoint where
  hashWithSalt :: Int -> DescribeManagedEndpoint -> Int
hashWithSalt Int
_salt DescribeManagedEndpoint' {Text
virtualClusterId :: Text
id :: Text
$sel:virtualClusterId:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
$sel:id:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualClusterId

instance Prelude.NFData DescribeManagedEndpoint where
  rnf :: DescribeManagedEndpoint -> ()
rnf DescribeManagedEndpoint' {Text
virtualClusterId :: Text
id :: Text
$sel:virtualClusterId:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
$sel:id:DescribeManagedEndpoint' :: DescribeManagedEndpoint -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
virtualClusterId

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

instance Data.ToQuery DescribeManagedEndpoint where
  toQuery :: DescribeManagedEndpoint -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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.
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'
    { $sel:endpoint:DescribeManagedEndpointResponse' :: Maybe Endpoint
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 :: Lens' DescribeManagedEndpointResponse (Maybe Endpoint)
describeManagedEndpointResponse_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 :: Lens' DescribeManagedEndpointResponse Int
describeManagedEndpointResponse_httpStatus = 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
  where
  rnf :: DescribeManagedEndpointResponse -> ()
rnf DescribeManagedEndpointResponse' {Int
Maybe Endpoint
httpStatus :: Int
endpoint :: Maybe Endpoint
$sel:httpStatus:DescribeManagedEndpointResponse' :: DescribeManagedEndpointResponse -> Int
$sel:endpoint:DescribeManagedEndpointResponse' :: DescribeManagedEndpointResponse -> Maybe Endpoint
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Endpoint
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus