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

package docdbelastic

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

// The type of pending maintenance action to be applied to the resource.
func (c *Client) ApplyPendingMaintenanceAction(ctx context.Context, params *ApplyPendingMaintenanceActionInput, optFns ...func(*Options)) (*ApplyPendingMaintenanceActionOutput, error) {
	if params == nil {
		params = &ApplyPendingMaintenanceActionInput{}
	}

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

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

type ApplyPendingMaintenanceActionInput struct {

	// The pending maintenance action to apply to the resource.
	//
	// Valid actions are:
	//
	//   - ENGINE_UPDATE
	//
	//   - ENGINE_UPGRADE
	//
	//   - SECURITY_UPDATE
	//
	//   - OS_UPDATE
	//
	//   - MASTER_USER_PASSWORD_UPDATE
	//
	// This member is required.
	ApplyAction *string

	// A value that specifies the type of opt-in request, or undoes an opt-in request.
	// An opt-in request of type IMMEDIATE can't be undone.
	//
	// This member is required.
	OptInType types.OptInType

	// The Amazon DocumentDB Amazon Resource Name (ARN) of the resource to which the
	// pending maintenance action applies.
	//
	// This member is required.
	ResourceArn *string

	// A specific date to apply the pending maintenance action. Required if
	// opt-in-type is APPLY_ON . Format: yyyy/MM/dd HH:mm-yyyy/MM/dd HH:mm
	ApplyOn *string

	noSmithyDocumentSerde
}

type ApplyPendingMaintenanceActionOutput struct {

	// The output of the pending maintenance action being applied.
	//
	// This member is required.
	ResourcePendingMaintenanceAction *types.ResourcePendingMaintenanceAction

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationApplyPendingMaintenanceActionMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpApplyPendingMaintenanceAction{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpApplyPendingMaintenanceAction{}, 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); 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 = addOpApplyPendingMaintenanceActionValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "ApplyPendingMaintenanceAction"), 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
}
