替换Secret
更新时间:2020-01-03
接口描述
替换Secret。
其中以下字段支持更新:
metadata.labels
metadata.annotations
data
说明: <br>
当“type”的值为“Opaque”时,“data”的“key”和“value”都可以更新。<br>
当“type”的值不为“Opaque”时,“data”的“value”可以更新。
请求结构
PUT /api/v1/{namespace}/secrets/{name} HTTP/1.1
Host: bec.bdcloudapi.com
Content-Type: application/json; charset=utf-8
Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
表1 Path参数描述
参数 | 类型 | 参数位置 | 描述 | 是否必须 |
---|---|---|---|---|
name | String | URI参数 | Name of the Secret. | 必须 |
namespace | String | URI参数 | Object name and auth scope, such as for teams and projects. | 必须 |
表2 Query参数描述
参数 | 类型 | 描述 | 是否必须 |
---|---|---|---|
pretty | String | If 'true', then the output is pretty printed. | 非必须 |
RequestBody的详细描述参考 数据结构 表 示例:secret新增 newitem项
{
"apiVersion": "v1",
"data": {
"namespace": "YmVjLXVzZXItbnMtOWFxMW9hZ3A=",
"token": "ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklpSjkuZXlKcGMzTWlPaUpyZFdKbGNtNWxkR1Z6TDNObGNuWnBZMlZoWTJOdmRXNTBJaXdpYTNWaVpYSnVaWFJsY3k1cGJ5OXpaWEoyYVdObFlXTmpiM1Z1ZEM5dVlXMWxjM0JoWTJVaU9pSmlaV010ZFhObGNpMXVjeTA1WVhFeGIyRm5jQ0lzSW10MVltVnlibVYwWlhNdWFXOHZjMlZ5ZG1salpXRmpZMjkxYm5RdmMyVmpjbVYwTG01aGJXVWlPaUprWldaaGRXeDBMWFJ2YTJWdUxXcGpaM1p4SWl3aWEzVmlaWEp1WlhSbGN5NXBieTl6WlhKMmFXTmxZV05qYjNWdWRDOXpaWEoyYVdObExXRmpZMjkxYm5RdWJtRnRaU0k2SW1SbFptRjFiSFFpTENKcmRXSmxjbTVsZEdWekxtbHZMM05sY25acFkyVmhZMk52ZFc1MEwzTmxjblpwWTJVdFlXTmpiM1Z1ZEM1MWFXUWlPaUpsWlRoak1tWmxaUzFrTkRoa0xURXhaVGt0WVdFeU9TMW1ZVEUyTTJVNVpXRTVNRE1pTENKemRXSWlPaUp6ZVhOMFpXMDZjMlZ5ZG1salpXRmpZMjkxYm5RNlltVmpMWFZ6WlhJdGJuTXRPV0Z4TVc5aFozQTZaR1ZtWVhWc2RDSjkuaXBsblUyd2t4ZHRJMzd1NU5VVnp3eTJUX01xaUhfOUYtWnpNaVNaUERqLTNqd0c2b2tpX0dQODZrNHpTMTZkLVk5QjFkc2hmckFPYkNUR0hWRDNwNllWQTdfaDFXRlY0c1Q5eGlQaEs2T3NtdEVEbUQ3N1VxTGhMMkxpUm9CTDdaUlYtbGc1TTdMZzJ5VUJ5d0JoMFNxM0luTjBERnpzU0VRN013OFpYUzR4RUNfZG9rdnNyTl8wTXdTcWl5SkJJMF9kT21zeVNGOTlTcVdzdUFGVXhqQkw5WmVPcHZtcjF6ZHFWMVBSVWc2T3ZsWnFNQUxIRUw5TkRQdjc1bmZJUEJ4aTJTcktjR0l6OVhVZ0VCdk9vS0VyLU5IbUc0a3NVWEo0YkhrMDg5eDRtZUZucDlLVmNRZGVPcmtQNVBjWVkxV2lhNnRST1BhV0ttUjZ6ZlRkVFl3",
"newitem":"bml1bWluZ2xpYW5nLXRlc3Q="
},
"kind": "Secret",
"metadata": {
"name": "nml-token-test"
},
"type": "Opaque"
}
响应头域
除公共头域外,无其它特殊头域。
响应参数
响应参数的详细描述请参见 数据结构 表
错误码
请参照前文的网关错误码和平台错误码。
请求示例
PUT /api/v1/namespaces/test-namespace/secrets/test-secret HTTP/1.1
Host: bec.bdcloudapi.com
Content-Type: application/json; charset=utf-8
Authorization: bce-auth-v1/318857a8f08b11e9845ca7e54775a0c2/2019-10-17T03:07:21Z/1800/host/212eef8cfe1ac94be56c4afedb9360bba621ef646c3c8288971d36801d70501a
响应示例
{
"apiVersion": "v1",
"data": {
"namespace": "YmVjLXVzZXItbnMtOWFxMW9hZ3A=",
"newitem":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ZHFWMVBSVWc2T3ZsWnFNQUxIRUw5TkRQdjc1bmZJUEJ4aTJTcktjR0l6OVhVZ0VCdk9vS0VyLU5IbUc0a3NVWEo0YkhrMDg5eDRtZUZucDlLVmNRZGVPcmtQNVBjWVkxV2lhNnRST1BhV0ttUjZ6ZlRkVFl3"
},
"kind": "Secret",
"metadata": {
"annotations": null,
"clusterName": null,
"creationTimestamp": 1575630360000,
"deletionGracePeriodSeconds": null,
"deletionTimestamp": null,
"finalizers": null,
"generateName": null,
"generation": null,
"initializers": null,
"labels": null,
"name": "nml-token-test2",
"namespace": "bec-user-ns-sgt0adwb",
"ownerReferences": null,
"resourceVersion": "29630124",
"selfLink": "/api/v1/namespaces/bec-user-ns-sgt0adwb/secrets/nml-token-test2",
"uid": "63025e10-1818-11ea-9f7b-fa163e8f3c23"
},
"stringData": null,
"type": "Opaque"
}