1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package servicecatalog
4
5import (
6	"context"
7	"fmt"
8	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
10	"github.com/aws/aws-sdk-go-v2/service/servicecatalog/types"
11	"github.com/aws/smithy-go/middleware"
12	smithyhttp "github.com/aws/smithy-go/transport/http"
13)
14
15// Requests updates to the properties of the specified provisioned product.
16func (c *Client) UpdateProvisionedProductProperties(ctx context.Context, params *UpdateProvisionedProductPropertiesInput, optFns ...func(*Options)) (*UpdateProvisionedProductPropertiesOutput, error) {
17	if params == nil {
18		params = &UpdateProvisionedProductPropertiesInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "UpdateProvisionedProductProperties", params, optFns, addOperationUpdateProvisionedProductPropertiesMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*UpdateProvisionedProductPropertiesOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type UpdateProvisionedProductPropertiesInput struct {
32
33	// The idempotency token that uniquely identifies the provisioning product update
34	// request.
35	//
36	// This member is required.
37	IdempotencyToken *string
38
39	// The identifier of the provisioned product.
40	//
41	// This member is required.
42	ProvisionedProductId *string
43
44	// A map that contains the provisioned product properties to be updated. The
45	// LAUNCH_ROLE key accepts role ARNs. This key allows an administrator to call
46	// UpdateProvisionedProductProperties to update the launch role that is associated
47	// with a provisioned product. This role is used when an end user calls a
48	// provisioning operation such as UpdateProvisionedProduct,
49	// TerminateProvisionedProduct, or ExecuteProvisionedProductServiceAction. Only a
50	// role ARN is valid. A user ARN is invalid. The OWNER key accepts user ARNs and
51	// role ARNs. The owner is the user that has permission to see, update, terminate,
52	// and execute service actions in the provisioned product. The administrator can
53	// change the owner of a provisioned product to another IAM user within the same
54	// account. Both end user owners and administrators can see ownership history of
55	// the provisioned product using the ListRecordHistory API. The new owner can
56	// describe all past records for the provisioned product using the DescribeRecord
57	// API. The previous owner can no longer use DescribeRecord, but can still see the
58	// product's history from when he was an owner using ListRecordHistory. If a
59	// provisioned product ownership is assigned to an end user, they can see and
60	// perform any action through the API or Service Catalog console such as update,
61	// terminate, and execute service actions. If an end user provisions a product and
62	// the owner is updated to someone else, they will no longer be able to see or
63	// perform any actions through API or the Service Catalog console on that
64	// provisioned product.
65	//
66	// This member is required.
67	ProvisionedProductProperties map[string]string
68
69	// The language code.
70	//
71	// * en - English (default)
72	//
73	// * jp - Japanese
74	//
75	// * zh - Chinese
76	AcceptLanguage *string
77}
78
79type UpdateProvisionedProductPropertiesOutput struct {
80
81	// The provisioned product identifier.
82	ProvisionedProductId *string
83
84	// A map that contains the properties updated.
85	ProvisionedProductProperties map[string]string
86
87	// The identifier of the record.
88	RecordId *string
89
90	// The status of the request.
91	Status types.RecordStatus
92
93	// Metadata pertaining to the operation's result.
94	ResultMetadata middleware.Metadata
95}
96
97func addOperationUpdateProvisionedProductPropertiesMiddlewares(stack *middleware.Stack, options Options) (err error) {
98	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateProvisionedProductProperties{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateProvisionedProductProperties{}, middleware.After)
103	if err != nil {
104		return err
105	}
106	if err = addSetLoggerMiddleware(stack, options); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
110		return err
111	}
112	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
113		return err
114	}
115	if err = addResolveEndpointMiddleware(stack, options); err != nil {
116		return err
117	}
118	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
119		return err
120	}
121	if err = addRetryMiddlewares(stack, options); err != nil {
122		return err
123	}
124	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
131		return err
132	}
133	if err = addClientUserAgent(stack); err != nil {
134		return err
135	}
136	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
137		return err
138	}
139	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addIdempotencyToken_opUpdateProvisionedProductPropertiesMiddleware(stack, options); err != nil {
143		return err
144	}
145	if err = addOpUpdateProvisionedProductPropertiesValidationMiddleware(stack); err != nil {
146		return err
147	}
148	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateProvisionedProductProperties(options.Region), middleware.Before); err != nil {
149		return err
150	}
151	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addResponseErrorMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addRequestResponseLogging(stack, options); err != nil {
158		return err
159	}
160	return nil
161}
162
163type idempotencyToken_initializeOpUpdateProvisionedProductProperties struct {
164	tokenProvider IdempotencyTokenProvider
165}
166
167func (*idempotencyToken_initializeOpUpdateProvisionedProductProperties) ID() string {
168	return "OperationIdempotencyTokenAutoFill"
169}
170
171func (m *idempotencyToken_initializeOpUpdateProvisionedProductProperties) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
172	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
173) {
174	if m.tokenProvider == nil {
175		return next.HandleInitialize(ctx, in)
176	}
177
178	input, ok := in.Parameters.(*UpdateProvisionedProductPropertiesInput)
179	if !ok {
180		return out, metadata, fmt.Errorf("expected middleware input to be of type *UpdateProvisionedProductPropertiesInput ")
181	}
182
183	if input.IdempotencyToken == nil {
184		t, err := m.tokenProvider.GetIdempotencyToken()
185		if err != nil {
186			return out, metadata, err
187		}
188		input.IdempotencyToken = &t
189	}
190	return next.HandleInitialize(ctx, in)
191}
192func addIdempotencyToken_opUpdateProvisionedProductPropertiesMiddleware(stack *middleware.Stack, cfg Options) error {
193	return stack.Initialize.Add(&idempotencyToken_initializeOpUpdateProvisionedProductProperties{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
194}
195
196func newServiceMetadataMiddleware_opUpdateProvisionedProductProperties(region string) *awsmiddleware.RegisterServiceMetadata {
197	return &awsmiddleware.RegisterServiceMetadata{
198		Region:        region,
199		ServiceID:     ServiceID,
200		SigningName:   "servicecatalog",
201		OperationName: "UpdateProvisionedProductProperties",
202	}
203}
204