{-# 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 #-}
module Amazonka.Glue.GetConnection
(
GetConnection (..),
newGetConnection,
getConnection_catalogId,
getConnection_hidePassword,
getConnection_name,
GetConnectionResponse (..),
newGetConnectionResponse,
getConnectionResponse_connection,
getConnectionResponse_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
data GetConnection = GetConnection'
{
GetConnection -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetConnection -> Maybe Bool
hidePassword :: Prelude.Maybe Prelude.Bool,
GetConnection -> Text
name :: Prelude.Text
}
deriving (GetConnection -> GetConnection -> Bool
(GetConnection -> GetConnection -> Bool)
-> (GetConnection -> GetConnection -> Bool) -> Eq GetConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnection -> GetConnection -> Bool
$c/= :: GetConnection -> GetConnection -> Bool
== :: GetConnection -> GetConnection -> Bool
$c== :: GetConnection -> GetConnection -> Bool
Prelude.Eq, ReadPrec [GetConnection]
ReadPrec GetConnection
Int -> ReadS GetConnection
ReadS [GetConnection]
(Int -> ReadS GetConnection)
-> ReadS [GetConnection]
-> ReadPrec GetConnection
-> ReadPrec [GetConnection]
-> Read GetConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnection]
$creadListPrec :: ReadPrec [GetConnection]
readPrec :: ReadPrec GetConnection
$creadPrec :: ReadPrec GetConnection
readList :: ReadS [GetConnection]
$creadList :: ReadS [GetConnection]
readsPrec :: Int -> ReadS GetConnection
$creadsPrec :: Int -> ReadS GetConnection
Prelude.Read, Int -> GetConnection -> ShowS
[GetConnection] -> ShowS
GetConnection -> String
(Int -> GetConnection -> ShowS)
-> (GetConnection -> String)
-> ([GetConnection] -> ShowS)
-> Show GetConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnection] -> ShowS
$cshowList :: [GetConnection] -> ShowS
show :: GetConnection -> String
$cshow :: GetConnection -> String
showsPrec :: Int -> GetConnection -> ShowS
$cshowsPrec :: Int -> GetConnection -> ShowS
Prelude.Show, (forall x. GetConnection -> Rep GetConnection x)
-> (forall x. Rep GetConnection x -> GetConnection)
-> Generic GetConnection
forall x. Rep GetConnection x -> GetConnection
forall x. GetConnection -> Rep GetConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConnection x -> GetConnection
$cfrom :: forall x. GetConnection -> Rep GetConnection x
Prelude.Generic)
newGetConnection ::
Prelude.Text ->
GetConnection
newGetConnection :: Text -> GetConnection
newGetConnection Text
pName_ =
GetConnection' :: Maybe Text -> Maybe Bool -> Text -> GetConnection
GetConnection'
{ $sel:catalogId:GetConnection' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:hidePassword:GetConnection' :: Maybe Bool
hidePassword = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:name:GetConnection' :: Text
name = Text
pName_
}
getConnection_catalogId :: Lens.Lens' GetConnection (Prelude.Maybe Prelude.Text)
getConnection_catalogId :: (Maybe Text -> f (Maybe Text)) -> GetConnection -> f GetConnection
getConnection_catalogId = (GetConnection -> Maybe Text)
-> (GetConnection -> Maybe Text -> GetConnection)
-> Lens GetConnection GetConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnection' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetConnection' :: GetConnection -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetConnection
s@GetConnection' {} Maybe Text
a -> GetConnection
s {$sel:catalogId:GetConnection' :: Maybe Text
catalogId = Maybe Text
a} :: GetConnection)
getConnection_hidePassword :: Lens.Lens' GetConnection (Prelude.Maybe Prelude.Bool)
getConnection_hidePassword :: (Maybe Bool -> f (Maybe Bool)) -> GetConnection -> f GetConnection
getConnection_hidePassword = (GetConnection -> Maybe Bool)
-> (GetConnection -> Maybe Bool -> GetConnection)
-> Lens GetConnection GetConnection (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnection' {Maybe Bool
hidePassword :: Maybe Bool
$sel:hidePassword:GetConnection' :: GetConnection -> Maybe Bool
hidePassword} -> Maybe Bool
hidePassword) (\s :: GetConnection
s@GetConnection' {} Maybe Bool
a -> GetConnection
s {$sel:hidePassword:GetConnection' :: Maybe Bool
hidePassword = Maybe Bool
a} :: GetConnection)
getConnection_name :: Lens.Lens' GetConnection Prelude.Text
getConnection_name :: (Text -> f Text) -> GetConnection -> f GetConnection
getConnection_name = (GetConnection -> Text)
-> (GetConnection -> Text -> GetConnection)
-> Lens GetConnection GetConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnection' {Text
name :: Text
$sel:name:GetConnection' :: GetConnection -> Text
name} -> Text
name) (\s :: GetConnection
s@GetConnection' {} Text
a -> GetConnection
s {$sel:name:GetConnection' :: Text
name = Text
a} :: GetConnection)
instance Core.AWSRequest GetConnection where
type
AWSResponse GetConnection =
GetConnectionResponse
request :: GetConnection -> Request GetConnection
request = Service -> GetConnection -> Request GetConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetConnection))
-> Logger
-> Service
-> Proxy GetConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConnection)))
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 Connection -> Int -> GetConnectionResponse
GetConnectionResponse'
(Maybe Connection -> Int -> GetConnectionResponse)
-> Either String (Maybe Connection)
-> Either String (Int -> GetConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Connection)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Connection")
Either String (Int -> GetConnectionResponse)
-> Either String Int -> Either String GetConnectionResponse
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 GetConnection
instance Prelude.NFData GetConnection
instance Core.ToHeaders GetConnection where
toHeaders :: GetConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetConnection -> 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.GetConnection" :: 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 GetConnection where
toJSON :: GetConnection -> Value
toJSON GetConnection' {Maybe Bool
Maybe Text
Text
name :: Text
hidePassword :: Maybe Bool
catalogId :: Maybe Text
$sel:name:GetConnection' :: GetConnection -> Text
$sel:hidePassword:GetConnection' :: GetConnection -> Maybe Bool
$sel:catalogId:GetConnection' :: GetConnection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CatalogId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
(Text
"HidePassword" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
hidePassword,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath GetConnection where
toPath :: GetConnection -> ByteString
toPath = ByteString -> GetConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetConnection where
toQuery :: GetConnection -> QueryString
toQuery = QueryString -> GetConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetConnectionResponse = GetConnectionResponse'
{
GetConnectionResponse -> Maybe Connection
connection :: Prelude.Maybe Connection,
GetConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetConnectionResponse -> GetConnectionResponse -> Bool
(GetConnectionResponse -> GetConnectionResponse -> Bool)
-> (GetConnectionResponse -> GetConnectionResponse -> Bool)
-> Eq GetConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnectionResponse -> GetConnectionResponse -> Bool
$c/= :: GetConnectionResponse -> GetConnectionResponse -> Bool
== :: GetConnectionResponse -> GetConnectionResponse -> Bool
$c== :: GetConnectionResponse -> GetConnectionResponse -> Bool
Prelude.Eq, ReadPrec [GetConnectionResponse]
ReadPrec GetConnectionResponse
Int -> ReadS GetConnectionResponse
ReadS [GetConnectionResponse]
(Int -> ReadS GetConnectionResponse)
-> ReadS [GetConnectionResponse]
-> ReadPrec GetConnectionResponse
-> ReadPrec [GetConnectionResponse]
-> Read GetConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnectionResponse]
$creadListPrec :: ReadPrec [GetConnectionResponse]
readPrec :: ReadPrec GetConnectionResponse
$creadPrec :: ReadPrec GetConnectionResponse
readList :: ReadS [GetConnectionResponse]
$creadList :: ReadS [GetConnectionResponse]
readsPrec :: Int -> ReadS GetConnectionResponse
$creadsPrec :: Int -> ReadS GetConnectionResponse
Prelude.Read, Int -> GetConnectionResponse -> ShowS
[GetConnectionResponse] -> ShowS
GetConnectionResponse -> String
(Int -> GetConnectionResponse -> ShowS)
-> (GetConnectionResponse -> String)
-> ([GetConnectionResponse] -> ShowS)
-> Show GetConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnectionResponse] -> ShowS
$cshowList :: [GetConnectionResponse] -> ShowS
show :: GetConnectionResponse -> String
$cshow :: GetConnectionResponse -> String
showsPrec :: Int -> GetConnectionResponse -> ShowS
$cshowsPrec :: Int -> GetConnectionResponse -> ShowS
Prelude.Show, (forall x. GetConnectionResponse -> Rep GetConnectionResponse x)
-> (forall x. Rep GetConnectionResponse x -> GetConnectionResponse)
-> Generic GetConnectionResponse
forall x. Rep GetConnectionResponse x -> GetConnectionResponse
forall x. GetConnectionResponse -> Rep GetConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConnectionResponse x -> GetConnectionResponse
$cfrom :: forall x. GetConnectionResponse -> Rep GetConnectionResponse x
Prelude.Generic)
newGetConnectionResponse ::
Prelude.Int ->
GetConnectionResponse
newGetConnectionResponse :: Int -> GetConnectionResponse
newGetConnectionResponse Int
pHttpStatus_ =
GetConnectionResponse' :: Maybe Connection -> Int -> GetConnectionResponse
GetConnectionResponse'
{ $sel:connection:GetConnectionResponse' :: Maybe Connection
connection =
Maybe Connection
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getConnectionResponse_connection :: Lens.Lens' GetConnectionResponse (Prelude.Maybe Connection)
getConnectionResponse_connection :: (Maybe Connection -> f (Maybe Connection))
-> GetConnectionResponse -> f GetConnectionResponse
getConnectionResponse_connection = (GetConnectionResponse -> Maybe Connection)
-> (GetConnectionResponse
-> Maybe Connection -> GetConnectionResponse)
-> Lens
GetConnectionResponse
GetConnectionResponse
(Maybe Connection)
(Maybe Connection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionResponse' {Maybe Connection
connection :: Maybe Connection
$sel:connection:GetConnectionResponse' :: GetConnectionResponse -> Maybe Connection
connection} -> Maybe Connection
connection) (\s :: GetConnectionResponse
s@GetConnectionResponse' {} Maybe Connection
a -> GetConnectionResponse
s {$sel:connection:GetConnectionResponse' :: Maybe Connection
connection = Maybe Connection
a} :: GetConnectionResponse)
getConnectionResponse_httpStatus :: Lens.Lens' GetConnectionResponse Prelude.Int
getConnectionResponse_httpStatus :: (Int -> f Int) -> GetConnectionResponse -> f GetConnectionResponse
getConnectionResponse_httpStatus = (GetConnectionResponse -> Int)
-> (GetConnectionResponse -> Int -> GetConnectionResponse)
-> Lens GetConnectionResponse GetConnectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConnectionResponse' :: GetConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConnectionResponse
s@GetConnectionResponse' {} Int
a -> GetConnectionResponse
s {$sel:httpStatus:GetConnectionResponse' :: Int
httpStatus = Int
a} :: GetConnectionResponse)
instance Prelude.NFData GetConnectionResponse