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 BatchUpdateTableRows API allows you to update one or more rows in a table in
15// a workbook. You can specify the values to set in some or all of the columns in
16// the table for the specified rows. If a column is not explicitly specified in a
17// particular row, then that column will not be updated for that row. To clear out
18// the data in a specific cell, you need to set the value as an empty string ("").
19func (c *Client) BatchUpdateTableRows(ctx context.Context, params *BatchUpdateTableRowsInput, optFns ...func(*Options)) (*BatchUpdateTableRowsOutput, error) {
20	if params == nil {
21		params = &BatchUpdateTableRowsInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "BatchUpdateTableRows", params, optFns, c.addOperationBatchUpdateTableRowsMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*BatchUpdateTableRowsOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type BatchUpdateTableRowsInput struct {
35
36	// The list of rows to update in the table. Each item in this list needs to contain
37	// the row id to update along with the map of column id to cell values for each
38	// column in that row that needs to be updated. You need to specify at least one
39	// row in this list, and for each row, you need to specify at least one column to
40	// update. Note that if one of the row or column ids in the request does not exist
41	// in the table, then the request fails and no updates are made to the table.
42	//
43	// This member is required.
44	RowsToUpdate []types.UpdateRowData
45
46	// The ID of the table where the rows are being updated. If a table with the
47	// specified id could not be found, this API throws ResourceNotFoundException.
48	//
49	// This member is required.
50	TableId *string
51
52	// The ID of the workbook where the rows are being updated. If a workbook with the
53	// specified id could not be found, this API throws ResourceNotFoundException.
54	//
55	// This member is required.
56	WorkbookId *string
57
58	// The request token for performing the update action. Request tokens help to
59	// identify duplicate requests. If a call times out or fails due to a transient
60	// error like a failed network connection, you can retry the call with the same
61	// request token. The service ensures that if the first call using that request
62	// token is successfully performed, the second call will not perform the action
63	// again. Note that request tokens are valid only for a few minutes. You cannot use
64	// request tokens to dedupe requests spanning hours or days.
65	ClientRequestToken *string
66
67	noSmithyDocumentSerde
68}
69
70type BatchUpdateTableRowsOutput struct {
71
72	// The updated workbook cursor after adding the new rows at the end of the table.
73	//
74	// This member is required.
75	WorkbookCursor int64
76
77	// The list of batch items in the request that could not be updated in the table.
78	// Each element in this list contains one item from the request that could not be
79	// updated in the table along with the reason why that item could not be updated.
80	FailedBatchItems []types.FailedBatchItem
81
82	// Metadata pertaining to the operation's result.
83	ResultMetadata middleware.Metadata
84
85	noSmithyDocumentSerde
86}
87
88func (c *Client) addOperationBatchUpdateTableRowsMiddlewares(stack *middleware.Stack, options Options) (err error) {
89	err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchUpdateTableRows{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchUpdateTableRows{}, middleware.After)
94	if err != nil {
95		return err
96	}
97	if err = addSetLoggerMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
101		return err
102	}
103	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
104		return err
105	}
106	if err = addResolveEndpointMiddleware(stack, options); err != nil {
107		return err
108	}
109	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
110		return err
111	}
112	if err = addRetryMiddlewares(stack, options); err != nil {
113		return err
114	}
115	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
122		return err
123	}
124	if err = addClientUserAgent(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addOpBatchUpdateTableRowsValidationMiddleware(stack); err != nil {
134		return err
135	}
136	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchUpdateTableRows(options.Region), middleware.Before); err != nil {
137		return err
138	}
139	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addResponseErrorMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addRequestResponseLogging(stack, options); err != nil {
146		return err
147	}
148	return nil
149}
150
151func newServiceMetadataMiddleware_opBatchUpdateTableRows(region string) *awsmiddleware.RegisterServiceMetadata {
152	return &awsmiddleware.RegisterServiceMetadata{
153		Region:        region,
154		ServiceID:     ServiceID,
155		SigningName:   "honeycode",
156		OperationName: "BatchUpdateTableRows",
157	}
158}
159