github.com/blend/go-sdk@v1.20240719.1/pagerduty/ruleset.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package pagerduty
     9  
    10  // RuleConditions represents the conditions field for a Ruleset
    11  type RuleConditions struct {
    12  	Operator          string              `json:"operator,omitempty"`
    13  	RuleSubconditions []*RuleSubcondition `json:"subconditions,omitempty"`
    14  }
    15  
    16  // RuleSubcondition represents a subcondition of a ruleset condition
    17  type RuleSubcondition struct {
    18  	Operator   string              `json:"operator,omitempty"`
    19  	Parameters *ConditionParameter `json:"parameters,omitempty"`
    20  }
    21  
    22  // ConditionParameter represents  parameters in a rule condition
    23  type ConditionParameter struct {
    24  	Path  string `json:"path,omitempty"`
    25  	Value string `json:"value,omitempty"`
    26  }
    27  
    28  // RuleTimeFrame represents a time_frame object on the rule object
    29  type RuleTimeFrame struct {
    30  	ScheduledWeekly *ScheduledWeekly `json:"scheduled_weekly,omitempty"`
    31  	ActiveBetween   *ActiveBetween   `json:"active_between,omitempty"`
    32  }
    33  
    34  // ScheduledWeekly represents a time_frame object for scheduling rules weekly
    35  type ScheduledWeekly struct {
    36  	Weekdays  []int  `json:"weekdays,omitempty"`
    37  	Timezone  string `json:"timezone,omitempty"`
    38  	StartTime int    `json:"start_time,omitempty"`
    39  	Duration  int    `json:"duration,omitempty"`
    40  }
    41  
    42  // ActiveBetween represents an active_between object for setting a timeline for rules
    43  type ActiveBetween struct {
    44  	StartTime int `json:"start_time,omitempty"`
    45  	EndTime   int `json:"end_time,omitempty"`
    46  }
    47  
    48  // RuleActionParameter represents a generic parameter object on a rule action
    49  type RuleActionParameter struct {
    50  	Value string `json:"value,omitempty"`
    51  }
    52  
    53  // RuleActionSuppress represents a rule suppress action object
    54  type RuleActionSuppress struct {
    55  	Value               bool   `json:"value,omitempty"`
    56  	ThresholdValue      int    `json:"threshold_value,omitempty"`
    57  	ThresholdTimeUnit   string `json:"threshold_time_unit,omitempty"`
    58  	ThresholdTimeAmount int    `json:"threshold_time_amount,omitempty"`
    59  }
    60  
    61  // RuleActionSuspend represents a rule suspend action object
    62  type RuleActionSuspend struct {
    63  	Value *bool `json:"value,omitempty"`
    64  }
    65  
    66  // RuleActionExtraction represents a rule extraction action object
    67  type RuleActionExtraction struct {
    68  	Target string `json:"target,omitempty"`
    69  	Source string `json:"source,omitempty"`
    70  	Regex  string `json:"regex,omitempty"`
    71  }