Documentation
¶
Index ¶
- func WithCredentials(opts ...InstanceServiceAccountCredentialsOption) ydb.Option
- func WithInternalCA() ydb.Option
- type InstanceServiceAccountCredentials
- type InstanceServiceAccountCredentialsOption
- func WithInstanceServiceAccountCredentialsSourceInfo(sourceInfo string) InstanceServiceAccountCredentialsOption
- func WithInstanceServiceAccountURL(url string) InstanceServiceAccountCredentialsOption
- func WithRetryNotFound() InstanceServiceAccountCredentialsOption
- func WithTrace(t trace.Trace) InstanceServiceAccountCredentialsOption
- func WithURL(url string) InstanceServiceAccountCredentialsOption
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCredentials ¶
func WithCredentials(opts ...InstanceServiceAccountCredentialsOption) ydb.Option
func WithInternalCA ¶
Types ¶
type InstanceServiceAccountCredentials ¶ added in v0.5.0
type InstanceServiceAccountCredentials struct {
// contains filtered or unexported fields
}
func NewInstanceServiceAccount ¶
func NewInstanceServiceAccount(opts ...InstanceServiceAccountCredentialsOption) *InstanceServiceAccountCredentials
NewInstanceServiceAccount makes credentials provider that uses instance metadata url to obtain token for service account attached to instance. Cancelling context will lead to credentials refresh halt. It should be used during application stop or credentials recreation.
Example ¶
package main import ( "context" ydb "github.com/ydb-platform/ydb-go-sdk/v3" yc "github.com/ydb-platform/ydb-go-yc-metadata" ) func main() { db, err := ydb.Open(context.TODO(), "grpc://localhost:2136/local", ydb.WithCredentials( yc.NewInstanceServiceAccount( yc.WithURL("http://localhost:6770/meatadata/v1/instance/service-accounts/default/token"), ), ), ) if err != nil { panic(err) } _ = db.Close(context.TODO()) }
Output:
func (*InstanceServiceAccountCredentials) Stop ¶ added in v0.5.0
func (m *InstanceServiceAccountCredentials) Stop()
func (*InstanceServiceAccountCredentials) String ¶ added in v0.5.0
func (m *InstanceServiceAccountCredentials) String() string
type InstanceServiceAccountCredentialsOption ¶ added in v0.5.0
type InstanceServiceAccountCredentialsOption interface {
ApplyInstanceServiceAccountCredentialsOption(c *InstanceServiceAccountCredentials)
}
func WithInstanceServiceAccountCredentialsSourceInfo ¶ added in v0.5.0
func WithInstanceServiceAccountCredentialsSourceInfo(sourceInfo string) InstanceServiceAccountCredentialsOption
func WithInstanceServiceAccountURL ¶ added in v0.5.0
func WithInstanceServiceAccountURL(url string) InstanceServiceAccountCredentialsOption
func WithRetryNotFound ¶ added in v0.6.0
func WithRetryNotFound() InstanceServiceAccountCredentialsOption
func WithTrace ¶ added in v0.1.0
func WithTrace(t trace.Trace) InstanceServiceAccountCredentialsOption
func WithURL ¶
func WithURL(url string) InstanceServiceAccountCredentialsOption
Click to show internal directories.
Click to hide internal directories.