{-# 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.LakeFormation.ListResources
(
ListResources (..),
newListResources,
listResources_filterConditionList,
listResources_nextToken,
listResources_maxResults,
ListResourcesResponse (..),
newListResourcesResponse,
listResourcesResponse_resourceInfoList,
listResourcesResponse_nextToken,
listResourcesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.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 ListResources = ListResources'
{
ListResources -> Maybe (NonEmpty FilterCondition)
filterConditionList :: Prelude.Maybe (Prelude.NonEmpty FilterCondition),
ListResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListResources -> ListResources -> Bool
(ListResources -> ListResources -> Bool)
-> (ListResources -> ListResources -> Bool) -> Eq ListResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResources -> ListResources -> Bool
$c/= :: ListResources -> ListResources -> Bool
== :: ListResources -> ListResources -> Bool
$c== :: ListResources -> ListResources -> Bool
Prelude.Eq, ReadPrec [ListResources]
ReadPrec ListResources
Int -> ReadS ListResources
ReadS [ListResources]
(Int -> ReadS ListResources)
-> ReadS [ListResources]
-> ReadPrec ListResources
-> ReadPrec [ListResources]
-> Read ListResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResources]
$creadListPrec :: ReadPrec [ListResources]
readPrec :: ReadPrec ListResources
$creadPrec :: ReadPrec ListResources
readList :: ReadS [ListResources]
$creadList :: ReadS [ListResources]
readsPrec :: Int -> ReadS ListResources
$creadsPrec :: Int -> ReadS ListResources
Prelude.Read, Int -> ListResources -> ShowS
[ListResources] -> ShowS
ListResources -> String
(Int -> ListResources -> ShowS)
-> (ListResources -> String)
-> ([ListResources] -> ShowS)
-> Show ListResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResources] -> ShowS
$cshowList :: [ListResources] -> ShowS
show :: ListResources -> String
$cshow :: ListResources -> String
showsPrec :: Int -> ListResources -> ShowS
$cshowsPrec :: Int -> ListResources -> ShowS
Prelude.Show, (forall x. ListResources -> Rep ListResources x)
-> (forall x. Rep ListResources x -> ListResources)
-> Generic ListResources
forall x. Rep ListResources x -> ListResources
forall x. ListResources -> Rep ListResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResources x -> ListResources
$cfrom :: forall x. ListResources -> Rep ListResources x
Prelude.Generic)
newListResources ::
ListResources
newListResources :: ListResources
newListResources =
ListResources' :: Maybe (NonEmpty FilterCondition)
-> Maybe Text -> Maybe Natural -> ListResources
ListResources'
{ $sel:filterConditionList:ListResources' :: Maybe (NonEmpty FilterCondition)
filterConditionList =
Maybe (NonEmpty FilterCondition)
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListResources' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListResources' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listResources_filterConditionList :: Lens.Lens' ListResources (Prelude.Maybe (Prelude.NonEmpty FilterCondition))
listResources_filterConditionList :: (Maybe (NonEmpty FilterCondition)
-> f (Maybe (NonEmpty FilterCondition)))
-> ListResources -> f ListResources
listResources_filterConditionList = (ListResources -> Maybe (NonEmpty FilterCondition))
-> (ListResources
-> Maybe (NonEmpty FilterCondition) -> ListResources)
-> Lens
ListResources
ListResources
(Maybe (NonEmpty FilterCondition))
(Maybe (NonEmpty FilterCondition))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe (NonEmpty FilterCondition)
filterConditionList :: Maybe (NonEmpty FilterCondition)
$sel:filterConditionList:ListResources' :: ListResources -> Maybe (NonEmpty FilterCondition)
filterConditionList} -> Maybe (NonEmpty FilterCondition)
filterConditionList) (\s :: ListResources
s@ListResources' {} Maybe (NonEmpty FilterCondition)
a -> ListResources
s {$sel:filterConditionList:ListResources' :: Maybe (NonEmpty FilterCondition)
filterConditionList = Maybe (NonEmpty FilterCondition)
a} :: ListResources) ((Maybe (NonEmpty FilterCondition)
-> f (Maybe (NonEmpty FilterCondition)))
-> ListResources -> f ListResources)
-> ((Maybe (NonEmpty FilterCondition)
-> f (Maybe (NonEmpty FilterCondition)))
-> Maybe (NonEmpty FilterCondition)
-> f (Maybe (NonEmpty FilterCondition)))
-> (Maybe (NonEmpty FilterCondition)
-> f (Maybe (NonEmpty FilterCondition)))
-> ListResources
-> f ListResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
-> Iso
(Maybe (NonEmpty FilterCondition))
(Maybe (NonEmpty FilterCondition))
(Maybe (NonEmpty FilterCondition))
(Maybe (NonEmpty FilterCondition))
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
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
(NonEmpty FilterCondition)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listResources_nextToken :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Text)
listResources_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListResources -> f ListResources
listResources_nextToken = (ListResources -> Maybe Text)
-> (ListResources -> Maybe Text -> ListResources)
-> Lens ListResources ListResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResources' :: ListResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResources
s@ListResources' {} Maybe Text
a -> ListResources
s {$sel:nextToken:ListResources' :: Maybe Text
nextToken = Maybe Text
a} :: ListResources)
listResources_maxResults :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Natural)
listResources_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResources -> f ListResources
listResources_maxResults = (ListResources -> Maybe Natural)
-> (ListResources -> Maybe Natural -> ListResources)
-> Lens ListResources ListResources (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResources' :: ListResources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResources
s@ListResources' {} Maybe Natural
a -> ListResources
s {$sel:maxResults:ListResources' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResources)
instance Core.AWSRequest ListResources where
type
AWSResponse ListResources =
ListResourcesResponse
request :: ListResources -> Request ListResources
request = Service -> ListResources -> Request ListResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListResources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListResources))
-> Logger
-> Service
-> Proxy ListResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListResources)))
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 [ResourceInfo] -> Maybe Text -> Int -> ListResourcesResponse
ListResourcesResponse'
(Maybe [ResourceInfo]
-> Maybe Text -> Int -> ListResourcesResponse)
-> Either String (Maybe [ResourceInfo])
-> Either String (Maybe Text -> Int -> ListResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ResourceInfo]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceInfoList"
Either String (Maybe (Maybe [ResourceInfo]))
-> Maybe [ResourceInfo] -> Either String (Maybe [ResourceInfo])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResourceInfo]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> ListResourcesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListResourcesResponse)
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 -> ListResourcesResponse)
-> Either String Int -> Either String ListResourcesResponse
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 ListResources
instance Prelude.NFData ListResources
instance Core.ToHeaders ListResources where
toHeaders :: ListResources -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListResources -> 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
"AWSLakeFormation.ListResources" ::
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 ListResources where
toJSON :: ListResources -> Value
toJSON ListResources' {Maybe Natural
Maybe (NonEmpty FilterCondition)
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filterConditionList :: Maybe (NonEmpty FilterCondition)
$sel:maxResults:ListResources' :: ListResources -> Maybe Natural
$sel:nextToken:ListResources' :: ListResources -> Maybe Text
$sel:filterConditionList:ListResources' :: ListResources -> Maybe (NonEmpty FilterCondition)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FilterConditionList" Text -> NonEmpty FilterCondition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty FilterCondition -> Pair)
-> Maybe (NonEmpty FilterCondition) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty FilterCondition)
filterConditionList,
(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 ListResources where
toPath :: ListResources -> ByteString
toPath = ByteString -> ListResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListResources where
toQuery :: ListResources -> QueryString
toQuery = QueryString -> ListResources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListResourcesResponse = ListResourcesResponse'
{
ListResourcesResponse -> Maybe [ResourceInfo]
resourceInfoList :: Prelude.Maybe [ResourceInfo],
ListResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListResourcesResponse -> ListResourcesResponse -> Bool
(ListResourcesResponse -> ListResourcesResponse -> Bool)
-> (ListResourcesResponse -> ListResourcesResponse -> Bool)
-> Eq ListResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesResponse -> ListResourcesResponse -> Bool
$c/= :: ListResourcesResponse -> ListResourcesResponse -> Bool
== :: ListResourcesResponse -> ListResourcesResponse -> Bool
$c== :: ListResourcesResponse -> ListResourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListResourcesResponse]
ReadPrec ListResourcesResponse
Int -> ReadS ListResourcesResponse
ReadS [ListResourcesResponse]
(Int -> ReadS ListResourcesResponse)
-> ReadS [ListResourcesResponse]
-> ReadPrec ListResourcesResponse
-> ReadPrec [ListResourcesResponse]
-> Read ListResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesResponse]
$creadListPrec :: ReadPrec [ListResourcesResponse]
readPrec :: ReadPrec ListResourcesResponse
$creadPrec :: ReadPrec ListResourcesResponse
readList :: ReadS [ListResourcesResponse]
$creadList :: ReadS [ListResourcesResponse]
readsPrec :: Int -> ReadS ListResourcesResponse
$creadsPrec :: Int -> ReadS ListResourcesResponse
Prelude.Read, Int -> ListResourcesResponse -> ShowS
[ListResourcesResponse] -> ShowS
ListResourcesResponse -> String
(Int -> ListResourcesResponse -> ShowS)
-> (ListResourcesResponse -> String)
-> ([ListResourcesResponse] -> ShowS)
-> Show ListResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesResponse] -> ShowS
$cshowList :: [ListResourcesResponse] -> ShowS
show :: ListResourcesResponse -> String
$cshow :: ListResourcesResponse -> String
showsPrec :: Int -> ListResourcesResponse -> ShowS
$cshowsPrec :: Int -> ListResourcesResponse -> ShowS
Prelude.Show, (forall x. ListResourcesResponse -> Rep ListResourcesResponse x)
-> (forall x. Rep ListResourcesResponse x -> ListResourcesResponse)
-> Generic ListResourcesResponse
forall x. Rep ListResourcesResponse x -> ListResourcesResponse
forall x. ListResourcesResponse -> Rep ListResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourcesResponse x -> ListResourcesResponse
$cfrom :: forall x. ListResourcesResponse -> Rep ListResourcesResponse x
Prelude.Generic)
newListResourcesResponse ::
Prelude.Int ->
ListResourcesResponse
newListResourcesResponse :: Int -> ListResourcesResponse
newListResourcesResponse Int
pHttpStatus_ =
ListResourcesResponse' :: Maybe [ResourceInfo] -> Maybe Text -> Int -> ListResourcesResponse
ListResourcesResponse'
{ $sel:resourceInfoList:ListResourcesResponse' :: Maybe [ResourceInfo]
resourceInfoList =
Maybe [ResourceInfo]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListResourcesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listResourcesResponse_resourceInfoList :: Lens.Lens' ListResourcesResponse (Prelude.Maybe [ResourceInfo])
listResourcesResponse_resourceInfoList :: (Maybe [ResourceInfo] -> f (Maybe [ResourceInfo]))
-> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_resourceInfoList = (ListResourcesResponse -> Maybe [ResourceInfo])
-> (ListResourcesResponse
-> Maybe [ResourceInfo] -> ListResourcesResponse)
-> Lens
ListResourcesResponse
ListResourcesResponse
(Maybe [ResourceInfo])
(Maybe [ResourceInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Maybe [ResourceInfo]
resourceInfoList :: Maybe [ResourceInfo]
$sel:resourceInfoList:ListResourcesResponse' :: ListResourcesResponse -> Maybe [ResourceInfo]
resourceInfoList} -> Maybe [ResourceInfo]
resourceInfoList) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Maybe [ResourceInfo]
a -> ListResourcesResponse
s {$sel:resourceInfoList:ListResourcesResponse' :: Maybe [ResourceInfo]
resourceInfoList = Maybe [ResourceInfo]
a} :: ListResourcesResponse) ((Maybe [ResourceInfo] -> f (Maybe [ResourceInfo]))
-> ListResourcesResponse -> f ListResourcesResponse)
-> ((Maybe [ResourceInfo] -> f (Maybe [ResourceInfo]))
-> Maybe [ResourceInfo] -> f (Maybe [ResourceInfo]))
-> (Maybe [ResourceInfo] -> f (Maybe [ResourceInfo]))
-> ListResourcesResponse
-> f ListResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ResourceInfo] [ResourceInfo] [ResourceInfo] [ResourceInfo]
-> Iso
(Maybe [ResourceInfo])
(Maybe [ResourceInfo])
(Maybe [ResourceInfo])
(Maybe [ResourceInfo])
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 [ResourceInfo] [ResourceInfo] [ResourceInfo] [ResourceInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listResourcesResponse_nextToken :: Lens.Lens' ListResourcesResponse (Prelude.Maybe Prelude.Text)
listResourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_nextToken = (ListResourcesResponse -> Maybe Text)
-> (ListResourcesResponse -> Maybe Text -> ListResourcesResponse)
-> Lens
ListResourcesResponse
ListResourcesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourcesResponse' :: ListResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Maybe Text
a -> ListResourcesResponse
s {$sel:nextToken:ListResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourcesResponse)
listResourcesResponse_httpStatus :: Lens.Lens' ListResourcesResponse Prelude.Int
listResourcesResponse_httpStatus :: (Int -> f Int) -> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_httpStatus = (ListResourcesResponse -> Int)
-> (ListResourcesResponse -> Int -> ListResourcesResponse)
-> Lens ListResourcesResponse ListResourcesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListResourcesResponse' :: ListResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Int
a -> ListResourcesResponse
s {$sel:httpStatus:ListResourcesResponse' :: Int
httpStatus = Int
a} :: ListResourcesResponse)
instance Prelude.NFData ListResourcesResponse