mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-03 06:23:54 +08:00
refactor: clean code
This commit is contained in:
@@ -190,8 +190,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
cfg.Region = region
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
@@ -199,6 +200,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
cfg.BaseUrl = "https://" + endpoint
|
||||
}
|
||||
}
|
||||
if region != "" {
|
||||
cfg.Region = region
|
||||
}
|
||||
|
||||
credential := auth.NewCredential()
|
||||
credential.PrivateKey = privateKey
|
||||
|
||||
@@ -187,7 +187,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloud
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
|
||||
@@ -241,7 +241,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloud
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
|
||||
@@ -317,8 +317,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
cfg.Region = region
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
@@ -326,6 +327,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
cfg.BaseUrl = "https://" + endpoint
|
||||
}
|
||||
}
|
||||
if region != "" {
|
||||
cfg.Region = region
|
||||
}
|
||||
|
||||
credential := auth.NewCredential()
|
||||
credential.PrivateKey = privateKey
|
||||
|
||||
@@ -134,7 +134,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloud
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
|
||||
@@ -263,8 +263,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
cfg.Region = region
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
@@ -272,6 +273,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
cfg.BaseUrl = "https://" + endpoint
|
||||
}
|
||||
}
|
||||
if region != "" {
|
||||
cfg.Region = region
|
||||
}
|
||||
|
||||
credential := auth.NewCredential()
|
||||
credential.PrivateKey = privateKey
|
||||
|
||||
@@ -107,7 +107,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloud
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
|
||||
@@ -122,7 +122,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloud
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
|
||||
@@ -124,8 +124,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
}
|
||||
|
||||
cfg := ucloud.NewConfig()
|
||||
cfg.ProjectId = projectId
|
||||
cfg.Region = region
|
||||
if projectId != "" {
|
||||
cfg.ProjectId = projectId
|
||||
}
|
||||
if endpoint != "" {
|
||||
if strings.Contains(endpoint, "://") {
|
||||
cfg.BaseUrl = endpoint
|
||||
@@ -133,6 +134,9 @@ func createSDKClient(privateKey, publicKey, projectId, endpoint, region string)
|
||||
cfg.BaseUrl = "https://" + endpoint
|
||||
}
|
||||
}
|
||||
if region != "" {
|
||||
cfg.Region = region
|
||||
}
|
||||
|
||||
credential := auth.NewCredential()
|
||||
credential.PrivateKey = privateKey
|
||||
|
||||
Reference in New Issue
Block a user