-
Notifications
You must be signed in to change notification settings - Fork 35
/
client.go
51 lines (42 loc) · 1.04 KB
/
client.go
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
43
44
45
46
47
48
49
50
51
package gcp
import (
"context"
"github.com/viant/scy/cred"
"net/http"
)
// CtxClient represents generic google cloud service client
type CtxClient interface {
SetContext(ctx context.Context)
Context() context.Context
SetService(client interface{}) error
Service() interface{}
SetCredConfig(config *cred.Generic)
SetHttpClient(client *http.Client)
}
// AbstractClient represents an abstract client
type AbstractClient struct {
context context.Context
scopes []string
CredConfig *cred.Generic
HttpClinet *http.Client
service interface{}
}
func (c *AbstractClient) SetContext(ctx context.Context) {
c.context = ctx
}
func (c *AbstractClient) Context() context.Context {
return c.context
}
func (c *AbstractClient) SetCredConfig(config *cred.Generic) {
c.CredConfig = config
}
func (c *AbstractClient) SetHttpClient(client *http.Client) {
c.HttpClinet = client
}
func (c *AbstractClient) SetService(service interface{}) error {
c.service = service
return nil
}
func (c *AbstractClient) Service() interface{} {
return c.service
}