1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package honeycode
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/honeycode/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// The InvokeScreenAutomation API allows invoking an action defined in a screen in
15// a Honeycode app. The API allows setting local variables, which can then be used
16// in the automation being invoked. This allows automating the Honeycode app
17// interactions to write, update or delete data in the workbook.
18func (c *Client) InvokeScreenAutomation(ctx context.Context, params *InvokeScreenAutomationInput, optFns ...func(*Options)) (*InvokeScreenAutomationOutput, error) {
19	if params == nil {
20		params = &InvokeScreenAutomationInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "InvokeScreenAutomation", params, optFns, addOperationInvokeScreenAutomationMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*InvokeScreenAutomationOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type InvokeScreenAutomationInput struct {
34
35	// The ID of the app that contains the screen automation.
36	//
37	// This member is required.
38	AppId *string
39
40	// The ID of the automation action to be performed.
41	//
42	// This member is required.
43	ScreenAutomationId *string
44
45	// The ID of the screen that contains the screen automation.
46	//
47	// This member is required.
48	ScreenId *string
49
50	// The ID of the workbook that contains the screen automation.
51	//
52	// This member is required.
53	WorkbookId *string
54
55	// The request token for performing the automation action. Request tokens help to
56	// identify duplicate requests. If a call times out or fails due to a transient
57	// error like a failed network connection, you can retry the call with the same
58	// request token. The service ensures that if the first call using that request
59	// token is successfully performed, the second call will return the response of the
60	// previous call rather than performing the action again. Note that request tokens
61	// are valid only for a few minutes. You cannot use request tokens to dedupe
62	// requests spanning hours or days.
63	ClientRequestToken *string
64
65	// The row ID for the automation if the automation is defined inside a block with
66	// source or list.
67	RowId *string
68
69	// Variables are specified as a map where the key is the name of the variable as
70	// defined on the screen. The value is an object which currently has only one
71	// property, rawValue, which holds the value of the variable to be passed to the
72	// screen. Any variables defined in a screen are required to be passed in the call.
73	Variables map[string]types.VariableValue
74}
75
76type InvokeScreenAutomationOutput struct {
77
78	// The updated workbook cursor after performing the automation action.
79	//
80	// This member is required.
81	WorkbookCursor int64
82
83	// Metadata pertaining to the operation's result.
84	ResultMetadata middleware.Metadata
85}
86
87func addOperationInvokeScreenAutomationMiddlewares(stack *middleware.Stack, options Options) (err error) {
88	err = stack.Serialize.Add(&awsRestjson1_serializeOpInvokeScreenAutomation{}, middleware.After)
89	if err != nil {
90		return err
91	}
92	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpInvokeScreenAutomation{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	if err = addSetLoggerMiddleware(stack, options); err != nil {
97		return err
98	}
99	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
100		return err
101	}
102	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
103		return err
104	}
105	if err = addResolveEndpointMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
109		return err
110	}
111	if err = addRetryMiddlewares(stack, options); err != nil {
112		return err
113	}
114	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
115		return err
116	}
117	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
118		return err
119	}
120	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
121		return err
122	}
123	if err = addClientUserAgent(stack); err != nil {
124		return err
125	}
126	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
127		return err
128	}
129	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addOpInvokeScreenAutomationValidationMiddleware(stack); err != nil {
133		return err
134	}
135	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInvokeScreenAutomation(options.Region), middleware.Before); err != nil {
136		return err
137	}
138	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addResponseErrorMiddleware(stack); err != nil {
142		return err
143	}
144	if err = addRequestResponseLogging(stack, options); err != nil {
145		return err
146	}
147	return nil
148}
149
150func newServiceMetadataMiddleware_opInvokeScreenAutomation(region string) *awsmiddleware.RegisterServiceMetadata {
151	return &awsmiddleware.RegisterServiceMetadata{
152		Region:        region,
153		ServiceID:     ServiceID,
154		SigningName:   "honeycode",
155		OperationName: "InvokeScreenAutomation",
156	}
157}
158