1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package dataexchange
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	"time"
12)
13
14// This operation creates a revision for a data set.
15func (c *Client) CreateRevision(ctx context.Context, params *CreateRevisionInput, optFns ...func(*Options)) (*CreateRevisionOutput, error) {
16	if params == nil {
17		params = &CreateRevisionInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateRevision", params, optFns, addOperationCreateRevisionMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateRevisionOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// The request body for CreateRevision.
31type CreateRevisionInput struct {
32
33	// The unique identifier for a data set.
34	//
35	// This member is required.
36	DataSetId *string
37
38	// An optional comment about the revision.
39	Comment *string
40
41	// A revision tag is an optional label that you can assign to a revision when you
42	// create it. Each tag consists of a key and an optional value, both of which you
43	// define. When you use tagging, you can also use tag-based access control in IAM
44	// policies to control access to these data sets and revisions.
45	Tags map[string]string
46}
47
48type CreateRevisionOutput struct {
49
50	// The ARN for the revision
51	Arn *string
52
53	// An optional comment about the revision.
54	Comment *string
55
56	// The date and time that the revision was created, in ISO 8601 format.
57	CreatedAt *time.Time
58
59	// The unique identifier for the data set associated with this revision.
60	DataSetId *string
61
62	// To publish a revision to a data set in a product, the revision must first be
63	// finalized. Finalizing a revision tells AWS Data Exchange that your changes to
64	// the assets in the revision are complete. After it's in this read-only state, you
65	// can publish the revision to your products. Finalized revisions can be published
66	// through the AWS Data Exchange console or the AWS Marketplace Catalog API, using
67	// the StartChangeSet AWS Marketplace Catalog API action. When using the API,
68	// revisions are uniquely identified by their ARN.
69	Finalized bool
70
71	// The unique identifier for the revision.
72	Id *string
73
74	// The revision ID of the owned revision corresponding to the entitled revision
75	// being viewed. This parameter is returned when a revision owner is viewing the
76	// entitled copy of its owned revision.
77	SourceId *string
78
79	// The tags for the revision.
80	Tags map[string]string
81
82	// The date and time that the revision was last updated, in ISO 8601 format.
83	UpdatedAt *time.Time
84
85	// Metadata pertaining to the operation's result.
86	ResultMetadata middleware.Metadata
87}
88
89func addOperationCreateRevisionMiddlewares(stack *middleware.Stack, options Options) (err error) {
90	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateRevision{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateRevision{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	if err = addSetLoggerMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
105		return err
106	}
107	if err = addResolveEndpointMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
111		return err
112	}
113	if err = addRetryMiddlewares(stack, options); err != nil {
114		return err
115	}
116	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
120		return err
121	}
122	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
123		return err
124	}
125	if err = addClientUserAgent(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addOpCreateRevisionValidationMiddleware(stack); err != nil {
135		return err
136	}
137	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRevision(options.Region), middleware.Before); err != nil {
138		return err
139	}
140	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addResponseErrorMiddleware(stack); err != nil {
144		return err
145	}
146	if err = addRequestResponseLogging(stack, options); err != nil {
147		return err
148	}
149	return nil
150}
151
152func newServiceMetadataMiddleware_opCreateRevision(region string) *awsmiddleware.RegisterServiceMetadata {
153	return &awsmiddleware.RegisterServiceMetadata{
154		Region:        region,
155		ServiceID:     ServiceID,
156		SigningName:   "dataexchange",
157		OperationName: "CreateRevision",
158	}
159}
160