1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ec2
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Searches for routes in the specified transit gateway route table.
15func (c *Client) SearchTransitGatewayRoutes(ctx context.Context, params *SearchTransitGatewayRoutesInput, optFns ...func(*Options)) (*SearchTransitGatewayRoutesOutput, error) {
16	if params == nil {
17		params = &SearchTransitGatewayRoutesInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "SearchTransitGatewayRoutes", params, optFns, addOperationSearchTransitGatewayRoutesMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*SearchTransitGatewayRoutesOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type SearchTransitGatewayRoutesInput struct {
31
32	// One or more filters. The possible values are:
33	//
34	// *
35	// attachment.transit-gateway-attachment-id- The id of the transit gateway
36	// attachment.
37	//
38	// * attachment.resource-id - The resource id of the transit gateway
39	// attachment.
40	//
41	// * attachment.resource-type - The attachment resource type. Valid
42	// values are vpc | vpn | direct-connect-gateway | peering | connect.
43	//
44	// *
45	// prefix-list-id - The ID of the prefix list.
46	//
47	// * route-search.exact-match - The
48	// exact match of the specified filter.
49	//
50	// * route-search.longest-prefix-match - The
51	// longest prefix that matches the route.
52	//
53	// * route-search.subnet-of-match - The
54	// routes with a subnet that match the specified CIDR filter.
55	//
56	// *
57	// route-search.supernet-of-match - The routes with a CIDR that encompass the CIDR
58	// filter. For example, if you have 10.0.1.0/29 and 10.0.1.0/31 routes in your
59	// route table and you specify supernet-of-match as 10.0.1.0/30, then the result
60	// returns 10.0.1.0/29.
61	//
62	// * state - The state of the route (active | blackhole).
63	//
64	// *
65	// type - The type of route (propagated | static).
66	//
67	// This member is required.
68	Filters []types.Filter
69
70	// The ID of the transit gateway route table.
71	//
72	// This member is required.
73	TransitGatewayRouteTableId *string
74
75	// Checks whether you have the required permissions for the action, without
76	// actually making the request, and provides an error response. If you have the
77	// required permissions, the error response is DryRunOperation. Otherwise, it is
78	// UnauthorizedOperation.
79	DryRun bool
80
81	// The maximum number of routes to return.
82	MaxResults int32
83}
84
85type SearchTransitGatewayRoutesOutput struct {
86
87	// Indicates whether there are additional routes available.
88	AdditionalRoutesAvailable bool
89
90	// Information about the routes.
91	Routes []types.TransitGatewayRoute
92
93	// Metadata pertaining to the operation's result.
94	ResultMetadata middleware.Metadata
95}
96
97func addOperationSearchTransitGatewayRoutesMiddlewares(stack *middleware.Stack, options Options) (err error) {
98	err = stack.Serialize.Add(&awsEc2query_serializeOpSearchTransitGatewayRoutes{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	err = stack.Deserialize.Add(&awsEc2query_deserializeOpSearchTransitGatewayRoutes{}, 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 = addOpSearchTransitGatewayRoutesValidationMiddleware(stack); err != nil {
143		return err
144	}
145	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchTransitGatewayRoutes(options.Region), middleware.Before); err != nil {
146		return err
147	}
148	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addResponseErrorMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addRequestResponseLogging(stack, options); err != nil {
155		return err
156	}
157	return nil
158}
159
160func newServiceMetadataMiddleware_opSearchTransitGatewayRoutes(region string) *awsmiddleware.RegisterServiceMetadata {
161	return &awsmiddleware.RegisterServiceMetadata{
162		Region:        region,
163		ServiceID:     ServiceID,
164		SigningName:   "ec2",
165		OperationName: "SearchTransitGatewayRoutes",
166	}
167}
168