-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.go
More file actions
42 lines (35 loc) · 951 Bytes
/
client.go
File metadata and controls
42 lines (35 loc) · 951 Bytes
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
41
42
package kubedeployer
import (
"fmt"
"kubecloud/internal/infrastructure/gridclient"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)
type Client struct {
GridClient gridclient.GridClient
}
// NewClient creates a new Client instance
func NewClient(mnemonic, gridNet string, debug bool, tp *sdktrace.TracerProvider) (*Client, error) {
if gridNet == "" {
return nil, fmt.Errorf("gridNet is required and cannot be empty")
}
var opts []gridclient.ClientOpts
opts = append(opts, gridclient.WithNetwork(gridNet))
if debug {
opts = append(opts, gridclient.WithDebug())
}
if tp != nil {
opts = append(opts, gridclient.WithTracerProvider(tp))
}
opts = append(opts, gridclient.WithDisableSentry())
gridCl, err := gridclient.NewGridClient(mnemonic, opts...)
if err != nil {
return nil, err
}
return &Client{
GridClient: gridCl,
}, nil
}
// Close closes the underlying GridClient
func (c *Client) Close() {
c.GridClient.Close()
}