createGatewayRoute method
Creates a gateway route.
A gateway route is attached to a virtual gateway and routes traffic to an existing virtual service. If a route matches a request, it can distribute traffic to a target virtual service.
For more information about gateway routes, see Gateway routes.
May throw NotFoundException. May throw BadRequestException. May throw ConflictException. May throw TooManyRequestsException. May throw ForbiddenException. May throw ServiceUnavailableException. May throw InternalServerErrorException. May throw LimitExceededException.
Parameter gatewayRouteName
:
The name to use for the gateway route.
Parameter meshName
:
The name of the service mesh to create the gateway route in.
Parameter spec
:
The gateway route specification to apply.
Parameter virtualGatewayName
:
The name of the virtual gateway to associate the gateway route with. If
the virtual gateway is in a shared mesh, then you must be the owner of the
virtual gateway resource.
Parameter clientToken
:
Unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. Up to 36 letters, numbers, hyphens, and
underscores are allowed.
Parameter meshOwner
:
The AWS IAM account ID of the service mesh owner. If the account ID is not
your own, then the account that you specify must share the mesh with your
account before you can create the resource in the service mesh. For more
information about mesh sharing, see Working
with shared meshes.
Parameter tags
:
Optional metadata that you can apply to the gateway route to assist with
categorization and organization. Each tag consists of a key and an
optional value, both of which you define. Tag keys can have a maximum
character length of 128 characters, and tag values can have a maximum
length of 256 characters.
Implementation
Future<CreateGatewayRouteOutput> createGatewayRoute({
required String gatewayRouteName,
required String meshName,
required GatewayRouteSpec spec,
required String virtualGatewayName,
String? clientToken,
String? meshOwner,
List<TagRef>? tags,
}) async {
ArgumentError.checkNotNull(gatewayRouteName, 'gatewayRouteName');
_s.validateStringLength(
'gatewayRouteName',
gatewayRouteName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(meshName, 'meshName');
_s.validateStringLength(
'meshName',
meshName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(spec, 'spec');
ArgumentError.checkNotNull(virtualGatewayName, 'virtualGatewayName');
_s.validateStringLength(
'virtualGatewayName',
virtualGatewayName,
1,
255,
isRequired: true,
);
_s.validateStringLength(
'meshOwner',
meshOwner,
12,
12,
);
final $query = <String, List<String>>{
if (meshOwner != null) 'meshOwner': [meshOwner],
};
final $payload = <String, dynamic>{
'gatewayRouteName': gatewayRouteName,
'spec': spec,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'PUT',
requestUri:
'/v20190125/meshes/${Uri.encodeComponent(meshName)}/virtualGateway/${Uri.encodeComponent(virtualGatewayName)}/gatewayRoutes',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CreateGatewayRouteOutput(
gatewayRoute: GatewayRouteData.fromJson($json),
);
}