generated from davidji99/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.go
40 lines (31 loc) · 933 Bytes
/
config.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
package api
// Config represents all configuration options available to user to customize the API v2.
type Config struct {
// APIBaseURL is the base URL for Sendgrid's API v3.
APIBaseURL string
// UserAgent used when communicating with the Sendgrid API.
UserAgent string
// CustomHTTPHeaders are any additional user defined headers.
CustomHTTPHeaders map[string]string
// ContentTypeHeader
ContentTypeHeader string
// AcceptHeader
AcceptHeader string
// APIKey
APIKey string
// ClientTimeout
ClientTimeout int
}
// ParseOptions parses the supplied options functions.
func (c *Config) ParseOptions(opts ...Option) error {
// Range over each options function and apply it to our API type to
// configure it. Options functions are applied in order, with any
// conflicting options overriding earlier calls.
for _, option := range opts {
err := option(c)
if err != nil {
return err
}
}
return nil
}