Skip to content

Commit

Permalink
feat: ks3 data source
Browse files Browse the repository at this point in the history
  • Loading branch information
likui2 committed Feb 18, 2024
1 parent 10a8a95 commit e56bc11
Show file tree
Hide file tree
Showing 12 changed files with 1,216 additions and 439 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ vendor_bk
website_bk
go.sum
package.json
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,4 @@ _例:官网openapi里主机创建的接口里,可以同时创建eip和主机
| 虚拟私有网络 | ksyun_vpc | ksyun_vpcs | vpc|
| 登录SSHKEY | ksyun_ssh\_key | ksyun_ssh\_keys | sks|
| 标签管理 | ksyun_tag | ksyun_tags | tag|
| KS3 | ksyun_ks3 | - | Ks3 |
| KS3 | ksyun_ks3_bucket | ksyun_ks3_buckets | ks3|
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ require (
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/hcl/v2 v2.0.0
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/ks3sdklib/ksyun-ks3-go-sdk v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
github.com/wilac-pv/ksyun-ks3-go-sdk v1.0.10-0.20230324081615-1ff86b7ab10e
)

require (
Expand Down
2 changes: 1 addition & 1 deletion ksyun/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/KscSDK/ksc-sdk-go/service/tag"
"github.com/KscSDK/ksc-sdk-go/service/tagv2"
"github.com/KscSDK/ksc-sdk-go/service/vpc"
"github.com/wilac-pv/ksyun-ks3-go-sdk/ks3"
"github.com/ks3sdklib/ksyun-ks3-go-sdk/ks3"
)

type KsyunClient struct {
Expand Down
5 changes: 3 additions & 2 deletions ksyun/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
"github.com/KscSDK/ksc-sdk-go/service/tagv2"
"github.com/KscSDK/ksc-sdk-go/service/vpc"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/ks3sdklib/ksyun-ks3-go-sdk/ks3"
"github.com/terraform-providers/terraform-provider-ksyun/ksyun/internal/pkg/network"
"github.com/wilac-pv/ksyun-ks3-go-sdk/ks3"
)

// Config is the configuration of ksyun meta data
Expand All @@ -45,6 +45,7 @@ type Config struct {
Region string
Insecure bool
Domain string
Endpoint string
DryRun bool
IgnoreService bool
HttpKeepAlive bool
Expand Down Expand Up @@ -122,7 +123,7 @@ func (client *KsyunClient) WithKs3Client(do func(*ks3.Client) (interface{}, erro
defer goSdkMutex.Unlock()
// Initialize the KS3 client if necessary
if client.ks3conn == nil {
ks3conn, err := ks3.New(client.config.Domain, client.config.AccessKey, client.config.SecretKey)
ks3conn, err := ks3.New(client.config.Endpoint, client.config.AccessKey, client.config.SecretKey)
if err != nil {
return nil, fmt.Errorf("unable to initialize the KS3 client: %#v", err)
}
Expand Down
Loading

0 comments on commit e56bc11

Please sign in to comment.