{-# 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.Snowball.CreateAddress
(
CreateAddress (..),
newCreateAddress,
createAddress_address,
CreateAddressResponse (..),
newCreateAddressResponse,
createAddressResponse_addressId,
createAddressResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Snowball.Types
data CreateAddress = CreateAddress'
{
CreateAddress -> Address
address :: Address
}
deriving (CreateAddress -> CreateAddress -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAddress -> CreateAddress -> Bool
$c/= :: CreateAddress -> CreateAddress -> Bool
== :: CreateAddress -> CreateAddress -> Bool
$c== :: CreateAddress -> CreateAddress -> Bool
Prelude.Eq, ReadPrec [CreateAddress]
ReadPrec CreateAddress
Int -> ReadS CreateAddress
ReadS [CreateAddress]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAddress]
$creadListPrec :: ReadPrec [CreateAddress]
readPrec :: ReadPrec CreateAddress
$creadPrec :: ReadPrec CreateAddress
readList :: ReadS [CreateAddress]
$creadList :: ReadS [CreateAddress]
readsPrec :: Int -> ReadS CreateAddress
$creadsPrec :: Int -> ReadS CreateAddress
Prelude.Read, Int -> CreateAddress -> ShowS
[CreateAddress] -> ShowS
CreateAddress -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAddress] -> ShowS
$cshowList :: [CreateAddress] -> ShowS
show :: CreateAddress -> String
$cshow :: CreateAddress -> String
showsPrec :: Int -> CreateAddress -> ShowS
$cshowsPrec :: Int -> CreateAddress -> ShowS
Prelude.Show, forall x. Rep CreateAddress x -> CreateAddress
forall x. CreateAddress -> Rep CreateAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAddress x -> CreateAddress
$cfrom :: forall x. CreateAddress -> Rep CreateAddress x
Prelude.Generic)
newCreateAddress ::
Address ->
CreateAddress
newCreateAddress :: Address -> CreateAddress
newCreateAddress Address
pAddress_ =
CreateAddress' {$sel:address:CreateAddress' :: Address
address = Address
pAddress_}
createAddress_address :: Lens.Lens' CreateAddress Address
createAddress_address :: Lens' CreateAddress Address
createAddress_address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddress' {Address
address :: Address
$sel:address:CreateAddress' :: CreateAddress -> Address
address} -> Address
address) (\s :: CreateAddress
s@CreateAddress' {} Address
a -> CreateAddress
s {$sel:address:CreateAddress' :: Address
address = Address
a} :: CreateAddress)
instance Core.AWSRequest CreateAddress where
type
AWSResponse CreateAddress =
CreateAddressResponse
request :: (Service -> Service) -> CreateAddress -> Request CreateAddress
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateAddress
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAddress)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateAddressResponse
CreateAddressResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AddressId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateAddress where
hashWithSalt :: Int -> CreateAddress -> Int
hashWithSalt Int
_salt CreateAddress' {Address
address :: Address
$sel:address:CreateAddress' :: CreateAddress -> Address
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Address
address
instance Prelude.NFData CreateAddress where
rnf :: CreateAddress -> ()
rnf CreateAddress' {Address
address :: Address
$sel:address:CreateAddress' :: CreateAddress -> Address
..} = forall a. NFData a => a -> ()
Prelude.rnf Address
address
instance Data.ToHeaders CreateAddress where
toHeaders :: CreateAddress -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSIESnowballJobManagementService.CreateAddress" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateAddress where
toJSON :: CreateAddress -> Value
toJSON CreateAddress' {Address
address :: Address
$sel:address:CreateAddress' :: CreateAddress -> Address
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Address" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Address
address)]
)
instance Data.ToPath CreateAddress where
toPath :: CreateAddress -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateAddress where
toQuery :: CreateAddress -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateAddressResponse = CreateAddressResponse'
{
CreateAddressResponse -> Maybe Text
addressId :: Prelude.Maybe Prelude.Text,
CreateAddressResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateAddressResponse -> CreateAddressResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAddressResponse -> CreateAddressResponse -> Bool
$c/= :: CreateAddressResponse -> CreateAddressResponse -> Bool
== :: CreateAddressResponse -> CreateAddressResponse -> Bool
$c== :: CreateAddressResponse -> CreateAddressResponse -> Bool
Prelude.Eq, ReadPrec [CreateAddressResponse]
ReadPrec CreateAddressResponse
Int -> ReadS CreateAddressResponse
ReadS [CreateAddressResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAddressResponse]
$creadListPrec :: ReadPrec [CreateAddressResponse]
readPrec :: ReadPrec CreateAddressResponse
$creadPrec :: ReadPrec CreateAddressResponse
readList :: ReadS [CreateAddressResponse]
$creadList :: ReadS [CreateAddressResponse]
readsPrec :: Int -> ReadS CreateAddressResponse
$creadsPrec :: Int -> ReadS CreateAddressResponse
Prelude.Read, Int -> CreateAddressResponse -> ShowS
[CreateAddressResponse] -> ShowS
CreateAddressResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAddressResponse] -> ShowS
$cshowList :: [CreateAddressResponse] -> ShowS
show :: CreateAddressResponse -> String
$cshow :: CreateAddressResponse -> String
showsPrec :: Int -> CreateAddressResponse -> ShowS
$cshowsPrec :: Int -> CreateAddressResponse -> ShowS
Prelude.Show, forall x. Rep CreateAddressResponse x -> CreateAddressResponse
forall x. CreateAddressResponse -> Rep CreateAddressResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAddressResponse x -> CreateAddressResponse
$cfrom :: forall x. CreateAddressResponse -> Rep CreateAddressResponse x
Prelude.Generic)
newCreateAddressResponse ::
Prelude.Int ->
CreateAddressResponse
newCreateAddressResponse :: Int -> CreateAddressResponse
newCreateAddressResponse Int
pHttpStatus_ =
CreateAddressResponse'
{ $sel:addressId:CreateAddressResponse' :: Maybe Text
addressId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateAddressResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createAddressResponse_addressId :: Lens.Lens' CreateAddressResponse (Prelude.Maybe Prelude.Text)
createAddressResponse_addressId :: Lens' CreateAddressResponse (Maybe Text)
createAddressResponse_addressId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressResponse' {Maybe Text
addressId :: Maybe Text
$sel:addressId:CreateAddressResponse' :: CreateAddressResponse -> Maybe Text
addressId} -> Maybe Text
addressId) (\s :: CreateAddressResponse
s@CreateAddressResponse' {} Maybe Text
a -> CreateAddressResponse
s {$sel:addressId:CreateAddressResponse' :: Maybe Text
addressId = Maybe Text
a} :: CreateAddressResponse)
createAddressResponse_httpStatus :: Lens.Lens' CreateAddressResponse Prelude.Int
createAddressResponse_httpStatus :: Lens' CreateAddressResponse Int
createAddressResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddressResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAddressResponse' :: CreateAddressResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAddressResponse
s@CreateAddressResponse' {} Int
a -> CreateAddressResponse
s {$sel:httpStatus:CreateAddressResponse' :: Int
httpStatus = Int
a} :: CreateAddressResponse)
instance Prelude.NFData CreateAddressResponse where
rnf :: CreateAddressResponse -> ()
rnf CreateAddressResponse' {Int
Maybe Text
httpStatus :: Int
addressId :: Maybe Text
$sel:httpStatus:CreateAddressResponse' :: CreateAddressResponse -> Int
$sel:addressId:CreateAddressResponse' :: CreateAddressResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
addressId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus