updateStage method

Future<UpdateStageResponse> updateStage({
  1. required String apiId,
  2. required String stageName,
  3. AccessLogSettings? accessLogSettings,
  4. bool? autoDeploy,
  5. String? clientCertificateId,
  6. RouteSettings? defaultRouteSettings,
  7. String? deploymentId,
  8. String? description,
  9. Map<String, RouteSettings>? routeSettings,
  10. Map<String, String>? stageVariables,
})

Updates a Stage.

May throw NotFoundException. May throw TooManyRequestsException. May throw BadRequestException. May throw ConflictException.

Parameter apiId : The API identifier.

Parameter stageName : The stage name. Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default. Maximum length is 128 characters.

Parameter accessLogSettings : Settings for logging access in this stage.

Parameter autoDeploy : Specifies whether updates to an API automatically trigger a new deployment. The default value is false.

Parameter clientCertificateId : The identifier of a client certificate for a Stage.

Parameter defaultRouteSettings : The default route settings for the stage.

Parameter deploymentId : The deployment identifier for the API stage. Can't be updated if autoDeploy is enabled.

Parameter description : The description for the API stage.

Parameter routeSettings : Route settings for the stage.

Parameter stageVariables : A map that defines the stage variables for a Stage. Variable names can have alphanumeric and underscore characters, and the values must match A-Za-z0-9-._~:/?#&amp;=,+.

Implementation

Future<UpdateStageResponse> updateStage({
  required String apiId,
  required String stageName,
  AccessLogSettings? accessLogSettings,
  bool? autoDeploy,
  String? clientCertificateId,
  RouteSettings? defaultRouteSettings,
  String? deploymentId,
  String? description,
  Map<String, RouteSettings>? routeSettings,
  Map<String, String>? stageVariables,
}) async {
  ArgumentError.checkNotNull(apiId, 'apiId');
  ArgumentError.checkNotNull(stageName, 'stageName');
  final $payload = <String, dynamic>{
    if (accessLogSettings != null) 'accessLogSettings': accessLogSettings,
    if (autoDeploy != null) 'autoDeploy': autoDeploy,
    if (clientCertificateId != null)
      'clientCertificateId': clientCertificateId,
    if (defaultRouteSettings != null)
      'defaultRouteSettings': defaultRouteSettings,
    if (deploymentId != null) 'deploymentId': deploymentId,
    if (description != null) 'description': description,
    if (routeSettings != null) 'routeSettings': routeSettings,
    if (stageVariables != null) 'stageVariables': stageVariables,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/v2/apis/${Uri.encodeComponent(apiId)}/stages/${Uri.encodeComponent(stageName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateStageResponse.fromJson(response);
}