{-# 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.Lightsail.CreateDomainEntry
(
createDomainEntry
, CreateDomainEntry
, cdeDomainName
, cdeDomainEntry
, createDomainEntryResponse
, CreateDomainEntryResponse
, cdersOperation
, cdersResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Lightsail.Types
import Network.AWS.Lightsail.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateDomainEntry = CreateDomainEntry'
{ _cdeDomainName :: !Text
, _cdeDomainEntry :: !DomainEntry
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDomainEntry
:: Text
-> DomainEntry
-> CreateDomainEntry
createDomainEntry pDomainName_ pDomainEntry_ =
CreateDomainEntry'
{_cdeDomainName = pDomainName_, _cdeDomainEntry = pDomainEntry_}
cdeDomainName :: Lens' CreateDomainEntry Text
cdeDomainName = lens _cdeDomainName (\ s a -> s{_cdeDomainName = a})
cdeDomainEntry :: Lens' CreateDomainEntry DomainEntry
cdeDomainEntry = lens _cdeDomainEntry (\ s a -> s{_cdeDomainEntry = a})
instance AWSRequest CreateDomainEntry where
type Rs CreateDomainEntry = CreateDomainEntryResponse
request = postJSON lightsail
response
= receiveJSON
(\ s h x ->
CreateDomainEntryResponse' <$>
(x .?> "operation") <*> (pure (fromEnum s)))
instance Hashable CreateDomainEntry where
instance NFData CreateDomainEntry where
instance ToHeaders CreateDomainEntry where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Lightsail_20161128.CreateDomainEntry" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDomainEntry where
toJSON CreateDomainEntry'{..}
= object
(catMaybes
[Just ("domainName" .= _cdeDomainName),
Just ("domainEntry" .= _cdeDomainEntry)])
instance ToPath CreateDomainEntry where
toPath = const "/"
instance ToQuery CreateDomainEntry where
toQuery = const mempty
data CreateDomainEntryResponse = CreateDomainEntryResponse'
{ _cdersOperation :: !(Maybe Operation)
, _cdersResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDomainEntryResponse
:: Int
-> CreateDomainEntryResponse
createDomainEntryResponse pResponseStatus_ =
CreateDomainEntryResponse'
{_cdersOperation = Nothing, _cdersResponseStatus = pResponseStatus_}
cdersOperation :: Lens' CreateDomainEntryResponse (Maybe Operation)
cdersOperation = lens _cdersOperation (\ s a -> s{_cdersOperation = a})
cdersResponseStatus :: Lens' CreateDomainEntryResponse Int
cdersResponseStatus = lens _cdersResponseStatus (\ s a -> s{_cdersResponseStatus = a})
instance NFData CreateDomainEntryResponse where