// Code generated by smithy-go-codegen DO NOT EDIT.

package cleanrooms

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/cleanrooms/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Updates an existing collaboration change request. This operation allows
// approval actions for pending change requests in collaborations (APPROVE, DENY,
// CANCEL, COMMIT).
//
// For change requests without automatic approval, a member in the collaboration
// can manually APPROVE or DENY a change request. The collaboration owner can
// manually CANCEL or COMMIT a change request.
func (c *Client) UpdateCollaborationChangeRequest(ctx context.Context, params *UpdateCollaborationChangeRequestInput, optFns ...func(*Options)) (*UpdateCollaborationChangeRequestOutput, error) {
	if params == nil {
		params = &UpdateCollaborationChangeRequestInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "UpdateCollaborationChangeRequest", params, optFns, c.addOperationUpdateCollaborationChangeRequestMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*UpdateCollaborationChangeRequestOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type UpdateCollaborationChangeRequestInput struct {

	// The action to perform on the change request. Valid values include APPROVE
	// (approve the change), DENY (reject the change), CANCEL (cancel the request), and
	// COMMIT (commit after the request is approved).
	//
	// For change requests without automatic approval, a member in the collaboration
	// can manually APPROVE or DENY a change request. The collaboration owner can
	// manually CANCEL or COMMIT a change request.
	//
	// This member is required.
	Action types.ChangeRequestAction

	// The unique identifier of the specific change request to be updated within the
	// collaboration.
	//
	// This member is required.
	ChangeRequestIdentifier *string

	// The unique identifier of the collaboration that contains the change request to
	// be updated.
	//
	// This member is required.
	CollaborationIdentifier *string

	noSmithyDocumentSerde
}

type UpdateCollaborationChangeRequestOutput struct {

	// Represents a request to modify a collaboration. Change requests enable
	// structured modifications to collaborations after they have been created.
	//
	// This member is required.
	CollaborationChangeRequest *types.CollaborationChangeRequest

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdateCollaborationChangeRequestMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateCollaborationChangeRequest{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateCollaborationChangeRequest{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack, options); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpUpdateCollaborationChangeRequestValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "UpdateCollaborationChangeRequest"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
