updateRoute method

Future<UpdateRouteOutput> updateRoute({
  1. required String meshName,
  2. required String routeName,
  3. required RouteSpec spec,
  4. required String virtualRouterName,
  5. String? clientToken,
  6. String? meshOwner,
})

Updates an existing route for a specified service mesh and virtual router.

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 that the route resides in.

Parameter routeName : The name of the route to update.

Parameter spec : The new route specification to apply. This overwrites the existing data.

Parameter virtualRouterName : The name of the virtual router that the route is associated with.

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 it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.

Implementation

Future<UpdateRouteOutput> updateRoute({
  required String meshName,
  required String routeName,
  required RouteSpec spec,
  required String virtualRouterName,
  String? clientToken,
  String? meshOwner,
}) async {
  ArgumentError.checkNotNull(meshName, 'meshName');
  _s.validateStringLength(
    'meshName',
    meshName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(routeName, 'routeName');
  _s.validateStringLength(
    'routeName',
    routeName,
    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,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v20190125/meshes/${Uri.encodeComponent(meshName)}/virtualRouter/${Uri.encodeComponent(virtualRouterName)}/routes/${Uri.encodeComponent(routeName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return UpdateRouteOutput(
    route: RouteData.fromJson($json),
  );
}