文档首页> 云容器引擎 CCE> API参考> Kubernetes API> Secret> 列出指定Namespace下的Secret
更新时间:2022-04-18 GMT+08:00
分享

列出指定Namespace下的Secret

功能介绍

该API用于在指定的Namespace下列出Secret对象。

URI

GET /api/v1/namespaces/{namespace}/secrets

表1 描述该API的参数。

表1 参数描述

参数

是否必选

描述

namespace

Yes

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

pretty

No

If 'true', then the output is pretty printed.

fieldSelector

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

includeUninitialized

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

resourceVersion

No

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.

timeoutSeconds

No

Timeout for the list/watch call.

watch

No

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

请求消息

N/A

响应消息

响应参数:

表2 响应参数

参数

参数类型

描述

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.

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.

metadata

metadata object

Standard list metadata.

items

Object

List of services.具体请参见表2

表3 metadata字段数据结构说明

参数

参数类型

描述

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.

selfLink

String

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

响应示例:

{
    "kind": "SecretList",
    "apiVersion": "v1",
    "metadata": {
        "selfLink": "/api/v1/namespaces/default/secrets",
        "resourceVersion": "1810323"
    },
    "items": [
        {
            "metadata": {
                "name": "default-token-nlckn",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/secrets/default-token-nlckn",
                "uid": "23070e11-1425-11e7-96c7-fa163ec08232",
                "resourceVersion": "30",
                "creationTimestamp": "2017-03-29T02:12:19Z",
                "annotations": {
                    "kubernetes.io/service-account.name": "default",
                    "kubernetes.io/service-account.uid": "2303e59b-1425-11e7-96c7-fa163ec08232"
                }
            },
            "data": {
                "ca.crt": "",
                "namespace": "ZGVmYXVsdA==",
                "token": ""
            },
            "type": "kubernetes.io/service-account-token"
        },
        {
            "metadata": {
                "name": "myregistry",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/secrets/myregistry",
                "uid": "a34ed5e4-1427-11e7-96c7-fa163ec08232",
                "resourceVersion": "1243",
                "creationTimestamp": "2017-03-29T02:30:13Z"
            },
            "data": {
                ".dockercfg": ""
            },
            "type": "kubernetes.io/hwdockercfg"
        },
        {
            "metadata": {
                "name": "paas.elb",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/secrets/paas.elb",
                "uid": "a34df6f3-1427-11e7-96c7-fa163ec08232",
                "resourceVersion": "1242",
                "creationTimestamp": "2017-03-29T02:30:13Z"
            },
            "data": {
                "access.key": "",
                "secret.key": ""
            },
            "type": "Opaque"
        }
    ]
}

 

状态码

表4描述API的状态码。

表4 状态码

状态码

描述

200

This operation succeeds, and a secret resource object is returned.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

close