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// (Enterprise edition only) Creates a new namespace for you to use with Amazon
15// QuickSight. A namespace allows you to isolate the QuickSight users and groups
16// that are registered for that namespace. Users that access the namespace can
17// share assets only with other users or groups in the same namespace. They can't
18// see users and groups in other namespaces. You can create a namespace after your
19// AWS account is subscribed to QuickSight. The namespace must be unique within the
20// AWS account. By default, there is a limit of 100 namespaces per AWS account. To
21// increase your limit, create a ticket with AWS Support.
22func (c *Client) CreateNamespace(ctx context.Context, params *CreateNamespaceInput, optFns ...func(*Options)) (*CreateNamespaceOutput, error) {
23	if params == nil {
24		params = &CreateNamespaceInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "CreateNamespace", params, optFns, addOperationCreateNamespaceMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*CreateNamespaceOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type CreateNamespaceInput struct {
38
39	// The ID for the AWS account that you want to create the QuickSight namespace in.
40	//
41	// This member is required.
42	AwsAccountId *string
43
44	// Specifies the type of your user identity directory. Currently, this supports
45	// users with an identity type of QUICKSIGHT.
46	//
47	// This member is required.
48	IdentityStore types.IdentityStore
49
50	// The name that you want to use to describe the new namespace.
51	//
52	// This member is required.
53	Namespace *string
54
55	// The tags that you want to associate with the namespace that you're creating.
56	Tags []types.Tag
57}
58
59type CreateNamespaceOutput struct {
60
61	// The ARN of the QuickSight namespace you created.
62	Arn *string
63
64	// The AWS Region that you want to use for the free SPICE capacity for the new
65	// namespace. This is set to the region that you run CreateNamespace in.
66	CapacityRegion *string
67
68	// The status of the creation of the namespace. This is an asynchronous process. A
69	// status of CREATED means that your namespace is ready to use. If an error occurs,
70	// it indicates if the process is retryable or non-retryable. In the case of a
71	// non-retryable error, refer to the error message for follow-up tasks.
72	CreationStatus types.NamespaceStatus
73
74	// Specifies the type of your user identity directory. Currently, this supports
75	// users with an identity type of QUICKSIGHT.
76	IdentityStore types.IdentityStore
77
78	// The name of the new namespace that you created.
79	Name *string
80
81	// The AWS request ID for this operation.
82	RequestId *string
83
84	// The HTTP status of the request.
85	Status int32
86
87	// Metadata pertaining to the operation's result.
88	ResultMetadata middleware.Metadata
89}
90
91func addOperationCreateNamespaceMiddlewares(stack *middleware.Stack, options Options) (err error) {
92	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateNamespace{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateNamespace{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	if err = addSetLoggerMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
104		return err
105	}
106	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
107		return err
108	}
109	if err = addResolveEndpointMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
113		return err
114	}
115	if err = addRetryMiddlewares(stack, options); err != nil {
116		return err
117	}
118	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
125		return err
126	}
127	if err = addClientUserAgent(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addOpCreateNamespaceValidationMiddleware(stack); err != nil {
137		return err
138	}
139	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateNamespace(options.Region), middleware.Before); err != nil {
140		return err
141	}
142	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addResponseErrorMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addRequestResponseLogging(stack, options); err != nil {
149		return err
150	}
151	return nil
152}
153
154func newServiceMetadataMiddleware_opCreateNamespace(region string) *awsmiddleware.RegisterServiceMetadata {
155	return &awsmiddleware.RegisterServiceMetadata{
156		Region:        region,
157		ServiceID:     ServiceID,
158		SigningName:   "quicksight",
159		OperationName: "CreateNamespace",
160	}
161}
162