func GetRouteTablesForTransitGateway(tgwID string, svc *ec2.Client) map[string]TransitGatewayRouteTable {
	result := make(map[string]TransitGatewayRouteTable)
	params := &ec2.DescribeTransitGatewayRouteTablesInput{
		Filters: []types.Filter{
			{
				Name:   aws.String("transit-gateway-id"),
				Values: []string{tgwID},
			},
		},
	}
	resp, err := svc.DescribeTransitGatewayRouteTables(context.TODO(), params)
	if err != nil {
		panic(err)
	}
	for _, table := range resp.TransitGatewayRouteTables {
		routetable := TransitGatewayRouteTable{
			ID:   *table.TransitGatewayRouteTableId,
			Name: getNameFromTags(table.Tags),
		}
		result[routetable.ID] = routetable
	}
	for _, routetable := range result {
		routetable.Routes = GetActiveRoutesForTransitGatewayRouteTable(routetable.ID, svc)
		routetable.SourceAttachments = GetSourceAttachmentsForTransitGatewayRouteTable(routetable.ID, svc)
		result[routetable.ID] = routetable
	}
	return result
}
// GetRouteTablesForTransitGateway returns all route tables attached to a Transit Gateway
GetRouteTablesForTransitGateway returns all route tables attached to a Transit Gateway
// GetRouteTablesForTransitGateway returns all route tables attached to a Transit Gateway
func GetRouteTablesForTransitGateway(tgwID string, svc *ec2.Client) map[string]TransitGatewayRouteTable {
	result := make(map[string]TransitGatewayRouteTable)
	params := &ec2.DescribeTransitGatewayRouteTablesInput{
		Filters: []types.Filter{
			{
				Name:   aws.String("transit-gateway-id"),
				Values: []string{tgwID},
			},
		},
	}
	resp, err := svc.DescribeTransitGatewayRouteTables(context.TODO(), params)
	if err != nil {
		panic(err)
	}
	for _, table := range resp.TransitGatewayRouteTables {
		routetable := TransitGatewayRouteTable{
			ID:   *table.TransitGatewayRouteTableId,
			Name: getNameFromTags(table.Tags),
		}
		result[routetable.ID] = routetable
	}
	for _, routetable := range result {
		routetable.Routes = GetActiveRoutesForTransitGatewayRouteTable(routetable.ID, svc)
		routetable.SourceAttachments = GetSourceAttachmentsForTransitGatewayRouteTable(routetable.ID, svc)
		result[routetable.ID] = routetable
	}
	return result
}
func GetRouteTablesForTransitGateway ( tgwID string , svc * ec2 . Client ) map [ string ] TransitGatewayRouteTable { result := make ( map [ string ] TransitGatewayRouteTable ) params := & ec2 . DescribeTransitGatewayRouteTablesInput { Filters : [ ] types . Filter { { Name : aws . String ( " " ) , Values : [ ] string { tgwID } , } , } , } resp , err := svc . DescribeTransitGatewayRouteTables ( context . TODO ( ) , params ) if err != nil { panic ( err ) } for _ , table := range resp . TransitGatewayRouteTables { routetable := TransitGatewayRouteTable { ID : * table . TransitGatewayRouteTableId , Name : getNameFromTags ( table . Tags ) , } result [ routetable . ID ] = routetable } for _ , routetable := range result { routetable . Routes = GetActiveRoutesForTransitGatewayRouteTable ( routetable . ID , svc ) routetable . SourceAttachments = GetSourceAttachmentsForTransitGatewayRouteTable ( routetable . ID , svc ) result [ routetable . ID ] = routetable } return result }
GetRouteTablesForTransitGateway returns all route tables attached to a Transit Gateway
GetRouteTablesForTransitGateway returns all route tables attached to a Transit Gateway