{-# 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.QuickSight.ListDataSources
(
ListDataSources (..),
newListDataSources,
listDataSources_maxResults,
listDataSources_nextToken,
listDataSources_awsAccountId,
ListDataSourcesResponse (..),
newListDataSourcesResponse,
listDataSourcesResponse_dataSources,
listDataSourcesResponse_nextToken,
listDataSourcesResponse_requestId,
listDataSourcesResponse_status,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDataSources = ListDataSources'
{
ListDataSources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDataSources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDataSources -> Text
awsAccountId :: Prelude.Text
}
deriving (ListDataSources -> ListDataSources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataSources -> ListDataSources -> Bool
$c/= :: ListDataSources -> ListDataSources -> Bool
== :: ListDataSources -> ListDataSources -> Bool
$c== :: ListDataSources -> ListDataSources -> Bool
Prelude.Eq, ReadPrec [ListDataSources]
ReadPrec ListDataSources
Int -> ReadS ListDataSources
ReadS [ListDataSources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataSources]
$creadListPrec :: ReadPrec [ListDataSources]
readPrec :: ReadPrec ListDataSources
$creadPrec :: ReadPrec ListDataSources
readList :: ReadS [ListDataSources]
$creadList :: ReadS [ListDataSources]
readsPrec :: Int -> ReadS ListDataSources
$creadsPrec :: Int -> ReadS ListDataSources
Prelude.Read, Int -> ListDataSources -> ShowS
[ListDataSources] -> ShowS
ListDataSources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataSources] -> ShowS
$cshowList :: [ListDataSources] -> ShowS
show :: ListDataSources -> String
$cshow :: ListDataSources -> String
showsPrec :: Int -> ListDataSources -> ShowS
$cshowsPrec :: Int -> ListDataSources -> ShowS
Prelude.Show, forall x. Rep ListDataSources x -> ListDataSources
forall x. ListDataSources -> Rep ListDataSources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDataSources x -> ListDataSources
$cfrom :: forall x. ListDataSources -> Rep ListDataSources x
Prelude.Generic)
newListDataSources ::
Prelude.Text ->
ListDataSources
newListDataSources :: Text -> ListDataSources
newListDataSources Text
pAwsAccountId_ =
ListDataSources'
{ $sel:maxResults:ListDataSources' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDataSources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:awsAccountId:ListDataSources' :: Text
awsAccountId = Text
pAwsAccountId_
}
listDataSources_maxResults :: Lens.Lens' ListDataSources (Prelude.Maybe Prelude.Natural)
listDataSources_maxResults :: Lens' ListDataSources (Maybe Natural)
listDataSources_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDataSources
s@ListDataSources' {} Maybe Natural
a -> ListDataSources
s {$sel:maxResults:ListDataSources' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDataSources)
listDataSources_nextToken :: Lens.Lens' ListDataSources (Prelude.Maybe Prelude.Text)
listDataSources_nextToken :: Lens' ListDataSources (Maybe Text)
listDataSources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataSources
s@ListDataSources' {} Maybe Text
a -> ListDataSources
s {$sel:nextToken:ListDataSources' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataSources)
listDataSources_awsAccountId :: Lens.Lens' ListDataSources Prelude.Text
listDataSources_awsAccountId :: Lens' ListDataSources Text
listDataSources_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSources' {Text
awsAccountId :: Text
$sel:awsAccountId:ListDataSources' :: ListDataSources -> Text
awsAccountId} -> Text
awsAccountId) (\s :: ListDataSources
s@ListDataSources' {} Text
a -> ListDataSources
s {$sel:awsAccountId:ListDataSources' :: Text
awsAccountId = Text
a} :: ListDataSources)
instance Core.AWSPager ListDataSources where
page :: ListDataSources
-> AWSResponse ListDataSources -> Maybe ListDataSources
page ListDataSources
rq AWSResponse ListDataSources
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDataSources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataSourcesResponse (Maybe Text)
listDataSourcesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDataSources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataSourcesResponse (Maybe [DataSource])
listDataSourcesResponse_dataSources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListDataSources
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDataSources (Maybe Text)
listDataSources_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDataSources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataSourcesResponse (Maybe Text)
listDataSourcesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListDataSources where
type
AWSResponse ListDataSources =
ListDataSourcesResponse
request :: (Service -> Service) -> ListDataSources -> Request ListDataSources
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListDataSources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDataSources)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [DataSource]
-> Maybe Text -> Maybe Text -> Int -> ListDataSourcesResponse
ListDataSourcesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DataSources" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RequestId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListDataSources where
hashWithSalt :: Int -> ListDataSources -> Int
hashWithSalt Int
_salt ListDataSources' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
instance Prelude.NFData ListDataSources where
rnf :: ListDataSources -> ()
rnf ListDataSources' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
instance Data.ToHeaders ListDataSources where
toHeaders :: ListDataSources -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListDataSources where
toPath :: ListDataSources -> ByteString
toPath ListDataSources' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
ByteString
"/data-sources"
]
instance Data.ToQuery ListDataSources where
toQuery :: ListDataSources -> QueryString
toQuery ListDataSources' {Maybe Natural
Maybe Text
Text
awsAccountId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:awsAccountId:ListDataSources' :: ListDataSources -> Text
$sel:nextToken:ListDataSources' :: ListDataSources -> Maybe Text
$sel:maxResults:ListDataSources' :: ListDataSources -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"max-results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListDataSourcesResponse = ListDataSourcesResponse'
{
ListDataSourcesResponse -> Maybe [DataSource]
dataSources :: Prelude.Maybe [DataSource],
ListDataSourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDataSourcesResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
ListDataSourcesResponse -> Int
status :: Prelude.Int
}
deriving (ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
$c/= :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
== :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
$c== :: ListDataSourcesResponse -> ListDataSourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListDataSourcesResponse]
ReadPrec ListDataSourcesResponse
Int -> ReadS ListDataSourcesResponse
ReadS [ListDataSourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataSourcesResponse]
$creadListPrec :: ReadPrec [ListDataSourcesResponse]
readPrec :: ReadPrec ListDataSourcesResponse
$creadPrec :: ReadPrec ListDataSourcesResponse
readList :: ReadS [ListDataSourcesResponse]
$creadList :: ReadS [ListDataSourcesResponse]
readsPrec :: Int -> ReadS ListDataSourcesResponse
$creadsPrec :: Int -> ReadS ListDataSourcesResponse
Prelude.Read, Int -> ListDataSourcesResponse -> ShowS
[ListDataSourcesResponse] -> ShowS
ListDataSourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataSourcesResponse] -> ShowS
$cshowList :: [ListDataSourcesResponse] -> ShowS
show :: ListDataSourcesResponse -> String
$cshow :: ListDataSourcesResponse -> String
showsPrec :: Int -> ListDataSourcesResponse -> ShowS
$cshowsPrec :: Int -> ListDataSourcesResponse -> ShowS
Prelude.Show, forall x. Rep ListDataSourcesResponse x -> ListDataSourcesResponse
forall x. ListDataSourcesResponse -> Rep ListDataSourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDataSourcesResponse x -> ListDataSourcesResponse
$cfrom :: forall x. ListDataSourcesResponse -> Rep ListDataSourcesResponse x
Prelude.Generic)
newListDataSourcesResponse ::
Prelude.Int ->
ListDataSourcesResponse
newListDataSourcesResponse :: Int -> ListDataSourcesResponse
newListDataSourcesResponse Int
pStatus_ =
ListDataSourcesResponse'
{ $sel:dataSources:ListDataSourcesResponse' :: Maybe [DataSource]
dataSources =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDataSourcesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:requestId:ListDataSourcesResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:status:ListDataSourcesResponse' :: Int
status = Int
pStatus_
}
listDataSourcesResponse_dataSources :: Lens.Lens' ListDataSourcesResponse (Prelude.Maybe [DataSource])
listDataSourcesResponse_dataSources :: Lens' ListDataSourcesResponse (Maybe [DataSource])
listDataSourcesResponse_dataSources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Maybe [DataSource]
dataSources :: Maybe [DataSource]
$sel:dataSources:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe [DataSource]
dataSources} -> Maybe [DataSource]
dataSources) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Maybe [DataSource]
a -> ListDataSourcesResponse
s {$sel:dataSources:ListDataSourcesResponse' :: Maybe [DataSource]
dataSources = Maybe [DataSource]
a} :: ListDataSourcesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listDataSourcesResponse_nextToken :: Lens.Lens' ListDataSourcesResponse (Prelude.Maybe Prelude.Text)
listDataSourcesResponse_nextToken :: Lens' ListDataSourcesResponse (Maybe Text)
listDataSourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Maybe Text
a -> ListDataSourcesResponse
s {$sel:nextToken:ListDataSourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataSourcesResponse)
listDataSourcesResponse_requestId :: Lens.Lens' ListDataSourcesResponse (Prelude.Maybe Prelude.Text)
listDataSourcesResponse_requestId :: Lens' ListDataSourcesResponse (Maybe Text)
listDataSourcesResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Maybe Text
a -> ListDataSourcesResponse
s {$sel:requestId:ListDataSourcesResponse' :: Maybe Text
requestId = Maybe Text
a} :: ListDataSourcesResponse)
listDataSourcesResponse_status :: Lens.Lens' ListDataSourcesResponse Prelude.Int
listDataSourcesResponse_status :: Lens' ListDataSourcesResponse Int
listDataSourcesResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataSourcesResponse' {Int
status :: Int
$sel:status:ListDataSourcesResponse' :: ListDataSourcesResponse -> Int
status} -> Int
status) (\s :: ListDataSourcesResponse
s@ListDataSourcesResponse' {} Int
a -> ListDataSourcesResponse
s {$sel:status:ListDataSourcesResponse' :: Int
status = Int
a} :: ListDataSourcesResponse)
instance Prelude.NFData ListDataSourcesResponse where
rnf :: ListDataSourcesResponse -> ()
rnf ListDataSourcesResponse' {Int
Maybe [DataSource]
Maybe Text
status :: Int
requestId :: Maybe Text
nextToken :: Maybe Text
dataSources :: Maybe [DataSource]
$sel:status:ListDataSourcesResponse' :: ListDataSourcesResponse -> Int
$sel:requestId:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe Text
$sel:nextToken:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe Text
$sel:dataSources:ListDataSourcesResponse' :: ListDataSourcesResponse -> Maybe [DataSource]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DataSource]
dataSources
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status