{-# 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.LicenseManager.ListLicenseVersions
(
ListLicenseVersions (..),
newListLicenseVersions,
listLicenseVersions_nextToken,
listLicenseVersions_maxResults,
listLicenseVersions_licenseArn,
ListLicenseVersionsResponse (..),
newListLicenseVersionsResponse,
listLicenseVersionsResponse_nextToken,
listLicenseVersionsResponse_licenses,
listLicenseVersionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListLicenseVersions = ListLicenseVersions'
{
ListLicenseVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListLicenseVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListLicenseVersions -> Text
licenseArn :: Prelude.Text
}
deriving (ListLicenseVersions -> ListLicenseVersions -> Bool
(ListLicenseVersions -> ListLicenseVersions -> Bool)
-> (ListLicenseVersions -> ListLicenseVersions -> Bool)
-> Eq ListLicenseVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLicenseVersions -> ListLicenseVersions -> Bool
$c/= :: ListLicenseVersions -> ListLicenseVersions -> Bool
== :: ListLicenseVersions -> ListLicenseVersions -> Bool
$c== :: ListLicenseVersions -> ListLicenseVersions -> Bool
Prelude.Eq, ReadPrec [ListLicenseVersions]
ReadPrec ListLicenseVersions
Int -> ReadS ListLicenseVersions
ReadS [ListLicenseVersions]
(Int -> ReadS ListLicenseVersions)
-> ReadS [ListLicenseVersions]
-> ReadPrec ListLicenseVersions
-> ReadPrec [ListLicenseVersions]
-> Read ListLicenseVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLicenseVersions]
$creadListPrec :: ReadPrec [ListLicenseVersions]
readPrec :: ReadPrec ListLicenseVersions
$creadPrec :: ReadPrec ListLicenseVersions
readList :: ReadS [ListLicenseVersions]
$creadList :: ReadS [ListLicenseVersions]
readsPrec :: Int -> ReadS ListLicenseVersions
$creadsPrec :: Int -> ReadS ListLicenseVersions
Prelude.Read, Int -> ListLicenseVersions -> ShowS
[ListLicenseVersions] -> ShowS
ListLicenseVersions -> String
(Int -> ListLicenseVersions -> ShowS)
-> (ListLicenseVersions -> String)
-> ([ListLicenseVersions] -> ShowS)
-> Show ListLicenseVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLicenseVersions] -> ShowS
$cshowList :: [ListLicenseVersions] -> ShowS
show :: ListLicenseVersions -> String
$cshow :: ListLicenseVersions -> String
showsPrec :: Int -> ListLicenseVersions -> ShowS
$cshowsPrec :: Int -> ListLicenseVersions -> ShowS
Prelude.Show, (forall x. ListLicenseVersions -> Rep ListLicenseVersions x)
-> (forall x. Rep ListLicenseVersions x -> ListLicenseVersions)
-> Generic ListLicenseVersions
forall x. Rep ListLicenseVersions x -> ListLicenseVersions
forall x. ListLicenseVersions -> Rep ListLicenseVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLicenseVersions x -> ListLicenseVersions
$cfrom :: forall x. ListLicenseVersions -> Rep ListLicenseVersions x
Prelude.Generic)
newListLicenseVersions ::
Prelude.Text ->
ListLicenseVersions
newListLicenseVersions :: Text -> ListLicenseVersions
newListLicenseVersions Text
pLicenseArn_ =
ListLicenseVersions' :: Maybe Text -> Maybe Natural -> Text -> ListLicenseVersions
ListLicenseVersions'
{ $sel:nextToken:ListLicenseVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListLicenseVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:licenseArn:ListLicenseVersions' :: Text
licenseArn = Text
pLicenseArn_
}
listLicenseVersions_nextToken :: Lens.Lens' ListLicenseVersions (Prelude.Maybe Prelude.Text)
listLicenseVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLicenseVersions -> f ListLicenseVersions
listLicenseVersions_nextToken = (ListLicenseVersions -> Maybe Text)
-> (ListLicenseVersions -> Maybe Text -> ListLicenseVersions)
-> Lens
ListLicenseVersions ListLicenseVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLicenseVersions' :: ListLicenseVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLicenseVersions
s@ListLicenseVersions' {} Maybe Text
a -> ListLicenseVersions
s {$sel:nextToken:ListLicenseVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListLicenseVersions)
listLicenseVersions_maxResults :: Lens.Lens' ListLicenseVersions (Prelude.Maybe Prelude.Natural)
listLicenseVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListLicenseVersions -> f ListLicenseVersions
listLicenseVersions_maxResults = (ListLicenseVersions -> Maybe Natural)
-> (ListLicenseVersions -> Maybe Natural -> ListLicenseVersions)
-> Lens
ListLicenseVersions
ListLicenseVersions
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListLicenseVersions' :: ListLicenseVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListLicenseVersions
s@ListLicenseVersions' {} Maybe Natural
a -> ListLicenseVersions
s {$sel:maxResults:ListLicenseVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListLicenseVersions)
listLicenseVersions_licenseArn :: Lens.Lens' ListLicenseVersions Prelude.Text
listLicenseVersions_licenseArn :: (Text -> f Text) -> ListLicenseVersions -> f ListLicenseVersions
listLicenseVersions_licenseArn = (ListLicenseVersions -> Text)
-> (ListLicenseVersions -> Text -> ListLicenseVersions)
-> Lens ListLicenseVersions ListLicenseVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersions' {Text
licenseArn :: Text
$sel:licenseArn:ListLicenseVersions' :: ListLicenseVersions -> Text
licenseArn} -> Text
licenseArn) (\s :: ListLicenseVersions
s@ListLicenseVersions' {} Text
a -> ListLicenseVersions
s {$sel:licenseArn:ListLicenseVersions' :: Text
licenseArn = Text
a} :: ListLicenseVersions)
instance Core.AWSRequest ListLicenseVersions where
type
AWSResponse ListLicenseVersions =
ListLicenseVersionsResponse
request :: ListLicenseVersions -> Request ListLicenseVersions
request = Service -> ListLicenseVersions -> Request ListLicenseVersions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListLicenseVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListLicenseVersions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListLicenseVersions))
-> Logger
-> Service
-> Proxy ListLicenseVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListLicenseVersions)))
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 Text -> Maybe [License] -> Int -> ListLicenseVersionsResponse
ListLicenseVersionsResponse'
(Maybe Text
-> Maybe [License] -> Int -> ListLicenseVersionsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [License] -> Int -> ListLicenseVersionsResponse)
forall (f :: * -> *) a b. Functor 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 (Maybe [License] -> Int -> ListLicenseVersionsResponse)
-> Either String (Maybe [License])
-> Either String (Int -> ListLicenseVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [License]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Licenses" Either String (Maybe (Maybe [License]))
-> Maybe [License] -> Either String (Maybe [License])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [License]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListLicenseVersionsResponse)
-> Either String Int -> Either String ListLicenseVersionsResponse
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 ListLicenseVersions
instance Prelude.NFData ListLicenseVersions
instance Core.ToHeaders ListLicenseVersions where
toHeaders :: ListLicenseVersions -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListLicenseVersions -> 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
"AWSLicenseManager.ListLicenseVersions" ::
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 ListLicenseVersions where
toJSON :: ListLicenseVersions -> Value
toJSON ListLicenseVersions' {Maybe Natural
Maybe Text
Text
licenseArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:licenseArn:ListLicenseVersions' :: ListLicenseVersions -> Text
$sel:maxResults:ListLicenseVersions' :: ListLicenseVersions -> Maybe Natural
$sel:nextToken:ListLicenseVersions' :: ListLicenseVersions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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 -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LicenseArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseArn)
]
)
instance Core.ToPath ListLicenseVersions where
toPath :: ListLicenseVersions -> ByteString
toPath = ByteString -> ListLicenseVersions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListLicenseVersions where
toQuery :: ListLicenseVersions -> QueryString
toQuery = QueryString -> ListLicenseVersions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListLicenseVersionsResponse = ListLicenseVersionsResponse'
{
ListLicenseVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListLicenseVersionsResponse -> Maybe [License]
licenses :: Prelude.Maybe [License],
ListLicenseVersionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListLicenseVersionsResponse -> ListLicenseVersionsResponse -> Bool
(ListLicenseVersionsResponse
-> ListLicenseVersionsResponse -> Bool)
-> (ListLicenseVersionsResponse
-> ListLicenseVersionsResponse -> Bool)
-> Eq ListLicenseVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLicenseVersionsResponse -> ListLicenseVersionsResponse -> Bool
$c/= :: ListLicenseVersionsResponse -> ListLicenseVersionsResponse -> Bool
== :: ListLicenseVersionsResponse -> ListLicenseVersionsResponse -> Bool
$c== :: ListLicenseVersionsResponse -> ListLicenseVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListLicenseVersionsResponse]
ReadPrec ListLicenseVersionsResponse
Int -> ReadS ListLicenseVersionsResponse
ReadS [ListLicenseVersionsResponse]
(Int -> ReadS ListLicenseVersionsResponse)
-> ReadS [ListLicenseVersionsResponse]
-> ReadPrec ListLicenseVersionsResponse
-> ReadPrec [ListLicenseVersionsResponse]
-> Read ListLicenseVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLicenseVersionsResponse]
$creadListPrec :: ReadPrec [ListLicenseVersionsResponse]
readPrec :: ReadPrec ListLicenseVersionsResponse
$creadPrec :: ReadPrec ListLicenseVersionsResponse
readList :: ReadS [ListLicenseVersionsResponse]
$creadList :: ReadS [ListLicenseVersionsResponse]
readsPrec :: Int -> ReadS ListLicenseVersionsResponse
$creadsPrec :: Int -> ReadS ListLicenseVersionsResponse
Prelude.Read, Int -> ListLicenseVersionsResponse -> ShowS
[ListLicenseVersionsResponse] -> ShowS
ListLicenseVersionsResponse -> String
(Int -> ListLicenseVersionsResponse -> ShowS)
-> (ListLicenseVersionsResponse -> String)
-> ([ListLicenseVersionsResponse] -> ShowS)
-> Show ListLicenseVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLicenseVersionsResponse] -> ShowS
$cshowList :: [ListLicenseVersionsResponse] -> ShowS
show :: ListLicenseVersionsResponse -> String
$cshow :: ListLicenseVersionsResponse -> String
showsPrec :: Int -> ListLicenseVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListLicenseVersionsResponse -> ShowS
Prelude.Show, (forall x.
ListLicenseVersionsResponse -> Rep ListLicenseVersionsResponse x)
-> (forall x.
Rep ListLicenseVersionsResponse x -> ListLicenseVersionsResponse)
-> Generic ListLicenseVersionsResponse
forall x.
Rep ListLicenseVersionsResponse x -> ListLicenseVersionsResponse
forall x.
ListLicenseVersionsResponse -> Rep ListLicenseVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListLicenseVersionsResponse x -> ListLicenseVersionsResponse
$cfrom :: forall x.
ListLicenseVersionsResponse -> Rep ListLicenseVersionsResponse x
Prelude.Generic)
newListLicenseVersionsResponse ::
Prelude.Int ->
ListLicenseVersionsResponse
newListLicenseVersionsResponse :: Int -> ListLicenseVersionsResponse
newListLicenseVersionsResponse Int
pHttpStatus_ =
ListLicenseVersionsResponse' :: Maybe Text -> Maybe [License] -> Int -> ListLicenseVersionsResponse
ListLicenseVersionsResponse'
{ $sel:nextToken:ListLicenseVersionsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:licenses:ListLicenseVersionsResponse' :: Maybe [License]
licenses = Maybe [License]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListLicenseVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listLicenseVersionsResponse_nextToken :: Lens.Lens' ListLicenseVersionsResponse (Prelude.Maybe Prelude.Text)
listLicenseVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLicenseVersionsResponse -> f ListLicenseVersionsResponse
listLicenseVersionsResponse_nextToken = (ListLicenseVersionsResponse -> Maybe Text)
-> (ListLicenseVersionsResponse
-> Maybe Text -> ListLicenseVersionsResponse)
-> Lens
ListLicenseVersionsResponse
ListLicenseVersionsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLicenseVersionsResponse' :: ListLicenseVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLicenseVersionsResponse
s@ListLicenseVersionsResponse' {} Maybe Text
a -> ListLicenseVersionsResponse
s {$sel:nextToken:ListLicenseVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLicenseVersionsResponse)
listLicenseVersionsResponse_licenses :: Lens.Lens' ListLicenseVersionsResponse (Prelude.Maybe [License])
listLicenseVersionsResponse_licenses :: (Maybe [License] -> f (Maybe [License]))
-> ListLicenseVersionsResponse -> f ListLicenseVersionsResponse
listLicenseVersionsResponse_licenses = (ListLicenseVersionsResponse -> Maybe [License])
-> (ListLicenseVersionsResponse
-> Maybe [License] -> ListLicenseVersionsResponse)
-> Lens
ListLicenseVersionsResponse
ListLicenseVersionsResponse
(Maybe [License])
(Maybe [License])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersionsResponse' {Maybe [License]
licenses :: Maybe [License]
$sel:licenses:ListLicenseVersionsResponse' :: ListLicenseVersionsResponse -> Maybe [License]
licenses} -> Maybe [License]
licenses) (\s :: ListLicenseVersionsResponse
s@ListLicenseVersionsResponse' {} Maybe [License]
a -> ListLicenseVersionsResponse
s {$sel:licenses:ListLicenseVersionsResponse' :: Maybe [License]
licenses = Maybe [License]
a} :: ListLicenseVersionsResponse) ((Maybe [License] -> f (Maybe [License]))
-> ListLicenseVersionsResponse -> f ListLicenseVersionsResponse)
-> ((Maybe [License] -> f (Maybe [License]))
-> Maybe [License] -> f (Maybe [License]))
-> (Maybe [License] -> f (Maybe [License]))
-> ListLicenseVersionsResponse
-> f ListLicenseVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [License] [License] [License] [License]
-> Iso
(Maybe [License])
(Maybe [License])
(Maybe [License])
(Maybe [License])
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 [License] [License] [License] [License]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listLicenseVersionsResponse_httpStatus :: Lens.Lens' ListLicenseVersionsResponse Prelude.Int
listLicenseVersionsResponse_httpStatus :: (Int -> f Int)
-> ListLicenseVersionsResponse -> f ListLicenseVersionsResponse
listLicenseVersionsResponse_httpStatus = (ListLicenseVersionsResponse -> Int)
-> (ListLicenseVersionsResponse
-> Int -> ListLicenseVersionsResponse)
-> Lens
ListLicenseVersionsResponse ListLicenseVersionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLicenseVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListLicenseVersionsResponse' :: ListLicenseVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListLicenseVersionsResponse
s@ListLicenseVersionsResponse' {} Int
a -> ListLicenseVersionsResponse
s {$sel:httpStatus:ListLicenseVersionsResponse' :: Int
httpStatus = Int
a} :: ListLicenseVersionsResponse)
instance Prelude.NFData ListLicenseVersionsResponse