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

package ec2

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

// Modifies the description of an IPAM pool allocation. For more information, see [Modify an IPAM pool allocation]
// in the Amazon VPC IPAM User Guide.
//
// [Modify an IPAM pool allocation]: https://docs.aws.amazon.com/vpc/latest/ipam/modify-alloc-ipam.html
func (c *Client) ModifyIpamPoolAllocation(ctx context.Context, params *ModifyIpamPoolAllocationInput, optFns ...func(*Options)) (*ModifyIpamPoolAllocationOutput, error) {
	if params == nil {
		params = &ModifyIpamPoolAllocationInput{}
	}

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

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

type ModifyIpamPoolAllocationInput struct {

	// The ID of the IPAM pool allocation you want to modify.
	//
	// This member is required.
	IpamPoolAllocationId *string

	// The new description for the IPAM pool allocation. If you submit a null value,
	// the description is removed from the allocation.
	Description *string

	// A check for whether you have the required permissions for the action without
	// actually making the request and provides an error response. If you have the
	// required permissions, the error response is DryRunOperation . Otherwise, it is
	// UnauthorizedOperation .
	DryRun *bool

	noSmithyDocumentSerde
}

type ModifyIpamPoolAllocationOutput struct {

	// The modified IPAM pool allocation.
	IpamPoolAllocation *types.IpamPoolAllocation

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

	noSmithyDocumentSerde
}

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