{-# 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.CreateTemplateAlias
(
CreateTemplateAlias (..),
newCreateTemplateAlias,
createTemplateAlias_awsAccountId,
createTemplateAlias_templateId,
createTemplateAlias_aliasName,
createTemplateAlias_templateVersionNumber,
CreateTemplateAliasResponse (..),
newCreateTemplateAliasResponse,
createTemplateAliasResponse_requestId,
createTemplateAliasResponse_templateAlias,
createTemplateAliasResponse_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 CreateTemplateAlias = CreateTemplateAlias'
{
CreateTemplateAlias -> Text
awsAccountId :: Prelude.Text,
CreateTemplateAlias -> Text
templateId :: Prelude.Text,
CreateTemplateAlias -> Text
aliasName :: Prelude.Text,
CreateTemplateAlias -> Natural
templateVersionNumber :: Prelude.Natural
}
deriving (CreateTemplateAlias -> CreateTemplateAlias -> Bool
(CreateTemplateAlias -> CreateTemplateAlias -> Bool)
-> (CreateTemplateAlias -> CreateTemplateAlias -> Bool)
-> Eq CreateTemplateAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTemplateAlias -> CreateTemplateAlias -> Bool
$c/= :: CreateTemplateAlias -> CreateTemplateAlias -> Bool
== :: CreateTemplateAlias -> CreateTemplateAlias -> Bool
$c== :: CreateTemplateAlias -> CreateTemplateAlias -> Bool
Prelude.Eq, ReadPrec [CreateTemplateAlias]
ReadPrec CreateTemplateAlias
Int -> ReadS CreateTemplateAlias
ReadS [CreateTemplateAlias]
(Int -> ReadS CreateTemplateAlias)
-> ReadS [CreateTemplateAlias]
-> ReadPrec CreateTemplateAlias
-> ReadPrec [CreateTemplateAlias]
-> Read CreateTemplateAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTemplateAlias]
$creadListPrec :: ReadPrec [CreateTemplateAlias]
readPrec :: ReadPrec CreateTemplateAlias
$creadPrec :: ReadPrec CreateTemplateAlias
readList :: ReadS [CreateTemplateAlias]
$creadList :: ReadS [CreateTemplateAlias]
readsPrec :: Int -> ReadS CreateTemplateAlias
$creadsPrec :: Int -> ReadS CreateTemplateAlias
Prelude.Read, Int -> CreateTemplateAlias -> ShowS
[CreateTemplateAlias] -> ShowS
CreateTemplateAlias -> String
(Int -> CreateTemplateAlias -> ShowS)
-> (CreateTemplateAlias -> String)
-> ([CreateTemplateAlias] -> ShowS)
-> Show CreateTemplateAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTemplateAlias] -> ShowS
$cshowList :: [CreateTemplateAlias] -> ShowS
show :: CreateTemplateAlias -> String
$cshow :: CreateTemplateAlias -> String
showsPrec :: Int -> CreateTemplateAlias -> ShowS
$cshowsPrec :: Int -> CreateTemplateAlias -> ShowS
Prelude.Show, (forall x. CreateTemplateAlias -> Rep CreateTemplateAlias x)
-> (forall x. Rep CreateTemplateAlias x -> CreateTemplateAlias)
-> Generic CreateTemplateAlias
forall x. Rep CreateTemplateAlias x -> CreateTemplateAlias
forall x. CreateTemplateAlias -> Rep CreateTemplateAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTemplateAlias x -> CreateTemplateAlias
$cfrom :: forall x. CreateTemplateAlias -> Rep CreateTemplateAlias x
Prelude.Generic)
newCreateTemplateAlias ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Natural ->
CreateTemplateAlias
newCreateTemplateAlias :: Text -> Text -> Text -> Natural -> CreateTemplateAlias
newCreateTemplateAlias
Text
pAwsAccountId_
Text
pTemplateId_
Text
pAliasName_
Natural
pTemplateVersionNumber_ =
CreateTemplateAlias' :: Text -> Text -> Text -> Natural -> CreateTemplateAlias
CreateTemplateAlias'
{ $sel:awsAccountId:CreateTemplateAlias' :: Text
awsAccountId = Text
pAwsAccountId_,
$sel:templateId:CreateTemplateAlias' :: Text
templateId = Text
pTemplateId_,
$sel:aliasName:CreateTemplateAlias' :: Text
aliasName = Text
pAliasName_,
$sel:templateVersionNumber:CreateTemplateAlias' :: Natural
templateVersionNumber = Natural
pTemplateVersionNumber_
}
createTemplateAlias_awsAccountId :: Lens.Lens' CreateTemplateAlias Prelude.Text
createTemplateAlias_awsAccountId :: (Text -> f Text) -> CreateTemplateAlias -> f CreateTemplateAlias
createTemplateAlias_awsAccountId = (CreateTemplateAlias -> Text)
-> (CreateTemplateAlias -> Text -> CreateTemplateAlias)
-> Lens CreateTemplateAlias CreateTemplateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAlias' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateTemplateAlias' :: CreateTemplateAlias -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateTemplateAlias
s@CreateTemplateAlias' {} Text
a -> CreateTemplateAlias
s {$sel:awsAccountId:CreateTemplateAlias' :: Text
awsAccountId = Text
a} :: CreateTemplateAlias)
createTemplateAlias_templateId :: Lens.Lens' CreateTemplateAlias Prelude.Text
createTemplateAlias_templateId :: (Text -> f Text) -> CreateTemplateAlias -> f CreateTemplateAlias
createTemplateAlias_templateId = (CreateTemplateAlias -> Text)
-> (CreateTemplateAlias -> Text -> CreateTemplateAlias)
-> Lens CreateTemplateAlias CreateTemplateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAlias' {Text
templateId :: Text
$sel:templateId:CreateTemplateAlias' :: CreateTemplateAlias -> Text
templateId} -> Text
templateId) (\s :: CreateTemplateAlias
s@CreateTemplateAlias' {} Text
a -> CreateTemplateAlias
s {$sel:templateId:CreateTemplateAlias' :: Text
templateId = Text
a} :: CreateTemplateAlias)
createTemplateAlias_aliasName :: Lens.Lens' CreateTemplateAlias Prelude.Text
createTemplateAlias_aliasName :: (Text -> f Text) -> CreateTemplateAlias -> f CreateTemplateAlias
createTemplateAlias_aliasName = (CreateTemplateAlias -> Text)
-> (CreateTemplateAlias -> Text -> CreateTemplateAlias)
-> Lens CreateTemplateAlias CreateTemplateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAlias' {Text
aliasName :: Text
$sel:aliasName:CreateTemplateAlias' :: CreateTemplateAlias -> Text
aliasName} -> Text
aliasName) (\s :: CreateTemplateAlias
s@CreateTemplateAlias' {} Text
a -> CreateTemplateAlias
s {$sel:aliasName:CreateTemplateAlias' :: Text
aliasName = Text
a} :: CreateTemplateAlias)
createTemplateAlias_templateVersionNumber :: Lens.Lens' CreateTemplateAlias Prelude.Natural
createTemplateAlias_templateVersionNumber :: (Natural -> f Natural)
-> CreateTemplateAlias -> f CreateTemplateAlias
createTemplateAlias_templateVersionNumber = (CreateTemplateAlias -> Natural)
-> (CreateTemplateAlias -> Natural -> CreateTemplateAlias)
-> Lens CreateTemplateAlias CreateTemplateAlias Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAlias' {Natural
templateVersionNumber :: Natural
$sel:templateVersionNumber:CreateTemplateAlias' :: CreateTemplateAlias -> Natural
templateVersionNumber} -> Natural
templateVersionNumber) (\s :: CreateTemplateAlias
s@CreateTemplateAlias' {} Natural
a -> CreateTemplateAlias
s {$sel:templateVersionNumber:CreateTemplateAlias' :: Natural
templateVersionNumber = Natural
a} :: CreateTemplateAlias)
instance Core.AWSRequest CreateTemplateAlias where
type
AWSResponse CreateTemplateAlias =
CreateTemplateAliasResponse
request :: CreateTemplateAlias -> Request CreateTemplateAlias
request = Service -> CreateTemplateAlias -> Request CreateTemplateAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateTemplateAlias
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTemplateAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateTemplateAlias))
-> Logger
-> Service
-> Proxy CreateTemplateAlias
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTemplateAlias)))
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 TemplateAlias -> Int -> CreateTemplateAliasResponse
CreateTemplateAliasResponse'
(Maybe Text
-> Maybe TemplateAlias -> Int -> CreateTemplateAliasResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe TemplateAlias -> Int -> CreateTemplateAliasResponse)
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 TemplateAlias -> Int -> CreateTemplateAliasResponse)
-> Either String (Maybe TemplateAlias)
-> Either String (Int -> CreateTemplateAliasResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe TemplateAlias)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TemplateAlias")
Either String (Int -> CreateTemplateAliasResponse)
-> Either String Int -> Either String CreateTemplateAliasResponse
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 CreateTemplateAlias
instance Prelude.NFData CreateTemplateAlias
instance Core.ToHeaders CreateTemplateAlias where
toHeaders :: CreateTemplateAlias -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateTemplateAlias -> 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.ToJSON CreateTemplateAlias where
toJSON :: CreateTemplateAlias -> Value
toJSON CreateTemplateAlias' {Natural
Text
templateVersionNumber :: Natural
aliasName :: Text
templateId :: Text
awsAccountId :: Text
$sel:templateVersionNumber:CreateTemplateAlias' :: CreateTemplateAlias -> Natural
$sel:aliasName:CreateTemplateAlias' :: CreateTemplateAlias -> Text
$sel:templateId:CreateTemplateAlias' :: CreateTemplateAlias -> Text
$sel:awsAccountId:CreateTemplateAlias' :: CreateTemplateAlias -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TemplateVersionNumber"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
templateVersionNumber
)
]
)
instance Core.ToPath CreateTemplateAlias where
toPath :: CreateTemplateAlias -> ByteString
toPath CreateTemplateAlias' {Natural
Text
templateVersionNumber :: Natural
aliasName :: Text
templateId :: Text
awsAccountId :: Text
$sel:templateVersionNumber:CreateTemplateAlias' :: CreateTemplateAlias -> Natural
$sel:aliasName:CreateTemplateAlias' :: CreateTemplateAlias -> Text
$sel:templateId:CreateTemplateAlias' :: CreateTemplateAlias -> Text
$sel:awsAccountId:CreateTemplateAlias' :: CreateTemplateAlias -> 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,
ByteString
"/aliases/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
aliasName
]
instance Core.ToQuery CreateTemplateAlias where
toQuery :: CreateTemplateAlias -> QueryString
toQuery = QueryString -> CreateTemplateAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateTemplateAliasResponse = CreateTemplateAliasResponse'
{
CreateTemplateAliasResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
CreateTemplateAliasResponse -> Maybe TemplateAlias
templateAlias :: Prelude.Maybe TemplateAlias,
CreateTemplateAliasResponse -> Int
status :: Prelude.Int
}
deriving (CreateTemplateAliasResponse -> CreateTemplateAliasResponse -> Bool
(CreateTemplateAliasResponse
-> CreateTemplateAliasResponse -> Bool)
-> (CreateTemplateAliasResponse
-> CreateTemplateAliasResponse -> Bool)
-> Eq CreateTemplateAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTemplateAliasResponse -> CreateTemplateAliasResponse -> Bool
$c/= :: CreateTemplateAliasResponse -> CreateTemplateAliasResponse -> Bool
== :: CreateTemplateAliasResponse -> CreateTemplateAliasResponse -> Bool
$c== :: CreateTemplateAliasResponse -> CreateTemplateAliasResponse -> Bool
Prelude.Eq, ReadPrec [CreateTemplateAliasResponse]
ReadPrec CreateTemplateAliasResponse
Int -> ReadS CreateTemplateAliasResponse
ReadS [CreateTemplateAliasResponse]
(Int -> ReadS CreateTemplateAliasResponse)
-> ReadS [CreateTemplateAliasResponse]
-> ReadPrec CreateTemplateAliasResponse
-> ReadPrec [CreateTemplateAliasResponse]
-> Read CreateTemplateAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTemplateAliasResponse]
$creadListPrec :: ReadPrec [CreateTemplateAliasResponse]
readPrec :: ReadPrec CreateTemplateAliasResponse
$creadPrec :: ReadPrec CreateTemplateAliasResponse
readList :: ReadS [CreateTemplateAliasResponse]
$creadList :: ReadS [CreateTemplateAliasResponse]
readsPrec :: Int -> ReadS CreateTemplateAliasResponse
$creadsPrec :: Int -> ReadS CreateTemplateAliasResponse
Prelude.Read, Int -> CreateTemplateAliasResponse -> ShowS
[CreateTemplateAliasResponse] -> ShowS
CreateTemplateAliasResponse -> String
(Int -> CreateTemplateAliasResponse -> ShowS)
-> (CreateTemplateAliasResponse -> String)
-> ([CreateTemplateAliasResponse] -> ShowS)
-> Show CreateTemplateAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTemplateAliasResponse] -> ShowS
$cshowList :: [CreateTemplateAliasResponse] -> ShowS
show :: CreateTemplateAliasResponse -> String
$cshow :: CreateTemplateAliasResponse -> String
showsPrec :: Int -> CreateTemplateAliasResponse -> ShowS
$cshowsPrec :: Int -> CreateTemplateAliasResponse -> ShowS
Prelude.Show, (forall x.
CreateTemplateAliasResponse -> Rep CreateTemplateAliasResponse x)
-> (forall x.
Rep CreateTemplateAliasResponse x -> CreateTemplateAliasResponse)
-> Generic CreateTemplateAliasResponse
forall x.
Rep CreateTemplateAliasResponse x -> CreateTemplateAliasResponse
forall x.
CreateTemplateAliasResponse -> Rep CreateTemplateAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTemplateAliasResponse x -> CreateTemplateAliasResponse
$cfrom :: forall x.
CreateTemplateAliasResponse -> Rep CreateTemplateAliasResponse x
Prelude.Generic)
newCreateTemplateAliasResponse ::
Prelude.Int ->
CreateTemplateAliasResponse
newCreateTemplateAliasResponse :: Int -> CreateTemplateAliasResponse
newCreateTemplateAliasResponse Int
pStatus_ =
CreateTemplateAliasResponse' :: Maybe Text
-> Maybe TemplateAlias -> Int -> CreateTemplateAliasResponse
CreateTemplateAliasResponse'
{ $sel:requestId:CreateTemplateAliasResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateAlias:CreateTemplateAliasResponse' :: Maybe TemplateAlias
templateAlias = Maybe TemplateAlias
forall a. Maybe a
Prelude.Nothing,
$sel:status:CreateTemplateAliasResponse' :: Int
status = Int
pStatus_
}
createTemplateAliasResponse_requestId :: Lens.Lens' CreateTemplateAliasResponse (Prelude.Maybe Prelude.Text)
createTemplateAliasResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> CreateTemplateAliasResponse -> f CreateTemplateAliasResponse
createTemplateAliasResponse_requestId = (CreateTemplateAliasResponse -> Maybe Text)
-> (CreateTemplateAliasResponse
-> Maybe Text -> CreateTemplateAliasResponse)
-> Lens
CreateTemplateAliasResponse
CreateTemplateAliasResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAliasResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateTemplateAliasResponse' :: CreateTemplateAliasResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateTemplateAliasResponse
s@CreateTemplateAliasResponse' {} Maybe Text
a -> CreateTemplateAliasResponse
s {$sel:requestId:CreateTemplateAliasResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateTemplateAliasResponse)
createTemplateAliasResponse_templateAlias :: Lens.Lens' CreateTemplateAliasResponse (Prelude.Maybe TemplateAlias)
createTemplateAliasResponse_templateAlias :: (Maybe TemplateAlias -> f (Maybe TemplateAlias))
-> CreateTemplateAliasResponse -> f CreateTemplateAliasResponse
createTemplateAliasResponse_templateAlias = (CreateTemplateAliasResponse -> Maybe TemplateAlias)
-> (CreateTemplateAliasResponse
-> Maybe TemplateAlias -> CreateTemplateAliasResponse)
-> Lens
CreateTemplateAliasResponse
CreateTemplateAliasResponse
(Maybe TemplateAlias)
(Maybe TemplateAlias)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAliasResponse' {Maybe TemplateAlias
templateAlias :: Maybe TemplateAlias
$sel:templateAlias:CreateTemplateAliasResponse' :: CreateTemplateAliasResponse -> Maybe TemplateAlias
templateAlias} -> Maybe TemplateAlias
templateAlias) (\s :: CreateTemplateAliasResponse
s@CreateTemplateAliasResponse' {} Maybe TemplateAlias
a -> CreateTemplateAliasResponse
s {$sel:templateAlias:CreateTemplateAliasResponse' :: Maybe TemplateAlias
templateAlias = Maybe TemplateAlias
a} :: CreateTemplateAliasResponse)
createTemplateAliasResponse_status :: Lens.Lens' CreateTemplateAliasResponse Prelude.Int
createTemplateAliasResponse_status :: (Int -> f Int)
-> CreateTemplateAliasResponse -> f CreateTemplateAliasResponse
createTemplateAliasResponse_status = (CreateTemplateAliasResponse -> Int)
-> (CreateTemplateAliasResponse
-> Int -> CreateTemplateAliasResponse)
-> Lens
CreateTemplateAliasResponse CreateTemplateAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTemplateAliasResponse' {Int
status :: Int
$sel:status:CreateTemplateAliasResponse' :: CreateTemplateAliasResponse -> Int
status} -> Int
status) (\s :: CreateTemplateAliasResponse
s@CreateTemplateAliasResponse' {} Int
a -> CreateTemplateAliasResponse
s {$sel:status:CreateTemplateAliasResponse' :: Int
status = Int
a} :: CreateTemplateAliasResponse)
instance Prelude.NFData CreateTemplateAliasResponse