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, 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
68type BatchUpdateTableRowsOutput struct {
69
70	// The updated workbook cursor after adding the new rows at the end of the table.
71	//
72	// This member is required.
73	WorkbookCursor int64
74
75	// The list of batch items in the request that could not be updated in the table.
76	// Each element in this list contains one item from the request that could not be
77	// updated in the table along with the reason why that item could not be updated.
78	FailedBatchItems []types.FailedBatchItem
79
80	// Metadata pertaining to the operation's result.
81	ResultMetadata middleware.Metadata
82}
83
84func addOperationBatchUpdateTableRowsMiddlewares(stack *middleware.Stack, options Options) (err error) {
85	err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchUpdateTableRows{}, middleware.After)
86	if err != nil {
87		return err
88	}
89	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchUpdateTableRows{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	if err = addSetLoggerMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
97		return err
98	}
99	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
100		return err
101	}
102	if err = addResolveEndpointMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
106		return err
107	}
108	if err = addRetryMiddlewares(stack, options); err != nil {
109		return err
110	}
111	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
115		return err
116	}
117	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
118		return err
119	}
120	if err = addClientUserAgent(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addOpBatchUpdateTableRowsValidationMiddleware(stack); err != nil {
130		return err
131	}
132	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchUpdateTableRows(options.Region), middleware.Before); err != nil {
133		return err
134	}
135	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addResponseErrorMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addRequestResponseLogging(stack, options); err != nil {
142		return err
143	}
144	return nil
145}
146
147func newServiceMetadataMiddleware_opBatchUpdateTableRows(region string) *awsmiddleware.RegisterServiceMetadata {
148	return &awsmiddleware.RegisterServiceMetadata{
149		Region:        region,
150		ServiceID:     ServiceID,
151		SigningName:   "honeycode",
152		OperationName: "BatchUpdateTableRows",
153	}
154}
155