1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package quicksight
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/quicksight/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a theme. A theme is set of configuration options for color and layout.
15// Themes apply to analyses and dashboards. For more information, see Using Themes
16// in Amazon QuickSight
17// (https://docs.aws.amazon.com/quicksight/latest/user/themes-in-quicksight.html)
18// in the Amazon QuickSight User Guide.
19func (c *Client) CreateTheme(ctx context.Context, params *CreateThemeInput, optFns ...func(*Options)) (*CreateThemeOutput, error) {
20	if params == nil {
21		params = &CreateThemeInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "CreateTheme", params, optFns, c.addOperationCreateThemeMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*CreateThemeOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type CreateThemeInput struct {
35
36	// The ID of the Amazon Web Services account where you want to store the new theme.
37	//
38	// This member is required.
39	AwsAccountId *string
40
41	// The ID of the theme that a custom theme will inherit from. All themes inherit
42	// from one of the starting themes defined by Amazon QuickSight. For a list of the
43	// starting themes, use ListThemes or choose Themes from within a Amazon QuickSight
44	// analysis.
45	//
46	// This member is required.
47	BaseThemeId *string
48
49	// The theme configuration, which contains the theme display properties.
50	//
51	// This member is required.
52	Configuration *types.ThemeConfiguration
53
54	// A display name for the theme.
55	//
56	// This member is required.
57	Name *string
58
59	// An ID for the theme that you want to create. The theme ID is unique per Amazon
60	// Web Services Region in each Amazon Web Services account.
61	//
62	// This member is required.
63	ThemeId *string
64
65	// A valid grouping of resource permissions to apply to the new theme.
66	Permissions []types.ResourcePermission
67
68	// A map of the key-value pairs for the resource tag or tags that you want to add
69	// to the resource.
70	Tags []types.Tag
71
72	// A description of the first version of the theme that you're creating. Every time
73	// UpdateTheme is called, a new version is created. Each version of the theme has a
74	// description of the version in the VersionDescription field.
75	VersionDescription *string
76
77	noSmithyDocumentSerde
78}
79
80type CreateThemeOutput struct {
81
82	// The Amazon Resource Name (ARN) for the theme.
83	Arn *string
84
85	// The theme creation status.
86	CreationStatus types.ResourceStatus
87
88	// The Amazon Web Services request ID for this operation.
89	RequestId *string
90
91	// The HTTP status of the request.
92	Status int32
93
94	// The ID of the theme.
95	ThemeId *string
96
97	// The Amazon Resource Name (ARN) for the new theme.
98	VersionArn *string
99
100	// Metadata pertaining to the operation's result.
101	ResultMetadata middleware.Metadata
102
103	noSmithyDocumentSerde
104}
105
106func (c *Client) addOperationCreateThemeMiddlewares(stack *middleware.Stack, options Options) (err error) {
107	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateTheme{}, middleware.After)
108	if err != nil {
109		return err
110	}
111	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateTheme{}, middleware.After)
112	if err != nil {
113		return err
114	}
115	if err = addSetLoggerMiddleware(stack, options); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addResolveEndpointMiddleware(stack, options); err != nil {
125		return err
126	}
127	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
128		return err
129	}
130	if err = addRetryMiddlewares(stack, options); err != nil {
131		return err
132	}
133	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
134		return err
135	}
136	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
137		return err
138	}
139	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
140		return err
141	}
142	if err = addClientUserAgent(stack); err != nil {
143		return err
144	}
145	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
146		return err
147	}
148	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addOpCreateThemeValidationMiddleware(stack); err != nil {
152		return err
153	}
154	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTheme(options.Region), middleware.Before); err != nil {
155		return err
156	}
157	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addResponseErrorMiddleware(stack); err != nil {
161		return err
162	}
163	if err = addRequestResponseLogging(stack, options); err != nil {
164		return err
165	}
166	return nil
167}
168
169func newServiceMetadataMiddleware_opCreateTheme(region string) *awsmiddleware.RegisterServiceMetadata {
170	return &awsmiddleware.RegisterServiceMetadata{
171		Region:        region,
172		ServiceID:     ServiceID,
173		SigningName:   "quicksight",
174		OperationName: "CreateTheme",
175	}
176}
177