{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Route53AutoNaming.CreatePublicDNSNamespace
(
createPublicDNSNamespace
, CreatePublicDNSNamespace
, cpdnCreatorRequestId
, cpdnDescription
, cpdnName
, createPublicDNSNamespaceResponse
, CreatePublicDNSNamespaceResponse
, cpdnrsOperationId
, cpdnrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Route53AutoNaming.Types
import Network.AWS.Route53AutoNaming.Types.Product
data CreatePublicDNSNamespace = CreatePublicDNSNamespace'
{ _cpdnCreatorRequestId :: !(Maybe Text)
, _cpdnDescription :: !(Maybe Text)
, _cpdnName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPublicDNSNamespace
:: Text
-> CreatePublicDNSNamespace
createPublicDNSNamespace pName_ =
CreatePublicDNSNamespace'
{ _cpdnCreatorRequestId = Nothing
, _cpdnDescription = Nothing
, _cpdnName = pName_
}
cpdnCreatorRequestId :: Lens' CreatePublicDNSNamespace (Maybe Text)
cpdnCreatorRequestId = lens _cpdnCreatorRequestId (\ s a -> s{_cpdnCreatorRequestId = a})
cpdnDescription :: Lens' CreatePublicDNSNamespace (Maybe Text)
cpdnDescription = lens _cpdnDescription (\ s a -> s{_cpdnDescription = a})
cpdnName :: Lens' CreatePublicDNSNamespace Text
cpdnName = lens _cpdnName (\ s a -> s{_cpdnName = a})
instance AWSRequest CreatePublicDNSNamespace where
type Rs CreatePublicDNSNamespace =
CreatePublicDNSNamespaceResponse
request = postJSON route53AutoNaming
response
= receiveJSON
(\ s h x ->
CreatePublicDNSNamespaceResponse' <$>
(x .?> "OperationId") <*> (pure (fromEnum s)))
instance Hashable CreatePublicDNSNamespace where
instance NFData CreatePublicDNSNamespace where
instance ToHeaders CreatePublicDNSNamespace where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53AutoNaming_v20170314.CreatePublicDnsNamespace"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreatePublicDNSNamespace where
toJSON CreatePublicDNSNamespace'{..}
= object
(catMaybes
[("CreatorRequestId" .=) <$> _cpdnCreatorRequestId,
("Description" .=) <$> _cpdnDescription,
Just ("Name" .= _cpdnName)])
instance ToPath CreatePublicDNSNamespace where
toPath = const "/"
instance ToQuery CreatePublicDNSNamespace where
toQuery = const mempty
data CreatePublicDNSNamespaceResponse = CreatePublicDNSNamespaceResponse'
{ _cpdnrsOperationId :: !(Maybe Text)
, _cpdnrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPublicDNSNamespaceResponse
:: Int
-> CreatePublicDNSNamespaceResponse
createPublicDNSNamespaceResponse pResponseStatus_ =
CreatePublicDNSNamespaceResponse'
{_cpdnrsOperationId = Nothing, _cpdnrsResponseStatus = pResponseStatus_}
cpdnrsOperationId :: Lens' CreatePublicDNSNamespaceResponse (Maybe Text)
cpdnrsOperationId = lens _cpdnrsOperationId (\ s a -> s{_cpdnrsOperationId = a})
cpdnrsResponseStatus :: Lens' CreatePublicDNSNamespaceResponse Int
cpdnrsResponseStatus = lens _cpdnrsResponseStatus (\ s a -> s{_cpdnrsResponseStatus = a})
instance NFData CreatePublicDNSNamespaceResponse
where