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