blob: 749e1d34c5308c95ba354f768502f449059fcaf1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package cachedtvm_test
import (
"context"
"fmt"
"time"
"github.com/ydb-platform/ydb/library/go/core/log"
"github.com/ydb-platform/ydb/library/go/core/log/zap"
"github.com/ydb-platform/ydb/library/go/yandex/tvm/cachedtvm"
"github.com/ydb-platform/ydb/library/go/yandex/tvm/tvmtool"
)
func ExampleNewClient_checkServiceTicket() {
zlog, err := zap.New(zap.ConsoleConfig(log.DebugLevel))
if err != nil {
panic(err)
}
tvmClient, err := tvmtool.NewAnyClient(tvmtool.WithLogger(zlog))
if err != nil {
panic(err)
}
cachedTvmClient, err := cachedtvm.NewClient(
tvmClient,
cachedtvm.WithCheckServiceTicket(1*time.Minute, 1000),
)
if err != nil {
panic(err)
}
defer cachedTvmClient.Close()
ticketInfo, err := cachedTvmClient.CheckServiceTicket(context.TODO(), "3:serv:....")
if err != nil {
panic(err)
}
fmt.Println("ticket info: ", ticketInfo.LogInfo)
}
|