{-# 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.DeleteNamespace
(
DeleteNamespace (..),
newDeleteNamespace,
deleteNamespace_id,
DeleteNamespaceResponse (..),
newDeleteNamespaceResponse,
deleteNamespaceResponse_operationId,
deleteNamespaceResponse_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 DeleteNamespace = DeleteNamespace'
{
DeleteNamespace -> Text
id :: Prelude.Text
}
deriving (DeleteNamespace -> DeleteNamespace -> Bool
(DeleteNamespace -> DeleteNamespace -> Bool)
-> (DeleteNamespace -> DeleteNamespace -> Bool)
-> Eq DeleteNamespace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNamespace -> DeleteNamespace -> Bool
$c/= :: DeleteNamespace -> DeleteNamespace -> Bool
== :: DeleteNamespace -> DeleteNamespace -> Bool
$c== :: DeleteNamespace -> DeleteNamespace -> Bool
Prelude.Eq, ReadPrec [DeleteNamespace]
ReadPrec DeleteNamespace
Int -> ReadS DeleteNamespace
ReadS [DeleteNamespace]
(Int -> ReadS DeleteNamespace)
-> ReadS [DeleteNamespace]
-> ReadPrec DeleteNamespace
-> ReadPrec [DeleteNamespace]
-> Read DeleteNamespace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNamespace]
$creadListPrec :: ReadPrec [DeleteNamespace]
readPrec :: ReadPrec DeleteNamespace
$creadPrec :: ReadPrec DeleteNamespace
readList :: ReadS [DeleteNamespace]
$creadList :: ReadS [DeleteNamespace]
readsPrec :: Int -> ReadS DeleteNamespace
$creadsPrec :: Int -> ReadS DeleteNamespace
Prelude.Read, Int -> DeleteNamespace -> ShowS
[DeleteNamespace] -> ShowS
DeleteNamespace -> String
(Int -> DeleteNamespace -> ShowS)
-> (DeleteNamespace -> String)
-> ([DeleteNamespace] -> ShowS)
-> Show DeleteNamespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNamespace] -> ShowS
$cshowList :: [DeleteNamespace] -> ShowS
show :: DeleteNamespace -> String
$cshow :: DeleteNamespace -> String
showsPrec :: Int -> DeleteNamespace -> ShowS
$cshowsPrec :: Int -> DeleteNamespace -> ShowS
Prelude.Show, (forall x. DeleteNamespace -> Rep DeleteNamespace x)
-> (forall x. Rep DeleteNamespace x -> DeleteNamespace)
-> Generic DeleteNamespace
forall x. Rep DeleteNamespace x -> DeleteNamespace
forall x. DeleteNamespace -> Rep DeleteNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteNamespace x -> DeleteNamespace
$cfrom :: forall x. DeleteNamespace -> Rep DeleteNamespace x
Prelude.Generic)
newDeleteNamespace ::
Prelude.Text ->
DeleteNamespace
newDeleteNamespace :: Text -> DeleteNamespace
newDeleteNamespace Text
pId_ = DeleteNamespace' :: Text -> DeleteNamespace
DeleteNamespace' {$sel:id:DeleteNamespace' :: Text
id = Text
pId_}
deleteNamespace_id :: Lens.Lens' DeleteNamespace Prelude.Text
deleteNamespace_id :: (Text -> f Text) -> DeleteNamespace -> f DeleteNamespace
deleteNamespace_id = (DeleteNamespace -> Text)
-> (DeleteNamespace -> Text -> DeleteNamespace)
-> Lens DeleteNamespace DeleteNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespace' {Text
id :: Text
$sel:id:DeleteNamespace' :: DeleteNamespace -> Text
id} -> Text
id) (\s :: DeleteNamespace
s@DeleteNamespace' {} Text
a -> DeleteNamespace
s {$sel:id:DeleteNamespace' :: Text
id = Text
a} :: DeleteNamespace)
instance Core.AWSRequest DeleteNamespace where
type
AWSResponse DeleteNamespace =
DeleteNamespaceResponse
request :: DeleteNamespace -> Request DeleteNamespace
request = Service -> DeleteNamespace -> Request DeleteNamespace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteNamespace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteNamespace)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteNamespace))
-> Logger
-> Service
-> Proxy DeleteNamespace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteNamespace)))
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 -> DeleteNamespaceResponse
DeleteNamespaceResponse'
(Maybe Text -> Int -> DeleteNamespaceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteNamespaceResponse)
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 -> DeleteNamespaceResponse)
-> Either String Int -> Either String DeleteNamespaceResponse
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 DeleteNamespace
instance Prelude.NFData DeleteNamespace
instance Core.ToHeaders DeleteNamespace where
toHeaders :: DeleteNamespace -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteNamespace -> 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.DeleteNamespace" ::
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 DeleteNamespace where
toJSON :: DeleteNamespace -> Value
toJSON DeleteNamespace' {Text
id :: Text
$sel:id:DeleteNamespace' :: DeleteNamespace -> 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
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)])
instance Core.ToPath DeleteNamespace where
toPath :: DeleteNamespace -> ByteString
toPath = ByteString -> DeleteNamespace -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteNamespace where
toQuery :: DeleteNamespace -> QueryString
toQuery = QueryString -> DeleteNamespace -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteNamespaceResponse = DeleteNamespaceResponse'
{
DeleteNamespaceResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
DeleteNamespaceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
(DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool)
-> (DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool)
-> Eq DeleteNamespaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
$c/= :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
== :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
$c== :: DeleteNamespaceResponse -> DeleteNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteNamespaceResponse]
ReadPrec DeleteNamespaceResponse
Int -> ReadS DeleteNamespaceResponse
ReadS [DeleteNamespaceResponse]
(Int -> ReadS DeleteNamespaceResponse)
-> ReadS [DeleteNamespaceResponse]
-> ReadPrec DeleteNamespaceResponse
-> ReadPrec [DeleteNamespaceResponse]
-> Read DeleteNamespaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNamespaceResponse]
$creadListPrec :: ReadPrec [DeleteNamespaceResponse]
readPrec :: ReadPrec DeleteNamespaceResponse
$creadPrec :: ReadPrec DeleteNamespaceResponse
readList :: ReadS [DeleteNamespaceResponse]
$creadList :: ReadS [DeleteNamespaceResponse]
readsPrec :: Int -> ReadS DeleteNamespaceResponse
$creadsPrec :: Int -> ReadS DeleteNamespaceResponse
Prelude.Read, Int -> DeleteNamespaceResponse -> ShowS
[DeleteNamespaceResponse] -> ShowS
DeleteNamespaceResponse -> String
(Int -> DeleteNamespaceResponse -> ShowS)
-> (DeleteNamespaceResponse -> String)
-> ([DeleteNamespaceResponse] -> ShowS)
-> Show DeleteNamespaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNamespaceResponse] -> ShowS
$cshowList :: [DeleteNamespaceResponse] -> ShowS
show :: DeleteNamespaceResponse -> String
$cshow :: DeleteNamespaceResponse -> String
showsPrec :: Int -> DeleteNamespaceResponse -> ShowS
$cshowsPrec :: Int -> DeleteNamespaceResponse -> ShowS
Prelude.Show, (forall x.
DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x)
-> (forall x.
Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse)
-> Generic DeleteNamespaceResponse
forall x. Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse
forall x. DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteNamespaceResponse x -> DeleteNamespaceResponse
$cfrom :: forall x. DeleteNamespaceResponse -> Rep DeleteNamespaceResponse x
Prelude.Generic)
newDeleteNamespaceResponse ::
Prelude.Int ->
DeleteNamespaceResponse
newDeleteNamespaceResponse :: Int -> DeleteNamespaceResponse
newDeleteNamespaceResponse Int
pHttpStatus_ =
DeleteNamespaceResponse' :: Maybe Text -> Int -> DeleteNamespaceResponse
DeleteNamespaceResponse'
{ $sel:operationId:DeleteNamespaceResponse' :: Maybe Text
operationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteNamespaceResponse_operationId :: Lens.Lens' DeleteNamespaceResponse (Prelude.Maybe Prelude.Text)
deleteNamespaceResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> DeleteNamespaceResponse -> f DeleteNamespaceResponse
deleteNamespaceResponse_operationId = (DeleteNamespaceResponse -> Maybe Text)
-> (DeleteNamespaceResponse
-> Maybe Text -> DeleteNamespaceResponse)
-> Lens
DeleteNamespaceResponse
DeleteNamespaceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespaceResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:DeleteNamespaceResponse' :: DeleteNamespaceResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: DeleteNamespaceResponse
s@DeleteNamespaceResponse' {} Maybe Text
a -> DeleteNamespaceResponse
s {$sel:operationId:DeleteNamespaceResponse' :: Maybe Text
operationId = Maybe Text
a} :: DeleteNamespaceResponse)
deleteNamespaceResponse_httpStatus :: Lens.Lens' DeleteNamespaceResponse Prelude.Int
deleteNamespaceResponse_httpStatus :: (Int -> f Int)
-> DeleteNamespaceResponse -> f DeleteNamespaceResponse
deleteNamespaceResponse_httpStatus = (DeleteNamespaceResponse -> Int)
-> (DeleteNamespaceResponse -> Int -> DeleteNamespaceResponse)
-> Lens DeleteNamespaceResponse DeleteNamespaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNamespaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteNamespaceResponse' :: DeleteNamespaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteNamespaceResponse
s@DeleteNamespaceResponse' {} Int
a -> DeleteNamespaceResponse
s {$sel:httpStatus:DeleteNamespaceResponse' :: Int
httpStatus = Int
a} :: DeleteNamespaceResponse)
instance Prelude.NFData DeleteNamespaceResponse