createVirtualRouter method
Creates a virtual router within a service mesh.
Specify a listener
for any inbound traffic that your virtual
router receives. Create a virtual router for each protocol and port that
you need to route. Virtual routers handle traffic for one or more virtual
services within your mesh. After you create your virtual router, create
and associate routes for your virtual router that direct incoming requests
to different virtual nodes.
For more information about virtual routers, see Virtual routers.
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 meshName
:
The name of the service mesh to create the virtual router in.
Parameter spec
:
The virtual router specification to apply.
Parameter virtualRouterName
:
The name to use for the virtual router.
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 virtual router 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<CreateVirtualRouterOutput> createVirtualRouter({
required String meshName,
required VirtualRouterSpec spec,
required String virtualRouterName,
String? clientToken,
String? meshOwner,
List<TagRef>? tags,
}) async {
ArgumentError.checkNotNull(meshName, 'meshName');
_s.validateStringLength(
'meshName',
meshName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(spec, 'spec');
ArgumentError.checkNotNull(virtualRouterName, 'virtualRouterName');
_s.validateStringLength(
'virtualRouterName',
virtualRouterName,
1,
255,
isRequired: true,
);
_s.validateStringLength(
'meshOwner',
meshOwner,
12,
12,
);
final $query = <String, List<String>>{
if (meshOwner != null) 'meshOwner': [meshOwner],
};
final $payload = <String, dynamic>{
'spec': spec,
'virtualRouterName': virtualRouterName,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.sendRaw(
payload: $payload,
method: 'PUT',
requestUri:
'/v20190125/meshes/${Uri.encodeComponent(meshName)}/virtualRouters',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CreateVirtualRouterOutput(
virtualRouter: VirtualRouterData.fromJson($json),
);
}