Skip to content

Commit ddc6ae6

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update Get All Notification Rules API docs to include pagination, sorting, and filtering params (#3320)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f328df3 commit ddc6ae6

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58413,6 +58413,47 @@ paths:
5841358413
description: Returns a list of all monitor notification rules.
5841458414
operationId: GetMonitorNotificationRules
5841558415
parameters:
58416+
- description: The page to start paginating from. If `page` is not specified,
58417+
the argument defaults to the first page.
58418+
in: query
58419+
name: page
58420+
required: false
58421+
schema:
58422+
format: int32
58423+
maximum: 1000000
58424+
minimum: 0
58425+
type: integer
58426+
- description: The number of rules to return per page. If `per_page` is not
58427+
specified, the argument defaults to 100.
58428+
in: query
58429+
name: per_page
58430+
required: false
58431+
schema:
58432+
format: int32
58433+
maximum: 1000
58434+
minimum: 1
58435+
type: integer
58436+
- description: 'String for sort order, composed of field and sort order separated
58437+
by a colon, for example `name:asc`. Supported sort directions: `asc`, `desc`.
58438+
Supported fields: `name`, `created_at`.'
58439+
in: query
58440+
name: sort
58441+
required: false
58442+
schema:
58443+
type: string
58444+
- description: 'JSON-encoded filter object. Supported keys:
58445+
58446+
* `text`: Free-text query matched against rule name, tags, and recipients.
58447+
58448+
* `tags`: Array of strings. Return rules that have any of these tags.
58449+
58450+
* `recipients`: Array of strings. Return rules that have any of these recipients.'
58451+
example: '{"text":"error","tags":["env:prod","team:my-team"],"recipients":["slack-monitor-app","email@example.com"]}'
58452+
in: query
58453+
name: filters
58454+
required: false
58455+
schema:
58456+
type: string
5841658457
- description: 'Comma-separated list of resource paths for related resources
5841758458
to include in the response. Supported resource
5841858459

api/datadogV2/api_monitors.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,10 @@ func (a *MonitorsApi) GetMonitorNotificationRule(ctx _context.Context, ruleId st
665665

666666
// GetMonitorNotificationRulesOptionalParameters holds optional parameters for GetMonitorNotificationRules.
667667
type GetMonitorNotificationRulesOptionalParameters struct {
668+
Page *int32
669+
PerPage *int32
670+
Sort *string
671+
Filters *string
668672
Include *string
669673
}
670674

@@ -674,6 +678,30 @@ func NewGetMonitorNotificationRulesOptionalParameters() *GetMonitorNotificationR
674678
return &this
675679
}
676680

681+
// WithPage sets the corresponding parameter name and returns the struct.
682+
func (r *GetMonitorNotificationRulesOptionalParameters) WithPage(page int32) *GetMonitorNotificationRulesOptionalParameters {
683+
r.Page = &page
684+
return r
685+
}
686+
687+
// WithPerPage sets the corresponding parameter name and returns the struct.
688+
func (r *GetMonitorNotificationRulesOptionalParameters) WithPerPage(perPage int32) *GetMonitorNotificationRulesOptionalParameters {
689+
r.PerPage = &perPage
690+
return r
691+
}
692+
693+
// WithSort sets the corresponding parameter name and returns the struct.
694+
func (r *GetMonitorNotificationRulesOptionalParameters) WithSort(sort string) *GetMonitorNotificationRulesOptionalParameters {
695+
r.Sort = &sort
696+
return r
697+
}
698+
699+
// WithFilters sets the corresponding parameter name and returns the struct.
700+
func (r *GetMonitorNotificationRulesOptionalParameters) WithFilters(filters string) *GetMonitorNotificationRulesOptionalParameters {
701+
r.Filters = &filters
702+
return r
703+
}
704+
677705
// WithInclude sets the corresponding parameter name and returns the struct.
678706
func (r *GetMonitorNotificationRulesOptionalParameters) WithInclude(include string) *GetMonitorNotificationRulesOptionalParameters {
679707
r.Include = &include
@@ -707,6 +735,18 @@ func (a *MonitorsApi) GetMonitorNotificationRules(ctx _context.Context, o ...Get
707735
localVarHeaderParams := make(map[string]string)
708736
localVarQueryParams := _neturl.Values{}
709737
localVarFormParams := _neturl.Values{}
738+
if optionalParams.Page != nil {
739+
localVarQueryParams.Add("page", datadog.ParameterToString(*optionalParams.Page, ""))
740+
}
741+
if optionalParams.PerPage != nil {
742+
localVarQueryParams.Add("per_page", datadog.ParameterToString(*optionalParams.PerPage, ""))
743+
}
744+
if optionalParams.Sort != nil {
745+
localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, ""))
746+
}
747+
if optionalParams.Filters != nil {
748+
localVarQueryParams.Add("filters", datadog.ParameterToString(*optionalParams.Filters, ""))
749+
}
710750
if optionalParams.Include != nil {
711751
localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, ""))
712752
}

0 commit comments

Comments
 (0)