{-# 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.Glue.GetDevEndpoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about a specified development endpoint.
--
-- When you create a development endpoint in a virtual private cloud (VPC),
-- Glue returns only a private IP address, and the public IP address field
-- is not populated. When you create a non-VPC development endpoint, Glue
-- returns only a public IP address.
module Amazonka.Glue.GetDevEndpoint
  ( -- * Creating a Request
    GetDevEndpoint (..),
    newGetDevEndpoint,

    -- * Request Lenses
    getDevEndpoint_endpointName,

    -- * Destructuring the Response
    GetDevEndpointResponse (..),
    newGetDevEndpointResponse,

    -- * Response Lenses
    getDevEndpointResponse_devEndpoint,
    getDevEndpointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetDevEndpoint' smart constructor.
data GetDevEndpoint = GetDevEndpoint'
  { -- | Name of the @DevEndpoint@ to retrieve information for.
    GetDevEndpoint -> Text
endpointName :: Prelude.Text
  }
  deriving (GetDevEndpoint -> GetDevEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevEndpoint -> GetDevEndpoint -> Bool
$c/= :: GetDevEndpoint -> GetDevEndpoint -> Bool
== :: GetDevEndpoint -> GetDevEndpoint -> Bool
$c== :: GetDevEndpoint -> GetDevEndpoint -> Bool
Prelude.Eq, ReadPrec [GetDevEndpoint]
ReadPrec GetDevEndpoint
Int -> ReadS GetDevEndpoint
ReadS [GetDevEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDevEndpoint]
$creadListPrec :: ReadPrec [GetDevEndpoint]
readPrec :: ReadPrec GetDevEndpoint
$creadPrec :: ReadPrec GetDevEndpoint
readList :: ReadS [GetDevEndpoint]
$creadList :: ReadS [GetDevEndpoint]
readsPrec :: Int -> ReadS GetDevEndpoint
$creadsPrec :: Int -> ReadS GetDevEndpoint
Prelude.Read, Int -> GetDevEndpoint -> ShowS
[GetDevEndpoint] -> ShowS
GetDevEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevEndpoint] -> ShowS
$cshowList :: [GetDevEndpoint] -> ShowS
show :: GetDevEndpoint -> String
$cshow :: GetDevEndpoint -> String
showsPrec :: Int -> GetDevEndpoint -> ShowS
$cshowsPrec :: Int -> GetDevEndpoint -> ShowS
Prelude.Show, forall x. Rep GetDevEndpoint x -> GetDevEndpoint
forall x. GetDevEndpoint -> Rep GetDevEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevEndpoint x -> GetDevEndpoint
$cfrom :: forall x. GetDevEndpoint -> Rep GetDevEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'GetDevEndpoint' 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:
--
-- 'endpointName', 'getDevEndpoint_endpointName' - Name of the @DevEndpoint@ to retrieve information for.
newGetDevEndpoint ::
  -- | 'endpointName'
  Prelude.Text ->
  GetDevEndpoint
newGetDevEndpoint :: Text -> GetDevEndpoint
newGetDevEndpoint Text
pEndpointName_ =
  GetDevEndpoint' {$sel:endpointName:GetDevEndpoint' :: Text
endpointName = Text
pEndpointName_}

-- | Name of the @DevEndpoint@ to retrieve information for.
getDevEndpoint_endpointName :: Lens.Lens' GetDevEndpoint Prelude.Text
getDevEndpoint_endpointName :: Lens' GetDevEndpoint Text
getDevEndpoint_endpointName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevEndpoint' {Text
endpointName :: Text
$sel:endpointName:GetDevEndpoint' :: GetDevEndpoint -> Text
endpointName} -> Text
endpointName) (\s :: GetDevEndpoint
s@GetDevEndpoint' {} Text
a -> GetDevEndpoint
s {$sel:endpointName:GetDevEndpoint' :: Text
endpointName = Text
a} :: GetDevEndpoint)

instance Core.AWSRequest GetDevEndpoint where
  type
    AWSResponse GetDevEndpoint =
      GetDevEndpointResponse
  request :: (Service -> Service) -> GetDevEndpoint -> Request GetDevEndpoint
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDevEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevEndpoint)))
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 DevEndpoint -> Int -> GetDevEndpointResponse
GetDevEndpointResponse'
            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
"DevEndpoint")
            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 GetDevEndpoint where
  hashWithSalt :: Int -> GetDevEndpoint -> Int
hashWithSalt Int
_salt GetDevEndpoint' {Text
endpointName :: Text
$sel:endpointName:GetDevEndpoint' :: GetDevEndpoint -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointName

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

instance Data.ToHeaders GetDevEndpoint where
  toHeaders :: GetDevEndpoint -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AWSGlue.GetDevEndpoint" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetDevEndpoint where
  toJSON :: GetDevEndpoint -> Value
toJSON GetDevEndpoint' {Text
endpointName :: Text
$sel:endpointName:GetDevEndpoint' :: GetDevEndpoint -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"EndpointName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointName)]
      )

instance Data.ToPath GetDevEndpoint where
  toPath :: GetDevEndpoint -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'GetDevEndpointResponse' 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:
--
-- 'devEndpoint', 'getDevEndpointResponse_devEndpoint' - A @DevEndpoint@ definition.
--
-- 'httpStatus', 'getDevEndpointResponse_httpStatus' - The response's http status code.
newGetDevEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDevEndpointResponse
newGetDevEndpointResponse :: Int -> GetDevEndpointResponse
newGetDevEndpointResponse Int
pHttpStatus_ =
  GetDevEndpointResponse'
    { $sel:devEndpoint:GetDevEndpointResponse' :: Maybe DevEndpoint
devEndpoint =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDevEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A @DevEndpoint@ definition.
getDevEndpointResponse_devEndpoint :: Lens.Lens' GetDevEndpointResponse (Prelude.Maybe DevEndpoint)
getDevEndpointResponse_devEndpoint :: Lens' GetDevEndpointResponse (Maybe DevEndpoint)
getDevEndpointResponse_devEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevEndpointResponse' {Maybe DevEndpoint
devEndpoint :: Maybe DevEndpoint
$sel:devEndpoint:GetDevEndpointResponse' :: GetDevEndpointResponse -> Maybe DevEndpoint
devEndpoint} -> Maybe DevEndpoint
devEndpoint) (\s :: GetDevEndpointResponse
s@GetDevEndpointResponse' {} Maybe DevEndpoint
a -> GetDevEndpointResponse
s {$sel:devEndpoint:GetDevEndpointResponse' :: Maybe DevEndpoint
devEndpoint = Maybe DevEndpoint
a} :: GetDevEndpointResponse)

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

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