{-# 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.Lightsail.AttachStaticIp
(
AttachStaticIp (..),
newAttachStaticIp,
attachStaticIp_staticIpName,
attachStaticIp_instanceName,
AttachStaticIpResponse (..),
newAttachStaticIpResponse,
attachStaticIpResponse_operations,
attachStaticIpResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AttachStaticIp = AttachStaticIp'
{
AttachStaticIp -> Text
staticIpName :: Prelude.Text,
AttachStaticIp -> Text
instanceName :: Prelude.Text
}
deriving (AttachStaticIp -> AttachStaticIp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachStaticIp -> AttachStaticIp -> Bool
$c/= :: AttachStaticIp -> AttachStaticIp -> Bool
== :: AttachStaticIp -> AttachStaticIp -> Bool
$c== :: AttachStaticIp -> AttachStaticIp -> Bool
Prelude.Eq, ReadPrec [AttachStaticIp]
ReadPrec AttachStaticIp
Int -> ReadS AttachStaticIp
ReadS [AttachStaticIp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachStaticIp]
$creadListPrec :: ReadPrec [AttachStaticIp]
readPrec :: ReadPrec AttachStaticIp
$creadPrec :: ReadPrec AttachStaticIp
readList :: ReadS [AttachStaticIp]
$creadList :: ReadS [AttachStaticIp]
readsPrec :: Int -> ReadS AttachStaticIp
$creadsPrec :: Int -> ReadS AttachStaticIp
Prelude.Read, Int -> AttachStaticIp -> ShowS
[AttachStaticIp] -> ShowS
AttachStaticIp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachStaticIp] -> ShowS
$cshowList :: [AttachStaticIp] -> ShowS
show :: AttachStaticIp -> String
$cshow :: AttachStaticIp -> String
showsPrec :: Int -> AttachStaticIp -> ShowS
$cshowsPrec :: Int -> AttachStaticIp -> ShowS
Prelude.Show, forall x. Rep AttachStaticIp x -> AttachStaticIp
forall x. AttachStaticIp -> Rep AttachStaticIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachStaticIp x -> AttachStaticIp
$cfrom :: forall x. AttachStaticIp -> Rep AttachStaticIp x
Prelude.Generic)
newAttachStaticIp ::
Prelude.Text ->
Prelude.Text ->
AttachStaticIp
newAttachStaticIp :: Text -> Text -> AttachStaticIp
newAttachStaticIp Text
pStaticIpName_ Text
pInstanceName_ =
AttachStaticIp'
{ $sel:staticIpName:AttachStaticIp' :: Text
staticIpName = Text
pStaticIpName_,
$sel:instanceName:AttachStaticIp' :: Text
instanceName = Text
pInstanceName_
}
attachStaticIp_staticIpName :: Lens.Lens' AttachStaticIp Prelude.Text
attachStaticIp_staticIpName :: Lens' AttachStaticIp Text
attachStaticIp_staticIpName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachStaticIp' {Text
staticIpName :: Text
$sel:staticIpName:AttachStaticIp' :: AttachStaticIp -> Text
staticIpName} -> Text
staticIpName) (\s :: AttachStaticIp
s@AttachStaticIp' {} Text
a -> AttachStaticIp
s {$sel:staticIpName:AttachStaticIp' :: Text
staticIpName = Text
a} :: AttachStaticIp)
attachStaticIp_instanceName :: Lens.Lens' AttachStaticIp Prelude.Text
attachStaticIp_instanceName :: Lens' AttachStaticIp Text
attachStaticIp_instanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachStaticIp' {Text
instanceName :: Text
$sel:instanceName:AttachStaticIp' :: AttachStaticIp -> Text
instanceName} -> Text
instanceName) (\s :: AttachStaticIp
s@AttachStaticIp' {} Text
a -> AttachStaticIp
s {$sel:instanceName:AttachStaticIp' :: Text
instanceName = Text
a} :: AttachStaticIp)
instance Core.AWSRequest AttachStaticIp where
type
AWSResponse AttachStaticIp =
AttachStaticIpResponse
request :: (Service -> Service) -> AttachStaticIp -> Request AttachStaticIp
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 AttachStaticIp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachStaticIp)))
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 [Operation] -> Int -> AttachStaticIpResponse
AttachStaticIpResponse'
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
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 AttachStaticIp where
hashWithSalt :: Int -> AttachStaticIp -> Int
hashWithSalt Int
_salt AttachStaticIp' {Text
instanceName :: Text
staticIpName :: Text
$sel:instanceName:AttachStaticIp' :: AttachStaticIp -> Text
$sel:staticIpName:AttachStaticIp' :: AttachStaticIp -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
staticIpName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceName
instance Prelude.NFData AttachStaticIp where
rnf :: AttachStaticIp -> ()
rnf AttachStaticIp' {Text
instanceName :: Text
staticIpName :: Text
$sel:instanceName:AttachStaticIp' :: AttachStaticIp -> Text
$sel:staticIpName:AttachStaticIp' :: AttachStaticIp -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
staticIpName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceName
instance Data.ToHeaders AttachStaticIp where
toHeaders :: AttachStaticIp -> 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
"Lightsail_20161128.AttachStaticIp" ::
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 AttachStaticIp where
toJSON :: AttachStaticIp -> Value
toJSON AttachStaticIp' {Text
instanceName :: Text
staticIpName :: Text
$sel:instanceName:AttachStaticIp' :: AttachStaticIp -> Text
$sel:staticIpName:AttachStaticIp' :: AttachStaticIp -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"staticIpName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
staticIpName),
forall a. a -> Maybe a
Prelude.Just (Key
"instanceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceName)
]
)
instance Data.ToPath AttachStaticIp where
toPath :: AttachStaticIp -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AttachStaticIp where
toQuery :: AttachStaticIp -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AttachStaticIpResponse = AttachStaticIpResponse'
{
AttachStaticIpResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
AttachStaticIpResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachStaticIpResponse -> AttachStaticIpResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachStaticIpResponse -> AttachStaticIpResponse -> Bool
$c/= :: AttachStaticIpResponse -> AttachStaticIpResponse -> Bool
== :: AttachStaticIpResponse -> AttachStaticIpResponse -> Bool
$c== :: AttachStaticIpResponse -> AttachStaticIpResponse -> Bool
Prelude.Eq, ReadPrec [AttachStaticIpResponse]
ReadPrec AttachStaticIpResponse
Int -> ReadS AttachStaticIpResponse
ReadS [AttachStaticIpResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachStaticIpResponse]
$creadListPrec :: ReadPrec [AttachStaticIpResponse]
readPrec :: ReadPrec AttachStaticIpResponse
$creadPrec :: ReadPrec AttachStaticIpResponse
readList :: ReadS [AttachStaticIpResponse]
$creadList :: ReadS [AttachStaticIpResponse]
readsPrec :: Int -> ReadS AttachStaticIpResponse
$creadsPrec :: Int -> ReadS AttachStaticIpResponse
Prelude.Read, Int -> AttachStaticIpResponse -> ShowS
[AttachStaticIpResponse] -> ShowS
AttachStaticIpResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachStaticIpResponse] -> ShowS
$cshowList :: [AttachStaticIpResponse] -> ShowS
show :: AttachStaticIpResponse -> String
$cshow :: AttachStaticIpResponse -> String
showsPrec :: Int -> AttachStaticIpResponse -> ShowS
$cshowsPrec :: Int -> AttachStaticIpResponse -> ShowS
Prelude.Show, forall x. Rep AttachStaticIpResponse x -> AttachStaticIpResponse
forall x. AttachStaticIpResponse -> Rep AttachStaticIpResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachStaticIpResponse x -> AttachStaticIpResponse
$cfrom :: forall x. AttachStaticIpResponse -> Rep AttachStaticIpResponse x
Prelude.Generic)
newAttachStaticIpResponse ::
Prelude.Int ->
AttachStaticIpResponse
newAttachStaticIpResponse :: Int -> AttachStaticIpResponse
newAttachStaticIpResponse Int
pHttpStatus_ =
AttachStaticIpResponse'
{ $sel:operations:AttachStaticIpResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachStaticIpResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachStaticIpResponse_operations :: Lens.Lens' AttachStaticIpResponse (Prelude.Maybe [Operation])
attachStaticIpResponse_operations :: Lens' AttachStaticIpResponse (Maybe [Operation])
attachStaticIpResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachStaticIpResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:AttachStaticIpResponse' :: AttachStaticIpResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: AttachStaticIpResponse
s@AttachStaticIpResponse' {} Maybe [Operation]
a -> AttachStaticIpResponse
s {$sel:operations:AttachStaticIpResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: AttachStaticIpResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attachStaticIpResponse_httpStatus :: Lens.Lens' AttachStaticIpResponse Prelude.Int
attachStaticIpResponse_httpStatus :: Lens' AttachStaticIpResponse Int
attachStaticIpResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachStaticIpResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachStaticIpResponse' :: AttachStaticIpResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachStaticIpResponse
s@AttachStaticIpResponse' {} Int
a -> AttachStaticIpResponse
s {$sel:httpStatus:AttachStaticIpResponse' :: Int
httpStatus = Int
a} :: AttachStaticIpResponse)
instance Prelude.NFData AttachStaticIpResponse where
rnf :: AttachStaticIpResponse -> ()
rnf AttachStaticIpResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:AttachStaticIpResponse' :: AttachStaticIpResponse -> Int
$sel:operations:AttachStaticIpResponse' :: AttachStaticIpResponse -> Maybe [Operation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus