1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package swf
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/swf/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Registers a new domain. Access Control You can use IAM policies to control this
15// action's access to Amazon SWF resources as follows:
16//
17// * You cannot use an IAM
18// policy to control domain access for this action. The name of the domain being
19// registered is available as the resource of this action.
20//
21// * Use an Action element
22// to allow or deny permission to call this action.
23//
24// * You cannot use an IAM policy
25// to constrain this action's parameters.
26//
27// If the caller doesn't have sufficient
28// permissions to invoke the action, or the parameter values fall outside the
29// specified constraints, the action fails. The associated event attribute's cause
30// parameter is set to OPERATION_NOT_PERMITTED. For details and example IAM
31// policies, see Using IAM to Manage Access to Amazon SWF Workflows
32// (https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html)
33// in the Amazon SWF Developer Guide.
34func (c *Client) RegisterDomain(ctx context.Context, params *RegisterDomainInput, optFns ...func(*Options)) (*RegisterDomainOutput, error) {
35	if params == nil {
36		params = &RegisterDomainInput{}
37	}
38
39	result, metadata, err := c.invokeOperation(ctx, "RegisterDomain", params, optFns, addOperationRegisterDomainMiddlewares)
40	if err != nil {
41		return nil, err
42	}
43
44	out := result.(*RegisterDomainOutput)
45	out.ResultMetadata = metadata
46	return out, nil
47}
48
49type RegisterDomainInput struct {
50
51	// Name of the domain to register. The name must be unique in the region that the
52	// domain is registered in. The specified string must not start or end with
53	// whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any
54	// control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the
55	// literal string arn.
56	//
57	// This member is required.
58	Name *string
59
60	// The duration (in days) that records and histories of workflow executions on the
61	// domain should be kept by the service. After the retention period, the workflow
62	// execution isn't available in the results of visibility calls. If you pass the
63	// value NONE or 0 (zero), then the workflow execution history isn't retained. As
64	// soon as the workflow execution completes, the execution record and its history
65	// are deleted. The maximum workflow execution retention period is 90 days. For
66	// more information about Amazon SWF service limits, see: Amazon SWF Service Limits
67	// (https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-limits.html)
68	// in the Amazon SWF Developer Guide.
69	//
70	// This member is required.
71	WorkflowExecutionRetentionPeriodInDays *string
72
73	// A text description of the domain.
74	Description *string
75
76	// Tags to be added when registering a domain. Tags may only contain unicode
77	// letters, digits, whitespace, or these symbols: _ . : / = + - @.
78	Tags []types.ResourceTag
79}
80
81type RegisterDomainOutput struct {
82	// Metadata pertaining to the operation's result.
83	ResultMetadata middleware.Metadata
84}
85
86func addOperationRegisterDomainMiddlewares(stack *middleware.Stack, options Options) (err error) {
87	err = stack.Serialize.Add(&awsAwsjson10_serializeOpRegisterDomain{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpRegisterDomain{}, middleware.After)
92	if err != nil {
93		return err
94	}
95	if err = addSetLoggerMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
99		return err
100	}
101	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
102		return err
103	}
104	if err = addResolveEndpointMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
108		return err
109	}
110	if err = addRetryMiddlewares(stack, options); err != nil {
111		return err
112	}
113	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
120		return err
121	}
122	if err = addClientUserAgent(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addOpRegisterDomainValidationMiddleware(stack); err != nil {
132		return err
133	}
134	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterDomain(options.Region), middleware.Before); err != nil {
135		return err
136	}
137	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addResponseErrorMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addRequestResponseLogging(stack, options); err != nil {
144		return err
145	}
146	return nil
147}
148
149func newServiceMetadataMiddleware_opRegisterDomain(region string) *awsmiddleware.RegisterServiceMetadata {
150	return &awsmiddleware.RegisterServiceMetadata{
151		Region:        region,
152		ServiceID:     ServiceID,
153		SigningName:   "swf",
154		OperationName: "RegisterDomain",
155	}
156}
157