文档首页 > > API参考> Kubernetes API> Secret> 删除Secret

删除Secret

分享
更新时间:2020/05/26 GMT+08:00

功能介绍

该API用于删除指定Namespace下的Secret对象。

URI

DELETE /api/v1/namespaces/{namespace}/secrets/{name}

表1 描述该API的参数。

表1 参数描述

参数

是否必选

描述

namespace

Yes

Object name and auth scope, such as for teams and projects.

name

Yes

Name of the Secret.

请求消息

请求参数:

请求参数如表2所示。

表2 参数描述

参数

是否必选

参数类型

描述

kind

Yes

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.

The value of this parameter is DeleteOptions.

apiVersion

Yes

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

The value of this parameter is v1.

gracePeriodSeconds

No

Integer

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.

Value range of this parameter: > 0.

preconditions

No

preconditions object

Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.

orphanDependents

No

Boolean

Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list.

表3 preconditions字段数据结构说明

参数

是否必选

参数类型

描述

uid

No

String

Specifies the target UID.

请求示例:

{ 
   "kind": "DeleteOptions", 
   "apiVersion": "v1", 
   "gracePeriodSeconds": 10 
 }

响应消息

响应参数:

响应参数如表4所示。

表4 参数描述

参数

参数类型

描述

kind

String

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.

apiVersion

String

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

metadata

metadata object

-

status

String

Status of the operation. One of: "Success" or "Failure".

message

String

A human-readable description of the status of this operation.

reason

String

A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.

details

details object

-

code

Integer

Suggested HTTP return code for this status, 0 if not set.

表5 metadata字段数据结构说明

参数

参数类型

描述

selfLink

String

SelfLink is a URL representing this object. Populated by the system. Read-only.

resourceVersion

String

String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only.

表6 details字段数据结构说明

参数

参数类型

描述

name

String

The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).

kind

String

The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind.

causes

causes

-

retryAfterSeconds

Integer

If specified, the time in seconds before the operation should be retried.

uid

String

UID of the resource. (when there is a single resource which can be described).

group

String

The group attribute of the resource associated with the status StatusReason.

表7 causes字段数据结构说明

参数

参数类型

描述

reason

String

A machine-readable description of the cause of the error. If this value is empty there is no information available.

message

String

A human-readable description of the cause of the error. This field may be presented as-is to a reader.

field

String

The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors.

响应示例:

{ 
   "kind": "Status", 
   "apiVersion": "v1", 
   "metadata": {}, 
   "status": "Success", 
   "code": 200 
 }

状态码

表8描述API的状态码。

表8 状态码

状态码

描述

200

Delete a secret resource objectre successfully.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!非常感谢您的反馈,我们会继续努力做到更好!
反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问