{-# 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.ElasticSearch.DescribePackages
(
DescribePackages (..),
newDescribePackages,
describePackages_filters,
describePackages_nextToken,
describePackages_maxResults,
DescribePackagesResponse (..),
newDescribePackagesResponse,
describePackagesResponse_packageDetailsList,
describePackagesResponse_nextToken,
describePackagesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribePackages = DescribePackages'
{
DescribePackages -> Maybe [DescribePackagesFilter]
filters :: Prelude.Maybe [DescribePackagesFilter],
DescribePackages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribePackages -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
}
deriving (DescribePackages -> DescribePackages -> Bool
(DescribePackages -> DescribePackages -> Bool)
-> (DescribePackages -> DescribePackages -> Bool)
-> Eq DescribePackages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePackages -> DescribePackages -> Bool
$c/= :: DescribePackages -> DescribePackages -> Bool
== :: DescribePackages -> DescribePackages -> Bool
$c== :: DescribePackages -> DescribePackages -> Bool
Prelude.Eq, ReadPrec [DescribePackages]
ReadPrec DescribePackages
Int -> ReadS DescribePackages
ReadS [DescribePackages]
(Int -> ReadS DescribePackages)
-> ReadS [DescribePackages]
-> ReadPrec DescribePackages
-> ReadPrec [DescribePackages]
-> Read DescribePackages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePackages]
$creadListPrec :: ReadPrec [DescribePackages]
readPrec :: ReadPrec DescribePackages
$creadPrec :: ReadPrec DescribePackages
readList :: ReadS [DescribePackages]
$creadList :: ReadS [DescribePackages]
readsPrec :: Int -> ReadS DescribePackages
$creadsPrec :: Int -> ReadS DescribePackages
Prelude.Read, Int -> DescribePackages -> ShowS
[DescribePackages] -> ShowS
DescribePackages -> String
(Int -> DescribePackages -> ShowS)
-> (DescribePackages -> String)
-> ([DescribePackages] -> ShowS)
-> Show DescribePackages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePackages] -> ShowS
$cshowList :: [DescribePackages] -> ShowS
show :: DescribePackages -> String
$cshow :: DescribePackages -> String
showsPrec :: Int -> DescribePackages -> ShowS
$cshowsPrec :: Int -> DescribePackages -> ShowS
Prelude.Show, (forall x. DescribePackages -> Rep DescribePackages x)
-> (forall x. Rep DescribePackages x -> DescribePackages)
-> Generic DescribePackages
forall x. Rep DescribePackages x -> DescribePackages
forall x. DescribePackages -> Rep DescribePackages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePackages x -> DescribePackages
$cfrom :: forall x. DescribePackages -> Rep DescribePackages x
Prelude.Generic)
newDescribePackages ::
DescribePackages
newDescribePackages :: DescribePackages
newDescribePackages =
DescribePackages' :: Maybe [DescribePackagesFilter]
-> Maybe Text -> Maybe Int -> DescribePackages
DescribePackages'
{ $sel:filters:DescribePackages' :: Maybe [DescribePackagesFilter]
filters = Maybe [DescribePackagesFilter]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribePackages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:DescribePackages' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
describePackages_filters :: Lens.Lens' DescribePackages (Prelude.Maybe [DescribePackagesFilter])
describePackages_filters :: (Maybe [DescribePackagesFilter]
-> f (Maybe [DescribePackagesFilter]))
-> DescribePackages -> f DescribePackages
describePackages_filters = (DescribePackages -> Maybe [DescribePackagesFilter])
-> (DescribePackages
-> Maybe [DescribePackagesFilter] -> DescribePackages)
-> Lens
DescribePackages
DescribePackages
(Maybe [DescribePackagesFilter])
(Maybe [DescribePackagesFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackages' {Maybe [DescribePackagesFilter]
filters :: Maybe [DescribePackagesFilter]
$sel:filters:DescribePackages' :: DescribePackages -> Maybe [DescribePackagesFilter]
filters} -> Maybe [DescribePackagesFilter]
filters) (\s :: DescribePackages
s@DescribePackages' {} Maybe [DescribePackagesFilter]
a -> DescribePackages
s {$sel:filters:DescribePackages' :: Maybe [DescribePackagesFilter]
filters = Maybe [DescribePackagesFilter]
a} :: DescribePackages) ((Maybe [DescribePackagesFilter]
-> f (Maybe [DescribePackagesFilter]))
-> DescribePackages -> f DescribePackages)
-> ((Maybe [DescribePackagesFilter]
-> f (Maybe [DescribePackagesFilter]))
-> Maybe [DescribePackagesFilter]
-> f (Maybe [DescribePackagesFilter]))
-> (Maybe [DescribePackagesFilter]
-> f (Maybe [DescribePackagesFilter]))
-> DescribePackages
-> f DescribePackages
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DescribePackagesFilter]
[DescribePackagesFilter]
[DescribePackagesFilter]
[DescribePackagesFilter]
-> Iso
(Maybe [DescribePackagesFilter])
(Maybe [DescribePackagesFilter])
(Maybe [DescribePackagesFilter])
(Maybe [DescribePackagesFilter])
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
[DescribePackagesFilter]
[DescribePackagesFilter]
[DescribePackagesFilter]
[DescribePackagesFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describePackages_nextToken :: Lens.Lens' DescribePackages (Prelude.Maybe Prelude.Text)
describePackages_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePackages -> f DescribePackages
describePackages_nextToken = (DescribePackages -> Maybe Text)
-> (DescribePackages -> Maybe Text -> DescribePackages)
-> Lens DescribePackages DescribePackages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePackages' :: DescribePackages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePackages
s@DescribePackages' {} Maybe Text
a -> DescribePackages
s {$sel:nextToken:DescribePackages' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePackages)
describePackages_maxResults :: Lens.Lens' DescribePackages (Prelude.Maybe Prelude.Int)
describePackages_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribePackages -> f DescribePackages
describePackages_maxResults = (DescribePackages -> Maybe Int)
-> (DescribePackages -> Maybe Int -> DescribePackages)
-> Lens DescribePackages DescribePackages (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackages' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribePackages' :: DescribePackages -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribePackages
s@DescribePackages' {} Maybe Int
a -> DescribePackages
s {$sel:maxResults:DescribePackages' :: Maybe Int
maxResults = Maybe Int
a} :: DescribePackages)
instance Core.AWSRequest DescribePackages where
type
AWSResponse DescribePackages =
DescribePackagesResponse
request :: DescribePackages -> Request DescribePackages
request = Service -> DescribePackages -> Request DescribePackages
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribePackages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribePackages)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribePackages))
-> Logger
-> Service
-> Proxy DescribePackages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribePackages)))
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 [PackageDetails]
-> Maybe Text -> Int -> DescribePackagesResponse
DescribePackagesResponse'
(Maybe [PackageDetails]
-> Maybe Text -> Int -> DescribePackagesResponse)
-> Either String (Maybe [PackageDetails])
-> Either String (Maybe Text -> Int -> DescribePackagesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [PackageDetails]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PackageDetailsList"
Either String (Maybe (Maybe [PackageDetails]))
-> Maybe [PackageDetails] -> Either String (Maybe [PackageDetails])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PackageDetails]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> DescribePackagesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribePackagesResponse)
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 -> DescribePackagesResponse)
-> Either String Int -> Either String DescribePackagesResponse
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 DescribePackages
instance Prelude.NFData DescribePackages
instance Core.ToHeaders DescribePackages where
toHeaders :: DescribePackages -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribePackages -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON DescribePackages where
toJSON :: DescribePackages -> Value
toJSON DescribePackages' {Maybe Int
Maybe [DescribePackagesFilter]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [DescribePackagesFilter]
$sel:maxResults:DescribePackages' :: DescribePackages -> Maybe Int
$sel:nextToken:DescribePackages' :: DescribePackages -> Maybe Text
$sel:filters:DescribePackages' :: DescribePackages -> Maybe [DescribePackagesFilter]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Filters" Text -> [DescribePackagesFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([DescribePackagesFilter] -> Pair)
-> Maybe [DescribePackagesFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DescribePackagesFilter]
filters,
(Text
"NextToken" 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
nextToken,
(Text
"MaxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
]
)
instance Core.ToPath DescribePackages where
toPath :: DescribePackages -> ByteString
toPath =
ByteString -> DescribePackages -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2015-01-01/packages/describe"
instance Core.ToQuery DescribePackages where
toQuery :: DescribePackages -> QueryString
toQuery = QueryString -> DescribePackages -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribePackagesResponse = DescribePackagesResponse'
{
DescribePackagesResponse -> Maybe [PackageDetails]
packageDetailsList :: Prelude.Maybe [PackageDetails],
DescribePackagesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribePackagesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribePackagesResponse -> DescribePackagesResponse -> Bool
(DescribePackagesResponse -> DescribePackagesResponse -> Bool)
-> (DescribePackagesResponse -> DescribePackagesResponse -> Bool)
-> Eq DescribePackagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePackagesResponse -> DescribePackagesResponse -> Bool
$c/= :: DescribePackagesResponse -> DescribePackagesResponse -> Bool
== :: DescribePackagesResponse -> DescribePackagesResponse -> Bool
$c== :: DescribePackagesResponse -> DescribePackagesResponse -> Bool
Prelude.Eq, ReadPrec [DescribePackagesResponse]
ReadPrec DescribePackagesResponse
Int -> ReadS DescribePackagesResponse
ReadS [DescribePackagesResponse]
(Int -> ReadS DescribePackagesResponse)
-> ReadS [DescribePackagesResponse]
-> ReadPrec DescribePackagesResponse
-> ReadPrec [DescribePackagesResponse]
-> Read DescribePackagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePackagesResponse]
$creadListPrec :: ReadPrec [DescribePackagesResponse]
readPrec :: ReadPrec DescribePackagesResponse
$creadPrec :: ReadPrec DescribePackagesResponse
readList :: ReadS [DescribePackagesResponse]
$creadList :: ReadS [DescribePackagesResponse]
readsPrec :: Int -> ReadS DescribePackagesResponse
$creadsPrec :: Int -> ReadS DescribePackagesResponse
Prelude.Read, Int -> DescribePackagesResponse -> ShowS
[DescribePackagesResponse] -> ShowS
DescribePackagesResponse -> String
(Int -> DescribePackagesResponse -> ShowS)
-> (DescribePackagesResponse -> String)
-> ([DescribePackagesResponse] -> ShowS)
-> Show DescribePackagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePackagesResponse] -> ShowS
$cshowList :: [DescribePackagesResponse] -> ShowS
show :: DescribePackagesResponse -> String
$cshow :: DescribePackagesResponse -> String
showsPrec :: Int -> DescribePackagesResponse -> ShowS
$cshowsPrec :: Int -> DescribePackagesResponse -> ShowS
Prelude.Show, (forall x.
DescribePackagesResponse -> Rep DescribePackagesResponse x)
-> (forall x.
Rep DescribePackagesResponse x -> DescribePackagesResponse)
-> Generic DescribePackagesResponse
forall x.
Rep DescribePackagesResponse x -> DescribePackagesResponse
forall x.
DescribePackagesResponse -> Rep DescribePackagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePackagesResponse x -> DescribePackagesResponse
$cfrom :: forall x.
DescribePackagesResponse -> Rep DescribePackagesResponse x
Prelude.Generic)
newDescribePackagesResponse ::
Prelude.Int ->
DescribePackagesResponse
newDescribePackagesResponse :: Int -> DescribePackagesResponse
newDescribePackagesResponse Int
pHttpStatus_ =
DescribePackagesResponse' :: Maybe [PackageDetails]
-> Maybe Text -> Int -> DescribePackagesResponse
DescribePackagesResponse'
{ $sel:packageDetailsList:DescribePackagesResponse' :: Maybe [PackageDetails]
packageDetailsList =
Maybe [PackageDetails]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribePackagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribePackagesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describePackagesResponse_packageDetailsList :: Lens.Lens' DescribePackagesResponse (Prelude.Maybe [PackageDetails])
describePackagesResponse_packageDetailsList :: (Maybe [PackageDetails] -> f (Maybe [PackageDetails]))
-> DescribePackagesResponse -> f DescribePackagesResponse
describePackagesResponse_packageDetailsList = (DescribePackagesResponse -> Maybe [PackageDetails])
-> (DescribePackagesResponse
-> Maybe [PackageDetails] -> DescribePackagesResponse)
-> Lens
DescribePackagesResponse
DescribePackagesResponse
(Maybe [PackageDetails])
(Maybe [PackageDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackagesResponse' {Maybe [PackageDetails]
packageDetailsList :: Maybe [PackageDetails]
$sel:packageDetailsList:DescribePackagesResponse' :: DescribePackagesResponse -> Maybe [PackageDetails]
packageDetailsList} -> Maybe [PackageDetails]
packageDetailsList) (\s :: DescribePackagesResponse
s@DescribePackagesResponse' {} Maybe [PackageDetails]
a -> DescribePackagesResponse
s {$sel:packageDetailsList:DescribePackagesResponse' :: Maybe [PackageDetails]
packageDetailsList = Maybe [PackageDetails]
a} :: DescribePackagesResponse) ((Maybe [PackageDetails] -> f (Maybe [PackageDetails]))
-> DescribePackagesResponse -> f DescribePackagesResponse)
-> ((Maybe [PackageDetails] -> f (Maybe [PackageDetails]))
-> Maybe [PackageDetails] -> f (Maybe [PackageDetails]))
-> (Maybe [PackageDetails] -> f (Maybe [PackageDetails]))
-> DescribePackagesResponse
-> f DescribePackagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PackageDetails] [PackageDetails] [PackageDetails] [PackageDetails]
-> Iso
(Maybe [PackageDetails])
(Maybe [PackageDetails])
(Maybe [PackageDetails])
(Maybe [PackageDetails])
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
[PackageDetails] [PackageDetails] [PackageDetails] [PackageDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describePackagesResponse_nextToken :: Lens.Lens' DescribePackagesResponse (Prelude.Maybe Prelude.Text)
describePackagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePackagesResponse -> f DescribePackagesResponse
describePackagesResponse_nextToken = (DescribePackagesResponse -> Maybe Text)
-> (DescribePackagesResponse
-> Maybe Text -> DescribePackagesResponse)
-> Lens
DescribePackagesResponse
DescribePackagesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePackagesResponse' :: DescribePackagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePackagesResponse
s@DescribePackagesResponse' {} Maybe Text
a -> DescribePackagesResponse
s {$sel:nextToken:DescribePackagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePackagesResponse)
describePackagesResponse_httpStatus :: Lens.Lens' DescribePackagesResponse Prelude.Int
describePackagesResponse_httpStatus :: (Int -> f Int)
-> DescribePackagesResponse -> f DescribePackagesResponse
describePackagesResponse_httpStatus = (DescribePackagesResponse -> Int)
-> (DescribePackagesResponse -> Int -> DescribePackagesResponse)
-> Lens DescribePackagesResponse DescribePackagesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePackagesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribePackagesResponse' :: DescribePackagesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribePackagesResponse
s@DescribePackagesResponse' {} Int
a -> DescribePackagesResponse
s {$sel:httpStatus:DescribePackagesResponse' :: Int
httpStatus = Int
a} :: DescribePackagesResponse)
instance Prelude.NFData DescribePackagesResponse