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 workflow type and its configuration settings in the specified 15// domain. The retention period for the workflow history is set by the 16// RegisterDomain action. If the type already exists, then a TypeAlreadyExists 17// fault is returned. You cannot change the configuration settings of a workflow 18// type once it is registered and it must be registered as a new version. Access 19// Control You can use IAM policies to control this action's access to Amazon SWF 20// resources as follows: 21// 22// * Use a Resource element with the domain name to limit 23// the action to only specified domains. 24// 25// * Use an Action element to allow or deny 26// permission to call this action. 27// 28// * Constrain the following parameters by using a 29// Condition element with the appropriate keys. 30// 31// * defaultTaskList.name: String 32// constraint. The key is swf:defaultTaskList.name. 33// 34// * name: String constraint. The 35// key is swf:name. 36// 37// * version: String constraint. The key is swf:version. 38// 39// If the 40// caller doesn't have sufficient permissions to invoke the action, or the 41// parameter values fall outside the specified constraints, the action fails. The 42// associated event attribute's cause parameter is set to OPERATION_NOT_PERMITTED. 43// For details and example IAM policies, see Using IAM to Manage Access to Amazon 44// SWF Workflows 45// (https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html) 46// in the Amazon SWF Developer Guide. 47func (c *Client) RegisterWorkflowType(ctx context.Context, params *RegisterWorkflowTypeInput, optFns ...func(*Options)) (*RegisterWorkflowTypeOutput, error) { 48 if params == nil { 49 params = &RegisterWorkflowTypeInput{} 50 } 51 52 result, metadata, err := c.invokeOperation(ctx, "RegisterWorkflowType", params, optFns, addOperationRegisterWorkflowTypeMiddlewares) 53 if err != nil { 54 return nil, err 55 } 56 57 out := result.(*RegisterWorkflowTypeOutput) 58 out.ResultMetadata = metadata 59 return out, nil 60} 61 62type RegisterWorkflowTypeInput struct { 63 64 // The name of the domain in which to register the workflow type. 65 // 66 // This member is required. 67 Domain *string 68 69 // The name of the workflow type. The specified string must not start or end with 70 // whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any 71 // control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the 72 // literal string arn. 73 // 74 // This member is required. 75 Name *string 76 77 // The version of the workflow type. The workflow type consists of the name and 78 // version, the combination of which must be unique within the domain. To get a 79 // list of all currently registered workflow types, use the ListWorkflowTypes 80 // action. The specified string must not start or end with whitespace. It must not 81 // contain a : (colon), / (slash), | (vertical bar), or any control characters 82 // (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn. 83 // 84 // This member is required. 85 Version *string 86 87 // If set, specifies the default policy to use for the child workflow executions 88 // when a workflow execution of this type is terminated, by calling the 89 // TerminateWorkflowExecution action explicitly or due to an expired timeout. This 90 // default can be overridden when starting a workflow execution using the 91 // StartWorkflowExecution action or the StartChildWorkflowExecutionDecision. The 92 // supported child policies are: 93 // 94 // * TERMINATE – The child executions are 95 // terminated. 96 // 97 // * REQUEST_CANCEL – A request to cancel is attempted for each child 98 // execution by recording a WorkflowExecutionCancelRequested event in its history. 99 // It is up to the decider to take appropriate actions when it receives an 100 // execution history with this event. 101 // 102 // * ABANDON – No action is taken. The child 103 // executions continue to run. 104 DefaultChildPolicy types.ChildPolicy 105 106 // If set, specifies the default maximum duration for executions of this workflow 107 // type. You can override this default when starting an execution through the 108 // StartWorkflowExecution Action or StartChildWorkflowExecutionDecision. The 109 // duration is specified in seconds; an integer greater than or equal to 0. Unlike 110 // some of the other timeout parameters in Amazon SWF, you cannot specify a value 111 // of "NONE" for defaultExecutionStartToCloseTimeout; there is a one-year max limit 112 // on the time that a workflow execution can run. Exceeding this limit always 113 // causes the workflow execution to time out. 114 DefaultExecutionStartToCloseTimeout *string 115 116 // The default IAM role attached to this workflow type. Executions of this workflow 117 // type need IAM roles to invoke Lambda functions. If you don't specify an IAM role 118 // when you start this workflow type, the default Lambda role is attached to the 119 // execution. For more information, see 120 // https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html 121 // (https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html) 122 // in the Amazon SWF Developer Guide. 123 DefaultLambdaRole *string 124 125 // If set, specifies the default task list to use for scheduling decision tasks for 126 // executions of this workflow type. This default is used only if a task list isn't 127 // provided when starting the execution through the StartWorkflowExecution Action 128 // or StartChildWorkflowExecutionDecision. 129 DefaultTaskList *types.TaskList 130 131 // The default task priority to assign to the workflow type. If not assigned, then 132 // 0 is used. Valid values are integers that range from Java's Integer.MIN_VALUE 133 // (-2147483648) to Integer.MAX_VALUE (2147483647). Higher numbers indicate higher 134 // priority. For more information about setting task priority, see Setting Task 135 // Priority 136 // (https://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html) 137 // in the Amazon SWF Developer Guide. 138 DefaultTaskPriority *string 139 140 // If set, specifies the default maximum duration of decision tasks for this 141 // workflow type. This default can be overridden when starting a workflow execution 142 // using the StartWorkflowExecution action or the 143 // StartChildWorkflowExecutionDecision. The duration is specified in seconds, an 144 // integer greater than or equal to 0. You can use NONE to specify unlimited 145 // duration. 146 DefaultTaskStartToCloseTimeout *string 147 148 // Textual description of the workflow type. 149 Description *string 150} 151 152type RegisterWorkflowTypeOutput struct { 153 // Metadata pertaining to the operation's result. 154 ResultMetadata middleware.Metadata 155} 156 157func addOperationRegisterWorkflowTypeMiddlewares(stack *middleware.Stack, options Options) (err error) { 158 err = stack.Serialize.Add(&awsAwsjson10_serializeOpRegisterWorkflowType{}, middleware.After) 159 if err != nil { 160 return err 161 } 162 err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpRegisterWorkflowType{}, middleware.After) 163 if err != nil { 164 return err 165 } 166 if err = addSetLoggerMiddleware(stack, options); err != nil { 167 return err 168 } 169 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 170 return err 171 } 172 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 173 return err 174 } 175 if err = addResolveEndpointMiddleware(stack, options); err != nil { 176 return err 177 } 178 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 179 return err 180 } 181 if err = addRetryMiddlewares(stack, options); err != nil { 182 return err 183 } 184 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 185 return err 186 } 187 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 188 return err 189 } 190 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 191 return err 192 } 193 if err = addClientUserAgent(stack); err != nil { 194 return err 195 } 196 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 197 return err 198 } 199 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 200 return err 201 } 202 if err = addOpRegisterWorkflowTypeValidationMiddleware(stack); err != nil { 203 return err 204 } 205 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterWorkflowType(options.Region), middleware.Before); err != nil { 206 return err 207 } 208 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 209 return err 210 } 211 if err = addResponseErrorMiddleware(stack); err != nil { 212 return err 213 } 214 if err = addRequestResponseLogging(stack, options); err != nil { 215 return err 216 } 217 return nil 218} 219 220func newServiceMetadataMiddleware_opRegisterWorkflowType(region string) *awsmiddleware.RegisterServiceMetadata { 221 return &awsmiddleware.RegisterServiceMetadata{ 222 Region: region, 223 ServiceID: ServiceID, 224 SigningName: "swf", 225 OperationName: "RegisterWorkflowType", 226 } 227} 228