refactor: clean code

This commit is contained in:
Fu Diwei
2026-06-10 23:13:22 +08:00
parent 390f500ad5
commit 1d466439b3
12 changed files with 13 additions and 13 deletions

View File

@@ -165,7 +165,7 @@ func createSDKClient(serverUrl, authMethod, username, password, apiToken string,
case "", AUTH_METHOD_PASSWORD:
{
client, err = npmsdk.NewClient(serverUrl,
npmsdk.WithCredentials(username, password),
npmsdk.WithLogins(username, password),
)
}

View File

@@ -78,7 +78,7 @@ func (c *Certmgr) Replace(ctx context.Context, certIdOrName string, certPEM, pri
func createSDKClient(username, password string) (*upyunsdk.Client, error) {
client, err := upyunsdk.NewClient(
upyunsdk.WithCredentials(username, password),
upyunsdk.WithLogins(username, password),
)
if err != nil {
return nil, err

View File

@@ -151,7 +151,7 @@ func createSDKClient(serverUrl, apiVersion, apiRole, username, password string,
if apiVersion == sdkVersionV3 && apiRole == sdkRoleClient {
// v3 版客户端
client, err := lecdnclientv3.NewClient(serverUrl,
lecdnclientv3.WithCredentials(username, password),
lecdnclientv3.WithLogins(username, password),
)
if err != nil {
return nil, err
@@ -165,7 +165,7 @@ func createSDKClient(serverUrl, apiVersion, apiRole, username, password string,
} else if apiVersion == sdkVersionV3 && apiRole == sdkRoleMaster {
// v3 版主控端
client, err := lecdnmasterv3.NewClient(serverUrl,
lecdnmasterv3.WithCredentials(username, password),
lecdnmasterv3.WithLogins(username, password),
)
if err != nil {
return nil, err

View File

@@ -387,7 +387,7 @@ func createSDKClient(serverUrl, authMethod, username, password, apiToken string,
case "", AUTH_METHOD_PASSWORD:
{
client, err = npmsdk.NewClient(serverUrl,
npmsdk.WithCredentials(username, password),
npmsdk.WithLogins(username, password),
)
}

View File

@@ -92,7 +92,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
func createSDKClient(username, password string) (*unicloudsdk.Client, error) {
client, err := unicloudsdk.NewClient(
unicloudsdk.WithCredentials(username, password),
unicloudsdk.WithLogins(username, password),
)
if err != nil {
return nil, err

View File

@@ -262,7 +262,7 @@ func (d *Deployer) updateDomainCertificate(ctx context.Context, domain string, c
func createSDKClient(username, password string) (*upyunsdk.Client, error) {
client, err := upyunsdk.NewClient(
upyunsdk.WithCredentials(username, password),
upyunsdk.WithLogins(username, password),
)
if err != nil {
return nil, err

View File

@@ -123,7 +123,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
func createSDKClient(username, password string) (*upyunsdk.Client, error) {
client, err := upyunsdk.NewClient(
upyunsdk.WithCredentials(username, password),
upyunsdk.WithLogins(username, password),
)
if err != nil {
return nil, err

View File

@@ -7,7 +7,7 @@ type Options struct {
type OptionsFunc func(*Options)
func WithCredentials(username, password string) OptionsFunc {
func WithLogins(username, password string) OptionsFunc {
return func(o *Options) {
o.Username = username
o.Password = password

View File

@@ -7,7 +7,7 @@ type Options struct {
type OptionsFunc func(*Options)
func WithCredentials(username, password string) OptionsFunc {
func WithLogins(username, password string) OptionsFunc {
return func(o *Options) {
o.Username = username
o.Password = password

View File

@@ -7,7 +7,7 @@ type Options struct {
type OptionsFunc func(*Options)
func WithCredentials(username, password string) OptionsFunc {
func WithLogins(username, password string) OptionsFunc {
return func(o *Options) {
o.Username = username
o.Password = password

View File

@@ -8,7 +8,7 @@ type Options struct {
type OptionsFunc func(*Options)
func WithCredentials(username, password string) OptionsFunc {
func WithLogins(username, password string) OptionsFunc {
return func(o *Options) {
o.Username = username
o.Password = password

View File

@@ -7,7 +7,7 @@ type Options struct {
type OptionsFunc func(*Options)
func WithCredentials(username, password string) OptionsFunc {
func WithLogins(username, password string) OptionsFunc {
return func(o *Options) {
o.Username = username
o.Password = password