1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package datapipeline
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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Task runners call ReportTaskRunnerHeartbeat every 15 minutes to indicate that
14// they are operational. If the AWS Data Pipeline Task Runner is launched on a
15// resource managed by AWS Data Pipeline, the web service can use this call to
16// detect when the task runner application has failed and restart a new instance.
17// POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target:
18// DataPipeline.ReportTaskRunnerHeartbeat Content-Length: 84 Host:
19// datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon, 12 Nov 2012 17:49:52 GMT
20// Authorization: AuthParams {"taskrunnerId": "1234567890", "workerGroup":
21// "wg-12345", "hostname": "example.com"} Status: x-amzn-RequestId:
22// b3104dc5-0734-11e2-af6f-6bc7a6be60d9 Content-Type: application/x-amz-json-1.1
23// Content-Length: 20 Date: Mon, 12 Nov 2012 17:50:53 GMT {"terminate": false}
24func (c *Client) ReportTaskRunnerHeartbeat(ctx context.Context, params *ReportTaskRunnerHeartbeatInput, optFns ...func(*Options)) (*ReportTaskRunnerHeartbeatOutput, error) {
25	if params == nil {
26		params = &ReportTaskRunnerHeartbeatInput{}
27	}
28
29	result, metadata, err := c.invokeOperation(ctx, "ReportTaskRunnerHeartbeat", params, optFns, addOperationReportTaskRunnerHeartbeatMiddlewares)
30	if err != nil {
31		return nil, err
32	}
33
34	out := result.(*ReportTaskRunnerHeartbeatOutput)
35	out.ResultMetadata = metadata
36	return out, nil
37}
38
39// Contains the parameters for ReportTaskRunnerHeartbeat.
40type ReportTaskRunnerHeartbeatInput struct {
41
42	// The ID of the task runner. This value should be unique across your AWS account.
43	// In the case of AWS Data Pipeline Task Runner launched on a resource managed by
44	// AWS Data Pipeline, the web service provides a unique identifier when it launches
45	// the application. If you have written a custom task runner, you should assign a
46	// unique identifier for the task runner.
47	//
48	// This member is required.
49	TaskrunnerId *string
50
51	// The public DNS name of the task runner.
52	Hostname *string
53
54	// The type of task the task runner is configured to accept and process. The worker
55	// group is set as a field on objects in the pipeline when they are created. You
56	// can only specify a single value for workerGroup. There are no wildcard values
57	// permitted in workerGroup; the string must be an exact, case-sensitive, match.
58	WorkerGroup *string
59}
60
61// Contains the output of ReportTaskRunnerHeartbeat.
62type ReportTaskRunnerHeartbeatOutput struct {
63
64	// Indicates whether the calling task runner should terminate.
65	//
66	// This member is required.
67	Terminate bool
68
69	// Metadata pertaining to the operation's result.
70	ResultMetadata middleware.Metadata
71}
72
73func addOperationReportTaskRunnerHeartbeatMiddlewares(stack *middleware.Stack, options Options) (err error) {
74	err = stack.Serialize.Add(&awsAwsjson11_serializeOpReportTaskRunnerHeartbeat{}, middleware.After)
75	if err != nil {
76		return err
77	}
78	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpReportTaskRunnerHeartbeat{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	if err = addSetLoggerMiddleware(stack, options); err != nil {
83		return err
84	}
85	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
86		return err
87	}
88	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
89		return err
90	}
91	if err = addResolveEndpointMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
95		return err
96	}
97	if err = addRetryMiddlewares(stack, options); err != nil {
98		return err
99	}
100	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
107		return err
108	}
109	if err = addClientUserAgent(stack); err != nil {
110		return err
111	}
112	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addOpReportTaskRunnerHeartbeatValidationMiddleware(stack); err != nil {
119		return err
120	}
121	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opReportTaskRunnerHeartbeat(options.Region), middleware.Before); err != nil {
122		return err
123	}
124	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addResponseErrorMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addRequestResponseLogging(stack, options); err != nil {
131		return err
132	}
133	return nil
134}
135
136func newServiceMetadataMiddleware_opReportTaskRunnerHeartbeat(region string) *awsmiddleware.RegisterServiceMetadata {
137	return &awsmiddleware.RegisterServiceMetadata{
138		Region:        region,
139		ServiceID:     ServiceID,
140		SigningName:   "datapipeline",
141		OperationName: "ReportTaskRunnerHeartbeat",
142	}
143}
144