Skip to content

refactor(tke): [117157094] regenerate some tke resource #2599

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

Merged
merged 6 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,10 @@ func Provider() *schema.Provider {
"tencentcloud_kubernetes_auth_attachment": tke.ResourceTencentCloudTKEAuthAttachment(),
"tencentcloud_kubernetes_as_scaling_group": tke.ResourceTencentCloudKubernetesAsScalingGroup(),
"tencentcloud_kubernetes_scale_worker": tke.ResourceTencentCloudTkeScaleWorker(),
"tencentcloud_kubernetes_cluster_attachment": tke.ResourceTencentCloudTkeClusterAttachment(),
"tencentcloud_kubernetes_cluster_attachment": tke.ResourceTencentCloudKubernetesClusterAttachment(),
"tencentcloud_kubernetes_node_pool": tke.ResourceTencentCloudKubernetesNodePool(),
"tencentcloud_kubernetes_serverless_node_pool": tke.ResourceTencentCloudTkeServerLessNodePool(),
"tencentcloud_kubernetes_backup_storage_location": tke.ResourceTencentCloudTkeBackupStorageLocation(),
"tencentcloud_kubernetes_backup_storage_location": tke.ResourceTencentCloudKubernetesBackupStorageLocation(),
"tencentcloud_kubernetes_encryption_protection": tke.ResourceTencentCloudKubernetesEncryptionProtection(),
"tencentcloud_mysql_backup_policy": cdb.ResourceTencentCloudMysqlBackupPolicy(),
"tencentcloud_mysql_account": cdb.ResourceTencentCloudMysqlAccount(),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package tke

import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
tke "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525"

tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
)

func resourceTencentCloudKubernetesBackupStorageLocationCreatePostHandleResponse0(ctx context.Context, resp *tke.CreateBackupStorageLocationResponse) error {
d := tccommon.ResourceDataFromContext(ctx)
if d == nil {
return fmt.Errorf("resource data can not be nil")
}

meta := tccommon.ProviderMetaFromContext(ctx)
if meta == nil {
return fmt.Errorf("provider meta can not be nil")
}
service := TkeService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}

// wait for status ok
return resource.Retry(3*tccommon.ReadRetryTimeout, func() *resource.RetryError {
locations, errRet := service.DescribeBackupStorageLocations(ctx, []string{d.Get("name").(string)})
if errRet != nil {
return tccommon.RetryError(errRet, tccommon.InternalError)
}
if len(locations) != 1 {
resource.RetryableError(fmt.Errorf("more than 1 location returnen in api response, expected 1 but got %d", len(locations)))
}
if locations[0].State == nil {
return resource.RetryableError(fmt.Errorf("location %s is still in state nil", d.Get("name").(string)))
}
if len(locations) == 1 && *locations[0].State == backupStorageLocationStateAvailable {
return nil
}
return resource.RetryableError(fmt.Errorf("location %s is still in state %s", d.Get("name").(string), *locations[0].State))
})
}

func resourceTencentCloudKubernetesBackupStorageLocationDeletePostHandleResponse0(ctx context.Context, resp *tke.DeleteBackupStorageLocationResponse) error {
d := tccommon.ResourceDataFromContext(ctx)
if d == nil {
return fmt.Errorf("resource data can not be nil")
}
meta := tccommon.ProviderMetaFromContext(ctx)
if meta == nil {
return fmt.Errorf("provider meta can not be nil")
}
service := TkeService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}

// wait until location is deleted
return resource.Retry(3*tccommon.ReadRetryTimeout, func() *resource.RetryError {
locations, errRet := service.DescribeBackupStorageLocations(ctx, []string{d.Id()})
if errRet != nil {
return tccommon.RetryError(errRet, tccommon.InternalError)
}
if len(locations) == 0 {
return nil
}
return resource.RetryableError(fmt.Errorf("location %s is still not deleted", d.Id()))
})
}
Loading
Loading