replaceIngressClass method

Future<Response<V1IngressClass>> replaceIngressClass({
  1. required String name,
  2. required V1IngressClass body,
  3. String? pretty,
  4. String? dryRun,
  5. String? fieldManager,
  6. String? fieldValidation,
  7. CancelToken? cancelToken,
  8. Map<String, dynamic>? headers,
  9. Map<String, dynamic>? extra,
  10. ValidateStatus? validateStatus,
  11. ProgressCallback? onSendProgress,
  12. ProgressCallback? onReceiveProgress,
})

replaceIngressClass replace the specified IngressClass

Parameters:

  • name - name of the IngressClass
  • body
  • pretty - If 'true', then the output is pretty printed.
  • dryRun - When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
  • fieldManager - fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
  • fieldValidation - fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.
  • cancelToken - A CancelToken that can be used to cancel the operation
  • headers - Can be used to add additional headers to the request
  • extras - Can be used to add flags to the request
  • validateStatus - A ValidateStatus callback that can be used to determine request success based on the HTTP status of the response
  • onSendProgress - A ProgressCallback that can be used to get the send progress
  • onReceiveProgress - A ProgressCallback that can be used to get the receive progress

Returns a Future containing a Response with a V1IngressClass as data Throws DioError if API call or serialization fails

Implementation

Future<Response<V1IngressClass>> replaceIngressClass({
  required String name,
  required V1IngressClass body,
  String? pretty,
  String? dryRun,
  String? fieldManager,
  String? fieldValidation,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _path = r'/apis/networking.k8s.io/v1/ingressclasses/{name}'.replaceAll('{' r'name' '}', name.toString());
  final _options = Options(
    method: r'PUT',
    headers: <String, dynamic>{
      ...?headers,
    },
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[
        {
          'type': 'apiKey',
          'name': 'BearerToken',
          'keyName': 'authorization',
          'where': 'header',
        },
      ],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final _queryParameters = <String, dynamic>{
    if (pretty != null) r'pretty': pretty,
    if (dryRun != null) r'dryRun': dryRun,
    if (fieldManager != null) r'fieldManager': fieldManager,
    if (fieldValidation != null) r'fieldValidation': fieldValidation,
  };

  dynamic _bodyData;

  try {
_bodyData=jsonEncode(body);
  } catch(error, stackTrace) {
    throw DioError(
       requestOptions: _options.compose(
        _dio.options,
        _path,
        queryParameters: _queryParameters,
      ),
      type: DioErrorType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }

  final _response = await _dio.request<Object>(
    _path,
    data: _bodyData,
    options: _options,
    queryParameters: _queryParameters,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );

  V1IngressClass _responseData;

  try {
_responseData = deserialize<V1IngressClass, V1IngressClass>(_response.data!, 'V1IngressClass', growable: true);
  } catch (error, stackTrace) {
    throw DioError(
      requestOptions: _response.requestOptions,
      response: _response,
      type: DioErrorType.unknown,
      error: error,
      stackTrace: stackTrace,
    );
  }

  return Response<V1IngressClass>(
    data: _responseData,
    headers: _response.headers,
    isRedirect: _response.isRedirect,
    requestOptions: _response.requestOptions,
    redirects: _response.redirects,
    statusCode: _response.statusCode,
    statusMessage: _response.statusMessage,
    extra: _response.extra,
  );
}