{-# 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.GetStaticIp
(
GetStaticIp (..),
newGetStaticIp,
getStaticIp_staticIpName,
GetStaticIpResponse (..),
newGetStaticIpResponse,
getStaticIpResponse_staticIp,
getStaticIpResponse_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 GetStaticIp = GetStaticIp'
{
GetStaticIp -> Text
staticIpName :: Prelude.Text
}
deriving (GetStaticIp -> GetStaticIp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStaticIp -> GetStaticIp -> Bool
$c/= :: GetStaticIp -> GetStaticIp -> Bool
== :: GetStaticIp -> GetStaticIp -> Bool
$c== :: GetStaticIp -> GetStaticIp -> Bool
Prelude.Eq, ReadPrec [GetStaticIp]
ReadPrec GetStaticIp
Int -> ReadS GetStaticIp
ReadS [GetStaticIp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStaticIp]
$creadListPrec :: ReadPrec [GetStaticIp]
readPrec :: ReadPrec GetStaticIp
$creadPrec :: ReadPrec GetStaticIp
readList :: ReadS [GetStaticIp]
$creadList :: ReadS [GetStaticIp]
readsPrec :: Int -> ReadS GetStaticIp
$creadsPrec :: Int -> ReadS GetStaticIp
Prelude.Read, Int -> GetStaticIp -> ShowS
[GetStaticIp] -> ShowS
GetStaticIp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStaticIp] -> ShowS
$cshowList :: [GetStaticIp] -> ShowS
show :: GetStaticIp -> String
$cshow :: GetStaticIp -> String
showsPrec :: Int -> GetStaticIp -> ShowS
$cshowsPrec :: Int -> GetStaticIp -> ShowS
Prelude.Show, forall x. Rep GetStaticIp x -> GetStaticIp
forall x. GetStaticIp -> Rep GetStaticIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStaticIp x -> GetStaticIp
$cfrom :: forall x. GetStaticIp -> Rep GetStaticIp x
Prelude.Generic)
newGetStaticIp ::
Prelude.Text ->
GetStaticIp
newGetStaticIp :: Text -> GetStaticIp
newGetStaticIp Text
pStaticIpName_ =
GetStaticIp' {$sel:staticIpName:GetStaticIp' :: Text
staticIpName = Text
pStaticIpName_}
getStaticIp_staticIpName :: Lens.Lens' GetStaticIp Prelude.Text
getStaticIp_staticIpName :: Lens' GetStaticIp Text
getStaticIp_staticIpName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIp' {Text
staticIpName :: Text
$sel:staticIpName:GetStaticIp' :: GetStaticIp -> Text
staticIpName} -> Text
staticIpName) (\s :: GetStaticIp
s@GetStaticIp' {} Text
a -> GetStaticIp
s {$sel:staticIpName:GetStaticIp' :: Text
staticIpName = Text
a} :: GetStaticIp)
instance Core.AWSRequest GetStaticIp where
type AWSResponse GetStaticIp = GetStaticIpResponse
request :: (Service -> Service) -> GetStaticIp -> Request GetStaticIp
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 GetStaticIp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStaticIp)))
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 StaticIp -> Int -> GetStaticIpResponse
GetStaticIpResponse'
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
"staticIp")
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 GetStaticIp where
hashWithSalt :: Int -> GetStaticIp -> Int
hashWithSalt Int
_salt GetStaticIp' {Text
staticIpName :: Text
$sel:staticIpName:GetStaticIp' :: GetStaticIp -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
staticIpName
instance Prelude.NFData GetStaticIp where
rnf :: GetStaticIp -> ()
rnf GetStaticIp' {Text
staticIpName :: Text
$sel:staticIpName:GetStaticIp' :: GetStaticIp -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
staticIpName
instance Data.ToHeaders GetStaticIp where
toHeaders :: GetStaticIp -> 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.GetStaticIp" ::
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 GetStaticIp where
toJSON :: GetStaticIp -> Value
toJSON GetStaticIp' {Text
staticIpName :: Text
$sel:staticIpName:GetStaticIp' :: GetStaticIp -> 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)]
)
instance Data.ToPath GetStaticIp where
toPath :: GetStaticIp -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetStaticIp where
toQuery :: GetStaticIp -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetStaticIpResponse = GetStaticIpResponse'
{
GetStaticIpResponse -> Maybe StaticIp
staticIp :: Prelude.Maybe StaticIp,
GetStaticIpResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStaticIpResponse -> GetStaticIpResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStaticIpResponse -> GetStaticIpResponse -> Bool
$c/= :: GetStaticIpResponse -> GetStaticIpResponse -> Bool
== :: GetStaticIpResponse -> GetStaticIpResponse -> Bool
$c== :: GetStaticIpResponse -> GetStaticIpResponse -> Bool
Prelude.Eq, ReadPrec [GetStaticIpResponse]
ReadPrec GetStaticIpResponse
Int -> ReadS GetStaticIpResponse
ReadS [GetStaticIpResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStaticIpResponse]
$creadListPrec :: ReadPrec [GetStaticIpResponse]
readPrec :: ReadPrec GetStaticIpResponse
$creadPrec :: ReadPrec GetStaticIpResponse
readList :: ReadS [GetStaticIpResponse]
$creadList :: ReadS [GetStaticIpResponse]
readsPrec :: Int -> ReadS GetStaticIpResponse
$creadsPrec :: Int -> ReadS GetStaticIpResponse
Prelude.Read, Int -> GetStaticIpResponse -> ShowS
[GetStaticIpResponse] -> ShowS
GetStaticIpResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStaticIpResponse] -> ShowS
$cshowList :: [GetStaticIpResponse] -> ShowS
show :: GetStaticIpResponse -> String
$cshow :: GetStaticIpResponse -> String
showsPrec :: Int -> GetStaticIpResponse -> ShowS
$cshowsPrec :: Int -> GetStaticIpResponse -> ShowS
Prelude.Show, forall x. Rep GetStaticIpResponse x -> GetStaticIpResponse
forall x. GetStaticIpResponse -> Rep GetStaticIpResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStaticIpResponse x -> GetStaticIpResponse
$cfrom :: forall x. GetStaticIpResponse -> Rep GetStaticIpResponse x
Prelude.Generic)
newGetStaticIpResponse ::
Prelude.Int ->
GetStaticIpResponse
newGetStaticIpResponse :: Int -> GetStaticIpResponse
newGetStaticIpResponse Int
pHttpStatus_ =
GetStaticIpResponse'
{ $sel:staticIp:GetStaticIpResponse' :: Maybe StaticIp
staticIp = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStaticIpResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStaticIpResponse_staticIp :: Lens.Lens' GetStaticIpResponse (Prelude.Maybe StaticIp)
getStaticIpResponse_staticIp :: Lens' GetStaticIpResponse (Maybe StaticIp)
getStaticIpResponse_staticIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIpResponse' {Maybe StaticIp
staticIp :: Maybe StaticIp
$sel:staticIp:GetStaticIpResponse' :: GetStaticIpResponse -> Maybe StaticIp
staticIp} -> Maybe StaticIp
staticIp) (\s :: GetStaticIpResponse
s@GetStaticIpResponse' {} Maybe StaticIp
a -> GetStaticIpResponse
s {$sel:staticIp:GetStaticIpResponse' :: Maybe StaticIp
staticIp = Maybe StaticIp
a} :: GetStaticIpResponse)
getStaticIpResponse_httpStatus :: Lens.Lens' GetStaticIpResponse Prelude.Int
getStaticIpResponse_httpStatus :: Lens' GetStaticIpResponse Int
getStaticIpResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIpResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStaticIpResponse' :: GetStaticIpResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStaticIpResponse
s@GetStaticIpResponse' {} Int
a -> GetStaticIpResponse
s {$sel:httpStatus:GetStaticIpResponse' :: Int
httpStatus = Int
a} :: GetStaticIpResponse)
instance Prelude.NFData GetStaticIpResponse where
rnf :: GetStaticIpResponse -> ()
rnf GetStaticIpResponse' {Int
Maybe StaticIp
httpStatus :: Int
staticIp :: Maybe StaticIp
$sel:httpStatus:GetStaticIpResponse' :: GetStaticIpResponse -> Int
$sel:staticIp:GetStaticIpResponse' :: GetStaticIpResponse -> Maybe StaticIp
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe StaticIp
staticIp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus