{-# 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.GetNamespace
(
getNamespace
, GetNamespace
, gnId
, getNamespaceResponse
, GetNamespaceResponse
, gnrsNamespace
, gnrsResponseStatus
) 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
newtype GetNamespace = GetNamespace'
{ _gnId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getNamespace
:: Text
-> GetNamespace
getNamespace pId_ = GetNamespace' {_gnId = pId_}
gnId :: Lens' GetNamespace Text
gnId = lens _gnId (\ s a -> s{_gnId = a})
instance AWSRequest GetNamespace where
type Rs GetNamespace = GetNamespaceResponse
request = postJSON route53AutoNaming
response
= receiveJSON
(\ s h x ->
GetNamespaceResponse' <$>
(x .?> "Namespace") <*> (pure (fromEnum s)))
instance Hashable GetNamespace where
instance NFData GetNamespace where
instance ToHeaders GetNamespace where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Route53AutoNaming_v20170314.GetNamespace" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetNamespace where
toJSON GetNamespace'{..}
= object (catMaybes [Just ("Id" .= _gnId)])
instance ToPath GetNamespace where
toPath = const "/"
instance ToQuery GetNamespace where
toQuery = const mempty
data GetNamespaceResponse = GetNamespaceResponse'
{ _gnrsNamespace :: !(Maybe Namespace)
, _gnrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getNamespaceResponse
:: Int
-> GetNamespaceResponse
getNamespaceResponse pResponseStatus_ =
GetNamespaceResponse'
{_gnrsNamespace = Nothing, _gnrsResponseStatus = pResponseStatus_}
gnrsNamespace :: Lens' GetNamespaceResponse (Maybe Namespace)
gnrsNamespace = lens _gnrsNamespace (\ s a -> s{_gnrsNamespace = a})
gnrsResponseStatus :: Lens' GetNamespaceResponse Int
gnrsResponseStatus = lens _gnrsResponseStatus (\ s a -> s{_gnrsResponseStatus = a})
instance NFData GetNamespaceResponse where