{-# 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.Route53AutoNaming.GetNamespace
(
GetNamespace (..),
newGetNamespace,
getNamespace_id,
GetNamespaceResponse (..),
newGetNamespaceResponse,
getNamespaceResponse_namespace,
getNamespaceResponse_httpStatus,
)
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53AutoNaming.Types
data GetNamespace = GetNamespace'
{
GetNamespace -> Text
id :: 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
pId_ = GetNamespace' {$sel:id:GetNamespace' :: Text
id = Text
pId_}
getNamespace_id :: Lens.Lens' GetNamespace Prelude.Text
getNamespace_id :: Lens' GetNamespace Text
getNamespace_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNamespace' {Text
id :: Text
$sel:id:GetNamespace' :: GetNamespace -> Text
id} -> Text
id) (\s :: GetNamespace
s@GetNamespace' {} Text
a -> GetNamespace
s {$sel:id:GetNamespace' :: Text
id = 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 ->
Maybe Namespace -> Int -> GetNamespaceResponse
GetNamespaceResponse'
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
"Namespace")
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 GetNamespace where
hashWithSalt :: Int -> GetNamespace -> Int
hashWithSalt Int
_salt GetNamespace' {Text
id :: Text
$sel:id:GetNamespace' :: GetNamespace -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetNamespace where
rnf :: GetNamespace -> ()
rnf GetNamespace' {Text
id :: Text
$sel:id:GetNamespace' :: GetNamespace -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
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
"Route53AutoNaming_v20170314.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
id :: Text
$sel:id:GetNamespace' :: GetNamespace -> Text
..} =
[Pair] -> Value
Data.object
(forall a. [Maybe a] -> [a]
Prelude.catMaybes [forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)])
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 -> Maybe Namespace
namespace :: Prelude.Maybe Namespace,
GetNamespaceResponse -> Int
httpStatus :: Prelude.Int
}
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, ReadPrec [GetNamespaceResponse]
ReadPrec GetNamespaceResponse
Int -> ReadS GetNamespaceResponse
ReadS [GetNamespaceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNamespaceResponse]
$creadListPrec :: ReadPrec [GetNamespaceResponse]
readPrec :: ReadPrec GetNamespaceResponse
$creadPrec :: ReadPrec GetNamespaceResponse
readList :: ReadS [GetNamespaceResponse]
$creadList :: ReadS [GetNamespaceResponse]
readsPrec :: Int -> ReadS GetNamespaceResponse
$creadsPrec :: Int -> ReadS GetNamespaceResponse
Prelude.Read, 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 ->
GetNamespaceResponse
newGetNamespaceResponse :: Int -> GetNamespaceResponse
newGetNamespaceResponse Int
pHttpStatus_ =
GetNamespaceResponse'
{ $sel:namespace:GetNamespaceResponse' :: Maybe Namespace
namespace = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getNamespaceResponse_namespace :: Lens.Lens' GetNamespaceResponse (Prelude.Maybe Namespace)
getNamespaceResponse_namespace :: Lens' GetNamespaceResponse (Maybe Namespace)
getNamespaceResponse_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNamespaceResponse' {Maybe Namespace
namespace :: Maybe Namespace
$sel:namespace:GetNamespaceResponse' :: GetNamespaceResponse -> Maybe Namespace
namespace} -> Maybe Namespace
namespace) (\s :: GetNamespaceResponse
s@GetNamespaceResponse' {} Maybe Namespace
a -> GetNamespaceResponse
s {$sel:namespace:GetNamespaceResponse' :: Maybe Namespace
namespace = Maybe Namespace
a} :: GetNamespaceResponse)
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)
instance Prelude.NFData GetNamespaceResponse where
rnf :: GetNamespaceResponse -> ()
rnf GetNamespaceResponse' {Int
Maybe Namespace
httpStatus :: Int
namespace :: Maybe Namespace
$sel:httpStatus:GetNamespaceResponse' :: GetNamespaceResponse -> Int
$sel:namespace:GetNamespaceResponse' :: GetNamespaceResponse -> Maybe Namespace
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Namespace
namespace
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus