-
Notifications
You must be signed in to change notification settings - Fork 162
/
client.go
34 lines (27 loc) · 883 Bytes
/
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
package director
import (
"time"
boshhttp "github.com/cloudfoundry/bosh-utils/httpclient"
boshlog "github.com/cloudfoundry/bosh-utils/logger"
)
type Client struct {
clientRequest ClientRequest
taskClientRequest TaskClientRequest
}
func NewClient(
endpoint string,
httpClient boshhttp.HTTPClient,
taskReporter TaskReporter,
fileReporter FileReporter,
logger boshlog.Logger,
) Client {
clientRequest := NewClientRequest(endpoint, httpClient, fileReporter, logger)
taskClientRequest := NewTaskClientRequest(clientRequest, taskReporter, 500*time.Millisecond)
return Client{clientRequest, taskClientRequest}
}
func (c Client) WithContext(contextId string) Client {
clientRequest := c.clientRequest.WithContext(contextId)
taskClientRequest := c.taskClientRequest
taskClientRequest.clientRequest = clientRequest
return Client{clientRequest, taskClientRequest}
}