{-# 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.DescribeTemplate
(
DescribeTemplate (..),
newDescribeTemplate,
describeTemplate_aliasName,
describeTemplate_versionNumber,
describeTemplate_awsAccountId,
describeTemplate_templateId,
DescribeTemplateResponse (..),
newDescribeTemplateResponse,
describeTemplateResponse_requestId,
describeTemplateResponse_template,
describeTemplateResponse_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 DescribeTemplate = DescribeTemplate'
{
DescribeTemplate -> Maybe Text
aliasName :: Prelude.Maybe Prelude.Text,
DescribeTemplate -> Maybe Natural
versionNumber :: Prelude.Maybe Prelude.Natural,
DescribeTemplate -> Text
awsAccountId :: Prelude.Text,
DescribeTemplate -> Text
templateId :: Prelude.Text
}
deriving (DescribeTemplate -> DescribeTemplate -> Bool
(DescribeTemplate -> DescribeTemplate -> Bool)
-> (DescribeTemplate -> DescribeTemplate -> Bool)
-> Eq DescribeTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTemplate -> DescribeTemplate -> Bool
$c/= :: DescribeTemplate -> DescribeTemplate -> Bool
== :: DescribeTemplate -> DescribeTemplate -> Bool
$c== :: DescribeTemplate -> DescribeTemplate -> Bool
Prelude.Eq, ReadPrec [DescribeTemplate]
ReadPrec DescribeTemplate
Int -> ReadS DescribeTemplate
ReadS [DescribeTemplate]
(Int -> ReadS DescribeTemplate)
-> ReadS [DescribeTemplate]
-> ReadPrec DescribeTemplate
-> ReadPrec [DescribeTemplate]
-> Read DescribeTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTemplate]
$creadListPrec :: ReadPrec [DescribeTemplate]
readPrec :: ReadPrec DescribeTemplate
$creadPrec :: ReadPrec DescribeTemplate
readList :: ReadS [DescribeTemplate]
$creadList :: ReadS [DescribeTemplate]
readsPrec :: Int -> ReadS DescribeTemplate
$creadsPrec :: Int -> ReadS DescribeTemplate
Prelude.Read, Int -> DescribeTemplate -> ShowS
[DescribeTemplate] -> ShowS
DescribeTemplate -> String
(Int -> DescribeTemplate -> ShowS)
-> (DescribeTemplate -> String)
-> ([DescribeTemplate] -> ShowS)
-> Show DescribeTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTemplate] -> ShowS
$cshowList :: [DescribeTemplate] -> ShowS
show :: DescribeTemplate -> String
$cshow :: DescribeTemplate -> String
showsPrec :: Int -> DescribeTemplate -> ShowS
$cshowsPrec :: Int -> DescribeTemplate -> ShowS
Prelude.Show, (forall x. DescribeTemplate -> Rep DescribeTemplate x)
-> (forall x. Rep DescribeTemplate x -> DescribeTemplate)
-> Generic DescribeTemplate
forall x. Rep DescribeTemplate x -> DescribeTemplate
forall x. DescribeTemplate -> Rep DescribeTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTemplate x -> DescribeTemplate
$cfrom :: forall x. DescribeTemplate -> Rep DescribeTemplate x
Prelude.Generic)
newDescribeTemplate ::
Prelude.Text ->
Prelude.Text ->
DescribeTemplate
newDescribeTemplate :: Text -> Text -> DescribeTemplate
newDescribeTemplate Text
pAwsAccountId_ Text
pTemplateId_ =
DescribeTemplate' :: Maybe Text -> Maybe Natural -> Text -> Text -> DescribeTemplate
DescribeTemplate'
{ $sel:aliasName:DescribeTemplate' :: Maybe Text
aliasName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:versionNumber:DescribeTemplate' :: Maybe Natural
versionNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:awsAccountId:DescribeTemplate' :: Text
awsAccountId = Text
pAwsAccountId_,
$sel:templateId:DescribeTemplate' :: Text
templateId = Text
pTemplateId_
}
describeTemplate_aliasName :: Lens.Lens' DescribeTemplate (Prelude.Maybe Prelude.Text)
describeTemplate_aliasName :: (Maybe Text -> f (Maybe Text))
-> DescribeTemplate -> f DescribeTemplate
describeTemplate_aliasName = (DescribeTemplate -> Maybe Text)
-> (DescribeTemplate -> Maybe Text -> DescribeTemplate)
-> Lens DescribeTemplate DescribeTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplate' {Maybe Text
aliasName :: Maybe Text
$sel:aliasName:DescribeTemplate' :: DescribeTemplate -> Maybe Text
aliasName} -> Maybe Text
aliasName) (\s :: DescribeTemplate
s@DescribeTemplate' {} Maybe Text
a -> DescribeTemplate
s {$sel:aliasName:DescribeTemplate' :: Maybe Text
aliasName = Maybe Text
a} :: DescribeTemplate)
describeTemplate_versionNumber :: Lens.Lens' DescribeTemplate (Prelude.Maybe Prelude.Natural)
describeTemplate_versionNumber :: (Maybe Natural -> f (Maybe Natural))
-> DescribeTemplate -> f DescribeTemplate
describeTemplate_versionNumber = (DescribeTemplate -> Maybe Natural)
-> (DescribeTemplate -> Maybe Natural -> DescribeTemplate)
-> Lens
DescribeTemplate DescribeTemplate (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplate' {Maybe Natural
versionNumber :: Maybe Natural
$sel:versionNumber:DescribeTemplate' :: DescribeTemplate -> Maybe Natural
versionNumber} -> Maybe Natural
versionNumber) (\s :: DescribeTemplate
s@DescribeTemplate' {} Maybe Natural
a -> DescribeTemplate
s {$sel:versionNumber:DescribeTemplate' :: Maybe Natural
versionNumber = Maybe Natural
a} :: DescribeTemplate)
describeTemplate_awsAccountId :: Lens.Lens' DescribeTemplate Prelude.Text
describeTemplate_awsAccountId :: (Text -> f Text) -> DescribeTemplate -> f DescribeTemplate
describeTemplate_awsAccountId = (DescribeTemplate -> Text)
-> (DescribeTemplate -> Text -> DescribeTemplate)
-> Lens DescribeTemplate DescribeTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplate' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeTemplate' :: DescribeTemplate -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeTemplate
s@DescribeTemplate' {} Text
a -> DescribeTemplate
s {$sel:awsAccountId:DescribeTemplate' :: Text
awsAccountId = Text
a} :: DescribeTemplate)
describeTemplate_templateId :: Lens.Lens' DescribeTemplate Prelude.Text
describeTemplate_templateId :: (Text -> f Text) -> DescribeTemplate -> f DescribeTemplate
describeTemplate_templateId = (DescribeTemplate -> Text)
-> (DescribeTemplate -> Text -> DescribeTemplate)
-> Lens DescribeTemplate DescribeTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplate' {Text
templateId :: Text
$sel:templateId:DescribeTemplate' :: DescribeTemplate -> Text
templateId} -> Text
templateId) (\s :: DescribeTemplate
s@DescribeTemplate' {} Text
a -> DescribeTemplate
s {$sel:templateId:DescribeTemplate' :: Text
templateId = Text
a} :: DescribeTemplate)
instance Core.AWSRequest DescribeTemplate where
type
AWSResponse DescribeTemplate =
DescribeTemplateResponse
request :: DescribeTemplate -> Request DescribeTemplate
request = Service -> DescribeTemplate -> Request DescribeTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeTemplate))
-> Logger
-> Service
-> Proxy DescribeTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTemplate)))
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 Template -> Int -> DescribeTemplateResponse
DescribeTemplateResponse'
(Maybe Text -> Maybe Template -> Int -> DescribeTemplateResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Template -> Int -> DescribeTemplateResponse)
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 Template -> Int -> DescribeTemplateResponse)
-> Either String (Maybe Template)
-> Either String (Int -> DescribeTemplateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Template)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Template")
Either String (Int -> DescribeTemplateResponse)
-> Either String Int -> Either String DescribeTemplateResponse
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 DescribeTemplate
instance Prelude.NFData DescribeTemplate
instance Core.ToHeaders DescribeTemplate where
toHeaders :: DescribeTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeTemplate -> 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 DescribeTemplate where
toPath :: DescribeTemplate -> ByteString
toPath DescribeTemplate' {Maybe Natural
Maybe Text
Text
templateId :: Text
awsAccountId :: Text
versionNumber :: Maybe Natural
aliasName :: Maybe Text
$sel:templateId:DescribeTemplate' :: DescribeTemplate -> Text
$sel:awsAccountId:DescribeTemplate' :: DescribeTemplate -> Text
$sel:versionNumber:DescribeTemplate' :: DescribeTemplate -> Maybe Natural
$sel:aliasName:DescribeTemplate' :: DescribeTemplate -> Maybe 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
"/templates/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateId
]
instance Core.ToQuery DescribeTemplate where
toQuery :: DescribeTemplate -> QueryString
toQuery DescribeTemplate' {Maybe Natural
Maybe Text
Text
templateId :: Text
awsAccountId :: Text
versionNumber :: Maybe Natural
aliasName :: Maybe Text
$sel:templateId:DescribeTemplate' :: DescribeTemplate -> Text
$sel:awsAccountId:DescribeTemplate' :: DescribeTemplate -> Text
$sel:versionNumber:DescribeTemplate' :: DescribeTemplate -> Maybe Natural
$sel:aliasName:DescribeTemplate' :: DescribeTemplate -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"alias-name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
aliasName,
ByteString
"version-number" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
versionNumber
]
data DescribeTemplateResponse = DescribeTemplateResponse'
{
DescribeTemplateResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
DescribeTemplateResponse -> Maybe Template
template :: Prelude.Maybe Template,
DescribeTemplateResponse -> Int
status :: Prelude.Int
}
deriving (DescribeTemplateResponse -> DescribeTemplateResponse -> Bool
(DescribeTemplateResponse -> DescribeTemplateResponse -> Bool)
-> (DescribeTemplateResponse -> DescribeTemplateResponse -> Bool)
-> Eq DescribeTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTemplateResponse -> DescribeTemplateResponse -> Bool
$c/= :: DescribeTemplateResponse -> DescribeTemplateResponse -> Bool
== :: DescribeTemplateResponse -> DescribeTemplateResponse -> Bool
$c== :: DescribeTemplateResponse -> DescribeTemplateResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTemplateResponse]
ReadPrec DescribeTemplateResponse
Int -> ReadS DescribeTemplateResponse
ReadS [DescribeTemplateResponse]
(Int -> ReadS DescribeTemplateResponse)
-> ReadS [DescribeTemplateResponse]
-> ReadPrec DescribeTemplateResponse
-> ReadPrec [DescribeTemplateResponse]
-> Read DescribeTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTemplateResponse]
$creadListPrec :: ReadPrec [DescribeTemplateResponse]
readPrec :: ReadPrec DescribeTemplateResponse
$creadPrec :: ReadPrec DescribeTemplateResponse
readList :: ReadS [DescribeTemplateResponse]
$creadList :: ReadS [DescribeTemplateResponse]
readsPrec :: Int -> ReadS DescribeTemplateResponse
$creadsPrec :: Int -> ReadS DescribeTemplateResponse
Prelude.Read, Int -> DescribeTemplateResponse -> ShowS
[DescribeTemplateResponse] -> ShowS
DescribeTemplateResponse -> String
(Int -> DescribeTemplateResponse -> ShowS)
-> (DescribeTemplateResponse -> String)
-> ([DescribeTemplateResponse] -> ShowS)
-> Show DescribeTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTemplateResponse] -> ShowS
$cshowList :: [DescribeTemplateResponse] -> ShowS
show :: DescribeTemplateResponse -> String
$cshow :: DescribeTemplateResponse -> String
showsPrec :: Int -> DescribeTemplateResponse -> ShowS
$cshowsPrec :: Int -> DescribeTemplateResponse -> ShowS
Prelude.Show, (forall x.
DescribeTemplateResponse -> Rep DescribeTemplateResponse x)
-> (forall x.
Rep DescribeTemplateResponse x -> DescribeTemplateResponse)
-> Generic DescribeTemplateResponse
forall x.
Rep DescribeTemplateResponse x -> DescribeTemplateResponse
forall x.
DescribeTemplateResponse -> Rep DescribeTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTemplateResponse x -> DescribeTemplateResponse
$cfrom :: forall x.
DescribeTemplateResponse -> Rep DescribeTemplateResponse x
Prelude.Generic)
newDescribeTemplateResponse ::
Prelude.Int ->
DescribeTemplateResponse
newDescribeTemplateResponse :: Int -> DescribeTemplateResponse
newDescribeTemplateResponse Int
pStatus_ =
DescribeTemplateResponse' :: Maybe Text -> Maybe Template -> Int -> DescribeTemplateResponse
DescribeTemplateResponse'
{ $sel:requestId:DescribeTemplateResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:template:DescribeTemplateResponse' :: Maybe Template
template = Maybe Template
forall a. Maybe a
Prelude.Nothing,
$sel:status:DescribeTemplateResponse' :: Int
status = Int
pStatus_
}
describeTemplateResponse_requestId :: Lens.Lens' DescribeTemplateResponse (Prelude.Maybe Prelude.Text)
describeTemplateResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeTemplateResponse -> f DescribeTemplateResponse
describeTemplateResponse_requestId = (DescribeTemplateResponse -> Maybe Text)
-> (DescribeTemplateResponse
-> Maybe Text -> DescribeTemplateResponse)
-> Lens
DescribeTemplateResponse
DescribeTemplateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplateResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeTemplateResponse' :: DescribeTemplateResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeTemplateResponse
s@DescribeTemplateResponse' {} Maybe Text
a -> DescribeTemplateResponse
s {$sel:requestId:DescribeTemplateResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeTemplateResponse)
describeTemplateResponse_template :: Lens.Lens' DescribeTemplateResponse (Prelude.Maybe Template)
describeTemplateResponse_template :: (Maybe Template -> f (Maybe Template))
-> DescribeTemplateResponse -> f DescribeTemplateResponse
describeTemplateResponse_template = (DescribeTemplateResponse -> Maybe Template)
-> (DescribeTemplateResponse
-> Maybe Template -> DescribeTemplateResponse)
-> Lens
DescribeTemplateResponse
DescribeTemplateResponse
(Maybe Template)
(Maybe Template)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplateResponse' {Maybe Template
template :: Maybe Template
$sel:template:DescribeTemplateResponse' :: DescribeTemplateResponse -> Maybe Template
template} -> Maybe Template
template) (\s :: DescribeTemplateResponse
s@DescribeTemplateResponse' {} Maybe Template
a -> DescribeTemplateResponse
s {$sel:template:DescribeTemplateResponse' :: Maybe Template
template = Maybe Template
a} :: DescribeTemplateResponse)
describeTemplateResponse_status :: Lens.Lens' DescribeTemplateResponse Prelude.Int
describeTemplateResponse_status :: (Int -> f Int)
-> DescribeTemplateResponse -> f DescribeTemplateResponse
describeTemplateResponse_status = (DescribeTemplateResponse -> Int)
-> (DescribeTemplateResponse -> Int -> DescribeTemplateResponse)
-> Lens DescribeTemplateResponse DescribeTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTemplateResponse' {Int
status :: Int
$sel:status:DescribeTemplateResponse' :: DescribeTemplateResponse -> Int
status} -> Int
status) (\s :: DescribeTemplateResponse
s@DescribeTemplateResponse' {} Int
a -> DescribeTemplateResponse
s {$sel:status:DescribeTemplateResponse' :: Int
status = Int
a} :: DescribeTemplateResponse)
instance Prelude.NFData DescribeTemplateResponse