{-# 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.Snowball.CreateAddress
(
createAddress
, CreateAddress
, caAddress
, createAddressResponse
, CreateAddressResponse
, carsAddressId
, carsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Snowball.Types
import Network.AWS.Snowball.Types.Product
newtype CreateAddress = CreateAddress'
{ _caAddress :: Address
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createAddress
:: Address
-> CreateAddress
createAddress pAddress_ = CreateAddress' {_caAddress = pAddress_}
caAddress :: Lens' CreateAddress Address
caAddress = lens _caAddress (\ s a -> s{_caAddress = a})
instance AWSRequest CreateAddress where
type Rs CreateAddress = CreateAddressResponse
request = postJSON snowball
response
= receiveJSON
(\ s h x ->
CreateAddressResponse' <$>
(x .?> "AddressId") <*> (pure (fromEnum s)))
instance Hashable CreateAddress where
instance NFData CreateAddress where
instance ToHeaders CreateAddress where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSIESnowballJobManagementService.CreateAddress" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateAddress where
toJSON CreateAddress'{..}
= object (catMaybes [Just ("Address" .= _caAddress)])
instance ToPath CreateAddress where
toPath = const "/"
instance ToQuery CreateAddress where
toQuery = const mempty
data CreateAddressResponse = CreateAddressResponse'
{ _carsAddressId :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createAddressResponse
:: Int
-> CreateAddressResponse
createAddressResponse pResponseStatus_ =
CreateAddressResponse'
{_carsAddressId = Nothing, _carsResponseStatus = pResponseStatus_}
carsAddressId :: Lens' CreateAddressResponse (Maybe Text)
carsAddressId = lens _carsAddressId (\ s a -> s{_carsAddressId = a})
carsResponseStatus :: Lens' CreateAddressResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a})
instance NFData CreateAddressResponse where