deleteValidatingAdmissionPolicy method

Future<Response<V1Status>> deleteValidatingAdmissionPolicy({
  1. required String name,
  2. String? pretty,
  3. String? dryRun,
  4. int? gracePeriodSeconds,
  5. bool? orphanDependents,
  6. String? propagationPolicy,
  7. V1DeleteOptions? body,
  8. CancelToken? cancelToken,
  9. Map<String, dynamic>? headers,
  10. Map<String, dynamic>? extra,
  11. ValidateStatus? validateStatus,
  12. ProgressCallback? onSendProgress,
  13. ProgressCallback? onReceiveProgress,
})

deleteValidatingAdmissionPolicy delete a ValidatingAdmissionPolicy

Parameters:

  • name - name of the ValidatingAdmissionPolicy
  • 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
  • gracePeriodSeconds - The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
  • orphanDependents - Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
  • propagationPolicy - Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
  • body
  • 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 V1Status as data Throws DioError if API call or serialization fails

Implementation

Future<Response<V1Status>> deleteValidatingAdmissionPolicy({
  required String name,
  String? pretty,
  String? dryRun,
  int? gracePeriodSeconds,
  bool? orphanDependents,
  String? propagationPolicy,
  V1DeleteOptions? body,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _path = r'/apis/admissionregistration.k8s.io/v1alpha1/validatingadmissionpolicies/{name}'.replaceAll('{' r'name' '}', name.toString());
  final _options = Options(
    method: r'DELETE',
    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 (gracePeriodSeconds != null) r'gracePeriodSeconds': gracePeriodSeconds,
    if (orphanDependents != null) r'orphanDependents': orphanDependents,
    if (propagationPolicy != null) r'propagationPolicy': propagationPolicy,
  };

  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,
  );

  V1Status _responseData;

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

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