{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.CreateTheme
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a theme.
--
-- A /theme/ is set of configuration options for color and layout. Themes
-- apply to analyses and dashboards. For more information, see
-- <https://docs.aws.amazon.com/quicksight/latest/user/themes-in-quicksight.html Using Themes in Amazon QuickSight>
-- in the /Amazon QuickSight User Guide/.
module Amazonka.QuickSight.CreateTheme
  ( -- * Creating a Request
    CreateTheme (..),
    newCreateTheme,

    -- * Request Lenses
    createTheme_permissions,
    createTheme_tags,
    createTheme_versionDescription,
    createTheme_awsAccountId,
    createTheme_themeId,
    createTheme_name,
    createTheme_baseThemeId,
    createTheme_configuration,

    -- * Destructuring the Response
    CreateThemeResponse (..),
    newCreateThemeResponse,

    -- * Response Lenses
    createThemeResponse_arn,
    createThemeResponse_creationStatus,
    createThemeResponse_requestId,
    createThemeResponse_themeId,
    createThemeResponse_versionArn,
    createThemeResponse_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

-- | /See:/ 'newCreateTheme' smart constructor.
data CreateTheme = CreateTheme'
  { -- | A valid grouping of resource permissions to apply to the new theme.
    CreateTheme -> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | A map of the key-value pairs for the resource tag or tags that you want
    -- to add to the resource.
    CreateTheme -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | A description of the first version of the theme that you\'re creating.
    -- Every time @UpdateTheme@ is called, a new version is created. Each
    -- version of the theme has a description of the version in the
    -- @VersionDescription@ field.
    CreateTheme -> Maybe Text
versionDescription :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services account where you want to store the
    -- new theme.
    CreateTheme -> Text
awsAccountId :: Prelude.Text,
    -- | An ID for the theme that you want to create. The theme ID is unique per
    -- Amazon Web Services Region in each Amazon Web Services account.
    CreateTheme -> Text
themeId :: Prelude.Text,
    -- | A display name for the theme.
    CreateTheme -> Text
name :: Prelude.Text,
    -- | The ID of the theme that a custom theme will inherit from. All themes
    -- inherit from one of the starting themes defined by Amazon QuickSight.
    -- For a list of the starting themes, use @ListThemes@ or choose __Themes__
    -- from within an analysis.
    CreateTheme -> Text
baseThemeId :: Prelude.Text,
    -- | The theme configuration, which contains the theme display properties.
    CreateTheme -> ThemeConfiguration
configuration :: ThemeConfiguration
  }
  deriving (CreateTheme -> CreateTheme -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTheme -> CreateTheme -> Bool
$c/= :: CreateTheme -> CreateTheme -> Bool
== :: CreateTheme -> CreateTheme -> Bool
$c== :: CreateTheme -> CreateTheme -> Bool
Prelude.Eq, ReadPrec [CreateTheme]
ReadPrec CreateTheme
Int -> ReadS CreateTheme
ReadS [CreateTheme]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTheme]
$creadListPrec :: ReadPrec [CreateTheme]
readPrec :: ReadPrec CreateTheme
$creadPrec :: ReadPrec CreateTheme
readList :: ReadS [CreateTheme]
$creadList :: ReadS [CreateTheme]
readsPrec :: Int -> ReadS CreateTheme
$creadsPrec :: Int -> ReadS CreateTheme
Prelude.Read, Int -> CreateTheme -> ShowS
[CreateTheme] -> ShowS
CreateTheme -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTheme] -> ShowS
$cshowList :: [CreateTheme] -> ShowS
show :: CreateTheme -> String
$cshow :: CreateTheme -> String
showsPrec :: Int -> CreateTheme -> ShowS
$cshowsPrec :: Int -> CreateTheme -> ShowS
Prelude.Show, forall x. Rep CreateTheme x -> CreateTheme
forall x. CreateTheme -> Rep CreateTheme x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTheme x -> CreateTheme
$cfrom :: forall x. CreateTheme -> Rep CreateTheme x
Prelude.Generic)

-- |
-- Create a value of 'CreateTheme' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'permissions', 'createTheme_permissions' - A valid grouping of resource permissions to apply to the new theme.
--
-- 'tags', 'createTheme_tags' - A map of the key-value pairs for the resource tag or tags that you want
-- to add to the resource.
--
-- 'versionDescription', 'createTheme_versionDescription' - A description of the first version of the theme that you\'re creating.
-- Every time @UpdateTheme@ is called, a new version is created. Each
-- version of the theme has a description of the version in the
-- @VersionDescription@ field.
--
-- 'awsAccountId', 'createTheme_awsAccountId' - The ID of the Amazon Web Services account where you want to store the
-- new theme.
--
-- 'themeId', 'createTheme_themeId' - An ID for the theme that you want to create. The theme ID is unique per
-- Amazon Web Services Region in each Amazon Web Services account.
--
-- 'name', 'createTheme_name' - A display name for the theme.
--
-- 'baseThemeId', 'createTheme_baseThemeId' - The ID of the theme that a custom theme will inherit from. All themes
-- inherit from one of the starting themes defined by Amazon QuickSight.
-- For a list of the starting themes, use @ListThemes@ or choose __Themes__
-- from within an analysis.
--
-- 'configuration', 'createTheme_configuration' - The theme configuration, which contains the theme display properties.
newCreateTheme ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'themeId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'baseThemeId'
  Prelude.Text ->
  -- | 'configuration'
  ThemeConfiguration ->
  CreateTheme
newCreateTheme :: Text -> Text -> Text -> Text -> ThemeConfiguration -> CreateTheme
newCreateTheme
  Text
pAwsAccountId_
  Text
pThemeId_
  Text
pName_
  Text
pBaseThemeId_
  ThemeConfiguration
pConfiguration_ =
    CreateTheme'
      { $sel:permissions:CreateTheme' :: Maybe (NonEmpty ResourcePermission)
permissions = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateTheme' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:versionDescription:CreateTheme' :: Maybe Text
versionDescription = forall a. Maybe a
Prelude.Nothing,
        $sel:awsAccountId:CreateTheme' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:themeId:CreateTheme' :: Text
themeId = Text
pThemeId_,
        $sel:name:CreateTheme' :: Text
name = Text
pName_,
        $sel:baseThemeId:CreateTheme' :: Text
baseThemeId = Text
pBaseThemeId_,
        $sel:configuration:CreateTheme' :: ThemeConfiguration
configuration = ThemeConfiguration
pConfiguration_
      }

-- | A valid grouping of resource permissions to apply to the new theme.
createTheme_permissions :: Lens.Lens' CreateTheme (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
createTheme_permissions :: Lens' CreateTheme (Maybe (NonEmpty ResourcePermission))
createTheme_permissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:CreateTheme' :: CreateTheme -> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: CreateTheme
s@CreateTheme' {} Maybe (NonEmpty ResourcePermission)
a -> CreateTheme
s {$sel:permissions:CreateTheme' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: CreateTheme) 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

-- | A map of the key-value pairs for the resource tag or tags that you want
-- to add to the resource.
createTheme_tags :: Lens.Lens' CreateTheme (Prelude.Maybe (Prelude.NonEmpty Tag))
createTheme_tags :: Lens' CreateTheme (Maybe (NonEmpty Tag))
createTheme_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateTheme' :: CreateTheme -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateTheme
s@CreateTheme' {} Maybe (NonEmpty Tag)
a -> CreateTheme
s {$sel:tags:CreateTheme' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateTheme) 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

-- | A description of the first version of the theme that you\'re creating.
-- Every time @UpdateTheme@ is called, a new version is created. Each
-- version of the theme has a description of the version in the
-- @VersionDescription@ field.
createTheme_versionDescription :: Lens.Lens' CreateTheme (Prelude.Maybe Prelude.Text)
createTheme_versionDescription :: Lens' CreateTheme (Maybe Text)
createTheme_versionDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Maybe Text
versionDescription :: Maybe Text
$sel:versionDescription:CreateTheme' :: CreateTheme -> Maybe Text
versionDescription} -> Maybe Text
versionDescription) (\s :: CreateTheme
s@CreateTheme' {} Maybe Text
a -> CreateTheme
s {$sel:versionDescription:CreateTheme' :: Maybe Text
versionDescription = Maybe Text
a} :: CreateTheme)

-- | The ID of the Amazon Web Services account where you want to store the
-- new theme.
createTheme_awsAccountId :: Lens.Lens' CreateTheme Prelude.Text
createTheme_awsAccountId :: Lens' CreateTheme Text
createTheme_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateTheme' :: CreateTheme -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateTheme
s@CreateTheme' {} Text
a -> CreateTheme
s {$sel:awsAccountId:CreateTheme' :: Text
awsAccountId = Text
a} :: CreateTheme)

-- | An ID for the theme that you want to create. The theme ID is unique per
-- Amazon Web Services Region in each Amazon Web Services account.
createTheme_themeId :: Lens.Lens' CreateTheme Prelude.Text
createTheme_themeId :: Lens' CreateTheme Text
createTheme_themeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Text
themeId :: Text
$sel:themeId:CreateTheme' :: CreateTheme -> Text
themeId} -> Text
themeId) (\s :: CreateTheme
s@CreateTheme' {} Text
a -> CreateTheme
s {$sel:themeId:CreateTheme' :: Text
themeId = Text
a} :: CreateTheme)

-- | A display name for the theme.
createTheme_name :: Lens.Lens' CreateTheme Prelude.Text
createTheme_name :: Lens' CreateTheme Text
createTheme_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Text
name :: Text
$sel:name:CreateTheme' :: CreateTheme -> Text
name} -> Text
name) (\s :: CreateTheme
s@CreateTheme' {} Text
a -> CreateTheme
s {$sel:name:CreateTheme' :: Text
name = Text
a} :: CreateTheme)

-- | The ID of the theme that a custom theme will inherit from. All themes
-- inherit from one of the starting themes defined by Amazon QuickSight.
-- For a list of the starting themes, use @ListThemes@ or choose __Themes__
-- from within an analysis.
createTheme_baseThemeId :: Lens.Lens' CreateTheme Prelude.Text
createTheme_baseThemeId :: Lens' CreateTheme Text
createTheme_baseThemeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {Text
baseThemeId :: Text
$sel:baseThemeId:CreateTheme' :: CreateTheme -> Text
baseThemeId} -> Text
baseThemeId) (\s :: CreateTheme
s@CreateTheme' {} Text
a -> CreateTheme
s {$sel:baseThemeId:CreateTheme' :: Text
baseThemeId = Text
a} :: CreateTheme)

-- | The theme configuration, which contains the theme display properties.
createTheme_configuration :: Lens.Lens' CreateTheme ThemeConfiguration
createTheme_configuration :: Lens' CreateTheme ThemeConfiguration
createTheme_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTheme' {ThemeConfiguration
configuration :: ThemeConfiguration
$sel:configuration:CreateTheme' :: CreateTheme -> ThemeConfiguration
configuration} -> ThemeConfiguration
configuration) (\s :: CreateTheme
s@CreateTheme' {} ThemeConfiguration
a -> CreateTheme
s {$sel:configuration:CreateTheme' :: ThemeConfiguration
configuration = ThemeConfiguration
a} :: CreateTheme)

instance Core.AWSRequest CreateTheme where
  type AWSResponse CreateTheme = CreateThemeResponse
  request :: (Service -> Service) -> CreateTheme -> Request CreateTheme
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTheme
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTheme)))
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 Text
-> Maybe ResourceStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateThemeResponse
CreateThemeResponse'
            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
"Arn")
            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
"CreationStatus")
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ThemeId")
            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
"VersionArn")
            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 CreateTheme where
  hashWithSalt :: Int -> CreateTheme -> Int
hashWithSalt Int
_salt CreateTheme' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Text
ThemeConfiguration
configuration :: ThemeConfiguration
baseThemeId :: Text
name :: Text
themeId :: Text
awsAccountId :: Text
versionDescription :: Maybe Text
tags :: Maybe (NonEmpty Tag)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:configuration:CreateTheme' :: CreateTheme -> ThemeConfiguration
$sel:baseThemeId:CreateTheme' :: CreateTheme -> Text
$sel:name:CreateTheme' :: CreateTheme -> Text
$sel:themeId:CreateTheme' :: CreateTheme -> Text
$sel:awsAccountId:CreateTheme' :: CreateTheme -> Text
$sel:versionDescription:CreateTheme' :: CreateTheme -> Maybe Text
$sel:tags:CreateTheme' :: CreateTheme -> Maybe (NonEmpty Tag)
$sel:permissions:CreateTheme' :: CreateTheme -> Maybe (NonEmpty ResourcePermission)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ResourcePermission)
permissions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
themeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
baseThemeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ThemeConfiguration
configuration

instance Prelude.NFData CreateTheme where
  rnf :: CreateTheme -> ()
rnf CreateTheme' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Text
ThemeConfiguration
configuration :: ThemeConfiguration
baseThemeId :: Text
name :: Text
themeId :: Text
awsAccountId :: Text
versionDescription :: Maybe Text
tags :: Maybe (NonEmpty Tag)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:configuration:CreateTheme' :: CreateTheme -> ThemeConfiguration
$sel:baseThemeId:CreateTheme' :: CreateTheme -> Text
$sel:name:CreateTheme' :: CreateTheme -> Text
$sel:themeId:CreateTheme' :: CreateTheme -> Text
$sel:awsAccountId:CreateTheme' :: CreateTheme -> Text
$sel:versionDescription:CreateTheme' :: CreateTheme -> Maybe Text
$sel:tags:CreateTheme' :: CreateTheme -> Maybe (NonEmpty Tag)
$sel:permissions:CreateTheme' :: CreateTheme -> Maybe (NonEmpty ResourcePermission)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ResourcePermission)
permissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
themeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
baseThemeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ThemeConfiguration
configuration

instance Data.ToHeaders CreateTheme where
  toHeaders :: CreateTheme -> 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.ToJSON CreateTheme where
  toJSON :: CreateTheme -> Value
toJSON CreateTheme' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Text
ThemeConfiguration
configuration :: ThemeConfiguration
baseThemeId :: Text
name :: Text
themeId :: Text
awsAccountId :: Text
versionDescription :: Maybe Text
tags :: Maybe (NonEmpty Tag)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:configuration:CreateTheme' :: CreateTheme -> ThemeConfiguration
$sel:baseThemeId:CreateTheme' :: CreateTheme -> Text
$sel:name:CreateTheme' :: CreateTheme -> Text
$sel:themeId:CreateTheme' :: CreateTheme -> Text
$sel:awsAccountId:CreateTheme' :: CreateTheme -> Text
$sel:versionDescription:CreateTheme' :: CreateTheme -> Maybe Text
$sel:tags:CreateTheme' :: CreateTheme -> Maybe (NonEmpty Tag)
$sel:permissions:CreateTheme' :: CreateTheme -> Maybe (NonEmpty ResourcePermission)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Permissions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourcePermission)
permissions,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            (Key
"VersionDescription" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionDescription,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"BaseThemeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
baseThemeId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"Configuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ThemeConfiguration
configuration)
          ]
      )

instance Data.ToPath CreateTheme where
  toPath :: CreateTheme -> ByteString
toPath CreateTheme' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Text
ThemeConfiguration
configuration :: ThemeConfiguration
baseThemeId :: Text
name :: Text
themeId :: Text
awsAccountId :: Text
versionDescription :: Maybe Text
tags :: Maybe (NonEmpty Tag)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:configuration:CreateTheme' :: CreateTheme -> ThemeConfiguration
$sel:baseThemeId:CreateTheme' :: CreateTheme -> Text
$sel:name:CreateTheme' :: CreateTheme -> Text
$sel:themeId:CreateTheme' :: CreateTheme -> Text
$sel:awsAccountId:CreateTheme' :: CreateTheme -> Text
$sel:versionDescription:CreateTheme' :: CreateTheme -> Maybe Text
$sel:tags:CreateTheme' :: CreateTheme -> Maybe (NonEmpty Tag)
$sel:permissions:CreateTheme' :: CreateTheme -> Maybe (NonEmpty ResourcePermission)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
        ByteString
"/themes/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
themeId
      ]

instance Data.ToQuery CreateTheme where
  toQuery :: CreateTheme -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateThemeResponse' smart constructor.
data CreateThemeResponse = CreateThemeResponse'
  { -- | The Amazon Resource Name (ARN) for the theme.
    CreateThemeResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The theme creation status.
    CreateThemeResponse -> Maybe ResourceStatus
creationStatus :: Prelude.Maybe ResourceStatus,
    -- | The Amazon Web Services request ID for this operation.
    CreateThemeResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the theme.
    CreateThemeResponse -> Maybe Text
themeId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the new theme.
    CreateThemeResponse -> Maybe Text
versionArn :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    CreateThemeResponse -> Int
status :: Prelude.Int
  }
  deriving (CreateThemeResponse -> CreateThemeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateThemeResponse -> CreateThemeResponse -> Bool
$c/= :: CreateThemeResponse -> CreateThemeResponse -> Bool
== :: CreateThemeResponse -> CreateThemeResponse -> Bool
$c== :: CreateThemeResponse -> CreateThemeResponse -> Bool
Prelude.Eq, ReadPrec [CreateThemeResponse]
ReadPrec CreateThemeResponse
Int -> ReadS CreateThemeResponse
ReadS [CreateThemeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateThemeResponse]
$creadListPrec :: ReadPrec [CreateThemeResponse]
readPrec :: ReadPrec CreateThemeResponse
$creadPrec :: ReadPrec CreateThemeResponse
readList :: ReadS [CreateThemeResponse]
$creadList :: ReadS [CreateThemeResponse]
readsPrec :: Int -> ReadS CreateThemeResponse
$creadsPrec :: Int -> ReadS CreateThemeResponse
Prelude.Read, Int -> CreateThemeResponse -> ShowS
[CreateThemeResponse] -> ShowS
CreateThemeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateThemeResponse] -> ShowS
$cshowList :: [CreateThemeResponse] -> ShowS
show :: CreateThemeResponse -> String
$cshow :: CreateThemeResponse -> String
showsPrec :: Int -> CreateThemeResponse -> ShowS
$cshowsPrec :: Int -> CreateThemeResponse -> ShowS
Prelude.Show, forall x. Rep CreateThemeResponse x -> CreateThemeResponse
forall x. CreateThemeResponse -> Rep CreateThemeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateThemeResponse x -> CreateThemeResponse
$cfrom :: forall x. CreateThemeResponse -> Rep CreateThemeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateThemeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'arn', 'createThemeResponse_arn' - The Amazon Resource Name (ARN) for the theme.
--
-- 'creationStatus', 'createThemeResponse_creationStatus' - The theme creation status.
--
-- 'requestId', 'createThemeResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'themeId', 'createThemeResponse_themeId' - The ID of the theme.
--
-- 'versionArn', 'createThemeResponse_versionArn' - The Amazon Resource Name (ARN) for the new theme.
--
-- 'status', 'createThemeResponse_status' - The HTTP status of the request.
newCreateThemeResponse ::
  -- | 'status'
  Prelude.Int ->
  CreateThemeResponse
newCreateThemeResponse :: Int -> CreateThemeResponse
newCreateThemeResponse Int
pStatus_ =
  CreateThemeResponse'
    { $sel:arn:CreateThemeResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationStatus:CreateThemeResponse' :: Maybe ResourceStatus
creationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:CreateThemeResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:themeId:CreateThemeResponse' :: Maybe Text
themeId = forall a. Maybe a
Prelude.Nothing,
      $sel:versionArn:CreateThemeResponse' :: Maybe Text
versionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateThemeResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Resource Name (ARN) for the theme.
createThemeResponse_arn :: Lens.Lens' CreateThemeResponse (Prelude.Maybe Prelude.Text)
createThemeResponse_arn :: Lens' CreateThemeResponse (Maybe Text)
createThemeResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Maybe Text
a -> CreateThemeResponse
s {$sel:arn:CreateThemeResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateThemeResponse)

-- | The theme creation status.
createThemeResponse_creationStatus :: Lens.Lens' CreateThemeResponse (Prelude.Maybe ResourceStatus)
createThemeResponse_creationStatus :: Lens' CreateThemeResponse (Maybe ResourceStatus)
createThemeResponse_creationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Maybe ResourceStatus
creationStatus :: Maybe ResourceStatus
$sel:creationStatus:CreateThemeResponse' :: CreateThemeResponse -> Maybe ResourceStatus
creationStatus} -> Maybe ResourceStatus
creationStatus) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Maybe ResourceStatus
a -> CreateThemeResponse
s {$sel:creationStatus:CreateThemeResponse' :: Maybe ResourceStatus
creationStatus = Maybe ResourceStatus
a} :: CreateThemeResponse)

-- | The Amazon Web Services request ID for this operation.
createThemeResponse_requestId :: Lens.Lens' CreateThemeResponse (Prelude.Maybe Prelude.Text)
createThemeResponse_requestId :: Lens' CreateThemeResponse (Maybe Text)
createThemeResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Maybe Text
a -> CreateThemeResponse
s {$sel:requestId:CreateThemeResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateThemeResponse)

-- | The ID of the theme.
createThemeResponse_themeId :: Lens.Lens' CreateThemeResponse (Prelude.Maybe Prelude.Text)
createThemeResponse_themeId :: Lens' CreateThemeResponse (Maybe Text)
createThemeResponse_themeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Maybe Text
themeId :: Maybe Text
$sel:themeId:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
themeId} -> Maybe Text
themeId) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Maybe Text
a -> CreateThemeResponse
s {$sel:themeId:CreateThemeResponse' :: Maybe Text
themeId = Maybe Text
a} :: CreateThemeResponse)

-- | The Amazon Resource Name (ARN) for the new theme.
createThemeResponse_versionArn :: Lens.Lens' CreateThemeResponse (Prelude.Maybe Prelude.Text)
createThemeResponse_versionArn :: Lens' CreateThemeResponse (Maybe Text)
createThemeResponse_versionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Maybe Text
versionArn :: Maybe Text
$sel:versionArn:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
versionArn} -> Maybe Text
versionArn) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Maybe Text
a -> CreateThemeResponse
s {$sel:versionArn:CreateThemeResponse' :: Maybe Text
versionArn = Maybe Text
a} :: CreateThemeResponse)

-- | The HTTP status of the request.
createThemeResponse_status :: Lens.Lens' CreateThemeResponse Prelude.Int
createThemeResponse_status :: Lens' CreateThemeResponse Int
createThemeResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThemeResponse' {Int
status :: Int
$sel:status:CreateThemeResponse' :: CreateThemeResponse -> Int
status} -> Int
status) (\s :: CreateThemeResponse
s@CreateThemeResponse' {} Int
a -> CreateThemeResponse
s {$sel:status:CreateThemeResponse' :: Int
status = Int
a} :: CreateThemeResponse)

instance Prelude.NFData CreateThemeResponse where
  rnf :: CreateThemeResponse -> ()
rnf CreateThemeResponse' {Int
Maybe Text
Maybe ResourceStatus
status :: Int
versionArn :: Maybe Text
themeId :: Maybe Text
requestId :: Maybe Text
creationStatus :: Maybe ResourceStatus
arn :: Maybe Text
$sel:status:CreateThemeResponse' :: CreateThemeResponse -> Int
$sel:versionArn:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
$sel:themeId:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
$sel:requestId:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
$sel:creationStatus:CreateThemeResponse' :: CreateThemeResponse -> Maybe ResourceStatus
$sel:arn:CreateThemeResponse' :: CreateThemeResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceStatus
creationStatus
      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 Maybe Text
themeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status