// 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 specified transit gateway policy table entry.
func (c *Client) ModifyTransitGatewayPolicyTableEntry(ctx context.Context, params *ModifyTransitGatewayPolicyTableEntryInput, optFns ...func(*Options)) (*ModifyTransitGatewayPolicyTableEntryOutput, error) {
	if params == nil {
		params = &ModifyTransitGatewayPolicyTableEntryInput{}
	}

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

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

type ModifyTransitGatewayPolicyTableEntryInput struct {

	// The rule number of the policy table entry to modify.
	//
	// This member is required.
	PolicyRuleNumber *string

	// The ID of the transit gateway policy table.
	//
	// This member is required.
	TransitGatewayPolicyTableId *string

	// Checks 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

	// The updated matching criteria for the policy table entry. Unspecified fields
	// retain their current values.
	PolicyRule *types.TransitGatewayRequestPolicyRule

	// The ID of the transit gateway route table to use for traffic matching this rule.
	TargetRouteTableId *string

	noSmithyDocumentSerde
}

type ModifyTransitGatewayPolicyTableEntryOutput struct {

	// Describes a transit gateway policy table entry
	TransitGatewayPolicyTableEntry *types.TransitGatewayPolicyTableEntry

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

	noSmithyDocumentSerde
}

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