{-# 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.CreateHttpNamespace
(
CreateHttpNamespace (..),
newCreateHttpNamespace,
createHttpNamespace_creatorRequestId,
createHttpNamespace_description,
createHttpNamespace_tags,
createHttpNamespace_name,
CreateHttpNamespaceResponse (..),
newCreateHttpNamespaceResponse,
createHttpNamespaceResponse_operationId,
createHttpNamespaceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53AutoNaming.Types
data CreateHttpNamespace = CreateHttpNamespace'
{
CreateHttpNamespace -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
CreateHttpNamespace -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateHttpNamespace -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateHttpNamespace -> Text
name :: Prelude.Text
}
deriving (CreateHttpNamespace -> CreateHttpNamespace -> Bool
(CreateHttpNamespace -> CreateHttpNamespace -> Bool)
-> (CreateHttpNamespace -> CreateHttpNamespace -> Bool)
-> Eq CreateHttpNamespace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHttpNamespace -> CreateHttpNamespace -> Bool
$c/= :: CreateHttpNamespace -> CreateHttpNamespace -> Bool
== :: CreateHttpNamespace -> CreateHttpNamespace -> Bool
$c== :: CreateHttpNamespace -> CreateHttpNamespace -> Bool
Prelude.Eq, ReadPrec [CreateHttpNamespace]
ReadPrec CreateHttpNamespace
Int -> ReadS CreateHttpNamespace
ReadS [CreateHttpNamespace]
(Int -> ReadS CreateHttpNamespace)
-> ReadS [CreateHttpNamespace]
-> ReadPrec CreateHttpNamespace
-> ReadPrec [CreateHttpNamespace]
-> Read CreateHttpNamespace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHttpNamespace]
$creadListPrec :: ReadPrec [CreateHttpNamespace]
readPrec :: ReadPrec CreateHttpNamespace
$creadPrec :: ReadPrec CreateHttpNamespace
readList :: ReadS [CreateHttpNamespace]
$creadList :: ReadS [CreateHttpNamespace]
readsPrec :: Int -> ReadS CreateHttpNamespace
$creadsPrec :: Int -> ReadS CreateHttpNamespace
Prelude.Read, Int -> CreateHttpNamespace -> ShowS
[CreateHttpNamespace] -> ShowS
CreateHttpNamespace -> String
(Int -> CreateHttpNamespace -> ShowS)
-> (CreateHttpNamespace -> String)
-> ([CreateHttpNamespace] -> ShowS)
-> Show CreateHttpNamespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHttpNamespace] -> ShowS
$cshowList :: [CreateHttpNamespace] -> ShowS
show :: CreateHttpNamespace -> String
$cshow :: CreateHttpNamespace -> String
showsPrec :: Int -> CreateHttpNamespace -> ShowS
$cshowsPrec :: Int -> CreateHttpNamespace -> ShowS
Prelude.Show, (forall x. CreateHttpNamespace -> Rep CreateHttpNamespace x)
-> (forall x. Rep CreateHttpNamespace x -> CreateHttpNamespace)
-> Generic CreateHttpNamespace
forall x. Rep CreateHttpNamespace x -> CreateHttpNamespace
forall x. CreateHttpNamespace -> Rep CreateHttpNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHttpNamespace x -> CreateHttpNamespace
$cfrom :: forall x. CreateHttpNamespace -> Rep CreateHttpNamespace x
Prelude.Generic)
newCreateHttpNamespace ::
Prelude.Text ->
CreateHttpNamespace
newCreateHttpNamespace :: Text -> CreateHttpNamespace
newCreateHttpNamespace Text
pName_ =
CreateHttpNamespace' :: Maybe Text
-> Maybe Text -> Maybe [Tag] -> Text -> CreateHttpNamespace
CreateHttpNamespace'
{ $sel:creatorRequestId:CreateHttpNamespace' :: Maybe Text
creatorRequestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateHttpNamespace' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateHttpNamespace' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateHttpNamespace' :: Text
name = Text
pName_
}
createHttpNamespace_creatorRequestId :: Lens.Lens' CreateHttpNamespace (Prelude.Maybe Prelude.Text)
createHttpNamespace_creatorRequestId :: (Maybe Text -> f (Maybe Text))
-> CreateHttpNamespace -> f CreateHttpNamespace
createHttpNamespace_creatorRequestId = (CreateHttpNamespace -> Maybe Text)
-> (CreateHttpNamespace -> Maybe Text -> CreateHttpNamespace)
-> Lens
CreateHttpNamespace CreateHttpNamespace (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespace' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: CreateHttpNamespace
s@CreateHttpNamespace' {} Maybe Text
a -> CreateHttpNamespace
s {$sel:creatorRequestId:CreateHttpNamespace' :: Maybe Text
creatorRequestId = Maybe Text
a} :: CreateHttpNamespace)
createHttpNamespace_description :: Lens.Lens' CreateHttpNamespace (Prelude.Maybe Prelude.Text)
createHttpNamespace_description :: (Maybe Text -> f (Maybe Text))
-> CreateHttpNamespace -> f CreateHttpNamespace
createHttpNamespace_description = (CreateHttpNamespace -> Maybe Text)
-> (CreateHttpNamespace -> Maybe Text -> CreateHttpNamespace)
-> Lens
CreateHttpNamespace CreateHttpNamespace (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespace' {Maybe Text
description :: Maybe Text
$sel:description:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateHttpNamespace
s@CreateHttpNamespace' {} Maybe Text
a -> CreateHttpNamespace
s {$sel:description:CreateHttpNamespace' :: Maybe Text
description = Maybe Text
a} :: CreateHttpNamespace)
createHttpNamespace_tags :: Lens.Lens' CreateHttpNamespace (Prelude.Maybe [Tag])
createHttpNamespace_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateHttpNamespace -> f CreateHttpNamespace
createHttpNamespace_tags = (CreateHttpNamespace -> Maybe [Tag])
-> (CreateHttpNamespace -> Maybe [Tag] -> CreateHttpNamespace)
-> Lens
CreateHttpNamespace CreateHttpNamespace (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespace' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateHttpNamespace
s@CreateHttpNamespace' {} Maybe [Tag]
a -> CreateHttpNamespace
s {$sel:tags:CreateHttpNamespace' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateHttpNamespace) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateHttpNamespace -> f CreateHttpNamespace)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateHttpNamespace
-> f CreateHttpNamespace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createHttpNamespace_name :: Lens.Lens' CreateHttpNamespace Prelude.Text
createHttpNamespace_name :: (Text -> f Text) -> CreateHttpNamespace -> f CreateHttpNamespace
createHttpNamespace_name = (CreateHttpNamespace -> Text)
-> (CreateHttpNamespace -> Text -> CreateHttpNamespace)
-> Lens CreateHttpNamespace CreateHttpNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespace' {Text
name :: Text
$sel:name:CreateHttpNamespace' :: CreateHttpNamespace -> Text
name} -> Text
name) (\s :: CreateHttpNamespace
s@CreateHttpNamespace' {} Text
a -> CreateHttpNamespace
s {$sel:name:CreateHttpNamespace' :: Text
name = Text
a} :: CreateHttpNamespace)
instance Core.AWSRequest CreateHttpNamespace where
type
AWSResponse CreateHttpNamespace =
CreateHttpNamespaceResponse
request :: CreateHttpNamespace -> Request CreateHttpNamespace
request = Service -> CreateHttpNamespace -> Request CreateHttpNamespace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateHttpNamespace
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHttpNamespace)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateHttpNamespace))
-> Logger
-> Service
-> Proxy CreateHttpNamespace
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHttpNamespace)))
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 Text -> Int -> CreateHttpNamespaceResponse
CreateHttpNamespaceResponse'
(Maybe Text -> Int -> CreateHttpNamespaceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateHttpNamespaceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OperationId")
Either String (Int -> CreateHttpNamespaceResponse)
-> Either String Int -> Either String CreateHttpNamespaceResponse
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 CreateHttpNamespace
instance Prelude.NFData CreateHttpNamespace
instance Core.ToHeaders CreateHttpNamespace where
toHeaders :: CreateHttpNamespace -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateHttpNamespace -> 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
"Route53AutoNaming_v20170314.CreateHttpNamespace" ::
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 CreateHttpNamespace where
toJSON :: CreateHttpNamespace -> Value
toJSON CreateHttpNamespace' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
creatorRequestId :: Maybe Text
$sel:name:CreateHttpNamespace' :: CreateHttpNamespace -> Text
$sel:tags:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe [Tag]
$sel:description:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe Text
$sel:creatorRequestId:CreateHttpNamespace' :: CreateHttpNamespace -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CreatorRequestId" 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
creatorRequestId,
(Text
"Description" 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
description,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
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 CreateHttpNamespace where
toPath :: CreateHttpNamespace -> ByteString
toPath = ByteString -> CreateHttpNamespace -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateHttpNamespace where
toQuery :: CreateHttpNamespace -> QueryString
toQuery = QueryString -> CreateHttpNamespace -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateHttpNamespaceResponse = CreateHttpNamespaceResponse'
{
CreateHttpNamespaceResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
CreateHttpNamespaceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateHttpNamespaceResponse -> CreateHttpNamespaceResponse -> Bool
(CreateHttpNamespaceResponse
-> CreateHttpNamespaceResponse -> Bool)
-> (CreateHttpNamespaceResponse
-> CreateHttpNamespaceResponse -> Bool)
-> Eq CreateHttpNamespaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHttpNamespaceResponse -> CreateHttpNamespaceResponse -> Bool
$c/= :: CreateHttpNamespaceResponse -> CreateHttpNamespaceResponse -> Bool
== :: CreateHttpNamespaceResponse -> CreateHttpNamespaceResponse -> Bool
$c== :: CreateHttpNamespaceResponse -> CreateHttpNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [CreateHttpNamespaceResponse]
ReadPrec CreateHttpNamespaceResponse
Int -> ReadS CreateHttpNamespaceResponse
ReadS [CreateHttpNamespaceResponse]
(Int -> ReadS CreateHttpNamespaceResponse)
-> ReadS [CreateHttpNamespaceResponse]
-> ReadPrec CreateHttpNamespaceResponse
-> ReadPrec [CreateHttpNamespaceResponse]
-> Read CreateHttpNamespaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHttpNamespaceResponse]
$creadListPrec :: ReadPrec [CreateHttpNamespaceResponse]
readPrec :: ReadPrec CreateHttpNamespaceResponse
$creadPrec :: ReadPrec CreateHttpNamespaceResponse
readList :: ReadS [CreateHttpNamespaceResponse]
$creadList :: ReadS [CreateHttpNamespaceResponse]
readsPrec :: Int -> ReadS CreateHttpNamespaceResponse
$creadsPrec :: Int -> ReadS CreateHttpNamespaceResponse
Prelude.Read, Int -> CreateHttpNamespaceResponse -> ShowS
[CreateHttpNamespaceResponse] -> ShowS
CreateHttpNamespaceResponse -> String
(Int -> CreateHttpNamespaceResponse -> ShowS)
-> (CreateHttpNamespaceResponse -> String)
-> ([CreateHttpNamespaceResponse] -> ShowS)
-> Show CreateHttpNamespaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHttpNamespaceResponse] -> ShowS
$cshowList :: [CreateHttpNamespaceResponse] -> ShowS
show :: CreateHttpNamespaceResponse -> String
$cshow :: CreateHttpNamespaceResponse -> String
showsPrec :: Int -> CreateHttpNamespaceResponse -> ShowS
$cshowsPrec :: Int -> CreateHttpNamespaceResponse -> ShowS
Prelude.Show, (forall x.
CreateHttpNamespaceResponse -> Rep CreateHttpNamespaceResponse x)
-> (forall x.
Rep CreateHttpNamespaceResponse x -> CreateHttpNamespaceResponse)
-> Generic CreateHttpNamespaceResponse
forall x.
Rep CreateHttpNamespaceResponse x -> CreateHttpNamespaceResponse
forall x.
CreateHttpNamespaceResponse -> Rep CreateHttpNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHttpNamespaceResponse x -> CreateHttpNamespaceResponse
$cfrom :: forall x.
CreateHttpNamespaceResponse -> Rep CreateHttpNamespaceResponse x
Prelude.Generic)
newCreateHttpNamespaceResponse ::
Prelude.Int ->
CreateHttpNamespaceResponse
newCreateHttpNamespaceResponse :: Int -> CreateHttpNamespaceResponse
newCreateHttpNamespaceResponse Int
pHttpStatus_ =
CreateHttpNamespaceResponse' :: Maybe Text -> Int -> CreateHttpNamespaceResponse
CreateHttpNamespaceResponse'
{ $sel:operationId:CreateHttpNamespaceResponse' :: Maybe Text
operationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateHttpNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createHttpNamespaceResponse_operationId :: Lens.Lens' CreateHttpNamespaceResponse (Prelude.Maybe Prelude.Text)
createHttpNamespaceResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> CreateHttpNamespaceResponse -> f CreateHttpNamespaceResponse
createHttpNamespaceResponse_operationId = (CreateHttpNamespaceResponse -> Maybe Text)
-> (CreateHttpNamespaceResponse
-> Maybe Text -> CreateHttpNamespaceResponse)
-> Lens
CreateHttpNamespaceResponse
CreateHttpNamespaceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespaceResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:CreateHttpNamespaceResponse' :: CreateHttpNamespaceResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: CreateHttpNamespaceResponse
s@CreateHttpNamespaceResponse' {} Maybe Text
a -> CreateHttpNamespaceResponse
s {$sel:operationId:CreateHttpNamespaceResponse' :: Maybe Text
operationId = Maybe Text
a} :: CreateHttpNamespaceResponse)
createHttpNamespaceResponse_httpStatus :: Lens.Lens' CreateHttpNamespaceResponse Prelude.Int
createHttpNamespaceResponse_httpStatus :: (Int -> f Int)
-> CreateHttpNamespaceResponse -> f CreateHttpNamespaceResponse
createHttpNamespaceResponse_httpStatus = (CreateHttpNamespaceResponse -> Int)
-> (CreateHttpNamespaceResponse
-> Int -> CreateHttpNamespaceResponse)
-> Lens
CreateHttpNamespaceResponse CreateHttpNamespaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHttpNamespaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHttpNamespaceResponse' :: CreateHttpNamespaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHttpNamespaceResponse
s@CreateHttpNamespaceResponse' {} Int
a -> CreateHttpNamespaceResponse
s {$sel:httpStatus:CreateHttpNamespaceResponse' :: Int
httpStatus = Int
a} :: CreateHttpNamespaceResponse)
instance Prelude.NFData CreateHttpNamespaceResponse