{-# 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.DescribeDataSource
(
DescribeDataSource (..),
newDescribeDataSource,
describeDataSource_awsAccountId,
describeDataSource_dataSourceId,
DescribeDataSourceResponse (..),
newDescribeDataSourceResponse,
describeDataSourceResponse_requestId,
describeDataSourceResponse_dataSource,
describeDataSourceResponse_status,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeDataSource = DescribeDataSource'
{
DescribeDataSource -> Text
awsAccountId :: Prelude.Text,
DescribeDataSource -> Text
dataSourceId :: Prelude.Text
}
deriving (DescribeDataSource -> DescribeDataSource -> Bool
(DescribeDataSource -> DescribeDataSource -> Bool)
-> (DescribeDataSource -> DescribeDataSource -> Bool)
-> Eq DescribeDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataSource -> DescribeDataSource -> Bool
$c/= :: DescribeDataSource -> DescribeDataSource -> Bool
== :: DescribeDataSource -> DescribeDataSource -> Bool
$c== :: DescribeDataSource -> DescribeDataSource -> Bool
Prelude.Eq, ReadPrec [DescribeDataSource]
ReadPrec DescribeDataSource
Int -> ReadS DescribeDataSource
ReadS [DescribeDataSource]
(Int -> ReadS DescribeDataSource)
-> ReadS [DescribeDataSource]
-> ReadPrec DescribeDataSource
-> ReadPrec [DescribeDataSource]
-> Read DescribeDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDataSource]
$creadListPrec :: ReadPrec [DescribeDataSource]
readPrec :: ReadPrec DescribeDataSource
$creadPrec :: ReadPrec DescribeDataSource
readList :: ReadS [DescribeDataSource]
$creadList :: ReadS [DescribeDataSource]
readsPrec :: Int -> ReadS DescribeDataSource
$creadsPrec :: Int -> ReadS DescribeDataSource
Prelude.Read, Int -> DescribeDataSource -> ShowS
[DescribeDataSource] -> ShowS
DescribeDataSource -> String
(Int -> DescribeDataSource -> ShowS)
-> (DescribeDataSource -> String)
-> ([DescribeDataSource] -> ShowS)
-> Show DescribeDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataSource] -> ShowS
$cshowList :: [DescribeDataSource] -> ShowS
show :: DescribeDataSource -> String
$cshow :: DescribeDataSource -> String
showsPrec :: Int -> DescribeDataSource -> ShowS
$cshowsPrec :: Int -> DescribeDataSource -> ShowS
Prelude.Show, (forall x. DescribeDataSource -> Rep DescribeDataSource x)
-> (forall x. Rep DescribeDataSource x -> DescribeDataSource)
-> Generic DescribeDataSource
forall x. Rep DescribeDataSource x -> DescribeDataSource
forall x. DescribeDataSource -> Rep DescribeDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDataSource x -> DescribeDataSource
$cfrom :: forall x. DescribeDataSource -> Rep DescribeDataSource x
Prelude.Generic)
newDescribeDataSource ::
Prelude.Text ->
Prelude.Text ->
DescribeDataSource
newDescribeDataSource :: Text -> Text -> DescribeDataSource
newDescribeDataSource Text
pAwsAccountId_ Text
pDataSourceId_ =
DescribeDataSource' :: Text -> Text -> DescribeDataSource
DescribeDataSource'
{ $sel:awsAccountId:DescribeDataSource' :: Text
awsAccountId = Text
pAwsAccountId_,
$sel:dataSourceId:DescribeDataSource' :: Text
dataSourceId = Text
pDataSourceId_
}
describeDataSource_awsAccountId :: Lens.Lens' DescribeDataSource Prelude.Text
describeDataSource_awsAccountId :: (Text -> f Text) -> DescribeDataSource -> f DescribeDataSource
describeDataSource_awsAccountId = (DescribeDataSource -> Text)
-> (DescribeDataSource -> Text -> DescribeDataSource)
-> Lens DescribeDataSource DescribeDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSource' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeDataSource' :: DescribeDataSource -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeDataSource
s@DescribeDataSource' {} Text
a -> DescribeDataSource
s {$sel:awsAccountId:DescribeDataSource' :: Text
awsAccountId = Text
a} :: DescribeDataSource)
describeDataSource_dataSourceId :: Lens.Lens' DescribeDataSource Prelude.Text
describeDataSource_dataSourceId :: (Text -> f Text) -> DescribeDataSource -> f DescribeDataSource
describeDataSource_dataSourceId = (DescribeDataSource -> Text)
-> (DescribeDataSource -> Text -> DescribeDataSource)
-> Lens DescribeDataSource DescribeDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSource' {Text
dataSourceId :: Text
$sel:dataSourceId:DescribeDataSource' :: DescribeDataSource -> Text
dataSourceId} -> Text
dataSourceId) (\s :: DescribeDataSource
s@DescribeDataSource' {} Text
a -> DescribeDataSource
s {$sel:dataSourceId:DescribeDataSource' :: Text
dataSourceId = Text
a} :: DescribeDataSource)
instance Core.AWSRequest DescribeDataSource where
type
AWSResponse DescribeDataSource =
DescribeDataSourceResponse
request :: DescribeDataSource -> Request DescribeDataSource
request = Service -> DescribeDataSource -> Request DescribeDataSource
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeDataSource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeDataSource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeDataSource))
-> Logger
-> Service
-> Proxy DescribeDataSource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeDataSource)))
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 DataSource -> Int -> DescribeDataSourceResponse
DescribeDataSourceResponse'
(Maybe Text
-> Maybe DataSource -> Int -> DescribeDataSourceResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe DataSource -> Int -> DescribeDataSourceResponse)
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
"RequestId")
Either
String (Maybe DataSource -> Int -> DescribeDataSourceResponse)
-> Either String (Maybe DataSource)
-> Either String (Int -> DescribeDataSourceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DataSource)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataSource")
Either String (Int -> DescribeDataSourceResponse)
-> Either String Int -> Either String DescribeDataSourceResponse
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 DescribeDataSource
instance Prelude.NFData DescribeDataSource
instance Core.ToHeaders DescribeDataSource where
toHeaders :: DescribeDataSource -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeDataSource -> 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.0" ::
Prelude.ByteString
)
]
)
instance Core.ToPath DescribeDataSource where
toPath :: DescribeDataSource -> ByteString
toPath DescribeDataSource' {Text
dataSourceId :: Text
awsAccountId :: Text
$sel:dataSourceId:DescribeDataSource' :: DescribeDataSource -> Text
$sel:awsAccountId:DescribeDataSource' :: DescribeDataSource -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
ByteString
"/data-sources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
dataSourceId
]
instance Core.ToQuery DescribeDataSource where
toQuery :: DescribeDataSource -> QueryString
toQuery = QueryString -> DescribeDataSource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeDataSourceResponse = DescribeDataSourceResponse'
{
DescribeDataSourceResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
DescribeDataSourceResponse -> Maybe DataSource
dataSource :: Prelude.Maybe DataSource,
DescribeDataSourceResponse -> Int
status :: Prelude.Int
}
deriving (DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool
(DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool)
-> (DescribeDataSourceResponse
-> DescribeDataSourceResponse -> Bool)
-> Eq DescribeDataSourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool
$c/= :: DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool
== :: DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool
$c== :: DescribeDataSourceResponse -> DescribeDataSourceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDataSourceResponse]
ReadPrec DescribeDataSourceResponse
Int -> ReadS DescribeDataSourceResponse
ReadS [DescribeDataSourceResponse]
(Int -> ReadS DescribeDataSourceResponse)
-> ReadS [DescribeDataSourceResponse]
-> ReadPrec DescribeDataSourceResponse
-> ReadPrec [DescribeDataSourceResponse]
-> Read DescribeDataSourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDataSourceResponse]
$creadListPrec :: ReadPrec [DescribeDataSourceResponse]
readPrec :: ReadPrec DescribeDataSourceResponse
$creadPrec :: ReadPrec DescribeDataSourceResponse
readList :: ReadS [DescribeDataSourceResponse]
$creadList :: ReadS [DescribeDataSourceResponse]
readsPrec :: Int -> ReadS DescribeDataSourceResponse
$creadsPrec :: Int -> ReadS DescribeDataSourceResponse
Prelude.Read, Int -> DescribeDataSourceResponse -> ShowS
[DescribeDataSourceResponse] -> ShowS
DescribeDataSourceResponse -> String
(Int -> DescribeDataSourceResponse -> ShowS)
-> (DescribeDataSourceResponse -> String)
-> ([DescribeDataSourceResponse] -> ShowS)
-> Show DescribeDataSourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataSourceResponse] -> ShowS
$cshowList :: [DescribeDataSourceResponse] -> ShowS
show :: DescribeDataSourceResponse -> String
$cshow :: DescribeDataSourceResponse -> String
showsPrec :: Int -> DescribeDataSourceResponse -> ShowS
$cshowsPrec :: Int -> DescribeDataSourceResponse -> ShowS
Prelude.Show, (forall x.
DescribeDataSourceResponse -> Rep DescribeDataSourceResponse x)
-> (forall x.
Rep DescribeDataSourceResponse x -> DescribeDataSourceResponse)
-> Generic DescribeDataSourceResponse
forall x.
Rep DescribeDataSourceResponse x -> DescribeDataSourceResponse
forall x.
DescribeDataSourceResponse -> Rep DescribeDataSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDataSourceResponse x -> DescribeDataSourceResponse
$cfrom :: forall x.
DescribeDataSourceResponse -> Rep DescribeDataSourceResponse x
Prelude.Generic)
newDescribeDataSourceResponse ::
Prelude.Int ->
DescribeDataSourceResponse
newDescribeDataSourceResponse :: Int -> DescribeDataSourceResponse
newDescribeDataSourceResponse Int
pStatus_ =
DescribeDataSourceResponse' :: Maybe Text -> Maybe DataSource -> Int -> DescribeDataSourceResponse
DescribeDataSourceResponse'
{ $sel:requestId:DescribeDataSourceResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dataSource:DescribeDataSourceResponse' :: Maybe DataSource
dataSource = Maybe DataSource
forall a. Maybe a
Prelude.Nothing,
$sel:status:DescribeDataSourceResponse' :: Int
status = Int
pStatus_
}
describeDataSourceResponse_requestId :: Lens.Lens' DescribeDataSourceResponse (Prelude.Maybe Prelude.Text)
describeDataSourceResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeDataSourceResponse -> f DescribeDataSourceResponse
describeDataSourceResponse_requestId = (DescribeDataSourceResponse -> Maybe Text)
-> (DescribeDataSourceResponse
-> Maybe Text -> DescribeDataSourceResponse)
-> Lens
DescribeDataSourceResponse
DescribeDataSourceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSourceResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeDataSourceResponse' :: DescribeDataSourceResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeDataSourceResponse
s@DescribeDataSourceResponse' {} Maybe Text
a -> DescribeDataSourceResponse
s {$sel:requestId:DescribeDataSourceResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeDataSourceResponse)
describeDataSourceResponse_dataSource :: Lens.Lens' DescribeDataSourceResponse (Prelude.Maybe DataSource)
describeDataSourceResponse_dataSource :: (Maybe DataSource -> f (Maybe DataSource))
-> DescribeDataSourceResponse -> f DescribeDataSourceResponse
describeDataSourceResponse_dataSource = (DescribeDataSourceResponse -> Maybe DataSource)
-> (DescribeDataSourceResponse
-> Maybe DataSource -> DescribeDataSourceResponse)
-> Lens
DescribeDataSourceResponse
DescribeDataSourceResponse
(Maybe DataSource)
(Maybe DataSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSourceResponse' {Maybe DataSource
dataSource :: Maybe DataSource
$sel:dataSource:DescribeDataSourceResponse' :: DescribeDataSourceResponse -> Maybe DataSource
dataSource} -> Maybe DataSource
dataSource) (\s :: DescribeDataSourceResponse
s@DescribeDataSourceResponse' {} Maybe DataSource
a -> DescribeDataSourceResponse
s {$sel:dataSource:DescribeDataSourceResponse' :: Maybe DataSource
dataSource = Maybe DataSource
a} :: DescribeDataSourceResponse)
describeDataSourceResponse_status :: Lens.Lens' DescribeDataSourceResponse Prelude.Int
describeDataSourceResponse_status :: (Int -> f Int)
-> DescribeDataSourceResponse -> f DescribeDataSourceResponse
describeDataSourceResponse_status = (DescribeDataSourceResponse -> Int)
-> (DescribeDataSourceResponse
-> Int -> DescribeDataSourceResponse)
-> Lens
DescribeDataSourceResponse DescribeDataSourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSourceResponse' {Int
status :: Int
$sel:status:DescribeDataSourceResponse' :: DescribeDataSourceResponse -> Int
status} -> Int
status) (\s :: DescribeDataSourceResponse
s@DescribeDataSourceResponse' {} Int
a -> DescribeDataSourceResponse
s {$sel:status:DescribeDataSourceResponse' :: Int
status = Int
a} :: DescribeDataSourceResponse)
instance Prelude.NFData DescribeDataSourceResponse