{-# 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.Panorama.ListPackages
(
ListPackages (..),
newListPackages,
listPackages_nextToken,
listPackages_maxResults,
ListPackagesResponse (..),
newListPackagesResponse,
listPackagesResponse_packages,
listPackagesResponse_nextToken,
listPackagesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListPackages = ListPackages'
{
ListPackages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPackages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListPackages -> ListPackages -> Bool
(ListPackages -> ListPackages -> Bool)
-> (ListPackages -> ListPackages -> Bool) -> Eq ListPackages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPackages -> ListPackages -> Bool
$c/= :: ListPackages -> ListPackages -> Bool
== :: ListPackages -> ListPackages -> Bool
$c== :: ListPackages -> ListPackages -> Bool
Prelude.Eq, ReadPrec [ListPackages]
ReadPrec ListPackages
Int -> ReadS ListPackages
ReadS [ListPackages]
(Int -> ReadS ListPackages)
-> ReadS [ListPackages]
-> ReadPrec ListPackages
-> ReadPrec [ListPackages]
-> Read ListPackages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPackages]
$creadListPrec :: ReadPrec [ListPackages]
readPrec :: ReadPrec ListPackages
$creadPrec :: ReadPrec ListPackages
readList :: ReadS [ListPackages]
$creadList :: ReadS [ListPackages]
readsPrec :: Int -> ReadS ListPackages
$creadsPrec :: Int -> ReadS ListPackages
Prelude.Read, Int -> ListPackages -> ShowS
[ListPackages] -> ShowS
ListPackages -> String
(Int -> ListPackages -> ShowS)
-> (ListPackages -> String)
-> ([ListPackages] -> ShowS)
-> Show ListPackages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPackages] -> ShowS
$cshowList :: [ListPackages] -> ShowS
show :: ListPackages -> String
$cshow :: ListPackages -> String
showsPrec :: Int -> ListPackages -> ShowS
$cshowsPrec :: Int -> ListPackages -> ShowS
Prelude.Show, (forall x. ListPackages -> Rep ListPackages x)
-> (forall x. Rep ListPackages x -> ListPackages)
-> Generic ListPackages
forall x. Rep ListPackages x -> ListPackages
forall x. ListPackages -> Rep ListPackages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPackages x -> ListPackages
$cfrom :: forall x. ListPackages -> Rep ListPackages x
Prelude.Generic)
newListPackages ::
ListPackages
newListPackages :: ListPackages
newListPackages =
ListPackages' :: Maybe Text -> Maybe Natural -> ListPackages
ListPackages'
{ $sel:nextToken:ListPackages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListPackages' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listPackages_nextToken :: Lens.Lens' ListPackages (Prelude.Maybe Prelude.Text)
listPackages_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListPackages -> f ListPackages
listPackages_nextToken = (ListPackages -> Maybe Text)
-> (ListPackages -> Maybe Text -> ListPackages)
-> Lens ListPackages ListPackages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPackages' :: ListPackages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPackages
s@ListPackages' {} Maybe Text
a -> ListPackages
s {$sel:nextToken:ListPackages' :: Maybe Text
nextToken = Maybe Text
a} :: ListPackages)
listPackages_maxResults :: Lens.Lens' ListPackages (Prelude.Maybe Prelude.Natural)
listPackages_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPackages -> f ListPackages
listPackages_maxResults = (ListPackages -> Maybe Natural)
-> (ListPackages -> Maybe Natural -> ListPackages)
-> Lens ListPackages ListPackages (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPackages' :: ListPackages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPackages
s@ListPackages' {} Maybe Natural
a -> ListPackages
s {$sel:maxResults:ListPackages' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPackages)
instance Core.AWSRequest ListPackages where
type AWSResponse ListPackages = ListPackagesResponse
request :: ListPackages -> Request ListPackages
request = Service -> ListPackages -> Request ListPackages
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListPackages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPackages)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListPackages))
-> Logger
-> Service
-> Proxy ListPackages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPackages)))
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 [PackageListItem]
-> Maybe Text -> Int -> ListPackagesResponse
ListPackagesResponse'
(Maybe [PackageListItem]
-> Maybe Text -> Int -> ListPackagesResponse)
-> Either String (Maybe [PackageListItem])
-> Either String (Maybe Text -> Int -> ListPackagesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [PackageListItem]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Packages" Either String (Maybe (Maybe [PackageListItem]))
-> Maybe [PackageListItem]
-> Either String (Maybe [PackageListItem])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PackageListItem]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListPackagesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListPackagesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListPackagesResponse)
-> Either String Int -> Either String ListPackagesResponse
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 ListPackages
instance Prelude.NFData ListPackages
instance Core.ToHeaders ListPackages where
toHeaders :: ListPackages -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListPackages -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListPackages where
toPath :: ListPackages -> ByteString
toPath = ByteString -> ListPackages -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/packages"
instance Core.ToQuery ListPackages where
toQuery :: ListPackages -> QueryString
toQuery ListPackages' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListPackages' :: ListPackages -> Maybe Natural
$sel:nextToken:ListPackages' :: ListPackages -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListPackagesResponse = ListPackagesResponse'
{
ListPackagesResponse -> Maybe [PackageListItem]
packages :: Prelude.Maybe [PackageListItem],
ListPackagesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPackagesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListPackagesResponse -> ListPackagesResponse -> Bool
(ListPackagesResponse -> ListPackagesResponse -> Bool)
-> (ListPackagesResponse -> ListPackagesResponse -> Bool)
-> Eq ListPackagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPackagesResponse -> ListPackagesResponse -> Bool
$c/= :: ListPackagesResponse -> ListPackagesResponse -> Bool
== :: ListPackagesResponse -> ListPackagesResponse -> Bool
$c== :: ListPackagesResponse -> ListPackagesResponse -> Bool
Prelude.Eq, ReadPrec [ListPackagesResponse]
ReadPrec ListPackagesResponse
Int -> ReadS ListPackagesResponse
ReadS [ListPackagesResponse]
(Int -> ReadS ListPackagesResponse)
-> ReadS [ListPackagesResponse]
-> ReadPrec ListPackagesResponse
-> ReadPrec [ListPackagesResponse]
-> Read ListPackagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPackagesResponse]
$creadListPrec :: ReadPrec [ListPackagesResponse]
readPrec :: ReadPrec ListPackagesResponse
$creadPrec :: ReadPrec ListPackagesResponse
readList :: ReadS [ListPackagesResponse]
$creadList :: ReadS [ListPackagesResponse]
readsPrec :: Int -> ReadS ListPackagesResponse
$creadsPrec :: Int -> ReadS ListPackagesResponse
Prelude.Read, Int -> ListPackagesResponse -> ShowS
[ListPackagesResponse] -> ShowS
ListPackagesResponse -> String
(Int -> ListPackagesResponse -> ShowS)
-> (ListPackagesResponse -> String)
-> ([ListPackagesResponse] -> ShowS)
-> Show ListPackagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPackagesResponse] -> ShowS
$cshowList :: [ListPackagesResponse] -> ShowS
show :: ListPackagesResponse -> String
$cshow :: ListPackagesResponse -> String
showsPrec :: Int -> ListPackagesResponse -> ShowS
$cshowsPrec :: Int -> ListPackagesResponse -> ShowS
Prelude.Show, (forall x. ListPackagesResponse -> Rep ListPackagesResponse x)
-> (forall x. Rep ListPackagesResponse x -> ListPackagesResponse)
-> Generic ListPackagesResponse
forall x. Rep ListPackagesResponse x -> ListPackagesResponse
forall x. ListPackagesResponse -> Rep ListPackagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPackagesResponse x -> ListPackagesResponse
$cfrom :: forall x. ListPackagesResponse -> Rep ListPackagesResponse x
Prelude.Generic)
newListPackagesResponse ::
Prelude.Int ->
ListPackagesResponse
newListPackagesResponse :: Int -> ListPackagesResponse
newListPackagesResponse Int
pHttpStatus_ =
ListPackagesResponse' :: Maybe [PackageListItem]
-> Maybe Text -> Int -> ListPackagesResponse
ListPackagesResponse'
{ $sel:packages:ListPackagesResponse' :: Maybe [PackageListItem]
packages = Maybe [PackageListItem]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPackagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPackagesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPackagesResponse_packages :: Lens.Lens' ListPackagesResponse (Prelude.Maybe [PackageListItem])
listPackagesResponse_packages :: (Maybe [PackageListItem] -> f (Maybe [PackageListItem]))
-> ListPackagesResponse -> f ListPackagesResponse
listPackagesResponse_packages = (ListPackagesResponse -> Maybe [PackageListItem])
-> (ListPackagesResponse
-> Maybe [PackageListItem] -> ListPackagesResponse)
-> Lens
ListPackagesResponse
ListPackagesResponse
(Maybe [PackageListItem])
(Maybe [PackageListItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackagesResponse' {Maybe [PackageListItem]
packages :: Maybe [PackageListItem]
$sel:packages:ListPackagesResponse' :: ListPackagesResponse -> Maybe [PackageListItem]
packages} -> Maybe [PackageListItem]
packages) (\s :: ListPackagesResponse
s@ListPackagesResponse' {} Maybe [PackageListItem]
a -> ListPackagesResponse
s {$sel:packages:ListPackagesResponse' :: Maybe [PackageListItem]
packages = Maybe [PackageListItem]
a} :: ListPackagesResponse) ((Maybe [PackageListItem] -> f (Maybe [PackageListItem]))
-> ListPackagesResponse -> f ListPackagesResponse)
-> ((Maybe [PackageListItem] -> f (Maybe [PackageListItem]))
-> Maybe [PackageListItem] -> f (Maybe [PackageListItem]))
-> (Maybe [PackageListItem] -> f (Maybe [PackageListItem]))
-> ListPackagesResponse
-> f ListPackagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PackageListItem]
[PackageListItem]
[PackageListItem]
[PackageListItem]
-> Iso
(Maybe [PackageListItem])
(Maybe [PackageListItem])
(Maybe [PackageListItem])
(Maybe [PackageListItem])
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
[PackageListItem]
[PackageListItem]
[PackageListItem]
[PackageListItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listPackagesResponse_nextToken :: Lens.Lens' ListPackagesResponse (Prelude.Maybe Prelude.Text)
listPackagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPackagesResponse -> f ListPackagesResponse
listPackagesResponse_nextToken = (ListPackagesResponse -> Maybe Text)
-> (ListPackagesResponse -> Maybe Text -> ListPackagesResponse)
-> Lens
ListPackagesResponse ListPackagesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPackagesResponse' :: ListPackagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPackagesResponse
s@ListPackagesResponse' {} Maybe Text
a -> ListPackagesResponse
s {$sel:nextToken:ListPackagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPackagesResponse)
listPackagesResponse_httpStatus :: Lens.Lens' ListPackagesResponse Prelude.Int
listPackagesResponse_httpStatus :: (Int -> f Int) -> ListPackagesResponse -> f ListPackagesResponse
listPackagesResponse_httpStatus = (ListPackagesResponse -> Int)
-> (ListPackagesResponse -> Int -> ListPackagesResponse)
-> Lens ListPackagesResponse ListPackagesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPackagesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPackagesResponse' :: ListPackagesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPackagesResponse
s@ListPackagesResponse' {} Int
a -> ListPackagesResponse
s {$sel:httpStatus:ListPackagesResponse' :: Int
httpStatus = Int
a} :: ListPackagesResponse)
instance Prelude.NFData ListPackagesResponse