{-# 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.RedshiftServerLess.GetNamespace
(
GetNamespace (..),
newGetNamespace,
getNamespace_namespaceName,
GetNamespaceResponse (..),
newGetNamespaceResponse,
getNamespaceResponse_httpStatus,
getNamespaceResponse_namespace,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetNamespace = GetNamespace'
{
GetNamespace -> Text
namespaceName :: Prelude.Text
}
deriving (GetNamespace -> GetNamespace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNamespace -> GetNamespace -> Bool
$c/= :: GetNamespace -> GetNamespace -> Bool
== :: GetNamespace -> GetNamespace -> Bool
$c== :: GetNamespace -> GetNamespace -> Bool
Prelude.Eq, ReadPrec [GetNamespace]
ReadPrec GetNamespace
Int -> ReadS GetNamespace
ReadS [GetNamespace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNamespace]
$creadListPrec :: ReadPrec [GetNamespace]
readPrec :: ReadPrec GetNamespace
$creadPrec :: ReadPrec GetNamespace
readList :: ReadS [GetNamespace]
$creadList :: ReadS [GetNamespace]
readsPrec :: Int -> ReadS GetNamespace
$creadsPrec :: Int -> ReadS GetNamespace
Prelude.Read, Int -> GetNamespace -> ShowS
[GetNamespace] -> ShowS
GetNamespace -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNamespace] -> ShowS
$cshowList :: [GetNamespace] -> ShowS
show :: GetNamespace -> String
$cshow :: GetNamespace -> String
showsPrec :: Int -> GetNamespace -> ShowS
$cshowsPrec :: Int -> GetNamespace -> ShowS
Prelude.Show, forall x. Rep GetNamespace x -> GetNamespace
forall x. GetNamespace -> Rep GetNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNamespace x -> GetNamespace
$cfrom :: forall x. GetNamespace -> Rep GetNamespace x
Prelude.Generic)
newGetNamespace ::
Prelude.Text ->
GetNamespace
newGetNamespace :: Text -> GetNamespace
newGetNamespace Text
pNamespaceName_ =
GetNamespace' {$sel:namespaceName:GetNamespace' :: Text
namespaceName = Text
pNamespaceName_}
getNamespace_namespaceName :: Lens.Lens' GetNamespace Prelude.Text
getNamespace_namespaceName :: Lens' GetNamespace Text
getNamespace_namespaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNamespace' {Text
namespaceName :: Text
$sel:namespaceName:GetNamespace' :: GetNamespace -> Text
namespaceName} -> Text
namespaceName) (\s :: GetNamespace
s@GetNamespace' {} Text
a -> GetNamespace
s {$sel:namespaceName:GetNamespace' :: Text
namespaceName = Text
a} :: GetNamespace)
instance Core.AWSRequest GetNamespace where
type AWSResponse GetNamespace = GetNamespaceResponse
request :: (Service -> Service) -> GetNamespace -> Request GetNamespace
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 GetNamespace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetNamespace)))
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 ->
Int -> Namespace -> GetNamespaceResponse
GetNamespaceResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"namespace")
)
instance Prelude.Hashable GetNamespace where
hashWithSalt :: Int -> GetNamespace -> Int
hashWithSalt Int
_salt GetNamespace' {Text
namespaceName :: Text
$sel:namespaceName:GetNamespace' :: GetNamespace -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
namespaceName
instance Prelude.NFData GetNamespace where
rnf :: GetNamespace -> ()
rnf GetNamespace' {Text
namespaceName :: Text
$sel:namespaceName:GetNamespace' :: GetNamespace -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
namespaceName
instance Data.ToHeaders GetNamespace where
toHeaders :: GetNamespace -> 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
"RedshiftServerless.GetNamespace" ::
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 GetNamespace where
toJSON :: GetNamespace -> Value
toJSON GetNamespace' {Text
namespaceName :: Text
$sel:namespaceName:GetNamespace' :: GetNamespace -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"namespaceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
namespaceName)
]
)
instance Data.ToPath GetNamespace where
toPath :: GetNamespace -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetNamespace where
toQuery :: GetNamespace -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetNamespaceResponse = GetNamespaceResponse'
{
GetNamespaceResponse -> Int
httpStatus :: Prelude.Int,
GetNamespaceResponse -> Namespace
namespace :: Namespace
}
deriving (GetNamespaceResponse -> GetNamespaceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNamespaceResponse -> GetNamespaceResponse -> Bool
$c/= :: GetNamespaceResponse -> GetNamespaceResponse -> Bool
== :: GetNamespaceResponse -> GetNamespaceResponse -> Bool
$c== :: GetNamespaceResponse -> GetNamespaceResponse -> Bool
Prelude.Eq, Int -> GetNamespaceResponse -> ShowS
[GetNamespaceResponse] -> ShowS
GetNamespaceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNamespaceResponse] -> ShowS
$cshowList :: [GetNamespaceResponse] -> ShowS
show :: GetNamespaceResponse -> String
$cshow :: GetNamespaceResponse -> String
showsPrec :: Int -> GetNamespaceResponse -> ShowS
$cshowsPrec :: Int -> GetNamespaceResponse -> ShowS
Prelude.Show, forall x. Rep GetNamespaceResponse x -> GetNamespaceResponse
forall x. GetNamespaceResponse -> Rep GetNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNamespaceResponse x -> GetNamespaceResponse
$cfrom :: forall x. GetNamespaceResponse -> Rep GetNamespaceResponse x
Prelude.Generic)
newGetNamespaceResponse ::
Prelude.Int ->
Namespace ->
GetNamespaceResponse
newGetNamespaceResponse :: Int -> Namespace -> GetNamespaceResponse
newGetNamespaceResponse Int
pHttpStatus_ Namespace
pNamespace_ =
GetNamespaceResponse'
{ $sel:httpStatus:GetNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:namespace:GetNamespaceResponse' :: Namespace
namespace = Namespace
pNamespace_
}
getNamespaceResponse_httpStatus :: Lens.Lens' GetNamespaceResponse Prelude.Int
getNamespaceResponse_httpStatus :: Lens' GetNamespaceResponse Int
getNamespaceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNamespaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetNamespaceResponse' :: GetNamespaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetNamespaceResponse
s@GetNamespaceResponse' {} Int
a -> GetNamespaceResponse
s {$sel:httpStatus:GetNamespaceResponse' :: Int
httpStatus = Int
a} :: GetNamespaceResponse)
getNamespaceResponse_namespace :: Lens.Lens' GetNamespaceResponse Namespace
getNamespaceResponse_namespace :: Lens' GetNamespaceResponse Namespace
getNamespaceResponse_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNamespaceResponse' {Namespace
namespace :: Namespace
$sel:namespace:GetNamespaceResponse' :: GetNamespaceResponse -> Namespace
namespace} -> Namespace
namespace) (\s :: GetNamespaceResponse
s@GetNamespaceResponse' {} Namespace
a -> GetNamespaceResponse
s {$sel:namespace:GetNamespaceResponse' :: Namespace
namespace = Namespace
a} :: GetNamespaceResponse)
instance Prelude.NFData GetNamespaceResponse where
rnf :: GetNamespaceResponse -> ()
rnf GetNamespaceResponse' {Int
Namespace
namespace :: Namespace
httpStatus :: Int
$sel:namespace:GetNamespaceResponse' :: GetNamespaceResponse -> Namespace
$sel:httpStatus:GetNamespaceResponse' :: GetNamespaceResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Namespace
namespace