Skip to content

Conversation

@xkl401340100
Copy link
Contributor

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

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
@hellertang hellertang added the run check run check label Dec 1, 2022
ctx := context.WithValue(context.TODO(), logIdKey, logId)
service := TkeService{client: meta.(*TencentCloudClient).apiV3Conn}

if v, ok := helper.InterfacesHeadMap(d, "event_persistence"); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

假设用户删除之前持久化是 Disabled 的,这里再调用 Disable 会不会报错?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会,报错了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复了,帮忙再看看

@Kagashino Kagashino added run check run check and removed run check run check labels Dec 1, 2022

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourceData 尽量避免下放到 service 文件中处理,尽管每次都需要判断

Copy link
Contributor Author

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")
Copy link
Contributor

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 就行了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我用的是GetChange啊。你说的当前值是什么意思,要通过查询接口查询一下当前的状态吗

@Kagashino Kagashino added run check run check and removed run check run check labels Dec 6, 2022
@Kagashino Kagashino added run check run check and removed run check run check labels Dec 6, 2022
@Kagashino Kagashino merged commit 2207e61 into tencentcloudstack:master Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run check run check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants