-
Notifications
You must be signed in to change notification settings - Fork 144
feat:users can delete TKE cluster audit logs and event persistence logs #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ctx := context.WithValue(context.TODO(), logIdKey, logId) | ||
| service := TkeService{client: meta.(*TencentCloudClient).apiV3Conn} | ||
|
|
||
| if v, ok := helper.InterfacesHeadMap(d, "event_persistence"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
假设用户删除之前持久化是 Disabled 的,这里再调用 Disable 会不会报错?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
会,报错了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修复了,帮忙再看看
…eleting tke cluster event persistence logs
|
|
||
| func (me *TkeService) SwitchEventPersistence(ctx context.Context, clusterId, logSetId, topicId string, enable bool) error { | ||
| func (me *TkeService) SwitchEventPersistence(ctx context.Context, clusterId, logSetId, topicId string, | ||
| enable, deleteEventLog bool, d *schema.ResourceData) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceData 尽量避免下放到 service 文件中处理,尽管每次都需要判断
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,我提到上层,是的,每次都要去判断,我才下放到service的
| return me.EnableEventPersistence(ctx, request) | ||
| } | ||
| if !enable { | ||
| oldConf, _ := d.GetChange("event_persistence") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destroy 的状态判断应该以当前值为准,GetChange 仅为修改代码时有意义, d.GetOk / d.GetChange 就行了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我用的是GetChange啊。你说的当前值是什么意思,要通过查询接口查询一下当前的状态吗
… enable value of the cluster persistence log is modified
…e logs for the tke cluster
When you delete a TKE cluster, disable the cluster audit log, and disable the cluster event log, you can choose whether to delete the audit and event log sets and topics created by default