{-# 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.RAM.ListResourceTypes
(
ListResourceTypes (..),
newListResourceTypes,
listResourceTypes_nextToken,
listResourceTypes_maxResults,
ListResourceTypesResponse (..),
newListResourceTypesResponse,
listResourceTypesResponse_nextToken,
listResourceTypesResponse_resourceTypes,
listResourceTypesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RAM.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListResourceTypes = ListResourceTypes'
{
ListResourceTypes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListResourceTypes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListResourceTypes -> ListResourceTypes -> Bool
(ListResourceTypes -> ListResourceTypes -> Bool)
-> (ListResourceTypes -> ListResourceTypes -> Bool)
-> Eq ListResourceTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceTypes -> ListResourceTypes -> Bool
$c/= :: ListResourceTypes -> ListResourceTypes -> Bool
== :: ListResourceTypes -> ListResourceTypes -> Bool
$c== :: ListResourceTypes -> ListResourceTypes -> Bool
Prelude.Eq, ReadPrec [ListResourceTypes]
ReadPrec ListResourceTypes
Int -> ReadS ListResourceTypes
ReadS [ListResourceTypes]
(Int -> ReadS ListResourceTypes)
-> ReadS [ListResourceTypes]
-> ReadPrec ListResourceTypes
-> ReadPrec [ListResourceTypes]
-> Read ListResourceTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceTypes]
$creadListPrec :: ReadPrec [ListResourceTypes]
readPrec :: ReadPrec ListResourceTypes
$creadPrec :: ReadPrec ListResourceTypes
readList :: ReadS [ListResourceTypes]
$creadList :: ReadS [ListResourceTypes]
readsPrec :: Int -> ReadS ListResourceTypes
$creadsPrec :: Int -> ReadS ListResourceTypes
Prelude.Read, Int -> ListResourceTypes -> ShowS
[ListResourceTypes] -> ShowS
ListResourceTypes -> String
(Int -> ListResourceTypes -> ShowS)
-> (ListResourceTypes -> String)
-> ([ListResourceTypes] -> ShowS)
-> Show ListResourceTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceTypes] -> ShowS
$cshowList :: [ListResourceTypes] -> ShowS
show :: ListResourceTypes -> String
$cshow :: ListResourceTypes -> String
showsPrec :: Int -> ListResourceTypes -> ShowS
$cshowsPrec :: Int -> ListResourceTypes -> ShowS
Prelude.Show, (forall x. ListResourceTypes -> Rep ListResourceTypes x)
-> (forall x. Rep ListResourceTypes x -> ListResourceTypes)
-> Generic ListResourceTypes
forall x. Rep ListResourceTypes x -> ListResourceTypes
forall x. ListResourceTypes -> Rep ListResourceTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourceTypes x -> ListResourceTypes
$cfrom :: forall x. ListResourceTypes -> Rep ListResourceTypes x
Prelude.Generic)
newListResourceTypes ::
ListResourceTypes
newListResourceTypes :: ListResourceTypes
newListResourceTypes =
ListResourceTypes' :: Maybe Text -> Maybe Natural -> ListResourceTypes
ListResourceTypes'
{ $sel:nextToken:ListResourceTypes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListResourceTypes' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listResourceTypes_nextToken :: Lens.Lens' ListResourceTypes (Prelude.Maybe Prelude.Text)
listResourceTypes_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceTypes -> f ListResourceTypes
listResourceTypes_nextToken = (ListResourceTypes -> Maybe Text)
-> (ListResourceTypes -> Maybe Text -> ListResourceTypes)
-> Lens
ListResourceTypes ListResourceTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceTypes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceTypes' :: ListResourceTypes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceTypes
s@ListResourceTypes' {} Maybe Text
a -> ListResourceTypes
s {$sel:nextToken:ListResourceTypes' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceTypes)
listResourceTypes_maxResults :: Lens.Lens' ListResourceTypes (Prelude.Maybe Prelude.Natural)
listResourceTypes_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResourceTypes -> f ListResourceTypes
listResourceTypes_maxResults = (ListResourceTypes -> Maybe Natural)
-> (ListResourceTypes -> Maybe Natural -> ListResourceTypes)
-> Lens
ListResourceTypes ListResourceTypes (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceTypes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResourceTypes' :: ListResourceTypes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResourceTypes
s@ListResourceTypes' {} Maybe Natural
a -> ListResourceTypes
s {$sel:maxResults:ListResourceTypes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResourceTypes)
instance Core.AWSRequest ListResourceTypes where
type
AWSResponse ListResourceTypes =
ListResourceTypesResponse
request :: ListResourceTypes -> Request ListResourceTypes
request = Service -> ListResourceTypes -> Request ListResourceTypes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListResourceTypes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListResourceTypes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListResourceTypes))
-> Logger
-> Service
-> Proxy ListResourceTypes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListResourceTypes)))
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 [ServiceNameAndResourceType]
-> Int
-> ListResourceTypesResponse
ListResourceTypesResponse'
(Maybe Text
-> Maybe [ServiceNameAndResourceType]
-> Int
-> ListResourceTypesResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [ServiceNameAndResourceType]
-> Int -> ListResourceTypesResponse)
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 [ServiceNameAndResourceType]
-> Int -> ListResourceTypesResponse)
-> Either String (Maybe [ServiceNameAndResourceType])
-> Either String (Int -> ListResourceTypesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Either String (Maybe (Maybe [ServiceNameAndResourceType]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceTypes" Either String (Maybe (Maybe [ServiceNameAndResourceType]))
-> Maybe [ServiceNameAndResourceType]
-> Either String (Maybe [ServiceNameAndResourceType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ServiceNameAndResourceType]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListResourceTypesResponse)
-> Either String Int -> Either String ListResourceTypesResponse
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 ListResourceTypes
instance Prelude.NFData ListResourceTypes
instance Core.ToHeaders ListResourceTypes where
toHeaders :: ListResourceTypes -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListResourceTypes -> 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.ToJSON ListResourceTypes where
toJSON :: ListResourceTypes -> Value
toJSON ListResourceTypes' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListResourceTypes' :: ListResourceTypes -> Maybe Natural
$sel:nextToken:ListResourceTypes' :: ListResourceTypes -> 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
]
)
instance Core.ToPath ListResourceTypes where
toPath :: ListResourceTypes -> ByteString
toPath = ByteString -> ListResourceTypes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/listresourcetypes"
instance Core.ToQuery ListResourceTypes where
toQuery :: ListResourceTypes -> QueryString
toQuery = QueryString -> ListResourceTypes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListResourceTypesResponse = ListResourceTypesResponse'
{
ListResourceTypesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListResourceTypesResponse -> Maybe [ServiceNameAndResourceType]
resourceTypes :: Prelude.Maybe [ServiceNameAndResourceType],
ListResourceTypesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListResourceTypesResponse -> ListResourceTypesResponse -> Bool
(ListResourceTypesResponse -> ListResourceTypesResponse -> Bool)
-> (ListResourceTypesResponse -> ListResourceTypesResponse -> Bool)
-> Eq ListResourceTypesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceTypesResponse -> ListResourceTypesResponse -> Bool
$c/= :: ListResourceTypesResponse -> ListResourceTypesResponse -> Bool
== :: ListResourceTypesResponse -> ListResourceTypesResponse -> Bool
$c== :: ListResourceTypesResponse -> ListResourceTypesResponse -> Bool
Prelude.Eq, ReadPrec [ListResourceTypesResponse]
ReadPrec ListResourceTypesResponse
Int -> ReadS ListResourceTypesResponse
ReadS [ListResourceTypesResponse]
(Int -> ReadS ListResourceTypesResponse)
-> ReadS [ListResourceTypesResponse]
-> ReadPrec ListResourceTypesResponse
-> ReadPrec [ListResourceTypesResponse]
-> Read ListResourceTypesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceTypesResponse]
$creadListPrec :: ReadPrec [ListResourceTypesResponse]
readPrec :: ReadPrec ListResourceTypesResponse
$creadPrec :: ReadPrec ListResourceTypesResponse
readList :: ReadS [ListResourceTypesResponse]
$creadList :: ReadS [ListResourceTypesResponse]
readsPrec :: Int -> ReadS ListResourceTypesResponse
$creadsPrec :: Int -> ReadS ListResourceTypesResponse
Prelude.Read, Int -> ListResourceTypesResponse -> ShowS
[ListResourceTypesResponse] -> ShowS
ListResourceTypesResponse -> String
(Int -> ListResourceTypesResponse -> ShowS)
-> (ListResourceTypesResponse -> String)
-> ([ListResourceTypesResponse] -> ShowS)
-> Show ListResourceTypesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceTypesResponse] -> ShowS
$cshowList :: [ListResourceTypesResponse] -> ShowS
show :: ListResourceTypesResponse -> String
$cshow :: ListResourceTypesResponse -> String
showsPrec :: Int -> ListResourceTypesResponse -> ShowS
$cshowsPrec :: Int -> ListResourceTypesResponse -> ShowS
Prelude.Show, (forall x.
ListResourceTypesResponse -> Rep ListResourceTypesResponse x)
-> (forall x.
Rep ListResourceTypesResponse x -> ListResourceTypesResponse)
-> Generic ListResourceTypesResponse
forall x.
Rep ListResourceTypesResponse x -> ListResourceTypesResponse
forall x.
ListResourceTypesResponse -> Rep ListResourceTypesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourceTypesResponse x -> ListResourceTypesResponse
$cfrom :: forall x.
ListResourceTypesResponse -> Rep ListResourceTypesResponse x
Prelude.Generic)
newListResourceTypesResponse ::
Prelude.Int ->
ListResourceTypesResponse
newListResourceTypesResponse :: Int -> ListResourceTypesResponse
newListResourceTypesResponse Int
pHttpStatus_ =
ListResourceTypesResponse' :: Maybe Text
-> Maybe [ServiceNameAndResourceType]
-> Int
-> ListResourceTypesResponse
ListResourceTypesResponse'
{ $sel:nextToken:ListResourceTypesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceTypes:ListResourceTypesResponse' :: Maybe [ServiceNameAndResourceType]
resourceTypes = Maybe [ServiceNameAndResourceType]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListResourceTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listResourceTypesResponse_nextToken :: Lens.Lens' ListResourceTypesResponse (Prelude.Maybe Prelude.Text)
listResourceTypesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceTypesResponse -> f ListResourceTypesResponse
listResourceTypesResponse_nextToken = (ListResourceTypesResponse -> Maybe Text)
-> (ListResourceTypesResponse
-> Maybe Text -> ListResourceTypesResponse)
-> Lens
ListResourceTypesResponse
ListResourceTypesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceTypesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceTypesResponse' :: ListResourceTypesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceTypesResponse
s@ListResourceTypesResponse' {} Maybe Text
a -> ListResourceTypesResponse
s {$sel:nextToken:ListResourceTypesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceTypesResponse)
listResourceTypesResponse_resourceTypes :: Lens.Lens' ListResourceTypesResponse (Prelude.Maybe [ServiceNameAndResourceType])
listResourceTypesResponse_resourceTypes :: (Maybe [ServiceNameAndResourceType]
-> f (Maybe [ServiceNameAndResourceType]))
-> ListResourceTypesResponse -> f ListResourceTypesResponse
listResourceTypesResponse_resourceTypes = (ListResourceTypesResponse -> Maybe [ServiceNameAndResourceType])
-> (ListResourceTypesResponse
-> Maybe [ServiceNameAndResourceType] -> ListResourceTypesResponse)
-> Lens
ListResourceTypesResponse
ListResourceTypesResponse
(Maybe [ServiceNameAndResourceType])
(Maybe [ServiceNameAndResourceType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceTypesResponse' {Maybe [ServiceNameAndResourceType]
resourceTypes :: Maybe [ServiceNameAndResourceType]
$sel:resourceTypes:ListResourceTypesResponse' :: ListResourceTypesResponse -> Maybe [ServiceNameAndResourceType]
resourceTypes} -> Maybe [ServiceNameAndResourceType]
resourceTypes) (\s :: ListResourceTypesResponse
s@ListResourceTypesResponse' {} Maybe [ServiceNameAndResourceType]
a -> ListResourceTypesResponse
s {$sel:resourceTypes:ListResourceTypesResponse' :: Maybe [ServiceNameAndResourceType]
resourceTypes = Maybe [ServiceNameAndResourceType]
a} :: ListResourceTypesResponse) ((Maybe [ServiceNameAndResourceType]
-> f (Maybe [ServiceNameAndResourceType]))
-> ListResourceTypesResponse -> f ListResourceTypesResponse)
-> ((Maybe [ServiceNameAndResourceType]
-> f (Maybe [ServiceNameAndResourceType]))
-> Maybe [ServiceNameAndResourceType]
-> f (Maybe [ServiceNameAndResourceType]))
-> (Maybe [ServiceNameAndResourceType]
-> f (Maybe [ServiceNameAndResourceType]))
-> ListResourceTypesResponse
-> f ListResourceTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
-> Iso
(Maybe [ServiceNameAndResourceType])
(Maybe [ServiceNameAndResourceType])
(Maybe [ServiceNameAndResourceType])
(Maybe [ServiceNameAndResourceType])
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
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
[ServiceNameAndResourceType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listResourceTypesResponse_httpStatus :: Lens.Lens' ListResourceTypesResponse Prelude.Int
listResourceTypesResponse_httpStatus :: (Int -> f Int)
-> ListResourceTypesResponse -> f ListResourceTypesResponse
listResourceTypesResponse_httpStatus = (ListResourceTypesResponse -> Int)
-> (ListResourceTypesResponse -> Int -> ListResourceTypesResponse)
-> Lens ListResourceTypesResponse ListResourceTypesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceTypesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListResourceTypesResponse' :: ListResourceTypesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListResourceTypesResponse
s@ListResourceTypesResponse' {} Int
a -> ListResourceTypesResponse
s {$sel:httpStatus:ListResourceTypesResponse' :: Int
httpStatus = Int
a} :: ListResourceTypesResponse)
instance Prelude.NFData ListResourceTypesResponse