{-# 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.OpsWorks.RegisterElasticIp
(
RegisterElasticIp (..),
newRegisterElasticIp,
registerElasticIp_elasticIp,
registerElasticIp_stackId,
RegisterElasticIpResponse (..),
newRegisterElasticIpResponse,
registerElasticIpResponse_elasticIp,
registerElasticIpResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RegisterElasticIp = RegisterElasticIp'
{
RegisterElasticIp -> Text
elasticIp :: Prelude.Text,
RegisterElasticIp -> Text
stackId :: Prelude.Text
}
deriving (RegisterElasticIp -> RegisterElasticIp -> Bool
(RegisterElasticIp -> RegisterElasticIp -> Bool)
-> (RegisterElasticIp -> RegisterElasticIp -> Bool)
-> Eq RegisterElasticIp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterElasticIp -> RegisterElasticIp -> Bool
$c/= :: RegisterElasticIp -> RegisterElasticIp -> Bool
== :: RegisterElasticIp -> RegisterElasticIp -> Bool
$c== :: RegisterElasticIp -> RegisterElasticIp -> Bool
Prelude.Eq, ReadPrec [RegisterElasticIp]
ReadPrec RegisterElasticIp
Int -> ReadS RegisterElasticIp
ReadS [RegisterElasticIp]
(Int -> ReadS RegisterElasticIp)
-> ReadS [RegisterElasticIp]
-> ReadPrec RegisterElasticIp
-> ReadPrec [RegisterElasticIp]
-> Read RegisterElasticIp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterElasticIp]
$creadListPrec :: ReadPrec [RegisterElasticIp]
readPrec :: ReadPrec RegisterElasticIp
$creadPrec :: ReadPrec RegisterElasticIp
readList :: ReadS [RegisterElasticIp]
$creadList :: ReadS [RegisterElasticIp]
readsPrec :: Int -> ReadS RegisterElasticIp
$creadsPrec :: Int -> ReadS RegisterElasticIp
Prelude.Read, Int -> RegisterElasticIp -> ShowS
[RegisterElasticIp] -> ShowS
RegisterElasticIp -> String
(Int -> RegisterElasticIp -> ShowS)
-> (RegisterElasticIp -> String)
-> ([RegisterElasticIp] -> ShowS)
-> Show RegisterElasticIp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterElasticIp] -> ShowS
$cshowList :: [RegisterElasticIp] -> ShowS
show :: RegisterElasticIp -> String
$cshow :: RegisterElasticIp -> String
showsPrec :: Int -> RegisterElasticIp -> ShowS
$cshowsPrec :: Int -> RegisterElasticIp -> ShowS
Prelude.Show, (forall x. RegisterElasticIp -> Rep RegisterElasticIp x)
-> (forall x. Rep RegisterElasticIp x -> RegisterElasticIp)
-> Generic RegisterElasticIp
forall x. Rep RegisterElasticIp x -> RegisterElasticIp
forall x. RegisterElasticIp -> Rep RegisterElasticIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterElasticIp x -> RegisterElasticIp
$cfrom :: forall x. RegisterElasticIp -> Rep RegisterElasticIp x
Prelude.Generic)
newRegisterElasticIp ::
Prelude.Text ->
Prelude.Text ->
RegisterElasticIp
newRegisterElasticIp :: Text -> Text -> RegisterElasticIp
newRegisterElasticIp Text
pElasticIp_ Text
pStackId_ =
RegisterElasticIp' :: Text -> Text -> RegisterElasticIp
RegisterElasticIp'
{ $sel:elasticIp:RegisterElasticIp' :: Text
elasticIp = Text
pElasticIp_,
$sel:stackId:RegisterElasticIp' :: Text
stackId = Text
pStackId_
}
registerElasticIp_elasticIp :: Lens.Lens' RegisterElasticIp Prelude.Text
registerElasticIp_elasticIp :: (Text -> f Text) -> RegisterElasticIp -> f RegisterElasticIp
registerElasticIp_elasticIp = (RegisterElasticIp -> Text)
-> (RegisterElasticIp -> Text -> RegisterElasticIp)
-> Lens RegisterElasticIp RegisterElasticIp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterElasticIp' {Text
elasticIp :: Text
$sel:elasticIp:RegisterElasticIp' :: RegisterElasticIp -> Text
elasticIp} -> Text
elasticIp) (\s :: RegisterElasticIp
s@RegisterElasticIp' {} Text
a -> RegisterElasticIp
s {$sel:elasticIp:RegisterElasticIp' :: Text
elasticIp = Text
a} :: RegisterElasticIp)
registerElasticIp_stackId :: Lens.Lens' RegisterElasticIp Prelude.Text
registerElasticIp_stackId :: (Text -> f Text) -> RegisterElasticIp -> f RegisterElasticIp
registerElasticIp_stackId = (RegisterElasticIp -> Text)
-> (RegisterElasticIp -> Text -> RegisterElasticIp)
-> Lens RegisterElasticIp RegisterElasticIp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterElasticIp' {Text
stackId :: Text
$sel:stackId:RegisterElasticIp' :: RegisterElasticIp -> Text
stackId} -> Text
stackId) (\s :: RegisterElasticIp
s@RegisterElasticIp' {} Text
a -> RegisterElasticIp
s {$sel:stackId:RegisterElasticIp' :: Text
stackId = Text
a} :: RegisterElasticIp)
instance Core.AWSRequest RegisterElasticIp where
type
AWSResponse RegisterElasticIp =
RegisterElasticIpResponse
request :: RegisterElasticIp -> Request RegisterElasticIp
request = Service -> RegisterElasticIp -> Request RegisterElasticIp
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterElasticIp
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterElasticIp)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterElasticIp))
-> Logger
-> Service
-> Proxy RegisterElasticIp
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterElasticIp)))
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 Text -> Int -> RegisterElasticIpResponse
RegisterElasticIpResponse'
(Maybe Text -> Int -> RegisterElasticIpResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterElasticIpResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ElasticIp")
Either String (Int -> RegisterElasticIpResponse)
-> Either String Int -> Either String RegisterElasticIpResponse
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 RegisterElasticIp
instance Prelude.NFData RegisterElasticIp
instance Core.ToHeaders RegisterElasticIp where
toHeaders :: RegisterElasticIp -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterElasticIp -> 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
"OpsWorks_20130218.RegisterElasticIp" ::
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 RegisterElasticIp where
toJSON :: RegisterElasticIp -> Value
toJSON RegisterElasticIp' {Text
stackId :: Text
elasticIp :: Text
$sel:stackId:RegisterElasticIp' :: RegisterElasticIp -> Text
$sel:elasticIp:RegisterElasticIp' :: RegisterElasticIp -> 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
"ElasticIp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
elasticIp),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StackId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackId)
]
)
instance Core.ToPath RegisterElasticIp where
toPath :: RegisterElasticIp -> ByteString
toPath = ByteString -> RegisterElasticIp -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterElasticIp where
toQuery :: RegisterElasticIp -> QueryString
toQuery = QueryString -> RegisterElasticIp -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterElasticIpResponse = RegisterElasticIpResponse'
{
RegisterElasticIpResponse -> Maybe Text
elasticIp :: Prelude.Maybe Prelude.Text,
RegisterElasticIpResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool
(RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool)
-> (RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool)
-> Eq RegisterElasticIpResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool
$c/= :: RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool
== :: RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool
$c== :: RegisterElasticIpResponse -> RegisterElasticIpResponse -> Bool
Prelude.Eq, ReadPrec [RegisterElasticIpResponse]
ReadPrec RegisterElasticIpResponse
Int -> ReadS RegisterElasticIpResponse
ReadS [RegisterElasticIpResponse]
(Int -> ReadS RegisterElasticIpResponse)
-> ReadS [RegisterElasticIpResponse]
-> ReadPrec RegisterElasticIpResponse
-> ReadPrec [RegisterElasticIpResponse]
-> Read RegisterElasticIpResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterElasticIpResponse]
$creadListPrec :: ReadPrec [RegisterElasticIpResponse]
readPrec :: ReadPrec RegisterElasticIpResponse
$creadPrec :: ReadPrec RegisterElasticIpResponse
readList :: ReadS [RegisterElasticIpResponse]
$creadList :: ReadS [RegisterElasticIpResponse]
readsPrec :: Int -> ReadS RegisterElasticIpResponse
$creadsPrec :: Int -> ReadS RegisterElasticIpResponse
Prelude.Read, Int -> RegisterElasticIpResponse -> ShowS
[RegisterElasticIpResponse] -> ShowS
RegisterElasticIpResponse -> String
(Int -> RegisterElasticIpResponse -> ShowS)
-> (RegisterElasticIpResponse -> String)
-> ([RegisterElasticIpResponse] -> ShowS)
-> Show RegisterElasticIpResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterElasticIpResponse] -> ShowS
$cshowList :: [RegisterElasticIpResponse] -> ShowS
show :: RegisterElasticIpResponse -> String
$cshow :: RegisterElasticIpResponse -> String
showsPrec :: Int -> RegisterElasticIpResponse -> ShowS
$cshowsPrec :: Int -> RegisterElasticIpResponse -> ShowS
Prelude.Show, (forall x.
RegisterElasticIpResponse -> Rep RegisterElasticIpResponse x)
-> (forall x.
Rep RegisterElasticIpResponse x -> RegisterElasticIpResponse)
-> Generic RegisterElasticIpResponse
forall x.
Rep RegisterElasticIpResponse x -> RegisterElasticIpResponse
forall x.
RegisterElasticIpResponse -> Rep RegisterElasticIpResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterElasticIpResponse x -> RegisterElasticIpResponse
$cfrom :: forall x.
RegisterElasticIpResponse -> Rep RegisterElasticIpResponse x
Prelude.Generic)
newRegisterElasticIpResponse ::
Prelude.Int ->
RegisterElasticIpResponse
newRegisterElasticIpResponse :: Int -> RegisterElasticIpResponse
newRegisterElasticIpResponse Int
pHttpStatus_ =
RegisterElasticIpResponse' :: Maybe Text -> Int -> RegisterElasticIpResponse
RegisterElasticIpResponse'
{ $sel:elasticIp:RegisterElasticIpResponse' :: Maybe Text
elasticIp =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterElasticIpResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerElasticIpResponse_elasticIp :: Lens.Lens' RegisterElasticIpResponse (Prelude.Maybe Prelude.Text)
registerElasticIpResponse_elasticIp :: (Maybe Text -> f (Maybe Text))
-> RegisterElasticIpResponse -> f RegisterElasticIpResponse
registerElasticIpResponse_elasticIp = (RegisterElasticIpResponse -> Maybe Text)
-> (RegisterElasticIpResponse
-> Maybe Text -> RegisterElasticIpResponse)
-> Lens
RegisterElasticIpResponse
RegisterElasticIpResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterElasticIpResponse' {Maybe Text
elasticIp :: Maybe Text
$sel:elasticIp:RegisterElasticIpResponse' :: RegisterElasticIpResponse -> Maybe Text
elasticIp} -> Maybe Text
elasticIp) (\s :: RegisterElasticIpResponse
s@RegisterElasticIpResponse' {} Maybe Text
a -> RegisterElasticIpResponse
s {$sel:elasticIp:RegisterElasticIpResponse' :: Maybe Text
elasticIp = Maybe Text
a} :: RegisterElasticIpResponse)
registerElasticIpResponse_httpStatus :: Lens.Lens' RegisterElasticIpResponse Prelude.Int
registerElasticIpResponse_httpStatus :: (Int -> f Int)
-> RegisterElasticIpResponse -> f RegisterElasticIpResponse
registerElasticIpResponse_httpStatus = (RegisterElasticIpResponse -> Int)
-> (RegisterElasticIpResponse -> Int -> RegisterElasticIpResponse)
-> Lens RegisterElasticIpResponse RegisterElasticIpResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterElasticIpResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterElasticIpResponse' :: RegisterElasticIpResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterElasticIpResponse
s@RegisterElasticIpResponse' {} Int
a -> RegisterElasticIpResponse
s {$sel:httpStatus:RegisterElasticIpResponse' :: Int
httpStatus = Int
a} :: RegisterElasticIpResponse)
instance Prelude.NFData RegisterElasticIpResponse