updateRoute method

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

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

May throw BadRequestException. May throw ConflictException. May throw ForbiddenException. May throw InternalServerErrorException. May throw LimitExceededException. May throw NotFoundException. May throw ServiceUnavailableException. May throw TooManyRequestsException.

Parameter meshName : The name of the service mesh in which the route resides.

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 with which the route is associated.

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.

Implementation

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