-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfalcon_client.go
38 lines (34 loc) · 956 Bytes
/
falcon_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
package fdk
import (
"fmt"
"os"
"strings"
)
// version marks the version of the fdk for use in the falcon client. This should be
// provided via an LDFlag on build.
var version = "development"
// FalconClientOpts provides the cloud for use with the falcon client.
// To setup the falcon Client you can follow the following example.
//
// func newFalconClient(ctx context.Context, token string) (*client.CrowdStrikeAPISpecification, error) {
// opts := fdk.FalconClientOpts()
// return falcon.NewClient(&falcon.ApiConfig{
// AccessToken: token,
// Cloud: falcon.Cloud(opts.Cloud),
// Context: ctx,
// UserAgentOverride: opts.UserAgent,
// })
// }
func FalconClientOpts() (out struct {
Cloud string
UserAgent string
}) {
c := strings.ToLower(os.Getenv("CS_CLOUD"))
c = strings.TrimSpace(c)
if c == "" {
c = "us-1"
}
out.Cloud = c
out.UserAgent = fmt.Sprintf("foundry-fn/%s", version)
return out
}