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