yc package - github.com/ydb-platform/ydb-go-yc - Go Packages (original) (raw)

package main

import ( "context"

ydb "github.com/ydb-platform/ydb-go-sdk/v3"
yc "github.com/ydb-platform/ydb-go-yc"

)

func main() { db, err := ydb.Open(context.TODO(), "grpc://localhost:2136/local", yc.WithMetadataCredentials(), yc.WithInternalCA(), ) if err != nil { panic(err) } _ = db.Close(context.TODO()) }

package main

import ( "context"

ydb "github.com/ydb-platform/ydb-go-sdk/v3"
yc "github.com/ydb-platform/ydb-go-yc"

)

func main() { db, err := ydb.Open(context.TODO(), "grpc://localhost:2136/local", yc.WithServiceAccountKeyFileCredentials("~/.ydb/sa.json"), yc.WithInternalCA(), ) if err != nil { panic(err) } _ = db.Close(context.TODO()) }

This section is empty.

This section is empty.

func WithAuthClientCredentials(opts ...ClientOption) ydb.Option

WithInternalCA append internal yandex-cloud certs

func WithServiceAccountKeyCredentials(serviceAccountKey string, opts ...ClientOption) ydb.Option

func WithServiceAccountKeyFileCredentials(serviceAccountKeyFile string, opts ...ClientOption) ydb.Option

WithAudience set provided audience.

WithCertPool set provided certPool.

func WithCertPoolFile(caFile string) ClientOption

WithCertPoolFile try set root certPool from provided cert file path.

func WithDefaultEndpoint() ClientOption

WithDefaultEndpoint set endpoint with default value.

WithEndpoint set provided endpoint.

WithFallbackCredentials makes fallback credentials if primary credentials are failed

func WithInsecureSkipVerify(insecure bool) ClientOption

WithInsecureSkipVerify set insecureSkipVerify to true which force client accepts any TLS certificate presented by the iam server and any host name in that certificate.

If insecureSkipVerify is set, then certPool field is not used.

This should be used only for testing purposes.

WithIssuer set provided issuer.

WithKeyID set provided keyID.

WithPrivateKey set provided private key.

func WithPrivateKeyFile(path string) ClientOption

WithPrivateKeyFile try set key from provided private key file path

WithServiceFile try set key, keyID, issuer from provided service account file path.

Do not mix this option with WithKeyID, WithIssuer and key options (WithPrivateKey, WithPrivateKeyFile, etc).

WithServiceKey try set key, keyID, issuer from provided service account key.

Do not mix this option with WithKeyID, WithIssuer and key options (WithPrivateKey, WithPrivateKeyFile, etc).

func WithSourceInfo(sourceInfo string) ClientOption

WithSourceInfo set sourceInfo

func WithSystemCertPool() ClientOption

WithSystemCertPool try set certPool with system root certificates.

WithTokenTTL set provided tokenTTL duration.