mirror of
https://github.com/certimate-go/certimate.git
synced 2026-07-01 03:34:25 +08:00
refactor: clean code
This commit is contained in:
@@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user