{"base_path":"/","components":null,"consumes":"[\"application/json;charset=UTF-8\"]","definitions":{"CreateSecretEventRequestBody":{"description":"创建凭据事件通知请求体。","properties":{"event_types":{"description":"本次事件通知的基础事件列表,基础事件类型如下。\n\n- SECRET_VERSION_CREATED:版本创建\n- SECRET_VERSION_EXPIRED:版本过期\n- SECRET_ROTATED:凭据轮转\n- SECRET_DELETED:凭据删除\n- SECRET_ROTATED_FAILED:凭据轮转失败\n\n列表包含的基础事件类型不能重复。","example":"[\"SECRET_VERSION_CREATED\",\"SECRET_VERSION_EXPIRED\",\"SECRET_ROTATED\",\"SECRET_ROTATED_FAILED\"]","items":{"description":"基础事件类型。","enum":["SECRET_VERSION_CREATED","SECRET_VERSION_EXPIRED","SECRET_ROTATED","SECRET_DELETED","SECRET_ROTATED_FAILED"],"example":"SECRET_VERSION_CREATED","type":"string"},"maxItems":12,"minItems":0,"type":"array"},"name":{"description":"新创建事件通知的名称。\n\n约束:取值范围为1到64个字符,满足正则匹配“^[a-zA-Z0-9_-]{1,64}$”。","example":"demo","pattern":"^[a-zA-Z0-9_-]{1,64}$","type":"string"},"notification":{"$ref":"#/definitions/Notification"},"state":{"description":"控制事件是否生效,只有启用状态才能触发包含的基础事件类型\n\nENABLED:启用\nDISABLED:禁用","enum":["ENABLED","DISABLED"],"type":"string"}},"required":["name","event_types","state","notification"],"type":"object"},"Error":{"properties":{"error":{"$ref":"#/definitions/ErrorDetail","description":"错误信息返回体。"}},"type":"object"},"ErrorDetail":{"properties":{"error_code":{"description":"错误请求返回的错误码","maxLength":36,"minLength":3,"type":"string"},"error_msg":{"description":"错误请求返回的错误信息","maxLength":1024,"minLength":0,"type":"string"}}},"Event":{"description":"事件通知对象。","properties":{"create_time":{"description":"事件通知创建时间,时间戳,即从1970年1月1日至该时间的总秒数。","example":1581507580000,"format":"int64","maximum":13,"minimum":0,"type":"integer"},"event_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"},"event_types":{"description":"设置事件的基础事件类型列表,。\n\n约束:数组大小:最小1,最大12。","example":"eventDemo","items":{"description":"本次事件通知的基础事件列表,基础事件类型如下。\n\nSECRET_VERSION_CREATED:版本创建\nSECRET_VERSION_EXPIRED:版本过期\nSECRET_ROTATED:凭据轮转\nSECRET_DELETED:凭据删除\n\n列表包含的基础事件类型不能重复。","enum":["SECRET_VERSION_CREATED","SECRET_VERSION_EXPIRED","SECRET_ROTATED","SECRET_DELETED","SECRET_ROTATED_FAILED"],"type":"string"},"maxItems":12,"minItems":1,"type":"array"},"name":{"description":"事件通知名称。","example":"demo","pattern":"^[a-zA-Z0-9_-]{1,64}$","type":"string"},"notification":{"$ref":"#/definitions/Notification"},"state":{"description":"事件通知状态,取值如下。\n\nENABLED:表示启用状态\nDISABLED:表示禁用状态","enum":["ENABLED","DISABLED"],"example":"ENABLED","maxLength":1,"minLength":1,"type":"string"},"update_time":{"description":"事件通知上次更新时间,时间戳,即从1970年1月1日至该时间的总秒数。","example":1581507580000,"format":"int64","maximum":13,"minimum":0,"type":"integer"}},"type":"object"},"Notification":{"description":"通知主题对象。","properties":{"target_id":{"description":"事件通知的对象ID。","example":"urn:smn:cn-north-4:dc3b7c85759141accc0f2068:test-poc","pattern":"^[a-zA-Z0-9\\-._:]{1,256}$","type":"string"},"target_name":{"description":"事件通知的对象名称。","example":"test-poc","pattern":"^[a-zA-Z0-9_-]{1,64}$","type":"string"},"target_type":{"description":"事件通知的对象类型。","example":"SMN","pattern":"^SMN$","type":"string"}},"required":["target_type","target_id","target_name"],"type":"object"},"SecretEventResponseBody":{"properties":{"event":{"$ref":"#/definitions/Event"}}}},"description":null,"group_id":"2696b19762094c0393f47c92da7528c5","host":"kms.cn-north-4.myhuaweicloud.com","id":"02391d74e90c432ca6205ad7efc98fe1","info_version":"v1","method":"post","name":"CreateSecretEvent","parameters":{},"paths":{"/v1/{project_id}/csms/events":{"post":{"description":"创建事件,事件可配置在一个或多个凭据对象上。当事件为启用状态且包含的基础事件类型在凭据对象上触发时,云服务会将对应的事件通知发送至事件指定的通知主题上。","operationId":"CreateSecretEvent","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":"CreateSecretEventRequestBody","required":true,"schema":{"$ref":"#/definitions/CreateSecretEventRequestBody"},"x-example":{"event_types":["SECRET_VERSION_EXPIRED"],"name":"Test20230325","notification":{"target_id":"urn:smn:cn-north-4:dc3b7c85759141a991da17423c0f2068:smn-target-name","target_name":"smn-target-name","target_type":"SMN"},"state":["ENABLED"]}}],"responses":{"200":{"description":"请求已成功","examples":{"application/json":{"event":{"create_time":1581507580000,"event_id":"bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e","event_types":["SECRET_VERSION_CREATED","SECRET_VERSION_EXPIRED"],"name":"event-test","notification":{"target_id":"urn:smn:cn-north-4:SecertExpirationTest","target_name":"SecertExpirationNotificationTest","target_type":"SMN"},"state":"ENABLED","update_time":1581507580000}}},"schema":{"$ref":"#/definitions/SecretEventResponseBody"}},"400":{"description":"请求参数有误","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"被请求的页面需要用户名和密码","schema":{"$ref":"#/definitions/Error"}},"403":{"description":"认证失败","schema":{"$ref":"#/definitions/Error"}},"404":{"description":"资源不存在,资源未找到","schema":{"$ref":"#/definitions/Error"}},"500":{"description":"服务内部错误","schema":{"$ref":"#/definitions/Error"}},"502":{"description":"请求未完成。服务器从上游服务器收到一个无效的响应","schema":{"$ref":"#/definitions/Error"}},"504":{"description":"网关超时","schema":{"$ref":"#/definitions/Error"}}},"summary":"创建事件","tags":["事件管理"],"x-constraint":"创建的事件通知无法单独使用,需要配置在具体的凭据对象上。服务不会对事件通知中的通知对象进行有效性检查,如果用户账号下不存在该通知对象,则会造成事件触发时,事件通知失败。","x-is-registered":"Y","x-order":0,"x-request-examples-1":{"event_types":["SECRET_VERSION_CREATED","SECRET_VERSION_EXPIRED"],"name":"demo-event","notification":{"target_id":"demo-smn-id","target_name":"demo-smn-name","target_type":"SMN"},"state":"ENABLED"},"x-request-examples-description-1":"创建事件。","x-request-examples-text-1":{"event_types":["SECRET_VERSION_CREATED","SECRET_VERSION_EXPIRED"],"name":"demo-event","notification":{"target_id":"urn:smn:cn-north-4:dc3b7c85759141a991da17423c0f2068:test-poc","target_name":"demo-smn-name","target_type":"SMN"},"state":"ENABLED"},"x-support-sdk":"Y"}}},"product_short":"CSMS","region_id":"cn-north-4","schemes":["HTTPS"],"security_definitions":null,"summary":"创建事件","tags":"事件管理","uri":null,"version":"2.0"}