Skip to content
/ yc-conn Public

Yandex.Cloud Go SDK wrapper for getting gRPC client connection

License

Notifications You must be signed in to change notification settings

afansv/yc-conn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yc-conn

Go Reference

Yandex.Cloud Go SDK wrapper for getting gRPC client connection with original SDK auth to use with any YC API (even if it's not listed in endpoints)

Why?

Some Yandex.Cloud APIs are not listed in endpoints for some reason. That's why we can't just patch yc-go-sdk to add new services support

Installation

go get -u github.com/afansv/yc-conn

Usage

package main

import (
	"context"
	"fmt"
	"io"
	"os"
	"time"

	ycconn "github.com/afansv/yc-conn"
	"github.com/yandex-cloud/go-genproto/yandex/cloud/speechsense/v1"
	ycsdk "github.com/yandex-cloud/go-sdk"
)

const token = "<YOUR_OAUTH_TOKEN>"

const talkAnalyticsAPIAddr = "api.talk-analytics.yandexcloud.net:443"

func main() {
	ctx := context.Background()

	conn, err := ycconn.GetConnection(ctx, ycconn.ConnectionConfig{
		SDKConfig: ycsdk.Config{
			Credentials: ycsdk.OAuthToken(token),
		},
		APIAddress: talkAnalyticsAPIAddr,
	})
	if err != nil {
		panic(err)
	}

	ss := speechsense.NewTalkServiceClient(conn)

	// Now you can use service client from yandex-cloud/go-genproto
}

About

Yandex.Cloud Go SDK wrapper for getting gRPC client connection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages