{-# 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.EC2.AssociateAddress
(
AssociateAddress (..),
newAssociateAddress,
associateAddress_allocationId,
associateAddress_allowReassociation,
associateAddress_dryRun,
associateAddress_instanceId,
associateAddress_networkInterfaceId,
associateAddress_privateIpAddress,
associateAddress_publicIp,
AssociateAddressResponse (..),
newAssociateAddressResponse,
associateAddressResponse_associationId,
associateAddressResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateAddress = AssociateAddress'
{
AssociateAddress -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
AssociateAddress -> Maybe Bool
allowReassociation :: Prelude.Maybe Prelude.Bool,
AssociateAddress -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
AssociateAddress -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
AssociateAddress -> Maybe Text
networkInterfaceId :: Prelude.Maybe Prelude.Text,
AssociateAddress -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text,
AssociateAddress -> Maybe Text
publicIp :: Prelude.Maybe Prelude.Text
}
deriving (AssociateAddress -> AssociateAddress -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateAddress -> AssociateAddress -> Bool
$c/= :: AssociateAddress -> AssociateAddress -> Bool
== :: AssociateAddress -> AssociateAddress -> Bool
$c== :: AssociateAddress -> AssociateAddress -> Bool
Prelude.Eq, ReadPrec [AssociateAddress]
ReadPrec AssociateAddress
Int -> ReadS AssociateAddress
ReadS [AssociateAddress]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateAddress]
$creadListPrec :: ReadPrec [AssociateAddress]
readPrec :: ReadPrec AssociateAddress
$creadPrec :: ReadPrec AssociateAddress
readList :: ReadS [AssociateAddress]
$creadList :: ReadS [AssociateAddress]
readsPrec :: Int -> ReadS AssociateAddress
$creadsPrec :: Int -> ReadS AssociateAddress
Prelude.Read, Int -> AssociateAddress -> ShowS
[AssociateAddress] -> ShowS
AssociateAddress -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateAddress] -> ShowS
$cshowList :: [AssociateAddress] -> ShowS
show :: AssociateAddress -> String
$cshow :: AssociateAddress -> String
showsPrec :: Int -> AssociateAddress -> ShowS
$cshowsPrec :: Int -> AssociateAddress -> ShowS
Prelude.Show, forall x. Rep AssociateAddress x -> AssociateAddress
forall x. AssociateAddress -> Rep AssociateAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateAddress x -> AssociateAddress
$cfrom :: forall x. AssociateAddress -> Rep AssociateAddress x
Prelude.Generic)
newAssociateAddress ::
AssociateAddress
newAssociateAddress :: AssociateAddress
newAssociateAddress =
AssociateAddress'
{ $sel:allocationId:AssociateAddress' :: Maybe Text
allocationId = forall a. Maybe a
Prelude.Nothing,
$sel:allowReassociation:AssociateAddress' :: Maybe Bool
allowReassociation = forall a. Maybe a
Prelude.Nothing,
$sel:dryRun:AssociateAddress' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:AssociateAddress' :: Maybe Text
instanceId = forall a. Maybe a
Prelude.Nothing,
$sel:networkInterfaceId:AssociateAddress' :: Maybe Text
networkInterfaceId = forall a. Maybe a
Prelude.Nothing,
$sel:privateIpAddress:AssociateAddress' :: Maybe Text
privateIpAddress = forall a. Maybe a
Prelude.Nothing,
$sel:publicIp:AssociateAddress' :: Maybe Text
publicIp = forall a. Maybe a
Prelude.Nothing
}
associateAddress_allocationId :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Text)
associateAddress_allocationId :: Lens' AssociateAddress (Maybe Text)
associateAddress_allocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:AssociateAddress' :: AssociateAddress -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Text
a -> AssociateAddress
s {$sel:allocationId:AssociateAddress' :: Maybe Text
allocationId = Maybe Text
a} :: AssociateAddress)
associateAddress_allowReassociation :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Bool)
associateAddress_allowReassociation :: Lens' AssociateAddress (Maybe Bool)
associateAddress_allowReassociation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Bool
allowReassociation :: Maybe Bool
$sel:allowReassociation:AssociateAddress' :: AssociateAddress -> Maybe Bool
allowReassociation} -> Maybe Bool
allowReassociation) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Bool
a -> AssociateAddress
s {$sel:allowReassociation:AssociateAddress' :: Maybe Bool
allowReassociation = Maybe Bool
a} :: AssociateAddress)
associateAddress_dryRun :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Bool)
associateAddress_dryRun :: Lens' AssociateAddress (Maybe Bool)
associateAddress_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:AssociateAddress' :: AssociateAddress -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Bool
a -> AssociateAddress
s {$sel:dryRun:AssociateAddress' :: Maybe Bool
dryRun = Maybe Bool
a} :: AssociateAddress)
associateAddress_instanceId :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Text)
associateAddress_instanceId :: Lens' AssociateAddress (Maybe Text)
associateAddress_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:AssociateAddress' :: AssociateAddress -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Text
a -> AssociateAddress
s {$sel:instanceId:AssociateAddress' :: Maybe Text
instanceId = Maybe Text
a} :: AssociateAddress)
associateAddress_networkInterfaceId :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Text)
associateAddress_networkInterfaceId :: Lens' AssociateAddress (Maybe Text)
associateAddress_networkInterfaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Text
networkInterfaceId :: Maybe Text
$sel:networkInterfaceId:AssociateAddress' :: AssociateAddress -> Maybe Text
networkInterfaceId} -> Maybe Text
networkInterfaceId) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Text
a -> AssociateAddress
s {$sel:networkInterfaceId:AssociateAddress' :: Maybe Text
networkInterfaceId = Maybe Text
a} :: AssociateAddress)
associateAddress_privateIpAddress :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Text)
associateAddress_privateIpAddress :: Lens' AssociateAddress (Maybe Text)
associateAddress_privateIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:AssociateAddress' :: AssociateAddress -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Text
a -> AssociateAddress
s {$sel:privateIpAddress:AssociateAddress' :: Maybe Text
privateIpAddress = Maybe Text
a} :: AssociateAddress)
associateAddress_publicIp :: Lens.Lens' AssociateAddress (Prelude.Maybe Prelude.Text)
associateAddress_publicIp :: Lens' AssociateAddress (Maybe Text)
associateAddress_publicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddress' {Maybe Text
publicIp :: Maybe Text
$sel:publicIp:AssociateAddress' :: AssociateAddress -> Maybe Text
publicIp} -> Maybe Text
publicIp) (\s :: AssociateAddress
s@AssociateAddress' {} Maybe Text
a -> AssociateAddress
s {$sel:publicIp:AssociateAddress' :: Maybe Text
publicIp = Maybe Text
a} :: AssociateAddress)
instance Core.AWSRequest AssociateAddress where
type
AWSResponse AssociateAddress =
AssociateAddressResponse
request :: (Service -> Service)
-> AssociateAddress -> Request AssociateAddress
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateAddress
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateAddress)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> AssociateAddressResponse
AssociateAddressResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"associationId")
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 AssociateAddress where
hashWithSalt :: Int -> AssociateAddress -> Int
hashWithSalt Int
_salt AssociateAddress' {Maybe Bool
Maybe Text
publicIp :: Maybe Text
privateIpAddress :: Maybe Text
networkInterfaceId :: Maybe Text
instanceId :: Maybe Text
dryRun :: Maybe Bool
allowReassociation :: Maybe Bool
allocationId :: Maybe Text
$sel:publicIp:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:privateIpAddress:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:networkInterfaceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:instanceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:dryRun:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allowReassociation:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allocationId:AssociateAddress' :: AssociateAddress -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allocationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowReassociation
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkInterfaceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIpAddress
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicIp
instance Prelude.NFData AssociateAddress where
rnf :: AssociateAddress -> ()
rnf AssociateAddress' {Maybe Bool
Maybe Text
publicIp :: Maybe Text
privateIpAddress :: Maybe Text
networkInterfaceId :: Maybe Text
instanceId :: Maybe Text
dryRun :: Maybe Bool
allowReassociation :: Maybe Bool
allocationId :: Maybe Text
$sel:publicIp:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:privateIpAddress:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:networkInterfaceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:instanceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:dryRun:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allowReassociation:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allocationId:AssociateAddress' :: AssociateAddress -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allocationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowReassociation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkInterfaceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIpAddress
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicIp
instance Data.ToHeaders AssociateAddress where
toHeaders :: AssociateAddress -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath AssociateAddress where
toPath :: AssociateAddress -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AssociateAddress where
toQuery :: AssociateAddress -> QueryString
toQuery AssociateAddress' {Maybe Bool
Maybe Text
publicIp :: Maybe Text
privateIpAddress :: Maybe Text
networkInterfaceId :: Maybe Text
instanceId :: Maybe Text
dryRun :: Maybe Bool
allowReassociation :: Maybe Bool
allocationId :: Maybe Text
$sel:publicIp:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:privateIpAddress:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:networkInterfaceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:instanceId:AssociateAddress' :: AssociateAddress -> Maybe Text
$sel:dryRun:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allowReassociation:AssociateAddress' :: AssociateAddress -> Maybe Bool
$sel:allocationId:AssociateAddress' :: AssociateAddress -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"AssociateAddress" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
ByteString
"AllocationId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
allocationId,
ByteString
"AllowReassociation" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
allowReassociation,
ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
ByteString
"InstanceId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
instanceId,
ByteString
"NetworkInterfaceId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
networkInterfaceId,
ByteString
"PrivateIpAddress" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
privateIpAddress,
ByteString
"PublicIp" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
publicIp
]
data AssociateAddressResponse = AssociateAddressResponse'
{
AssociateAddressResponse -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
AssociateAddressResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateAddressResponse -> AssociateAddressResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateAddressResponse -> AssociateAddressResponse -> Bool
$c/= :: AssociateAddressResponse -> AssociateAddressResponse -> Bool
== :: AssociateAddressResponse -> AssociateAddressResponse -> Bool
$c== :: AssociateAddressResponse -> AssociateAddressResponse -> Bool
Prelude.Eq, ReadPrec [AssociateAddressResponse]
ReadPrec AssociateAddressResponse
Int -> ReadS AssociateAddressResponse
ReadS [AssociateAddressResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateAddressResponse]
$creadListPrec :: ReadPrec [AssociateAddressResponse]
readPrec :: ReadPrec AssociateAddressResponse
$creadPrec :: ReadPrec AssociateAddressResponse
readList :: ReadS [AssociateAddressResponse]
$creadList :: ReadS [AssociateAddressResponse]
readsPrec :: Int -> ReadS AssociateAddressResponse
$creadsPrec :: Int -> ReadS AssociateAddressResponse
Prelude.Read, Int -> AssociateAddressResponse -> ShowS
[AssociateAddressResponse] -> ShowS
AssociateAddressResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateAddressResponse] -> ShowS
$cshowList :: [AssociateAddressResponse] -> ShowS
show :: AssociateAddressResponse -> String
$cshow :: AssociateAddressResponse -> String
showsPrec :: Int -> AssociateAddressResponse -> ShowS
$cshowsPrec :: Int -> AssociateAddressResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateAddressResponse x -> AssociateAddressResponse
forall x.
AssociateAddressResponse -> Rep AssociateAddressResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateAddressResponse x -> AssociateAddressResponse
$cfrom :: forall x.
AssociateAddressResponse -> Rep AssociateAddressResponse x
Prelude.Generic)
newAssociateAddressResponse ::
Prelude.Int ->
AssociateAddressResponse
newAssociateAddressResponse :: Int -> AssociateAddressResponse
newAssociateAddressResponse Int
pHttpStatus_ =
AssociateAddressResponse'
{ $sel:associationId:AssociateAddressResponse' :: Maybe Text
associationId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateAddressResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateAddressResponse_associationId :: Lens.Lens' AssociateAddressResponse (Prelude.Maybe Prelude.Text)
associateAddressResponse_associationId :: Lens' AssociateAddressResponse (Maybe Text)
associateAddressResponse_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddressResponse' {Maybe Text
associationId :: Maybe Text
$sel:associationId:AssociateAddressResponse' :: AssociateAddressResponse -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: AssociateAddressResponse
s@AssociateAddressResponse' {} Maybe Text
a -> AssociateAddressResponse
s {$sel:associationId:AssociateAddressResponse' :: Maybe Text
associationId = Maybe Text
a} :: AssociateAddressResponse)
associateAddressResponse_httpStatus :: Lens.Lens' AssociateAddressResponse Prelude.Int
associateAddressResponse_httpStatus :: Lens' AssociateAddressResponse Int
associateAddressResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAddressResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateAddressResponse' :: AssociateAddressResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateAddressResponse
s@AssociateAddressResponse' {} Int
a -> AssociateAddressResponse
s {$sel:httpStatus:AssociateAddressResponse' :: Int
httpStatus = Int
a} :: AssociateAddressResponse)
instance Prelude.NFData AssociateAddressResponse where
rnf :: AssociateAddressResponse -> ()
rnf AssociateAddressResponse' {Int
Maybe Text
httpStatus :: Int
associationId :: Maybe Text
$sel:httpStatus:AssociateAddressResponse' :: AssociateAddressResponse -> Int
$sel:associationId:AssociateAddressResponse' :: AssociateAddressResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus