github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/credentials/credentials.go (about) 1 package credentials 2 3 import ( 4 "context" 5 6 "github.com/ydb-platform/ydb-go-sdk/v3/internal/credentials" 7 ) 8 9 // Credentials is an interface of YDB credentials required for connect with YDB 10 type Credentials interface { 11 // Token must return actual token or error 12 Token(ctx context.Context) (string, error) 13 } 14 15 // NewAccessTokenCredentials makes access token credentials object 16 // Passed options redefines default values of credentials object internal fields 17 func NewAccessTokenCredentials( 18 accessToken string, opts ...credentials.AccessTokenCredentialsOption, 19 ) *credentials.AccessToken { 20 return credentials.NewAccessTokenCredentials(accessToken, opts...) 21 } 22 23 // NewAnonymousCredentials makes anonymous credentials object 24 // Passed options redefines default values of credentials object internal fields 25 func NewAnonymousCredentials( 26 opts ...credentials.AnonymousCredentialsOption, 27 ) *credentials.Anonymous { 28 return credentials.NewAnonymousCredentials(opts...) 29 } 30 31 // NewStaticCredentials makes static credentials object 32 func NewStaticCredentials( 33 user, password, authEndpoint string, opts ...credentials.StaticCredentialsOption, 34 ) *credentials.Static { 35 return credentials.NewStaticCredentials(user, password, authEndpoint, opts...) 36 }