|
| 1 | +// this file is used to demonstrate how to set up the client with a manual configuration |
1 | 2 | package main |
2 | 3 |
|
3 | 4 | import ( |
4 | 5 | "fmt" |
5 | 6 | "log" |
6 | | - "time" |
7 | 7 |
|
8 | | - "github.com/deploymenttheory/go-api-http-client/httpclient" |
9 | 8 | "github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro" |
10 | 9 | ) |
11 | 10 |
|
12 | 11 | func main() { |
13 | | - // Manually define the client configuration |
14 | | - config := httpclient.ClientConfig{ |
15 | | - Environment: httpclient.EnvironmentConfig{ |
16 | | - InstanceName: "your-instance-name", |
17 | | - OverrideBaseDomain: "", // Only required if you are not on jamfcloud.com |
18 | | - APIType: "jamfpro", // Required to specify the API type |
19 | | - }, |
20 | | - Auth: httpclient.AuthConfig{ |
21 | | - ClientID: "your-client-id", |
22 | | - ClientSecret: "your-client-secret", |
23 | | - }, |
24 | | - ClientOptions: httpclient.ClientOptions{ |
25 | | - LogLevel: "LogLevelDebug", |
26 | | - LogOutputFormat: "console", |
27 | | - HideSensitiveData: true, |
28 | | - MaxRetryAttempts: 5, |
29 | | - EnableDynamicRateLimiting: true, |
30 | | - MaxConcurrentRequests: 10, |
31 | | - TokenRefreshBufferPeriod: 5 * time.Minute, |
32 | | - TotalRetryDuration: 60 * time.Second, |
33 | | - CustomTimeout: 30 * time.Second, |
34 | | - }, |
| 12 | + // Define the configuration based on the new ConfigContainer struct |
| 13 | + config := &jamfpro.ConfigContainer{ |
| 14 | + LogLevel: "warning", |
| 15 | + LogExportPath: "", // Set this if you want to export logs to a file |
| 16 | + HideSensitiveData: true, |
| 17 | + |
| 18 | + InstanceDomain: "your-instance-domain", |
| 19 | + AuthMethod: "oauth2", // Use "basic" for basic authentication |
| 20 | + ClientID: "your-client-id", |
| 21 | + ClientSecret: "your-client-secret", |
| 22 | + Username: "", // Set this if using basic auth |
| 23 | + Password: "", // Set this if using basic auth |
| 24 | + JamfLoadBalancerLock: true, |
| 25 | + |
| 26 | + CustomCookies: []jamfpro.CustomCookie{}, |
| 27 | + MaxRetryAttempts: 3, |
| 28 | + MaxConcurrentRequests: 1, |
| 29 | + EnableDynamicRateLimiting: false, |
| 30 | + CustomTimeout: 60, // in seconds |
| 31 | + TokenRefreshBufferPeriod: 300, // in seconds |
| 32 | + TotalRetryDuration: 60, // in seconds |
| 33 | + FollowRedirects: true, |
| 34 | + MaxRedirects: 5, |
| 35 | + EnableConcurrencyManagement: true, |
| 36 | + MandatoryRequestDelay: 0, // in milliseconds |
| 37 | + RetryEligiableRequests: true, |
35 | 38 | } |
36 | 39 |
|
37 | 40 | // Initialize the Jamf Pro client with the given configuration |
|
0 commit comments