Documentation ¶
Index ¶
- Constants
- Variables
- func FakeStringTimestamps(ptrObj any) error
- func New(logger zerolog.Logger, spec Spec, options ...Option) (schema.ClientMeta, error)
- func PagerdutyMockTestHelper(t *testing.T, table *schema.Table, buildMockHttpClient func() *MockHttpClient)
- type Client
- type MockHttpClient
- type Option
- type Options
- type PdYmlStruct
- type RateLimitedHttpClient
- type Spec
Constants ¶
View Source
const MaxPaginationLimit = 100
By default, the maximum `limit` parameter allowed by pagerduty API is 100.
Variables ¶
View Source
var JSONSchema string
Functions ¶
func FakeStringTimestamps ¶
Timestamp fields such as `created_at` arrive as `string`s from the API. this function pusts valid `RFC3339` timestamps into fields like `DeletedAt`, `CreatedAt`... Mostly copy-paste from the `plugin-sdk` faker. Receives an interface that is a pointer to a struct, and only looks at fields one level deep. Pionter-to-pointer structs are supported.
func PagerdutyMockTestHelper ¶
func PagerdutyMockTestHelper(t *testing.T, table *schema.Table, buildMockHttpClient func() *MockHttpClient)
Types ¶
type Client ¶
type Client struct { PagerdutyClient *pagerduty.Client Spec *Spec // contains filtered or unexported fields }
type MockHttpClient ¶
type MockHttpClient struct {
// contains filtered or unexported fields
}
func (*MockHttpClient) AddMockResponse ¶
func (mockHttpClient *MockHttpClient) AddMockResponse(url string, object any)
type Option ¶
type Option func(*Options)
func WithClient ¶
func WithClient(client *pagerduty.Client) Option
type PdYmlStruct ¶
type PdYmlStruct struct {
Authtoken string
}
type RateLimitedHttpClient ¶
type RateLimitedHttpClient struct {
// contains filtered or unexported fields
}
Note that this is an implementation of 'pagerduty.HTTPClient', not of 'http.Client'.
type Spec ¶
type Spec struct { // Used in API requests to filter only resources related to these team ids. // Used in the tables: ["escalation_policies", "incidents", "maintenance_windows", "services", "users"] TeamIds []string `json:"team_ids"` // PagerDuty API is heavily rate-limited (900 requests/min = 15 requests/sec, across the entire organization). // This option allows you to control the rate at which the plugin will make requests to the API. // You can reduce this parameter in case you are still seeing rate limit errors (status code 429), or increase // it if your PagerDuty API quota is higher. See https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTUz-rate-limiting#what-are-our-limits for more info. MaxRequestsPerSecond *int `json:"max_requests_per_second" jsonschema:"minimum=1,default=10"` // A best effort maximum number of Go routines to use. Lower this number to reduce memory usage. Concurrency int `json:"concurrency" jsonschema:"minimum=1,default=1000"` }
func (*Spec) SetDefaults ¶
func (spec *Spec) SetDefaults()
Click to show internal directories.
Click to hide internal directories.