1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package iotjobsdataplane 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/iotjobsdataplane/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Updates the status of a job execution. 15func (c *Client) UpdateJobExecution(ctx context.Context, params *UpdateJobExecutionInput, optFns ...func(*Options)) (*UpdateJobExecutionOutput, error) { 16 if params == nil { 17 params = &UpdateJobExecutionInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "UpdateJobExecution", params, optFns, addOperationUpdateJobExecutionMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*UpdateJobExecutionOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30type UpdateJobExecutionInput struct { 31 32 // The unique identifier assigned to this job when it was created. 33 // 34 // This member is required. 35 JobId *string 36 37 // The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or 38 // REJECTED). This must be specified on every update. 39 // 40 // This member is required. 41 Status types.JobExecutionStatus 42 43 // The name of the thing associated with the device. 44 // 45 // This member is required. 46 ThingName *string 47 48 // Optional. A number that identifies a particular job execution on a particular 49 // device. 50 ExecutionNumber *int64 51 52 // Optional. The expected current version of the job execution. Each time you 53 // update the job execution, its version is incremented. If the version of the job 54 // execution stored in Jobs does not match, the update is rejected with a 55 // VersionMismatch error, and an ErrorResponse that contains the current job 56 // execution status data is returned. (This makes it unnecessary to perform a 57 // separate DescribeJobExecution request in order to obtain the job execution 58 // status data.) 59 ExpectedVersion *int64 60 61 // Optional. When set to true, the response contains the job document. The default 62 // is false. 63 IncludeJobDocument *bool 64 65 // Optional. When included and set to true, the response contains the 66 // JobExecutionState data. The default is false. 67 IncludeJobExecutionState *bool 68 69 // Optional. A collection of name/value pairs that describe the status of the job 70 // execution. If not specified, the statusDetails are unchanged. 71 StatusDetails map[string]string 72 73 // Specifies the amount of time this device has to finish execution of this job. If 74 // the job execution status is not set to a terminal state before this timer 75 // expires, or before the timer is reset (by again calling UpdateJobExecution, 76 // setting the status to IN_PROGRESS and specifying a new timeout value in this 77 // field) the job execution status will be automatically set to TIMED_OUT. Note 78 // that setting or resetting this timeout has no effect on that job execution 79 // timeout which may have been specified when the job was created (CreateJob using 80 // field timeoutConfig). 81 StepTimeoutInMinutes *int64 82} 83 84type UpdateJobExecutionOutput struct { 85 86 // A JobExecutionState object. 87 ExecutionState *types.JobExecutionState 88 89 // The contents of the Job Documents. 90 JobDocument *string 91 92 // Metadata pertaining to the operation's result. 93 ResultMetadata middleware.Metadata 94} 95 96func addOperationUpdateJobExecutionMiddlewares(stack *middleware.Stack, options Options) (err error) { 97 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateJobExecution{}, middleware.After) 98 if err != nil { 99 return err 100 } 101 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateJobExecution{}, middleware.After) 102 if err != nil { 103 return err 104 } 105 if err = addSetLoggerMiddleware(stack, options); err != nil { 106 return err 107 } 108 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 109 return err 110 } 111 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 112 return err 113 } 114 if err = addResolveEndpointMiddleware(stack, options); err != nil { 115 return err 116 } 117 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 118 return err 119 } 120 if err = addRetryMiddlewares(stack, options); err != nil { 121 return err 122 } 123 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 124 return err 125 } 126 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 127 return err 128 } 129 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 130 return err 131 } 132 if err = addClientUserAgent(stack); err != nil { 133 return err 134 } 135 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 136 return err 137 } 138 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addOpUpdateJobExecutionValidationMiddleware(stack); err != nil { 142 return err 143 } 144 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateJobExecution(options.Region), middleware.Before); err != nil { 145 return err 146 } 147 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addResponseErrorMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addRequestResponseLogging(stack, options); err != nil { 154 return err 155 } 156 return nil 157} 158 159func newServiceMetadataMiddleware_opUpdateJobExecution(region string) *awsmiddleware.RegisterServiceMetadata { 160 return &awsmiddleware.RegisterServiceMetadata{ 161 Region: region, 162 ServiceID: ServiceID, 163 SigningName: "iot-jobs-data", 164 OperationName: "UpdateJobExecution", 165 } 166} 167