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