{"base_path":"/","components":null,"consumes":"[\"application/json;charset=UTF-8\"]","definitions":{"CreateSecretRequestBody":{"description":"创建凭据请求消息体。","properties":{"auto_rotation":{"description":"自动轮转\n\n取值:true 开启 ,false 关闭 (默认)","example":"this is a demo secret auto rotation","type":"boolean"},"description":{"description":"凭据的描述信息。\n\n约束:2048字节。","example":"this is a demo","maxLength":2048,"minLength":0,"type":"string"},"enterprise_project_id":{"description":"该参数针对企业用户使用。如果您是企业用户,且已创建企业项目,则请从下拉列表中为密钥选择需要绑定的企业项目,默认项目为“default”。\n未开通企业管理的用户页面则没有“企业项目”参数项,无需进行配置。","example":"xxxxxxxx-6545-44be-988f-6880a2cb0e2f","maxLength":36,"minLength":1,"type":"string"},"event_subscriptions":{"description":"凭据订阅的事件列表,当前最大可订阅一个事件。当事件包含的基础事件触发时,通知消息将发送到事件对应的通知主题。","example":"pocEvent","items":{"description":"基础事件类型。","maxLength":32,"minLength":0,"type":"string"},"maxItems":1,"minItems":0,"type":"array"},"kms_key_id":{"description":"用于加密保护凭据值的KMS主密钥ID,如果您未指定此参数,凭据管理服务将默认使用名为csms/default的默认主密钥,用于加密您账号在本项目中创建的凭据值。如果用户账号下不存在该名称的主密钥,则凭据管理服务自动为您创建该名称的密钥。","example":"0d0466b0-e727-4d9c-b35d-f84bb474a37f","pattern":"^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$","type":"string"},"name":{"description":"待创建凭据的名称。\n\n约束:取值范围为1到64个字符,满足正则匹配“^[a-zA-Z0-9_-]{1,64}$”。","example":"demo","pattern":"^[a-zA-Z0-9_-]{1,64}$","type":"string"},"rotation_config":{"description":"轮转配置\n\n约束:范围不超过1024个字符。\n\n当secret_type为RDS-FG、GaussDB-FG时,必须填写本参数,参数格式为{\"InstanceId\":\"\",\"SecretSubType\":\"\"}\n\n参数说明:InstanceId为实例ID,SecretSubType为轮转子类型,取值为:SingleUser,MultiUser。\n\nSingleUser:指定轮转类型为单用户模式轮转,每次轮转将指定账号重置为新的口令。\n\nMultiUser:指定轮转类型为双用户模式轮转,SYSCURRENT和SYSPREVIOUS分别引用其中一个账号。凭据轮转时,SYSPREVIOUS引用的账号口令会被重置为新的随机口令,随后凭据交换SYSCURRENT和SYSPREVIOUS对账号的引用。","example":"this is a demo secret rotation config","maxLength":1024,"minLength":0,"type":"string"},"rotation_func_urn":{"description":"FunctionGraph函数的urn。","example":"urn:fss:{region}:46b6f338fc3445b8846c71dfb1fbxxxx:function:default:test2-0:latest","type":"string"},"rotation_period":{"description":"轮转周期\n\n约束:6小时-8,760小时 (365天)\n\n类型:Integer[unit] ,Integer表示时间长度 。unit表示时间单位,d(天)、h(小时)、m(分钟)、s(秒)。例如 1d 表示一天,24h也表示一天\n\n说明:当开启自动轮转时,必须填写该值","example":"this is a demo secret rotation period","maxLength":50,"minLength":0,"type":"string"},"secret_binary":{"description":"二进制类型凭据在base64编码后的明文,凭据管理服务将其加密后,存入凭据的初始版本中。\n\n类型:base64编码的二进制数据对象。\n\n约束:secret_binary和secret_string必须且只能设置一个,最大32K。","example":"this is a demo secret binary","maxLength":32768,"minLength":0,"type":"string"},"secret_string":{"description":"文本类型凭据的明文,凭据管理服务将其加密后,存入凭据的初始版本中。\n\n约束:secret_binary和secret_string必须且只能设置一个,最大32K。","example":"this is a demo secret string","maxLength":32768,"minLength":0,"type":"string"},"secret_type":{"description":"凭据类型\n\n - COMMON:通用凭据(默认)。用于应用系统中的各种敏感信息储存。\n - RDS:RDS凭据 。专门针对RDS的凭据,用于存储RDS的账号信息。(已不支持,使用RDS-FG替代)\n - RDS-FG:RDS凭据 。专门针对RDS的凭据,用于存储RDS的账号信息。\n - GaussDB-FG:TaurusDB凭据。专门针对TaurusDB的凭据,用于存储TaurusDB的账号信息。","enum":["COMMON","RDS-FG","GaussDB-FG"],"example":"COMMON","type":"string"}},"required":["name"],"type":"object"},"ErrorRsp":{"description":"失败时返回的错误对象","properties":{"error_code":{"description":"错误码","example":"CSMS.XXXX","maxLength":36,"minLength":8,"type":"string"},"error_msg":{"description":"错误描述","example":"XXXX","maxLength":512,"minLength":2,"type":"string"}},"required":["error_code","error_msg"]},"Secret":{"description":"凭据对象。","properties":{"auto_rotation":{"description":"自动轮转\n\n取值:true 开启, false 关闭(默认)","example":"this is a demo secret auto rotation","type":"boolean"},"create_time":{"description":"凭据创建时间,时间戳,即从1970年1月1日至该时间的总秒数。","example":1581507580000,"format":"int64","maximum":13,"minimum":0,"type":"integer"},"description":{"description":"凭据的描述信息。","example":"凭据的描述。","maxLength":255,"minLength":0,"type":"string"},"enterprise_project_id":{"description":"企业项目ID","example":0,"maxLength":36,"minLength":1,"type":"string"},"event_subscriptions":{"description":"凭据订阅的事件列表,当前最大可订阅一个事件。当事件包含的基础事件触发时,通知消息将发送到事件对应的通知主题。","example":"pocEvent","items":{"description":"基础事件类型。","maxLength":32,"minLength":0,"type":"string"},"maxItems":1,"minItems":0,"type":"array"},"id":{"description":"凭据的资源标识符。","example":"2d1152f2-290d-4756-a1d2-e12c14992416","pattern":"^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$","type":"string"},"kms_key_id":{"description":"用于加密凭据值的KMS主密钥的ID值。","example":"0d0466b0-e727-4d9c-b35d-f84bb474a37f","pattern":"^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$","type":"string"},"name":{"description":"凭据名称。","example":"demo","pattern":"^[a-zA-Z0-9_-]{1,64}$","type":"string"},"next_rotation_time":{"description":"下一次轮转时间戳","example":"this is a demo secret next rotation time","format":"int64","maximum":13,"minimum":0,"type":"integer"},"rotation_config":{"description":"轮转配置\n\n约束:范围不超过1024个字符。\n\n当secret_type为RDS-FG、GaussDB-FG时,配置为{\"InstanceId\":\"\",\"SecretSubType\":\"\"}\n\n说明:当secret_type为RDS-FG、GaussDB-FG时,必须填写该值\n\nInstanceId为实例ID,SecretSubType为轮转子类型,取值为:SingleUser,MultiUser。\n\nSingleUser:指定轮转类型为单用户模式轮转,每次轮转将指定账号重置为新的口令。\n\nMultiUser:指定轮转类型为双用户模式轮转,SYSCURRENT和SYSPREVIOUS分别引用其中一个账号。凭据轮转时,SYSPREVIOUS引用的账号口令会被重置为新的随机口令,随后凭据交换SYSCURRENT和SYSPREVIOUS对账号的引用。","example":{"InstanceId":"63616bceef2c45409575d762a498318bin01","SecretSubType":"MultiUser"},"maxLength":1024,"minLength":0,"type":"string"},"rotation_func_urn":{"description":"FunctionGraph函数的urn。","example":"urn:fss:{region}:46b6f338fc3445b8846c71dfb1fbxxxx:function:default:test2-0:latest","type":"string"},"rotation_period":{"description":"轮转周期\n\n约束:6小时-8,760小时 (365天)\n\n类型:Integer[unit] ,Integer表示时间长度 。unit表示时间单位,d(天)、h(小时)、m(分钟)、s(秒)。例如 1d 表示一天,24h也表示一天\n\n说明:当开启自动轮转时,必须填写该值","example":"this is a demo secret rotation period","maxLength":50,"minLength":0,"type":"string"},"rotation_time":{"description":"轮转时间戳","example":1679488984000,"format":"int64","maximum":13,"minimum":0,"type":"integer"},"scheduled_delete_time":{"description":"凭据计划删除时间,时间戳,即从1970年1月1日至该时间的总秒数。\n\n凭据不在删除计划中时,本项值为null。","example":1581507580000,"format":"int64","maximum":13,"minimum":0,"type":"integer"},"secret_type":{"description":"凭据类型\n\n- COMMON:通用凭据(默认)。用于应用系统中的各种敏感信息储存。\n- RDS:RDS凭据 。专门针对RDS的凭据,用于存储RDS的账号信息。(已不支持,使用RDS-FG替代)\n- RDS-FG:RDS凭据 。专门针对RDS的凭据,用于存储RDS的账号信息。\n- GaussDB-FG:TaurusDB凭据。专门针对TaurusDB的凭据,用于存储TaurusDB的账号信息。","enum":["COMMON","RDS-FG","GaussDB-FG"],"example":"COMMON","type":"string"},"state":{"description":"凭据状态,取值如下:\n\nENABLED:表示启用状态\n\nDISABLED:表示禁用状态\n\nPENDING_DELETE:表示待删除状态\n\nFROZEN:表示冻结状态","example":1,"maxLength":8,"minLength":4,"type":"string"},"update_time":{"description":"凭据上次更新时间,时间戳,即从1970年1月1日至该时间的总秒数。","example":1581507580000,"format":"int64","maximum":13,"minimum":0,"type":"integer"}},"type":"object"},"SecretResponseBody":{"properties":{"secret":{"$ref":"#/definitions/Secret"}},"type":"object"}},"description":null,"group_id":"2696b19762094c0393f47c92da7528c5","host":"kms.cn-north-4.myhuaweicloud.com","id":"9638336ccb5f45cfa2904405bbb3d647","info_version":"v1","method":"post","name":"CreateSecret","parameters":{},"paths":{"/v1/{project_id}/secrets":{"post":{"description":"创建新的凭据,并将凭据值存入凭据的初始版本。\n\n凭据管理服务将凭据值加密后,存储在凭据对象下的版本中。每个版本可与多个凭据版本状态相关联,凭据版本状态用于标识凭据版本处于的阶段,没有版本状态标记的版本视为已弃用,可用凭据管理服务自动删除。\n\n初始版本的状态被标记为SYSCURRENT。","operationId":"CreateSecret","parameters":[{"description":"用户Token。\n\n通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。","in":"header","maxLength":2097152,"minLength":32,"name":"X-Auth-Token","required":true,"type":"string","x-example":"MIIDkgYJKoZIhvcNAQcCoIIDgzCCXXXXX..."},{"description":"项目ID。","in":"path","maxLength":64,"minLength":32,"name":"project_id","required":true,"type":"string","x-example":"2b31ed520xxxxxxebedb6e57xxxxxxxx"},{"description":"创建凭据请求消息体。","in":"body","name":"CreateSecretRequestBody","required":true,"schema":{"$ref":"#/definitions/CreateSecretRequestBody"},"x-example":{"kms_key_id":"0d0466b0-e727-4d9c-b35d-f84bb474a37f","name":"demo"}}],"produces":["application/json"],"responses":{"200":{"description":"请求已成功","examples":{"application/json":{"secret":{"auto_rotation":true,"create_time":1581507580000,"description":"description","event_subscriptions":["pocEvent"],"id":"bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e","kms_key_id":"b168fe00ff56492495a7d22974df2d0b","name":"test","next_rotation_time":1668629140000,"rotation_config":"{'InstanceId':'63616bceef2c45409575d762a498318bin01','SecretSubType':'MultiUser'}","rotation_func_urn":"urn:fss:{region}:46b6f338fc3445b8846c71dfb1fbxxxx:function:default:test2-0:latest","rotation_period":"1d","rotation_time":1668567940000,"scheduled_delete_time":1581507580000,"secret_type":"RDS-FG","state":"ENABLED","update_time":1581507580000}}},"schema":{"$ref":"#/definitions/SecretResponseBody"}},"400":{"description":"请求参数有误","schema":{"$ref":"#/definitions/ErrorRsp"}},"401":{"description":"被请求的页面需要用户名和密码","schema":{"$ref":"#/definitions/ErrorRsp"}},"403":{"description":"认证失败","schema":{"$ref":"#/definitions/ErrorRsp"}},"404":{"description":"资源不存在,资源未找到","schema":{"$ref":"#/definitions/ErrorRsp"}},"500":{"description":"服务内部错误","schema":{"$ref":"#/definitions/ErrorRsp"}},"502":{"description":"请求未完成。服务器从上游服务器收到一个无效的响应","schema":{"$ref":"#/definitions/ErrorRsp"}},"504":{"description":"网关超时","schema":{"$ref":"#/definitions/ErrorRsp"}}},"summary":"创建凭据","tags":["生命周期管理"],"x-constraint":"您可以指定一个对称密钥类型的用户主密钥作为保护凭据的加密密钥。当不指定kms_key_id参数时,凭据管理服务将默认使用名为csms/default的默认主密钥,用于加密您账号在本项目中创建的凭据。如果用户账号下不存在该名称的主密钥,则凭据管理服务会自动为您创建该名称的密钥。\n\n如果您指定主密钥,则需要同时具备相应主密钥的kms:dek:create权限,用于凭据值进行加密。","x-is-registered":"Y","x-request-examples-1":{"kms_key_id":"0d0466b0-e727-4d9c-b35d-f84bb474a37f","name":"demo","secret_string":"this is a demo secret string"},"x-request-examples-description-1":"创建一个名字为demo的凭据,使用kms密钥ID为0d0466b0-e727-4d9c-b35d-f84bb474a37f对“this is a demo secret string”凭据值加密。","x-request-examples-text-1":{"kms_key_id":"0d0466b0-e727-4d9c-b35d-f84bb474a37f","name":"demo","secret_string":"this is a demo secret string"},"x-support-sdk":"Y"}}},"product_short":"CSMS","region_id":"cn-north-4","schemes":["HTTPS"],"security_definitions":null,"summary":"创建凭据","tags":"生命周期管理","uri":null,"version":"2.0"}