{-# 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.GetContainerServices
(
GetContainerServices (..),
newGetContainerServices,
getContainerServices_serviceName,
GetContainerServicesResponse (..),
newGetContainerServicesResponse,
getContainerServicesResponse_containerServices,
getContainerServicesResponse_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 GetContainerServices = GetContainerServices'
{
GetContainerServices -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text
}
deriving (GetContainerServices -> GetContainerServices -> Bool
(GetContainerServices -> GetContainerServices -> Bool)
-> (GetContainerServices -> GetContainerServices -> Bool)
-> Eq GetContainerServices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerServices -> GetContainerServices -> Bool
$c/= :: GetContainerServices -> GetContainerServices -> Bool
== :: GetContainerServices -> GetContainerServices -> Bool
$c== :: GetContainerServices -> GetContainerServices -> Bool
Prelude.Eq, ReadPrec [GetContainerServices]
ReadPrec GetContainerServices
Int -> ReadS GetContainerServices
ReadS [GetContainerServices]
(Int -> ReadS GetContainerServices)
-> ReadS [GetContainerServices]
-> ReadPrec GetContainerServices
-> ReadPrec [GetContainerServices]
-> Read GetContainerServices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerServices]
$creadListPrec :: ReadPrec [GetContainerServices]
readPrec :: ReadPrec GetContainerServices
$creadPrec :: ReadPrec GetContainerServices
readList :: ReadS [GetContainerServices]
$creadList :: ReadS [GetContainerServices]
readsPrec :: Int -> ReadS GetContainerServices
$creadsPrec :: Int -> ReadS GetContainerServices
Prelude.Read, Int -> GetContainerServices -> ShowS
[GetContainerServices] -> ShowS
GetContainerServices -> String
(Int -> GetContainerServices -> ShowS)
-> (GetContainerServices -> String)
-> ([GetContainerServices] -> ShowS)
-> Show GetContainerServices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerServices] -> ShowS
$cshowList :: [GetContainerServices] -> ShowS
show :: GetContainerServices -> String
$cshow :: GetContainerServices -> String
showsPrec :: Int -> GetContainerServices -> ShowS
$cshowsPrec :: Int -> GetContainerServices -> ShowS
Prelude.Show, (forall x. GetContainerServices -> Rep GetContainerServices x)
-> (forall x. Rep GetContainerServices x -> GetContainerServices)
-> Generic GetContainerServices
forall x. Rep GetContainerServices x -> GetContainerServices
forall x. GetContainerServices -> Rep GetContainerServices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContainerServices x -> GetContainerServices
$cfrom :: forall x. GetContainerServices -> Rep GetContainerServices x
Prelude.Generic)
newGetContainerServices ::
GetContainerServices
newGetContainerServices :: GetContainerServices
newGetContainerServices =
GetContainerServices' :: Maybe Text -> GetContainerServices
GetContainerServices'
{ $sel:serviceName:GetContainerServices' :: Maybe Text
serviceName =
Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getContainerServices_serviceName :: Lens.Lens' GetContainerServices (Prelude.Maybe Prelude.Text)
getContainerServices_serviceName :: (Maybe Text -> f (Maybe Text))
-> GetContainerServices -> f GetContainerServices
getContainerServices_serviceName = (GetContainerServices -> Maybe Text)
-> (GetContainerServices -> Maybe Text -> GetContainerServices)
-> Lens
GetContainerServices GetContainerServices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerServices' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:GetContainerServices' :: GetContainerServices -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: GetContainerServices
s@GetContainerServices' {} Maybe Text
a -> GetContainerServices
s {$sel:serviceName:GetContainerServices' :: Maybe Text
serviceName = Maybe Text
a} :: GetContainerServices)
instance Core.AWSRequest GetContainerServices where
type
AWSResponse GetContainerServices =
GetContainerServicesResponse
request :: GetContainerServices -> Request GetContainerServices
request = Service -> GetContainerServices -> Request GetContainerServices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetContainerServices
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetContainerServices)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetContainerServices))
-> Logger
-> Service
-> Proxy GetContainerServices
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetContainerServices)))
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 [ContainerService] -> Int -> GetContainerServicesResponse
GetContainerServicesResponse'
(Maybe [ContainerService] -> Int -> GetContainerServicesResponse)
-> Either String (Maybe [ContainerService])
-> Either String (Int -> GetContainerServicesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ContainerService]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerServices"
Either String (Maybe (Maybe [ContainerService]))
-> Maybe [ContainerService]
-> Either String (Maybe [ContainerService])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ContainerService]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetContainerServicesResponse)
-> Either String Int -> Either String GetContainerServicesResponse
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 GetContainerServices
instance Prelude.NFData GetContainerServices
instance Core.ToHeaders GetContainerServices where
toHeaders :: GetContainerServices -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetContainerServices -> 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.GetContainerServices" ::
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 GetContainerServices where
toJSON :: GetContainerServices -> Value
toJSON GetContainerServices' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:GetContainerServices' :: GetContainerServices -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceName]
)
instance Core.ToPath GetContainerServices where
toPath :: GetContainerServices -> ByteString
toPath = ByteString -> GetContainerServices -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetContainerServices where
toQuery :: GetContainerServices -> QueryString
toQuery = QueryString -> GetContainerServices -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetContainerServicesResponse = GetContainerServicesResponse'
{
GetContainerServicesResponse -> Maybe [ContainerService]
containerServices :: Prelude.Maybe [ContainerService],
GetContainerServicesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool
(GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool)
-> (GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool)
-> Eq GetContainerServicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool
$c/= :: GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool
== :: GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool
$c== :: GetContainerServicesResponse
-> GetContainerServicesResponse -> Bool
Prelude.Eq, ReadPrec [GetContainerServicesResponse]
ReadPrec GetContainerServicesResponse
Int -> ReadS GetContainerServicesResponse
ReadS [GetContainerServicesResponse]
(Int -> ReadS GetContainerServicesResponse)
-> ReadS [GetContainerServicesResponse]
-> ReadPrec GetContainerServicesResponse
-> ReadPrec [GetContainerServicesResponse]
-> Read GetContainerServicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerServicesResponse]
$creadListPrec :: ReadPrec [GetContainerServicesResponse]
readPrec :: ReadPrec GetContainerServicesResponse
$creadPrec :: ReadPrec GetContainerServicesResponse
readList :: ReadS [GetContainerServicesResponse]
$creadList :: ReadS [GetContainerServicesResponse]
readsPrec :: Int -> ReadS GetContainerServicesResponse
$creadsPrec :: Int -> ReadS GetContainerServicesResponse
Prelude.Read, Int -> GetContainerServicesResponse -> ShowS
[GetContainerServicesResponse] -> ShowS
GetContainerServicesResponse -> String
(Int -> GetContainerServicesResponse -> ShowS)
-> (GetContainerServicesResponse -> String)
-> ([GetContainerServicesResponse] -> ShowS)
-> Show GetContainerServicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerServicesResponse] -> ShowS
$cshowList :: [GetContainerServicesResponse] -> ShowS
show :: GetContainerServicesResponse -> String
$cshow :: GetContainerServicesResponse -> String
showsPrec :: Int -> GetContainerServicesResponse -> ShowS
$cshowsPrec :: Int -> GetContainerServicesResponse -> ShowS
Prelude.Show, (forall x.
GetContainerServicesResponse -> Rep GetContainerServicesResponse x)
-> (forall x.
Rep GetContainerServicesResponse x -> GetContainerServicesResponse)
-> Generic GetContainerServicesResponse
forall x.
Rep GetContainerServicesResponse x -> GetContainerServicesResponse
forall x.
GetContainerServicesResponse -> Rep GetContainerServicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetContainerServicesResponse x -> GetContainerServicesResponse
$cfrom :: forall x.
GetContainerServicesResponse -> Rep GetContainerServicesResponse x
Prelude.Generic)
newGetContainerServicesResponse ::
Prelude.Int ->
GetContainerServicesResponse
newGetContainerServicesResponse :: Int -> GetContainerServicesResponse
newGetContainerServicesResponse Int
pHttpStatus_ =
GetContainerServicesResponse' :: Maybe [ContainerService] -> Int -> GetContainerServicesResponse
GetContainerServicesResponse'
{ $sel:containerServices:GetContainerServicesResponse' :: Maybe [ContainerService]
containerServices =
Maybe [ContainerService]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetContainerServicesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getContainerServicesResponse_containerServices :: Lens.Lens' GetContainerServicesResponse (Prelude.Maybe [ContainerService])
getContainerServicesResponse_containerServices :: (Maybe [ContainerService] -> f (Maybe [ContainerService]))
-> GetContainerServicesResponse -> f GetContainerServicesResponse
getContainerServicesResponse_containerServices = (GetContainerServicesResponse -> Maybe [ContainerService])
-> (GetContainerServicesResponse
-> Maybe [ContainerService] -> GetContainerServicesResponse)
-> Lens
GetContainerServicesResponse
GetContainerServicesResponse
(Maybe [ContainerService])
(Maybe [ContainerService])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerServicesResponse' {Maybe [ContainerService]
containerServices :: Maybe [ContainerService]
$sel:containerServices:GetContainerServicesResponse' :: GetContainerServicesResponse -> Maybe [ContainerService]
containerServices} -> Maybe [ContainerService]
containerServices) (\s :: GetContainerServicesResponse
s@GetContainerServicesResponse' {} Maybe [ContainerService]
a -> GetContainerServicesResponse
s {$sel:containerServices:GetContainerServicesResponse' :: Maybe [ContainerService]
containerServices = Maybe [ContainerService]
a} :: GetContainerServicesResponse) ((Maybe [ContainerService] -> f (Maybe [ContainerService]))
-> GetContainerServicesResponse -> f GetContainerServicesResponse)
-> ((Maybe [ContainerService] -> f (Maybe [ContainerService]))
-> Maybe [ContainerService] -> f (Maybe [ContainerService]))
-> (Maybe [ContainerService] -> f (Maybe [ContainerService]))
-> GetContainerServicesResponse
-> f GetContainerServicesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ContainerService]
[ContainerService]
[ContainerService]
[ContainerService]
-> Iso
(Maybe [ContainerService])
(Maybe [ContainerService])
(Maybe [ContainerService])
(Maybe [ContainerService])
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 AnIso
[ContainerService]
[ContainerService]
[ContainerService]
[ContainerService]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getContainerServicesResponse_httpStatus :: Lens.Lens' GetContainerServicesResponse Prelude.Int
getContainerServicesResponse_httpStatus :: (Int -> f Int)
-> GetContainerServicesResponse -> f GetContainerServicesResponse
getContainerServicesResponse_httpStatus = (GetContainerServicesResponse -> Int)
-> (GetContainerServicesResponse
-> Int -> GetContainerServicesResponse)
-> Lens
GetContainerServicesResponse GetContainerServicesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerServicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetContainerServicesResponse' :: GetContainerServicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetContainerServicesResponse
s@GetContainerServicesResponse' {} Int
a -> GetContainerServicesResponse
s {$sel:httpStatus:GetContainerServicesResponse' :: Int
httpStatus = Int
a} :: GetContainerServicesResponse)
instance Prelude.NFData GetContainerServicesResponse