Skip to content

Commit 56f2280

Browse files
feat: support CredentialsProvider and CredentialsProviderContext in UniversalClient
1 parent 1b4abd6 commit 56f2280

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

universal.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ type UniversalOptions struct {
6969
DisableIndentity bool
7070
IdentitySuffix string
7171
UnstableResp3 bool
72+
73+
CredentialsProvider func() (username string, password string)
74+
CredentialsProviderContext func(ctx context.Context) (username string, password string, err error)
7275
}
7376

7477
// Cluster returns cluster options created from the universal options.
@@ -113,8 +116,10 @@ func (o *UniversalOptions) Cluster() *ClusterOptions {
113116

114117
TLSConfig: o.TLSConfig,
115118

116-
DisableIndentity: o.DisableIndentity,
117-
IdentitySuffix: o.IdentitySuffix,
119+
DisableIndentity: o.DisableIndentity,
120+
IdentitySuffix: o.IdentitySuffix,
121+
CredentialsProvider: o.CredentialsProvider,
122+
CredentialsProviderContext: o.CredentialsProviderContext,
118123
}
119124
}
120125

@@ -203,9 +208,11 @@ func (o *UniversalOptions) Simple() *Options {
203208

204209
TLSConfig: o.TLSConfig,
205210

206-
DisableIndentity: o.DisableIndentity,
207-
IdentitySuffix: o.IdentitySuffix,
208-
UnstableResp3: o.UnstableResp3,
211+
DisableIndentity: o.DisableIndentity,
212+
IdentitySuffix: o.IdentitySuffix,
213+
UnstableResp3: o.UnstableResp3,
214+
CredentialsProvider: o.CredentialsProvider,
215+
CredentialsProviderContext: o.CredentialsProviderContext,
209216
}
210217
}
211218

0 commit comments

Comments
 (0)