{-# 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-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)
--
-- 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 Amazonka.Glue.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:/ 'newGetDevEndpoint' smart constructor.
data GetDevEndpoint = GetDevEndpoint'
  { -- | Name of the @DevEndpoint@ to retrieve information for.
    GetDevEndpoint -> Text
endpointName :: Prelude.Text
  }
  deriving (GetDevEndpoint -> GetDevEndpoint -> Bool
(GetDevEndpoint -> GetDevEndpoint -> Bool)
-> (GetDevEndpoint -> GetDevEndpoint -> Bool) -> Eq GetDevEndpoint
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]
(Int -> ReadS GetDevEndpoint)
-> ReadS [GetDevEndpoint]
-> ReadPrec GetDevEndpoint
-> ReadPrec [GetDevEndpoint]
-> Read 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
(Int -> GetDevEndpoint -> ShowS)
-> (GetDevEndpoint -> String)
-> ([GetDevEndpoint] -> ShowS)
-> Show GetDevEndpoint
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. GetDevEndpoint -> Rep GetDevEndpoint x)
-> (forall x. Rep GetDevEndpoint x -> GetDevEndpoint)
-> Generic GetDevEndpoint
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' :: Text -> GetDevEndpoint
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 :: (Text -> f Text) -> GetDevEndpoint -> f GetDevEndpoint
getDevEndpoint_endpointName = (GetDevEndpoint -> Text)
-> (GetDevEndpoint -> Text -> GetDevEndpoint)
-> Lens GetDevEndpoint GetDevEndpoint Text Text
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 :: GetDevEndpoint -> Request GetDevEndpoint
request = Service -> GetDevEndpoint -> Request GetDevEndpoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetDevEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevEndpoint)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetDevEndpoint))
-> Logger
-> Service
-> Proxy GetDevEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevEndpoint)))
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 DevEndpoint -> Int -> GetDevEndpointResponse
GetDevEndpointResponse'
            (Maybe DevEndpoint -> Int -> GetDevEndpointResponse)
-> Either String (Maybe DevEndpoint)
-> Either String (Int -> GetDevEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DevEndpoint)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DevEndpoint")
            Either String (Int -> GetDevEndpointResponse)
-> Either String Int -> Either String GetDevEndpointResponse
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 GetDevEndpoint

instance Prelude.NFData GetDevEndpoint

instance Core.ToHeaders GetDevEndpoint where
  toHeaders :: GetDevEndpoint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetDevEndpoint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSGlue.GetDevEndpoint" :: Prelude.ByteString),
            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.ToJSON GetDevEndpoint where
  toJSON :: GetDevEndpoint -> Value
toJSON GetDevEndpoint' {Text
endpointName :: Text
$sel:endpointName:GetDevEndpoint' :: GetDevEndpoint -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointName)]
      )

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

instance Core.ToQuery GetDevEndpoint where
  toQuery :: GetDevEndpoint -> QueryString
toQuery = QueryString -> GetDevEndpoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetDevEndpointResponse -> GetDevEndpointResponse -> Bool)
-> (GetDevEndpointResponse -> GetDevEndpointResponse -> Bool)
-> Eq GetDevEndpointResponse
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]
(Int -> ReadS GetDevEndpointResponse)
-> ReadS [GetDevEndpointResponse]
-> ReadPrec GetDevEndpointResponse
-> ReadPrec [GetDevEndpointResponse]
-> Read 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
(Int -> GetDevEndpointResponse -> ShowS)
-> (GetDevEndpointResponse -> String)
-> ([GetDevEndpointResponse] -> ShowS)
-> Show GetDevEndpointResponse
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. GetDevEndpointResponse -> Rep GetDevEndpointResponse x)
-> (forall x.
    Rep GetDevEndpointResponse x -> GetDevEndpointResponse)
-> Generic GetDevEndpointResponse
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' :: Maybe DevEndpoint -> Int -> GetDevEndpointResponse
GetDevEndpointResponse'
    { $sel:devEndpoint:GetDevEndpointResponse' :: Maybe DevEndpoint
devEndpoint =
        Maybe 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 :: (Maybe DevEndpoint -> f (Maybe DevEndpoint))
-> GetDevEndpointResponse -> f GetDevEndpointResponse
getDevEndpointResponse_devEndpoint = (GetDevEndpointResponse -> Maybe DevEndpoint)
-> (GetDevEndpointResponse
    -> Maybe DevEndpoint -> GetDevEndpointResponse)
-> Lens
     GetDevEndpointResponse
     GetDevEndpointResponse
     (Maybe DevEndpoint)
     (Maybe 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 :: (Int -> f Int)
-> GetDevEndpointResponse -> f GetDevEndpointResponse
getDevEndpointResponse_httpStatus = (GetDevEndpointResponse -> Int)
-> (GetDevEndpointResponse -> Int -> GetDevEndpointResponse)
-> Lens GetDevEndpointResponse GetDevEndpointResponse Int Int
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