This is page 2 of 3. Use http://codebase.md/metoro-io/metoro-mcp-server?lines=true&page={x} to view the full context.
# Directory Structure
```
├── .github
│ └── workflows
│ ├── go-test.yml
│ └── release.yml
├── .gitignore
├── .goreleaser.yml
├── go.mod
├── go.sum
├── images
│ └── Metoro_square.svg
├── LICENSE
├── main.go
├── model
│ ├── model_action_email_destination.go
│ ├── model_action_pager_duty_destination.go
│ ├── model_action_slack_destination.go
│ ├── model_action_webhook_destination.go
│ ├── model_action.go
│ ├── model_alert_type.go
│ ├── model_alert.go
│ ├── model_condition_type.go
│ ├── model_condition.go
│ ├── model_create_update_alert_request.go
│ ├── model_expression_config_filters_inner.go
│ ├── model_expression_config_metoro_timeseries_definition.go
│ ├── model_expression_config.go
│ ├── model_metadata_object.go
│ ├── model_metoro_ql_timeseries.go
│ ├── model_operator_config.go
│ ├── model_operator_type.go
│ ├── model_persistence_settings.go
│ ├── model_static_condition.go
│ ├── model_timeseries_config_expression.go
│ ├── model_timeseries_config.go
│ ├── model_timeseries_specifier_filters_inner.go
│ ├── model_timeseries_specifier_function.go
│ ├── model_timeseries_specifier_functions_math_expression.go
│ ├── model_timeseries_specifier_functions.go
│ ├── model_timeseries_specifier_kubernetes_resource.go
│ ├── model_timeseries_specifier_logs.go
│ ├── model_timeseries_specifier_metric.go
│ ├── model_timeseries_specifier_traces.go
│ ├── model_timeseries_specifier.go
│ ├── model.go
│ └── utils.go
├── README.md
├── resources
│ ├── environments.go
│ ├── k8s_events_attributes.go
│ ├── log_attributes.go
│ ├── metrics.go
│ ├── namespaces.go
│ ├── nodes.go
│ ├── resources.go
│ ├── services.go
│ └── trace_attributes.go
├── tools
│ ├── create_ai_issue.go
│ ├── create_alert.go
│ ├── create_dashboard.go
│ ├── create_investigation.go
│ ├── get_ai_issue.go
│ ├── get_alert_fires.go
│ ├── get_alerts.go
│ ├── get_attribute_keys.go
│ ├── get_attribute_values.go
│ ├── get_environments.go
│ ├── get_k8s_event_attribute_values.go
│ ├── get_k8s_events_attributes.go
│ ├── get_k8s_events_volume.go
│ ├── get_k8s_events.go
│ ├── get_k8s_service_information.go
│ ├── get_log_attribute_values.go
│ ├── get_log_attributes.go
│ ├── get_logs.go
│ ├── get_metric_attributes.go
│ ├── get_metric_metadata.go
│ ├── get_metric_names.go
│ ├── get_multi_metric.go
│ ├── get_namespaces.go
│ ├── get_node_attributes.go
│ ├── get_node_info.go
│ ├── get_nodes.go
│ ├── get_pod_by_ip.go
│ ├── get_pods.go
│ ├── get_profiles.go
│ ├── get_service_graph.go
│ ├── get_service_summaries.go
│ ├── get_services.go
│ ├── get_source_repository.go
│ ├── get_trace_attribute_values.go
│ ├── get_trace_attributes.go
│ ├── get_trace_metric.go
│ ├── get_trace_spans.go
│ ├── get_traces_distribution.go
│ ├── get_traces.go
│ ├── get_version_for_service.go
│ ├── list_ai_issue_events.go
│ ├── list_ai_issues.go
│ ├── list_investigations.go
│ ├── tools.go
│ ├── unix_to_rfc3339.go
│ ├── update_ai_issue.go
│ └── update_investigation.go
└── utils
├── request_utils.go
├── time_utils_test.go
└── time_utils.go
```
# Files
--------------------------------------------------------------------------------
/model/model_operator_config.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the OperatorConfig type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &OperatorConfig{}
21 |
22 | // OperatorConfig struct for OperatorConfig
23 | type OperatorConfig struct {
24 | Operator OperatorType `json:"operator"`
25 | // Threshold value for comparison
26 | Threshold float64 `json:"threshold"`
27 | }
28 |
29 | type _OperatorConfig OperatorConfig
30 |
31 | // NewOperatorConfig instantiates a new OperatorConfig object
32 | // This constructor will assign default values to properties that have it defined,
33 | // and makes sure properties required by API are set, but the set of arguments
34 | // will change when the set of required properties is changed
35 | func NewOperatorConfig(operator OperatorType, threshold float64) *OperatorConfig {
36 | this := OperatorConfig{}
37 | this.Operator = operator
38 | this.Threshold = threshold
39 | return &this
40 | }
41 |
42 | // NewOperatorConfigWithDefaults instantiates a new OperatorConfig object
43 | // This constructor will only assign default values to properties that have it defined,
44 | // but it doesn't guarantee that properties required by API are set
45 | func NewOperatorConfigWithDefaults() *OperatorConfig {
46 | this := OperatorConfig{}
47 | return &this
48 | }
49 |
50 | // GetOperator returns the Operator field value
51 | func (o *OperatorConfig) GetOperator() OperatorType {
52 | if o == nil {
53 | var ret OperatorType
54 | return ret
55 | }
56 |
57 | return o.Operator
58 | }
59 |
60 | // GetOperatorOk returns a tuple with the Operator field value
61 | // and a boolean to check if the value has been set.
62 | func (o *OperatorConfig) GetOperatorOk() (*OperatorType, bool) {
63 | if o == nil {
64 | return nil, false
65 | }
66 | return &o.Operator, true
67 | }
68 |
69 | // SetOperator sets field value
70 | func (o *OperatorConfig) SetOperator(v OperatorType) {
71 | o.Operator = v
72 | }
73 |
74 | // GetThreshold returns the Threshold field value
75 | func (o *OperatorConfig) GetThreshold() float64 {
76 | if o == nil {
77 | var ret float64
78 | return ret
79 | }
80 |
81 | return o.Threshold
82 | }
83 |
84 | // GetThresholdOk returns a tuple with the Threshold field value
85 | // and a boolean to check if the value has been set.
86 | func (o *OperatorConfig) GetThresholdOk() (*float64, bool) {
87 | if o == nil {
88 | return nil, false
89 | }
90 | return &o.Threshold, true
91 | }
92 |
93 | // SetThreshold sets field value
94 | func (o *OperatorConfig) SetThreshold(v float64) {
95 | o.Threshold = v
96 | }
97 |
98 | func (o OperatorConfig) MarshalJSON() ([]byte, error) {
99 | toSerialize, err := o.ToMap()
100 | if err != nil {
101 | return []byte{}, err
102 | }
103 | return json.Marshal(toSerialize)
104 | }
105 |
106 | func (o OperatorConfig) ToMap() (map[string]interface{}, error) {
107 | toSerialize := map[string]interface{}{}
108 | toSerialize["operator"] = o.Operator
109 | toSerialize["threshold"] = o.Threshold
110 | return toSerialize, nil
111 | }
112 |
113 | func (o *OperatorConfig) UnmarshalJSON(data []byte) (err error) {
114 | // This validates that all required properties are included in the JSON object
115 | // by unmarshalling the object into a generic map with string keys and checking
116 | // that every required field exists as a key in the generic map.
117 | requiredProperties := []string{
118 | "operator",
119 | "threshold",
120 | }
121 |
122 | allProperties := make(map[string]interface{})
123 |
124 | err = json.Unmarshal(data, &allProperties)
125 |
126 | if err != nil {
127 | return err
128 | }
129 |
130 | for _, requiredProperty := range requiredProperties {
131 | if _, exists := allProperties[requiredProperty]; !exists {
132 | return fmt.Errorf("no value given for required property %v", requiredProperty)
133 | }
134 | }
135 |
136 | varOperatorConfig := _OperatorConfig{}
137 |
138 | decoder := json.NewDecoder(bytes.NewReader(data))
139 | decoder.DisallowUnknownFields()
140 | err = decoder.Decode(&varOperatorConfig)
141 |
142 | if err != nil {
143 | return err
144 | }
145 |
146 | *o = OperatorConfig(varOperatorConfig)
147 |
148 | return err
149 | }
150 |
151 | type NullableOperatorConfig struct {
152 | value *OperatorConfig
153 | isSet bool
154 | }
155 |
156 | func (v NullableOperatorConfig) Get() *OperatorConfig {
157 | return v.value
158 | }
159 |
160 | func (v *NullableOperatorConfig) Set(val *OperatorConfig) {
161 | v.value = val
162 | v.isSet = true
163 | }
164 |
165 | func (v NullableOperatorConfig) IsSet() bool {
166 | return v.isSet
167 | }
168 |
169 | func (v *NullableOperatorConfig) Unset() {
170 | v.value = nil
171 | v.isSet = false
172 | }
173 |
174 | func NewNullableOperatorConfig(val *OperatorConfig) *NullableOperatorConfig {
175 | return &NullableOperatorConfig{value: val, isSet: true}
176 | }
177 |
178 | func (v NullableOperatorConfig) MarshalJSON() ([]byte, error) {
179 | return json.Marshal(v.value)
180 | }
181 |
182 | func (v *NullableOperatorConfig) UnmarshalJSON(src []byte) error {
183 | v.isSet = true
184 | return json.Unmarshal(src, &v.value)
185 | }
186 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_logs.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the TimeseriesSpecifierLogs type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &TimeseriesSpecifierLogs{}
19 |
20 | // TimeseriesSpecifierLogs Configuration for a logs timeseries
21 | type TimeseriesSpecifierLogs struct {
22 | // Regular expressions to match logs
23 | Regexes []string `json:"regexes,omitempty"`
24 | // Regular expressions to exclude logs
25 | ExcludeRegexes []string `json:"excludeRegexes,omitempty"`
26 | }
27 |
28 | // NewTimeseriesSpecifierLogs instantiates a new TimeseriesSpecifierLogs object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewTimeseriesSpecifierLogs() *TimeseriesSpecifierLogs {
33 | this := TimeseriesSpecifierLogs{}
34 | return &this
35 | }
36 |
37 | // NewTimeseriesSpecifierLogsWithDefaults instantiates a new TimeseriesSpecifierLogs object
38 | // This constructor will only assign default values to properties that have it defined,
39 | // but it doesn't guarantee that properties required by API are set
40 | func NewTimeseriesSpecifierLogsWithDefaults() *TimeseriesSpecifierLogs {
41 | this := TimeseriesSpecifierLogs{}
42 | return &this
43 | }
44 |
45 | // GetRegexes returns the Regexes field value if set, zero value otherwise.
46 | func (o *TimeseriesSpecifierLogs) GetRegexes() []string {
47 | if o == nil || IsNil(o.Regexes) {
48 | var ret []string
49 | return ret
50 | }
51 | return o.Regexes
52 | }
53 |
54 | // GetRegexesOk returns a tuple with the Regexes field value if set, nil otherwise
55 | // and a boolean to check if the value has been set.
56 | func (o *TimeseriesSpecifierLogs) GetRegexesOk() ([]string, bool) {
57 | if o == nil || IsNil(o.Regexes) {
58 | return nil, false
59 | }
60 | return o.Regexes, true
61 | }
62 |
63 | // HasRegexes returns a boolean if a field has been set.
64 | func (o *TimeseriesSpecifierLogs) HasRegexes() bool {
65 | if o != nil && !IsNil(o.Regexes) {
66 | return true
67 | }
68 |
69 | return false
70 | }
71 |
72 | // SetRegexes gets a reference to the given []string and assigns it to the Regexes field.
73 | func (o *TimeseriesSpecifierLogs) SetRegexes(v []string) {
74 | o.Regexes = v
75 | }
76 |
77 | // GetExcludeRegexes returns the ExcludeRegexes field value if set, zero value otherwise.
78 | func (o *TimeseriesSpecifierLogs) GetExcludeRegexes() []string {
79 | if o == nil || IsNil(o.ExcludeRegexes) {
80 | var ret []string
81 | return ret
82 | }
83 | return o.ExcludeRegexes
84 | }
85 |
86 | // GetExcludeRegexesOk returns a tuple with the ExcludeRegexes field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *TimeseriesSpecifierLogs) GetExcludeRegexesOk() ([]string, bool) {
89 | if o == nil || IsNil(o.ExcludeRegexes) {
90 | return nil, false
91 | }
92 | return o.ExcludeRegexes, true
93 | }
94 |
95 | // HasExcludeRegexes returns a boolean if a field has been set.
96 | func (o *TimeseriesSpecifierLogs) HasExcludeRegexes() bool {
97 | if o != nil && !IsNil(o.ExcludeRegexes) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetExcludeRegexes gets a reference to the given []string and assigns it to the ExcludeRegexes field.
105 | func (o *TimeseriesSpecifierLogs) SetExcludeRegexes(v []string) {
106 | o.ExcludeRegexes = v
107 | }
108 |
109 | func (o TimeseriesSpecifierLogs) MarshalJSON() ([]byte, error) {
110 | toSerialize,err := o.ToMap()
111 | if err != nil {
112 | return []byte{}, err
113 | }
114 | return json.Marshal(toSerialize)
115 | }
116 |
117 | func (o TimeseriesSpecifierLogs) ToMap() (map[string]interface{}, error) {
118 | toSerialize := map[string]interface{}{}
119 | if !IsNil(o.Regexes) {
120 | toSerialize["regexes"] = o.Regexes
121 | }
122 | if !IsNil(o.ExcludeRegexes) {
123 | toSerialize["excludeRegexes"] = o.ExcludeRegexes
124 | }
125 | return toSerialize, nil
126 | }
127 |
128 | type NullableTimeseriesSpecifierLogs struct {
129 | value *TimeseriesSpecifierLogs
130 | isSet bool
131 | }
132 |
133 | func (v NullableTimeseriesSpecifierLogs) Get() *TimeseriesSpecifierLogs {
134 | return v.value
135 | }
136 |
137 | func (v *NullableTimeseriesSpecifierLogs) Set(val *TimeseriesSpecifierLogs) {
138 | v.value = val
139 | v.isSet = true
140 | }
141 |
142 | func (v NullableTimeseriesSpecifierLogs) IsSet() bool {
143 | return v.isSet
144 | }
145 |
146 | func (v *NullableTimeseriesSpecifierLogs) Unset() {
147 | v.value = nil
148 | v.isSet = false
149 | }
150 |
151 | func NewNullableTimeseriesSpecifierLogs(val *TimeseriesSpecifierLogs) *NullableTimeseriesSpecifierLogs {
152 | return &NullableTimeseriesSpecifierLogs{value: val, isSet: true}
153 | }
154 |
155 | func (v NullableTimeseriesSpecifierLogs) MarshalJSON() ([]byte, error) {
156 | return json.Marshal(v.value)
157 | }
158 |
159 | func (v *NullableTimeseriesSpecifierLogs) UnmarshalJSON(src []byte) error {
160 | v.isSet = true
161 | return json.Unmarshal(src, &v.value)
162 | }
163 |
164 |
165 |
```
--------------------------------------------------------------------------------
/model/model_action_pager_duty_destination.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ActionPagerDutyDestination type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ActionPagerDutyDestination{}
19 |
20 | // ActionPagerDutyDestination struct for ActionPagerDutyDestination
21 | type ActionPagerDutyDestination struct {
22 | // PagerDuty service ID
23 | ServiceId *string `json:"serviceId,omitempty"`
24 | // PagerDuty service name
25 | ServiceName *string `json:"serviceName,omitempty"`
26 | }
27 |
28 | // NewActionPagerDutyDestination instantiates a new ActionPagerDutyDestination object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewActionPagerDutyDestination() *ActionPagerDutyDestination {
33 | this := ActionPagerDutyDestination{}
34 | return &this
35 | }
36 |
37 | // NewActionPagerDutyDestinationWithDefaults instantiates a new ActionPagerDutyDestination object
38 | // This constructor will only assign default values to properties that have it defined,
39 | // but it doesn't guarantee that properties required by API are set
40 | func NewActionPagerDutyDestinationWithDefaults() *ActionPagerDutyDestination {
41 | this := ActionPagerDutyDestination{}
42 | return &this
43 | }
44 |
45 | // GetServiceId returns the ServiceId field value if set, zero value otherwise.
46 | func (o *ActionPagerDutyDestination) GetServiceId() string {
47 | if o == nil || IsNil(o.ServiceId) {
48 | var ret string
49 | return ret
50 | }
51 | return *o.ServiceId
52 | }
53 |
54 | // GetServiceIdOk returns a tuple with the ServiceId field value if set, nil otherwise
55 | // and a boolean to check if the value has been set.
56 | func (o *ActionPagerDutyDestination) GetServiceIdOk() (*string, bool) {
57 | if o == nil || IsNil(o.ServiceId) {
58 | return nil, false
59 | }
60 | return o.ServiceId, true
61 | }
62 |
63 | // HasServiceId returns a boolean if a field has been set.
64 | func (o *ActionPagerDutyDestination) HasServiceId() bool {
65 | if o != nil && !IsNil(o.ServiceId) {
66 | return true
67 | }
68 |
69 | return false
70 | }
71 |
72 | // SetServiceId gets a reference to the given string and assigns it to the ServiceId field.
73 | func (o *ActionPagerDutyDestination) SetServiceId(v string) {
74 | o.ServiceId = &v
75 | }
76 |
77 | // GetServiceName returns the ServiceName field value if set, zero value otherwise.
78 | func (o *ActionPagerDutyDestination) GetServiceName() string {
79 | if o == nil || IsNil(o.ServiceName) {
80 | var ret string
81 | return ret
82 | }
83 | return *o.ServiceName
84 | }
85 |
86 | // GetServiceNameOk returns a tuple with the ServiceName field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *ActionPagerDutyDestination) GetServiceNameOk() (*string, bool) {
89 | if o == nil || IsNil(o.ServiceName) {
90 | return nil, false
91 | }
92 | return o.ServiceName, true
93 | }
94 |
95 | // HasServiceName returns a boolean if a field has been set.
96 | func (o *ActionPagerDutyDestination) HasServiceName() bool {
97 | if o != nil && !IsNil(o.ServiceName) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetServiceName gets a reference to the given string and assigns it to the ServiceName field.
105 | func (o *ActionPagerDutyDestination) SetServiceName(v string) {
106 | o.ServiceName = &v
107 | }
108 |
109 | func (o ActionPagerDutyDestination) MarshalJSON() ([]byte, error) {
110 | toSerialize, err := o.ToMap()
111 | if err != nil {
112 | return []byte{}, err
113 | }
114 | return json.Marshal(toSerialize)
115 | }
116 |
117 | func (o ActionPagerDutyDestination) ToMap() (map[string]interface{}, error) {
118 | toSerialize := map[string]interface{}{}
119 | if !IsNil(o.ServiceId) {
120 | toSerialize["serviceId"] = o.ServiceId
121 | }
122 | if !IsNil(o.ServiceName) {
123 | toSerialize["serviceName"] = o.ServiceName
124 | }
125 | return toSerialize, nil
126 | }
127 |
128 | type NullableActionPagerDutyDestination struct {
129 | value *ActionPagerDutyDestination
130 | isSet bool
131 | }
132 |
133 | func (v NullableActionPagerDutyDestination) Get() *ActionPagerDutyDestination {
134 | return v.value
135 | }
136 |
137 | func (v *NullableActionPagerDutyDestination) Set(val *ActionPagerDutyDestination) {
138 | v.value = val
139 | v.isSet = true
140 | }
141 |
142 | func (v NullableActionPagerDutyDestination) IsSet() bool {
143 | return v.isSet
144 | }
145 |
146 | func (v *NullableActionPagerDutyDestination) Unset() {
147 | v.value = nil
148 | v.isSet = false
149 | }
150 |
151 | func NewNullableActionPagerDutyDestination(val *ActionPagerDutyDestination) *NullableActionPagerDutyDestination {
152 | return &NullableActionPagerDutyDestination{value: val, isSet: true}
153 | }
154 |
155 | func (v NullableActionPagerDutyDestination) MarshalJSON() ([]byte, error) {
156 | return json.Marshal(v.value)
157 | }
158 |
159 | func (v *NullableActionPagerDutyDestination) UnmarshalJSON(src []byte) error {
160 | v.isSet = true
161 | return json.Unmarshal(src, &v.value)
162 | }
163 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_traces.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the TimeseriesSpecifierTraces type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &TimeseriesSpecifierTraces{}
19 |
20 | // TimeseriesSpecifierTraces Configuration for a traces timeseries
21 | type TimeseriesSpecifierTraces struct {
22 | // Regular expressions to match traces
23 | Regexes []string `json:"regexes,omitempty"`
24 | // Regular expressions to exclude traces
25 | ExcludeRegexes []string `json:"excludeRegexes,omitempty"`
26 | }
27 |
28 | // NewTimeseriesSpecifierTraces instantiates a new TimeseriesSpecifierTraces object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewTimeseriesSpecifierTraces() *TimeseriesSpecifierTraces {
33 | this := TimeseriesSpecifierTraces{}
34 | return &this
35 | }
36 |
37 | // NewTimeseriesSpecifierTracesWithDefaults instantiates a new TimeseriesSpecifierTraces object
38 | // This constructor will only assign default values to properties that have it defined,
39 | // but it doesn't guarantee that properties required by API are set
40 | func NewTimeseriesSpecifierTracesWithDefaults() *TimeseriesSpecifierTraces {
41 | this := TimeseriesSpecifierTraces{}
42 | return &this
43 | }
44 |
45 | // GetRegexes returns the Regexes field value if set, zero value otherwise.
46 | func (o *TimeseriesSpecifierTraces) GetRegexes() []string {
47 | if o == nil || IsNil(o.Regexes) {
48 | var ret []string
49 | return ret
50 | }
51 | return o.Regexes
52 | }
53 |
54 | // GetRegexesOk returns a tuple with the Regexes field value if set, nil otherwise
55 | // and a boolean to check if the value has been set.
56 | func (o *TimeseriesSpecifierTraces) GetRegexesOk() ([]string, bool) {
57 | if o == nil || IsNil(o.Regexes) {
58 | return nil, false
59 | }
60 | return o.Regexes, true
61 | }
62 |
63 | // HasRegexes returns a boolean if a field has been set.
64 | func (o *TimeseriesSpecifierTraces) HasRegexes() bool {
65 | if o != nil && !IsNil(o.Regexes) {
66 | return true
67 | }
68 |
69 | return false
70 | }
71 |
72 | // SetRegexes gets a reference to the given []string and assigns it to the Regexes field.
73 | func (o *TimeseriesSpecifierTraces) SetRegexes(v []string) {
74 | o.Regexes = v
75 | }
76 |
77 | // GetExcludeRegexes returns the ExcludeRegexes field value if set, zero value otherwise.
78 | func (o *TimeseriesSpecifierTraces) GetExcludeRegexes() []string {
79 | if o == nil || IsNil(o.ExcludeRegexes) {
80 | var ret []string
81 | return ret
82 | }
83 | return o.ExcludeRegexes
84 | }
85 |
86 | // GetExcludeRegexesOk returns a tuple with the ExcludeRegexes field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *TimeseriesSpecifierTraces) GetExcludeRegexesOk() ([]string, bool) {
89 | if o == nil || IsNil(o.ExcludeRegexes) {
90 | return nil, false
91 | }
92 | return o.ExcludeRegexes, true
93 | }
94 |
95 | // HasExcludeRegexes returns a boolean if a field has been set.
96 | func (o *TimeseriesSpecifierTraces) HasExcludeRegexes() bool {
97 | if o != nil && !IsNil(o.ExcludeRegexes) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetExcludeRegexes gets a reference to the given []string and assigns it to the ExcludeRegexes field.
105 | func (o *TimeseriesSpecifierTraces) SetExcludeRegexes(v []string) {
106 | o.ExcludeRegexes = v
107 | }
108 |
109 | func (o TimeseriesSpecifierTraces) MarshalJSON() ([]byte, error) {
110 | toSerialize,err := o.ToMap()
111 | if err != nil {
112 | return []byte{}, err
113 | }
114 | return json.Marshal(toSerialize)
115 | }
116 |
117 | func (o TimeseriesSpecifierTraces) ToMap() (map[string]interface{}, error) {
118 | toSerialize := map[string]interface{}{}
119 | if !IsNil(o.Regexes) {
120 | toSerialize["regexes"] = o.Regexes
121 | }
122 | if !IsNil(o.ExcludeRegexes) {
123 | toSerialize["excludeRegexes"] = o.ExcludeRegexes
124 | }
125 | return toSerialize, nil
126 | }
127 |
128 | type NullableTimeseriesSpecifierTraces struct {
129 | value *TimeseriesSpecifierTraces
130 | isSet bool
131 | }
132 |
133 | func (v NullableTimeseriesSpecifierTraces) Get() *TimeseriesSpecifierTraces {
134 | return v.value
135 | }
136 |
137 | func (v *NullableTimeseriesSpecifierTraces) Set(val *TimeseriesSpecifierTraces) {
138 | v.value = val
139 | v.isSet = true
140 | }
141 |
142 | func (v NullableTimeseriesSpecifierTraces) IsSet() bool {
143 | return v.isSet
144 | }
145 |
146 | func (v *NullableTimeseriesSpecifierTraces) Unset() {
147 | v.value = nil
148 | v.isSet = false
149 | }
150 |
151 | func NewNullableTimeseriesSpecifierTraces(val *TimeseriesSpecifierTraces) *NullableTimeseriesSpecifierTraces {
152 | return &NullableTimeseriesSpecifierTraces{value: val, isSet: true}
153 | }
154 |
155 | func (v NullableTimeseriesSpecifierTraces) MarshalJSON() ([]byte, error) {
156 | return json.Marshal(v.value)
157 | }
158 |
159 | func (v *NullableTimeseriesSpecifierTraces) UnmarshalJSON(src []byte) error {
160 | v.isSet = true
161 | return json.Unmarshal(src, &v.value)
162 | }
163 |
164 |
165 |
```
--------------------------------------------------------------------------------
/model/model_action_email_destination.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ActionEmailDestination type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ActionEmailDestination{}
19 |
20 | // ActionEmailDestination struct for ActionEmailDestination
21 | type ActionEmailDestination struct {
22 | // Whether to notify the email recipients when the alert is resolved
23 | NotifyOnResolve *bool `json:"notifyOnResolve,omitempty"`
24 | // Email addresses to send alert to
25 | Emails []string `json:"emails,omitempty"`
26 | }
27 |
28 | // NewActionEmailDestination instantiates a new ActionEmailDestination object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewActionEmailDestination() *ActionEmailDestination {
33 | this := ActionEmailDestination{}
34 | var notifyOnResolve bool = false
35 | this.NotifyOnResolve = ¬ifyOnResolve
36 | return &this
37 | }
38 |
39 | // NewActionEmailDestinationWithDefaults instantiates a new ActionEmailDestination object
40 | // This constructor will only assign default values to properties that have it defined,
41 | // but it doesn't guarantee that properties required by API are set
42 | func NewActionEmailDestinationWithDefaults() *ActionEmailDestination {
43 | this := ActionEmailDestination{}
44 | var notifyOnResolve bool = false
45 | this.NotifyOnResolve = ¬ifyOnResolve
46 | return &this
47 | }
48 |
49 | // GetNotifyOnResolve returns the NotifyOnResolve field value if set, zero value otherwise.
50 | func (o *ActionEmailDestination) GetNotifyOnResolve() bool {
51 | if o == nil || IsNil(o.NotifyOnResolve) {
52 | var ret bool
53 | return ret
54 | }
55 | return *o.NotifyOnResolve
56 | }
57 |
58 | // GetNotifyOnResolveOk returns a tuple with the NotifyOnResolve field value if set, nil otherwise
59 | // and a boolean to check if the value has been set.
60 | func (o *ActionEmailDestination) GetNotifyOnResolveOk() (*bool, bool) {
61 | if o == nil || IsNil(o.NotifyOnResolve) {
62 | return nil, false
63 | }
64 | return o.NotifyOnResolve, true
65 | }
66 |
67 | // HasNotifyOnResolve returns a boolean if a field has been set.
68 | func (o *ActionEmailDestination) HasNotifyOnResolve() bool {
69 | if o != nil && !IsNil(o.NotifyOnResolve) {
70 | return true
71 | }
72 |
73 | return false
74 | }
75 |
76 | // SetNotifyOnResolve gets a reference to the given bool and assigns it to the NotifyOnResolve field.
77 | func (o *ActionEmailDestination) SetNotifyOnResolve(v bool) {
78 | o.NotifyOnResolve = &v
79 | }
80 |
81 | // GetEmails returns the Emails field value if set, zero value otherwise.
82 | func (o *ActionEmailDestination) GetEmails() []string {
83 | if o == nil || IsNil(o.Emails) {
84 | var ret []string
85 | return ret
86 | }
87 | return o.Emails
88 | }
89 |
90 | // GetEmailsOk returns a tuple with the Emails field value if set, nil otherwise
91 | // and a boolean to check if the value has been set.
92 | func (o *ActionEmailDestination) GetEmailsOk() ([]string, bool) {
93 | if o == nil || IsNil(o.Emails) {
94 | return nil, false
95 | }
96 | return o.Emails, true
97 | }
98 |
99 | // HasEmails returns a boolean if a field has been set.
100 | func (o *ActionEmailDestination) HasEmails() bool {
101 | if o != nil && !IsNil(o.Emails) {
102 | return true
103 | }
104 |
105 | return false
106 | }
107 |
108 | // SetEmails gets a reference to the given []string and assigns it to the Emails field.
109 | func (o *ActionEmailDestination) SetEmails(v []string) {
110 | o.Emails = v
111 | }
112 |
113 | func (o ActionEmailDestination) MarshalJSON() ([]byte, error) {
114 | toSerialize,err := o.ToMap()
115 | if err != nil {
116 | return []byte{}, err
117 | }
118 | return json.Marshal(toSerialize)
119 | }
120 |
121 | func (o ActionEmailDestination) ToMap() (map[string]interface{}, error) {
122 | toSerialize := map[string]interface{}{}
123 | if !IsNil(o.NotifyOnResolve) {
124 | toSerialize["notifyOnResolve"] = o.NotifyOnResolve
125 | }
126 | if !IsNil(o.Emails) {
127 | toSerialize["emails"] = o.Emails
128 | }
129 | return toSerialize, nil
130 | }
131 |
132 | type NullableActionEmailDestination struct {
133 | value *ActionEmailDestination
134 | isSet bool
135 | }
136 |
137 | func (v NullableActionEmailDestination) Get() *ActionEmailDestination {
138 | return v.value
139 | }
140 |
141 | func (v *NullableActionEmailDestination) Set(val *ActionEmailDestination) {
142 | v.value = val
143 | v.isSet = true
144 | }
145 |
146 | func (v NullableActionEmailDestination) IsSet() bool {
147 | return v.isSet
148 | }
149 |
150 | func (v *NullableActionEmailDestination) Unset() {
151 | v.value = nil
152 | v.isSet = false
153 | }
154 |
155 | func NewNullableActionEmailDestination(val *ActionEmailDestination) *NullableActionEmailDestination {
156 | return &NullableActionEmailDestination{value: val, isSet: true}
157 | }
158 |
159 | func (v NullableActionEmailDestination) MarshalJSON() ([]byte, error) {
160 | return json.Marshal(v.value)
161 | }
162 |
163 | func (v *NullableActionEmailDestination) UnmarshalJSON(src []byte) error {
164 | v.isSet = true
165 | return json.Unmarshal(src, &v.value)
166 | }
167 |
168 |
169 |
```
--------------------------------------------------------------------------------
/model/model_action_slack_destination.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ActionSlackDestination type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ActionSlackDestination{}
19 |
20 | // ActionSlackDestination struct for ActionSlackDestination
21 | type ActionSlackDestination struct {
22 | // Slack channel to send alert to
23 | Channel *string `json:"channel,omitempty"`
24 | // Whether to notify the channel when the alert is resolved
25 | NotifyOnResolve *bool `json:"notifyOnResolve,omitempty"`
26 | }
27 |
28 | // NewActionSlackDestination instantiates a new ActionSlackDestination object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewActionSlackDestination() *ActionSlackDestination {
33 | this := ActionSlackDestination{}
34 | var notifyOnResolve bool = false
35 | this.NotifyOnResolve = ¬ifyOnResolve
36 | return &this
37 | }
38 |
39 | // NewActionSlackDestinationWithDefaults instantiates a new ActionSlackDestination object
40 | // This constructor will only assign default values to properties that have it defined,
41 | // but it doesn't guarantee that properties required by API are set
42 | func NewActionSlackDestinationWithDefaults() *ActionSlackDestination {
43 | this := ActionSlackDestination{}
44 | var notifyOnResolve bool = false
45 | this.NotifyOnResolve = ¬ifyOnResolve
46 | return &this
47 | }
48 |
49 | // GetChannel returns the Channel field value if set, zero value otherwise.
50 | func (o *ActionSlackDestination) GetChannel() string {
51 | if o == nil || IsNil(o.Channel) {
52 | var ret string
53 | return ret
54 | }
55 | return *o.Channel
56 | }
57 |
58 | // GetChannelOk returns a tuple with the Channel field value if set, nil otherwise
59 | // and a boolean to check if the value has been set.
60 | func (o *ActionSlackDestination) GetChannelOk() (*string, bool) {
61 | if o == nil || IsNil(o.Channel) {
62 | return nil, false
63 | }
64 | return o.Channel, true
65 | }
66 |
67 | // HasChannel returns a boolean if a field has been set.
68 | func (o *ActionSlackDestination) HasChannel() bool {
69 | if o != nil && !IsNil(o.Channel) {
70 | return true
71 | }
72 |
73 | return false
74 | }
75 |
76 | // SetChannel gets a reference to the given string and assigns it to the Channel field.
77 | func (o *ActionSlackDestination) SetChannel(v string) {
78 | o.Channel = &v
79 | }
80 |
81 | // GetNotifyOnResolve returns the NotifyOnResolve field value if set, zero value otherwise.
82 | func (o *ActionSlackDestination) GetNotifyOnResolve() bool {
83 | if o == nil || IsNil(o.NotifyOnResolve) {
84 | var ret bool
85 | return ret
86 | }
87 | return *o.NotifyOnResolve
88 | }
89 |
90 | // GetNotifyOnResolveOk returns a tuple with the NotifyOnResolve field value if set, nil otherwise
91 | // and a boolean to check if the value has been set.
92 | func (o *ActionSlackDestination) GetNotifyOnResolveOk() (*bool, bool) {
93 | if o == nil || IsNil(o.NotifyOnResolve) {
94 | return nil, false
95 | }
96 | return o.NotifyOnResolve, true
97 | }
98 |
99 | // HasNotifyOnResolve returns a boolean if a field has been set.
100 | func (o *ActionSlackDestination) HasNotifyOnResolve() bool {
101 | if o != nil && !IsNil(o.NotifyOnResolve) {
102 | return true
103 | }
104 |
105 | return false
106 | }
107 |
108 | // SetNotifyOnResolve gets a reference to the given bool and assigns it to the NotifyOnResolve field.
109 | func (o *ActionSlackDestination) SetNotifyOnResolve(v bool) {
110 | o.NotifyOnResolve = &v
111 | }
112 |
113 | func (o ActionSlackDestination) MarshalJSON() ([]byte, error) {
114 | toSerialize,err := o.ToMap()
115 | if err != nil {
116 | return []byte{}, err
117 | }
118 | return json.Marshal(toSerialize)
119 | }
120 |
121 | func (o ActionSlackDestination) ToMap() (map[string]interface{}, error) {
122 | toSerialize := map[string]interface{}{}
123 | if !IsNil(o.Channel) {
124 | toSerialize["channel"] = o.Channel
125 | }
126 | if !IsNil(o.NotifyOnResolve) {
127 | toSerialize["notifyOnResolve"] = o.NotifyOnResolve
128 | }
129 | return toSerialize, nil
130 | }
131 |
132 | type NullableActionSlackDestination struct {
133 | value *ActionSlackDestination
134 | isSet bool
135 | }
136 |
137 | func (v NullableActionSlackDestination) Get() *ActionSlackDestination {
138 | return v.value
139 | }
140 |
141 | func (v *NullableActionSlackDestination) Set(val *ActionSlackDestination) {
142 | v.value = val
143 | v.isSet = true
144 | }
145 |
146 | func (v NullableActionSlackDestination) IsSet() bool {
147 | return v.isSet
148 | }
149 |
150 | func (v *NullableActionSlackDestination) Unset() {
151 | v.value = nil
152 | v.isSet = false
153 | }
154 |
155 | func NewNullableActionSlackDestination(val *ActionSlackDestination) *NullableActionSlackDestination {
156 | return &NullableActionSlackDestination{value: val, isSet: true}
157 | }
158 |
159 | func (v NullableActionSlackDestination) MarshalJSON() ([]byte, error) {
160 | return json.Marshal(v.value)
161 | }
162 |
163 | func (v *NullableActionSlackDestination) UnmarshalJSON(src []byte) error {
164 | v.isSet = true
165 | return json.Unmarshal(src, &v.value)
166 | }
167 |
168 |
169 |
```
--------------------------------------------------------------------------------
/model/model_metoro_ql_timeseries.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the MetoroQlTimeseries type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &MetoroQlTimeseries{}
21 |
22 | // MetoroQlTimeseries struct for MetoroQlTimeseries
23 | type MetoroQlTimeseries struct {
24 | // MetoroQL query to use for the timeseries.
25 | Query string `json:"query"`
26 | // The size of each bucket to aggregate data into in seconds. For example, if the bucket size is 60, the data will be aggregated into 1 minute buckets.
27 | BucketSize int64 `json:"bucketSize"`
28 | }
29 |
30 | type _MetoroQlTimeseries MetoroQlTimeseries
31 |
32 | // NewMetoroQlTimeseries instantiates a new MetoroQlTimeseries object
33 | // This constructor will assign default values to properties that have it defined,
34 | // and makes sure properties required by API are set, but the set of arguments
35 | // will change when the set of required properties is changed
36 | func NewMetoroQlTimeseries(query string, bucketSize int64) *MetoroQlTimeseries {
37 | this := MetoroQlTimeseries{}
38 | this.Query = query
39 | this.BucketSize = bucketSize
40 | return &this
41 | }
42 |
43 | // NewMetoroQlTimeseriesWithDefaults instantiates a new MetoroQlTimeseries object
44 | // This constructor will only assign default values to properties that have it defined,
45 | // but it doesn't guarantee that properties required by API are set
46 | func NewMetoroQlTimeseriesWithDefaults() *MetoroQlTimeseries {
47 | this := MetoroQlTimeseries{}
48 | return &this
49 | }
50 |
51 | // GetQuery returns the Query field value
52 | func (o *MetoroQlTimeseries) GetQuery() string {
53 | if o == nil {
54 | var ret string
55 | return ret
56 | }
57 |
58 | return o.Query
59 | }
60 |
61 | // GetQueryOk returns a tuple with the Query field value
62 | // and a boolean to check if the value has been set.
63 | func (o *MetoroQlTimeseries) GetQueryOk() (*string, bool) {
64 | if o == nil {
65 | return nil, false
66 | }
67 | return &o.Query, true
68 | }
69 |
70 | // SetQuery sets field value
71 | func (o *MetoroQlTimeseries) SetQuery(v string) {
72 | o.Query = v
73 | }
74 |
75 | // GetBucketSize returns the BucketSize field value
76 | func (o *MetoroQlTimeseries) GetBucketSize() int64 {
77 | if o == nil {
78 | var ret int64
79 | return ret
80 | }
81 |
82 | return o.BucketSize
83 | }
84 |
85 | // GetBucketSizeOk returns a tuple with the BucketSize field value
86 | // and a boolean to check if the value has been set.
87 | func (o *MetoroQlTimeseries) GetBucketSizeOk() (*int64, bool) {
88 | if o == nil {
89 | return nil, false
90 | }
91 | return &o.BucketSize, true
92 | }
93 |
94 | // SetBucketSize sets field value
95 | func (o *MetoroQlTimeseries) SetBucketSize(v int64) {
96 | o.BucketSize = v
97 | }
98 |
99 | func (o MetoroQlTimeseries) MarshalJSON() ([]byte, error) {
100 | toSerialize, err := o.ToMap()
101 | if err != nil {
102 | return []byte{}, err
103 | }
104 | return json.Marshal(toSerialize)
105 | }
106 |
107 | func (o MetoroQlTimeseries) ToMap() (map[string]interface{}, error) {
108 | toSerialize := map[string]interface{}{}
109 | toSerialize["query"] = o.Query
110 | toSerialize["bucketSize"] = o.BucketSize
111 | return toSerialize, nil
112 | }
113 |
114 | func (o *MetoroQlTimeseries) UnmarshalJSON(data []byte) (err error) {
115 | // This validates that all required properties are included in the JSON object
116 | // by unmarshalling the object into a generic map with string keys and checking
117 | // that every required field exists as a key in the generic map.
118 | requiredProperties := []string{
119 | "query",
120 | "bucketSize",
121 | }
122 |
123 | allProperties := make(map[string]interface{})
124 |
125 | err = json.Unmarshal(data, &allProperties)
126 |
127 | if err != nil {
128 | return err
129 | }
130 |
131 | for _, requiredProperty := range requiredProperties {
132 | if _, exists := allProperties[requiredProperty]; !exists {
133 | return fmt.Errorf("no value given for required property %v", requiredProperty)
134 | }
135 | }
136 |
137 | varMetoroQlTimeseries := _MetoroQlTimeseries{}
138 |
139 | decoder := json.NewDecoder(bytes.NewReader(data))
140 | decoder.DisallowUnknownFields()
141 | err = decoder.Decode(&varMetoroQlTimeseries)
142 |
143 | if err != nil {
144 | return err
145 | }
146 |
147 | *o = MetoroQlTimeseries(varMetoroQlTimeseries)
148 |
149 | return err
150 | }
151 |
152 | type NullableMetoroQlTimeseries struct {
153 | value *MetoroQlTimeseries
154 | isSet bool
155 | }
156 |
157 | func (v NullableMetoroQlTimeseries) Get() *MetoroQlTimeseries {
158 | return v.value
159 | }
160 |
161 | func (v *NullableMetoroQlTimeseries) Set(val *MetoroQlTimeseries) {
162 | v.value = val
163 | v.isSet = true
164 | }
165 |
166 | func (v NullableMetoroQlTimeseries) IsSet() bool {
167 | return v.isSet
168 | }
169 |
170 | func (v *NullableMetoroQlTimeseries) Unset() {
171 | v.value = nil
172 | v.isSet = false
173 | }
174 |
175 | func NewNullableMetoroQlTimeseries(val *MetoroQlTimeseries) *NullableMetoroQlTimeseries {
176 | return &NullableMetoroQlTimeseries{value: val, isSet: true}
177 | }
178 |
179 | func (v NullableMetoroQlTimeseries) MarshalJSON() ([]byte, error) {
180 | return json.Marshal(v.value)
181 | }
182 |
183 | func (v *NullableMetoroQlTimeseries) UnmarshalJSON(src []byte) error {
184 | v.isSet = true
185 | return json.Unmarshal(src, &v.value)
186 | }
187 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_config.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the TimeseriesConfig type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &TimeseriesConfig{}
21 |
22 | // TimeseriesConfig struct for TimeseriesConfig
23 | type TimeseriesConfig struct {
24 | Expression ExpressionConfig `json:"expression"`
25 | // Rules for evaluating the metrics and triggering alerts
26 | EvaluationRules []Condition `json:"evaluationRules"`
27 | }
28 |
29 | type _TimeseriesConfig TimeseriesConfig
30 |
31 | // NewTimeseriesConfig instantiates a new TimeseriesConfig object
32 | // This constructor will assign default values to properties that have it defined,
33 | // and makes sure properties required by API are set, but the set of arguments
34 | // will change when the set of required properties is changed
35 | func NewTimeseriesConfig(expression ExpressionConfig, evaluationRules []Condition) *TimeseriesConfig {
36 | this := TimeseriesConfig{}
37 | this.Expression = expression
38 | this.EvaluationRules = evaluationRules
39 | return &this
40 | }
41 |
42 | // NewTimeseriesConfigWithDefaults instantiates a new TimeseriesConfig object
43 | // This constructor will only assign default values to properties that have it defined,
44 | // but it doesn't guarantee that properties required by API are set
45 | func NewTimeseriesConfigWithDefaults() *TimeseriesConfig {
46 | this := TimeseriesConfig{}
47 | return &this
48 | }
49 |
50 | // GetExpression returns the Expression field value
51 | func (o *TimeseriesConfig) GetExpression() ExpressionConfig {
52 | if o == nil {
53 | var ret ExpressionConfig
54 | return ret
55 | }
56 |
57 | return o.Expression
58 | }
59 |
60 | // GetExpressionOk returns a tuple with the Expression field value
61 | // and a boolean to check if the value has been set.
62 | func (o *TimeseriesConfig) GetExpressionOk() (*ExpressionConfig, bool) {
63 | if o == nil {
64 | return nil, false
65 | }
66 | return &o.Expression, true
67 | }
68 |
69 | // SetExpression sets field value
70 | func (o *TimeseriesConfig) SetExpression(v ExpressionConfig) {
71 | o.Expression = v
72 | }
73 |
74 | // GetEvaluationRules returns the EvaluationRules field value
75 | func (o *TimeseriesConfig) GetEvaluationRules() []Condition {
76 | if o == nil {
77 | var ret []Condition
78 | return ret
79 | }
80 |
81 | return o.EvaluationRules
82 | }
83 |
84 | // GetEvaluationRulesOk returns a tuple with the EvaluationRules field value
85 | // and a boolean to check if the value has been set.
86 | func (o *TimeseriesConfig) GetEvaluationRulesOk() ([]Condition, bool) {
87 | if o == nil {
88 | return nil, false
89 | }
90 | return o.EvaluationRules, true
91 | }
92 |
93 | // SetEvaluationRules sets field value
94 | func (o *TimeseriesConfig) SetEvaluationRules(v []Condition) {
95 | o.EvaluationRules = v
96 | }
97 |
98 | func (o TimeseriesConfig) MarshalJSON() ([]byte, error) {
99 | toSerialize, err := o.ToMap()
100 | if err != nil {
101 | return []byte{}, err
102 | }
103 | return json.Marshal(toSerialize)
104 | }
105 |
106 | func (o TimeseriesConfig) ToMap() (map[string]interface{}, error) {
107 | toSerialize := map[string]interface{}{}
108 | toSerialize["expression"] = o.Expression
109 | toSerialize["evaluationRules"] = o.EvaluationRules
110 | return toSerialize, nil
111 | }
112 |
113 | func (o *TimeseriesConfig) UnmarshalJSON(data []byte) (err error) {
114 | // This validates that all required properties are included in the JSON object
115 | // by unmarshalling the object into a generic map with string keys and checking
116 | // that every required field exists as a key in the generic map.
117 | requiredProperties := []string{
118 | "expression",
119 | "evaluationRules",
120 | }
121 |
122 | allProperties := make(map[string]interface{})
123 |
124 | err = json.Unmarshal(data, &allProperties)
125 |
126 | if err != nil {
127 | return err
128 | }
129 |
130 | for _, requiredProperty := range requiredProperties {
131 | if _, exists := allProperties[requiredProperty]; !exists {
132 | return fmt.Errorf("no value given for required property %v", requiredProperty)
133 | }
134 | }
135 |
136 | varTimeseriesConfig := _TimeseriesConfig{}
137 |
138 | decoder := json.NewDecoder(bytes.NewReader(data))
139 | decoder.DisallowUnknownFields()
140 | err = decoder.Decode(&varTimeseriesConfig)
141 |
142 | if err != nil {
143 | return err
144 | }
145 |
146 | *o = TimeseriesConfig(varTimeseriesConfig)
147 |
148 | return err
149 | }
150 |
151 | type NullableTimeseriesConfig struct {
152 | value *TimeseriesConfig
153 | isSet bool
154 | }
155 |
156 | func (v NullableTimeseriesConfig) Get() *TimeseriesConfig {
157 | return v.value
158 | }
159 |
160 | func (v *NullableTimeseriesConfig) Set(val *TimeseriesConfig) {
161 | v.value = val
162 | v.isSet = true
163 | }
164 |
165 | func (v NullableTimeseriesConfig) IsSet() bool {
166 | return v.isSet
167 | }
168 |
169 | func (v *NullableTimeseriesConfig) Unset() {
170 | v.value = nil
171 | v.isSet = false
172 | }
173 |
174 | func NewNullableTimeseriesConfig(val *TimeseriesConfig) *NullableTimeseriesConfig {
175 | return &NullableTimeseriesConfig{value: val, isSet: true}
176 | }
177 |
178 | func (v NullableTimeseriesConfig) MarshalJSON() ([]byte, error) {
179 | return json.Marshal(v.value)
180 | }
181 |
182 | func (v *NullableTimeseriesConfig) UnmarshalJSON(src []byte) error {
183 | v.isSet = true
184 | return json.Unmarshal(src, &v.value)
185 | }
186 |
```
--------------------------------------------------------------------------------
/model/model_static_condition.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the StaticCondition type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &StaticCondition{}
21 |
22 | // StaticCondition struct for StaticCondition
23 | type StaticCondition struct {
24 | // List of operator conditions that must be met
25 | Operators []OperatorConfig `json:"operators"`
26 | PersistenceSettings PersistenceSettings `json:"persistenceSettings"`
27 | }
28 |
29 | type _StaticCondition StaticCondition
30 |
31 | // NewStaticCondition instantiates a new StaticCondition object
32 | // This constructor will assign default values to properties that have it defined,
33 | // and makes sure properties required by API are set, but the set of arguments
34 | // will change when the set of required properties is changed
35 | func NewStaticCondition(operators []OperatorConfig, persistenceSettings PersistenceSettings) *StaticCondition {
36 | this := StaticCondition{}
37 | this.Operators = operators
38 | this.PersistenceSettings = persistenceSettings
39 | return &this
40 | }
41 |
42 | // NewStaticConditionWithDefaults instantiates a new StaticCondition object
43 | // This constructor will only assign default values to properties that have it defined,
44 | // but it doesn't guarantee that properties required by API are set
45 | func NewStaticConditionWithDefaults() *StaticCondition {
46 | this := StaticCondition{}
47 | return &this
48 | }
49 |
50 | // GetOperators returns the Operators field value
51 | func (o *StaticCondition) GetOperators() []OperatorConfig {
52 | if o == nil {
53 | var ret []OperatorConfig
54 | return ret
55 | }
56 |
57 | return o.Operators
58 | }
59 |
60 | // GetOperatorsOk returns a tuple with the Operators field value
61 | // and a boolean to check if the value has been set.
62 | func (o *StaticCondition) GetOperatorsOk() ([]OperatorConfig, bool) {
63 | if o == nil {
64 | return nil, false
65 | }
66 | return o.Operators, true
67 | }
68 |
69 | // SetOperators sets field value
70 | func (o *StaticCondition) SetOperators(v []OperatorConfig) {
71 | o.Operators = v
72 | }
73 |
74 | // GetPersistenceSettings returns the PersistenceSettings field value
75 | func (o *StaticCondition) GetPersistenceSettings() PersistenceSettings {
76 | if o == nil {
77 | var ret PersistenceSettings
78 | return ret
79 | }
80 |
81 | return o.PersistenceSettings
82 | }
83 |
84 | // GetPersistenceSettingsOk returns a tuple with the PersistenceSettings field value
85 | // and a boolean to check if the value has been set.
86 | func (o *StaticCondition) GetPersistenceSettingsOk() (*PersistenceSettings, bool) {
87 | if o == nil {
88 | return nil, false
89 | }
90 | return &o.PersistenceSettings, true
91 | }
92 |
93 | // SetPersistenceSettings sets field value
94 | func (o *StaticCondition) SetPersistenceSettings(v PersistenceSettings) {
95 | o.PersistenceSettings = v
96 | }
97 |
98 | func (o StaticCondition) MarshalJSON() ([]byte, error) {
99 | toSerialize, err := o.ToMap()
100 | if err != nil {
101 | return []byte{}, err
102 | }
103 | return json.Marshal(toSerialize)
104 | }
105 |
106 | func (o StaticCondition) ToMap() (map[string]interface{}, error) {
107 | toSerialize := map[string]interface{}{}
108 | toSerialize["operators"] = o.Operators
109 | toSerialize["persistenceSettings"] = o.PersistenceSettings
110 | return toSerialize, nil
111 | }
112 |
113 | func (o *StaticCondition) UnmarshalJSON(data []byte) (err error) {
114 | // This validates that all required properties are included in the JSON object
115 | // by unmarshalling the object into a generic map with string keys and checking
116 | // that every required field exists as a key in the generic map.
117 | requiredProperties := []string{
118 | "operators",
119 | "persistenceSettings",
120 | }
121 |
122 | allProperties := make(map[string]interface{})
123 |
124 | err = json.Unmarshal(data, &allProperties)
125 |
126 | if err != nil {
127 | return err
128 | }
129 |
130 | for _, requiredProperty := range requiredProperties {
131 | if _, exists := allProperties[requiredProperty]; !exists {
132 | return fmt.Errorf("no value given for required property %v", requiredProperty)
133 | }
134 | }
135 |
136 | varStaticCondition := _StaticCondition{}
137 |
138 | decoder := json.NewDecoder(bytes.NewReader(data))
139 | decoder.DisallowUnknownFields()
140 | err = decoder.Decode(&varStaticCondition)
141 |
142 | if err != nil {
143 | return err
144 | }
145 |
146 | *o = StaticCondition(varStaticCondition)
147 |
148 | return err
149 | }
150 |
151 | type NullableStaticCondition struct {
152 | value *StaticCondition
153 | isSet bool
154 | }
155 |
156 | func (v NullableStaticCondition) Get() *StaticCondition {
157 | return v.value
158 | }
159 |
160 | func (v *NullableStaticCondition) Set(val *StaticCondition) {
161 | v.value = val
162 | v.isSet = true
163 | }
164 |
165 | func (v NullableStaticCondition) IsSet() bool {
166 | return v.isSet
167 | }
168 |
169 | func (v *NullableStaticCondition) Unset() {
170 | v.value = nil
171 | v.isSet = false
172 | }
173 |
174 | func NewNullableStaticCondition(val *StaticCondition) *NullableStaticCondition {
175 | return &NullableStaticCondition{value: val, isSet: true}
176 | }
177 |
178 | func (v NullableStaticCondition) MarshalJSON() ([]byte, error) {
179 | return json.Marshal(v.value)
180 | }
181 |
182 | func (v *NullableStaticCondition) UnmarshalJSON(src []byte) error {
183 | v.isSet = true
184 | return json.Unmarshal(src, &v.value)
185 | }
186 |
```
--------------------------------------------------------------------------------
/model/model_alert.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the Alert type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &Alert{}
21 |
22 | // Alert struct for Alert
23 | type Alert struct {
24 | Metadata MetadataObject `json:"metadata"`
25 | Type *AlertType `json:"type,omitempty"`
26 | Timeseries TimeseriesConfig `json:"timeseries"`
27 | }
28 |
29 | type _Alert Alert
30 |
31 | // NewAlert instantiates a new Alert object
32 | // This constructor will assign default values to properties that have it defined,
33 | // and makes sure properties required by API are set, but the set of arguments
34 | // will change when the set of required properties is changed
35 | func NewAlert(metadata MetadataObject, timeseries TimeseriesConfig) *Alert {
36 | this := Alert{}
37 | this.Metadata = metadata
38 | this.Timeseries = timeseries
39 | return &this
40 | }
41 |
42 | // NewAlertWithDefaults instantiates a new Alert object
43 | // This constructor will only assign default values to properties that have it defined,
44 | // but it doesn't guarantee that properties required by API are set
45 | func NewAlertWithDefaults() *Alert {
46 | this := Alert{}
47 | return &this
48 | }
49 |
50 | // GetMetadata returns the Metadata field value
51 | func (o *Alert) GetMetadata() MetadataObject {
52 | if o == nil {
53 | var ret MetadataObject
54 | return ret
55 | }
56 |
57 | return o.Metadata
58 | }
59 |
60 | // GetMetadataOk returns a tuple with the Metadata field value
61 | // and a boolean to check if the value has been set.
62 | func (o *Alert) GetMetadataOk() (*MetadataObject, bool) {
63 | if o == nil {
64 | return nil, false
65 | }
66 | return &o.Metadata, true
67 | }
68 |
69 | // SetMetadata sets field value
70 | func (o *Alert) SetMetadata(v MetadataObject) {
71 | o.Metadata = v
72 | }
73 |
74 | // GetType returns the Type field value if set, zero value otherwise.
75 | func (o *Alert) GetType() AlertType {
76 | if o == nil || IsNil(o.Type) {
77 | var ret AlertType
78 | return ret
79 | }
80 | return *o.Type
81 | }
82 |
83 | // GetTypeOk returns a tuple with the Type field value if set, nil otherwise
84 | // and a boolean to check if the value has been set.
85 | func (o *Alert) GetTypeOk() (*AlertType, bool) {
86 | if o == nil || IsNil(o.Type) {
87 | return nil, false
88 | }
89 | return o.Type, true
90 | }
91 |
92 | // HasType returns a boolean if a field has been set.
93 | func (o *Alert) HasType() bool {
94 | if o != nil && !IsNil(o.Type) {
95 | return true
96 | }
97 |
98 | return false
99 | }
100 |
101 | // SetType gets a reference to the given AlertType and assigns it to the Type field.
102 | func (o *Alert) SetType(v AlertType) {
103 | o.Type = &v
104 | }
105 |
106 | // GetTimeseries returns the Timeseries field value
107 | func (o *Alert) GetTimeseries() TimeseriesConfig {
108 | if o == nil {
109 | var ret TimeseriesConfig
110 | return ret
111 | }
112 |
113 | return o.Timeseries
114 | }
115 |
116 | // GetTimeseriesOk returns a tuple with the Timeseries field value
117 | // and a boolean to check if the value has been set.
118 | func (o *Alert) GetTimeseriesOk() (*TimeseriesConfig, bool) {
119 | if o == nil {
120 | return nil, false
121 | }
122 | return &o.Timeseries, true
123 | }
124 |
125 | // SetTimeseries sets field value
126 | func (o *Alert) SetTimeseries(v TimeseriesConfig) {
127 | o.Timeseries = v
128 | }
129 |
130 | func (o Alert) MarshalJSON() ([]byte, error) {
131 | toSerialize, err := o.ToMap()
132 | if err != nil {
133 | return []byte{}, err
134 | }
135 | return json.Marshal(toSerialize)
136 | }
137 |
138 | func (o Alert) ToMap() (map[string]interface{}, error) {
139 | toSerialize := map[string]interface{}{}
140 | toSerialize["metadata"] = o.Metadata
141 | if !IsNil(o.Type) {
142 | toSerialize["type"] = o.Type
143 | }
144 | toSerialize["timeseries"] = o.Timeseries
145 | return toSerialize, nil
146 | }
147 |
148 | func (o *Alert) UnmarshalJSON(data []byte) (err error) {
149 | // This validates that all required properties are included in the JSON object
150 | // by unmarshalling the object into a generic map with string keys and checking
151 | // that every required field exists as a key in the generic map.
152 | requiredProperties := []string{
153 | "metadata",
154 | "timeseries",
155 | }
156 |
157 | allProperties := make(map[string]interface{})
158 |
159 | err = json.Unmarshal(data, &allProperties)
160 |
161 | if err != nil {
162 | return err
163 | }
164 |
165 | for _, requiredProperty := range requiredProperties {
166 | if _, exists := allProperties[requiredProperty]; !exists {
167 | return fmt.Errorf("no value given for required property %v", requiredProperty)
168 | }
169 | }
170 |
171 | varAlert := _Alert{}
172 |
173 | decoder := json.NewDecoder(bytes.NewReader(data))
174 | decoder.DisallowUnknownFields()
175 | err = decoder.Decode(&varAlert)
176 |
177 | if err != nil {
178 | return err
179 | }
180 |
181 | *o = Alert(varAlert)
182 |
183 | return err
184 | }
185 |
186 | type NullableAlert struct {
187 | value *Alert
188 | isSet bool
189 | }
190 |
191 | func (v NullableAlert) Get() *Alert {
192 | return v.value
193 | }
194 |
195 | func (v *NullableAlert) Set(val *Alert) {
196 | v.value = val
197 | v.isSet = true
198 | }
199 |
200 | func (v NullableAlert) IsSet() bool {
201 | return v.isSet
202 | }
203 |
204 | func (v *NullableAlert) Unset() {
205 | v.value = nil
206 | v.isSet = false
207 | }
208 |
209 | func NewNullableAlert(val *Alert) *NullableAlert {
210 | return &NullableAlert{value: val, isSet: true}
211 | }
212 |
213 | func (v NullableAlert) MarshalJSON() ([]byte, error) {
214 | return json.Marshal(v.value)
215 | }
216 |
217 | func (v *NullableAlert) UnmarshalJSON(src []byte) error {
218 | v.isSet = true
219 | return json.Unmarshal(src, &v.value)
220 | }
221 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_functions.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the TimeseriesSpecifierFunctions type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &TimeseriesSpecifierFunctions{}
19 |
20 | // TimeseriesSpecifierFunctions Functions to apply to the timeseries
21 | type TimeseriesSpecifierFunctions struct {
22 | // Type of function to apply
23 | FunctionType *string `json:"functionType,omitempty"`
24 | MathExpression *TimeseriesSpecifierFunctionsMathExpression `json:"mathExpression,omitempty"`
25 | }
26 |
27 | // NewTimeseriesSpecifierFunctions instantiates a new TimeseriesSpecifierFunctions object
28 | // This constructor will assign default values to properties that have it defined,
29 | // and makes sure properties required by API are set, but the set of arguments
30 | // will change when the set of required properties is changed
31 | func NewTimeseriesSpecifierFunctions() *TimeseriesSpecifierFunctions {
32 | this := TimeseriesSpecifierFunctions{}
33 | return &this
34 | }
35 |
36 | // NewTimeseriesSpecifierFunctionsWithDefaults instantiates a new TimeseriesSpecifierFunctions object
37 | // This constructor will only assign default values to properties that have it defined,
38 | // but it doesn't guarantee that properties required by API are set
39 | func NewTimeseriesSpecifierFunctionsWithDefaults() *TimeseriesSpecifierFunctions {
40 | this := TimeseriesSpecifierFunctions{}
41 | return &this
42 | }
43 |
44 | // GetFunctionType returns the FunctionType field value if set, zero value otherwise.
45 | func (o *TimeseriesSpecifierFunctions) GetFunctionType() string {
46 | if o == nil || IsNil(o.FunctionType) {
47 | var ret string
48 | return ret
49 | }
50 | return *o.FunctionType
51 | }
52 |
53 | // GetFunctionTypeOk returns a tuple with the FunctionType field value if set, nil otherwise
54 | // and a boolean to check if the value has been set.
55 | func (o *TimeseriesSpecifierFunctions) GetFunctionTypeOk() (*string, bool) {
56 | if o == nil || IsNil(o.FunctionType) {
57 | return nil, false
58 | }
59 | return o.FunctionType, true
60 | }
61 |
62 | // HasFunctionType returns a boolean if a field has been set.
63 | func (o *TimeseriesSpecifierFunctions) HasFunctionType() bool {
64 | if o != nil && !IsNil(o.FunctionType) {
65 | return true
66 | }
67 |
68 | return false
69 | }
70 |
71 | // SetFunctionType gets a reference to the given string and assigns it to the FunctionType field.
72 | func (o *TimeseriesSpecifierFunctions) SetFunctionType(v string) {
73 | o.FunctionType = &v
74 | }
75 |
76 | // GetMathExpression returns the MathExpression field value if set, zero value otherwise.
77 | func (o *TimeseriesSpecifierFunctions) GetMathExpression() TimeseriesSpecifierFunctionsMathExpression {
78 | if o == nil || IsNil(o.MathExpression) {
79 | var ret TimeseriesSpecifierFunctionsMathExpression
80 | return ret
81 | }
82 | return *o.MathExpression
83 | }
84 |
85 | // GetMathExpressionOk returns a tuple with the MathExpression field value if set, nil otherwise
86 | // and a boolean to check if the value has been set.
87 | func (o *TimeseriesSpecifierFunctions) GetMathExpressionOk() (*TimeseriesSpecifierFunctionsMathExpression, bool) {
88 | if o == nil || IsNil(o.MathExpression) {
89 | return nil, false
90 | }
91 | return o.MathExpression, true
92 | }
93 |
94 | // HasMathExpression returns a boolean if a field has been set.
95 | func (o *TimeseriesSpecifierFunctions) HasMathExpression() bool {
96 | if o != nil && !IsNil(o.MathExpression) {
97 | return true
98 | }
99 |
100 | return false
101 | }
102 |
103 | // SetMathExpression gets a reference to the given TimeseriesSpecifierFunctionsMathExpression and assigns it to the MathExpression field.
104 | func (o *TimeseriesSpecifierFunctions) SetMathExpression(v TimeseriesSpecifierFunctionsMathExpression) {
105 | o.MathExpression = &v
106 | }
107 |
108 | func (o TimeseriesSpecifierFunctions) MarshalJSON() ([]byte, error) {
109 | toSerialize,err := o.ToMap()
110 | if err != nil {
111 | return []byte{}, err
112 | }
113 | return json.Marshal(toSerialize)
114 | }
115 |
116 | func (o TimeseriesSpecifierFunctions) ToMap() (map[string]interface{}, error) {
117 | toSerialize := map[string]interface{}{}
118 | if !IsNil(o.FunctionType) {
119 | toSerialize["functionType"] = o.FunctionType
120 | }
121 | if !IsNil(o.MathExpression) {
122 | toSerialize["mathExpression"] = o.MathExpression
123 | }
124 | return toSerialize, nil
125 | }
126 |
127 | type NullableTimeseriesSpecifierFunctions struct {
128 | value *TimeseriesSpecifierFunctions
129 | isSet bool
130 | }
131 |
132 | func (v NullableTimeseriesSpecifierFunctions) Get() *TimeseriesSpecifierFunctions {
133 | return v.value
134 | }
135 |
136 | func (v *NullableTimeseriesSpecifierFunctions) Set(val *TimeseriesSpecifierFunctions) {
137 | v.value = val
138 | v.isSet = true
139 | }
140 |
141 | func (v NullableTimeseriesSpecifierFunctions) IsSet() bool {
142 | return v.isSet
143 | }
144 |
145 | func (v *NullableTimeseriesSpecifierFunctions) Unset() {
146 | v.value = nil
147 | v.isSet = false
148 | }
149 |
150 | func NewNullableTimeseriesSpecifierFunctions(val *TimeseriesSpecifierFunctions) *NullableTimeseriesSpecifierFunctions {
151 | return &NullableTimeseriesSpecifierFunctions{value: val, isSet: true}
152 | }
153 |
154 | func (v NullableTimeseriesSpecifierFunctions) MarshalJSON() ([]byte, error) {
155 | return json.Marshal(v.value)
156 | }
157 |
158 | func (v *NullableTimeseriesSpecifierFunctions) UnmarshalJSON(src []byte) error {
159 | v.isSet = true
160 | return json.Unmarshal(src, &v.value)
161 | }
162 |
163 |
164 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_functions_math_expression.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the TimeseriesSpecifierFunctionsMathExpression type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &TimeseriesSpecifierFunctionsMathExpression{}
19 |
20 | // TimeseriesSpecifierFunctionsMathExpression Mathematical expression for custom functions
21 | type TimeseriesSpecifierFunctionsMathExpression struct {
22 | // Array of variable names used in the expression
23 | Variables []string `json:"variables,omitempty"`
24 | // The mathematical expression to apply
25 | Expression *string `json:"expression,omitempty"`
26 | }
27 |
28 | // NewTimeseriesSpecifierFunctionsMathExpression instantiates a new TimeseriesSpecifierFunctionsMathExpression object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewTimeseriesSpecifierFunctionsMathExpression() *TimeseriesSpecifierFunctionsMathExpression {
33 | this := TimeseriesSpecifierFunctionsMathExpression{}
34 | return &this
35 | }
36 |
37 | // NewTimeseriesSpecifierFunctionsMathExpressionWithDefaults instantiates a new TimeseriesSpecifierFunctionsMathExpression object
38 | // This constructor will only assign default values to properties that have it defined,
39 | // but it doesn't guarantee that properties required by API are set
40 | func NewTimeseriesSpecifierFunctionsMathExpressionWithDefaults() *TimeseriesSpecifierFunctionsMathExpression {
41 | this := TimeseriesSpecifierFunctionsMathExpression{}
42 | return &this
43 | }
44 |
45 | // GetVariables returns the Variables field value if set, zero value otherwise.
46 | func (o *TimeseriesSpecifierFunctionsMathExpression) GetVariables() []string {
47 | if o == nil || IsNil(o.Variables) {
48 | var ret []string
49 | return ret
50 | }
51 | return o.Variables
52 | }
53 |
54 | // GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise
55 | // and a boolean to check if the value has been set.
56 | func (o *TimeseriesSpecifierFunctionsMathExpression) GetVariablesOk() ([]string, bool) {
57 | if o == nil || IsNil(o.Variables) {
58 | return nil, false
59 | }
60 | return o.Variables, true
61 | }
62 |
63 | // HasVariables returns a boolean if a field has been set.
64 | func (o *TimeseriesSpecifierFunctionsMathExpression) HasVariables() bool {
65 | if o != nil && !IsNil(o.Variables) {
66 | return true
67 | }
68 |
69 | return false
70 | }
71 |
72 | // SetVariables gets a reference to the given []string and assigns it to the Variables field.
73 | func (o *TimeseriesSpecifierFunctionsMathExpression) SetVariables(v []string) {
74 | o.Variables = v
75 | }
76 |
77 | // GetExpression returns the Expression field value if set, zero value otherwise.
78 | func (o *TimeseriesSpecifierFunctionsMathExpression) GetExpression() string {
79 | if o == nil || IsNil(o.Expression) {
80 | var ret string
81 | return ret
82 | }
83 | return *o.Expression
84 | }
85 |
86 | // GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *TimeseriesSpecifierFunctionsMathExpression) GetExpressionOk() (*string, bool) {
89 | if o == nil || IsNil(o.Expression) {
90 | return nil, false
91 | }
92 | return o.Expression, true
93 | }
94 |
95 | // HasExpression returns a boolean if a field has been set.
96 | func (o *TimeseriesSpecifierFunctionsMathExpression) HasExpression() bool {
97 | if o != nil && !IsNil(o.Expression) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetExpression gets a reference to the given string and assigns it to the Expression field.
105 | func (o *TimeseriesSpecifierFunctionsMathExpression) SetExpression(v string) {
106 | o.Expression = &v
107 | }
108 |
109 | func (o TimeseriesSpecifierFunctionsMathExpression) MarshalJSON() ([]byte, error) {
110 | toSerialize,err := o.ToMap()
111 | if err != nil {
112 | return []byte{}, err
113 | }
114 | return json.Marshal(toSerialize)
115 | }
116 |
117 | func (o TimeseriesSpecifierFunctionsMathExpression) ToMap() (map[string]interface{}, error) {
118 | toSerialize := map[string]interface{}{}
119 | if !IsNil(o.Variables) {
120 | toSerialize["variables"] = o.Variables
121 | }
122 | if !IsNil(o.Expression) {
123 | toSerialize["expression"] = o.Expression
124 | }
125 | return toSerialize, nil
126 | }
127 |
128 | type NullableTimeseriesSpecifierFunctionsMathExpression struct {
129 | value *TimeseriesSpecifierFunctionsMathExpression
130 | isSet bool
131 | }
132 |
133 | func (v NullableTimeseriesSpecifierFunctionsMathExpression) Get() *TimeseriesSpecifierFunctionsMathExpression {
134 | return v.value
135 | }
136 |
137 | func (v *NullableTimeseriesSpecifierFunctionsMathExpression) Set(val *TimeseriesSpecifierFunctionsMathExpression) {
138 | v.value = val
139 | v.isSet = true
140 | }
141 |
142 | func (v NullableTimeseriesSpecifierFunctionsMathExpression) IsSet() bool {
143 | return v.isSet
144 | }
145 |
146 | func (v *NullableTimeseriesSpecifierFunctionsMathExpression) Unset() {
147 | v.value = nil
148 | v.isSet = false
149 | }
150 |
151 | func NewNullableTimeseriesSpecifierFunctionsMathExpression(val *TimeseriesSpecifierFunctionsMathExpression) *NullableTimeseriesSpecifierFunctionsMathExpression {
152 | return &NullableTimeseriesSpecifierFunctionsMathExpression{value: val, isSet: true}
153 | }
154 |
155 | func (v NullableTimeseriesSpecifierFunctionsMathExpression) MarshalJSON() ([]byte, error) {
156 | return json.Marshal(v.value)
157 | }
158 |
159 | func (v *NullableTimeseriesSpecifierFunctionsMathExpression) UnmarshalJSON(src []byte) error {
160 | v.isSet = true
161 | return json.Unmarshal(src, &v.value)
162 | }
163 |
164 |
165 |
```
--------------------------------------------------------------------------------
/model/model_metadata_object.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the MetadataObject type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &MetadataObject{}
21 |
22 | // MetadataObject struct for MetadataObject
23 | type MetadataObject struct {
24 | // Name of the alert
25 | Name string `json:"name"`
26 | // Description of the alert with additional context
27 | Description *string `json:"description,omitempty"`
28 | // Unique identifier for the alert.
29 | Id string `json:"id"`
30 | }
31 |
32 | type _MetadataObject MetadataObject
33 |
34 | // NewMetadataObject instantiates a new MetadataObject object
35 | // This constructor will assign default values to properties that have it defined,
36 | // and makes sure properties required by API are set, but the set of arguments
37 | // will change when the set of required properties is changed
38 | func NewMetadataObject(name string, id string) *MetadataObject {
39 | this := MetadataObject{}
40 | this.Name = name
41 | this.Id = id
42 | return &this
43 | }
44 |
45 | // NewMetadataObjectWithDefaults instantiates a new MetadataObject object
46 | // This constructor will only assign default values to properties that have it defined,
47 | // but it doesn't guarantee that properties required by API are set
48 | func NewMetadataObjectWithDefaults() *MetadataObject {
49 | this := MetadataObject{}
50 | return &this
51 | }
52 |
53 | // GetName returns the Name field value
54 | func (o *MetadataObject) GetName() string {
55 | if o == nil {
56 | var ret string
57 | return ret
58 | }
59 |
60 | return o.Name
61 | }
62 |
63 | // GetNameOk returns a tuple with the Name field value
64 | // and a boolean to check if the value has been set.
65 | func (o *MetadataObject) GetNameOk() (*string, bool) {
66 | if o == nil {
67 | return nil, false
68 | }
69 | return &o.Name, true
70 | }
71 |
72 | // SetName sets field value
73 | func (o *MetadataObject) SetName(v string) {
74 | o.Name = v
75 | }
76 |
77 | // GetDescription returns the Description field value if set, zero value otherwise.
78 | func (o *MetadataObject) GetDescription() string {
79 | if o == nil || IsNil(o.Description) {
80 | var ret string
81 | return ret
82 | }
83 | return *o.Description
84 | }
85 |
86 | // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *MetadataObject) GetDescriptionOk() (*string, bool) {
89 | if o == nil || IsNil(o.Description) {
90 | return nil, false
91 | }
92 | return o.Description, true
93 | }
94 |
95 | // HasDescription returns a boolean if a field has been set.
96 | func (o *MetadataObject) HasDescription() bool {
97 | if o != nil && !IsNil(o.Description) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetDescription gets a reference to the given string and assigns it to the Description field.
105 | func (o *MetadataObject) SetDescription(v string) {
106 | o.Description = &v
107 | }
108 |
109 | // GetId returns the Id field value
110 | func (o *MetadataObject) GetId() string {
111 | if o == nil {
112 | var ret string
113 | return ret
114 | }
115 |
116 | return o.Id
117 | }
118 |
119 | // GetIdOk returns a tuple with the Id field value
120 | // and a boolean to check if the value has been set.
121 | func (o *MetadataObject) GetIdOk() (*string, bool) {
122 | if o == nil {
123 | return nil, false
124 | }
125 | return &o.Id, true
126 | }
127 |
128 | // SetId sets field value
129 | func (o *MetadataObject) SetId(v string) {
130 | o.Id = v
131 | }
132 |
133 | func (o MetadataObject) MarshalJSON() ([]byte, error) {
134 | toSerialize, err := o.ToMap()
135 | if err != nil {
136 | return []byte{}, err
137 | }
138 | return json.Marshal(toSerialize)
139 | }
140 |
141 | func (o MetadataObject) ToMap() (map[string]interface{}, error) {
142 | toSerialize := map[string]interface{}{}
143 | toSerialize["name"] = o.Name
144 | if !IsNil(o.Description) {
145 | toSerialize["description"] = o.Description
146 | }
147 | toSerialize["id"] = o.Id
148 | return toSerialize, nil
149 | }
150 |
151 | func (o *MetadataObject) UnmarshalJSON(data []byte) (err error) {
152 | // This validates that all required properties are included in the JSON object
153 | // by unmarshalling the object into a generic map with string keys and checking
154 | // that every required field exists as a key in the generic map.
155 | requiredProperties := []string{
156 | "name",
157 | "id",
158 | }
159 |
160 | allProperties := make(map[string]interface{})
161 |
162 | err = json.Unmarshal(data, &allProperties)
163 |
164 | if err != nil {
165 | return err
166 | }
167 |
168 | for _, requiredProperty := range requiredProperties {
169 | if _, exists := allProperties[requiredProperty]; !exists {
170 | return fmt.Errorf("no value given for required property %v", requiredProperty)
171 | }
172 | }
173 |
174 | varMetadataObject := _MetadataObject{}
175 |
176 | decoder := json.NewDecoder(bytes.NewReader(data))
177 | decoder.DisallowUnknownFields()
178 | err = decoder.Decode(&varMetadataObject)
179 |
180 | if err != nil {
181 | return err
182 | }
183 |
184 | *o = MetadataObject(varMetadataObject)
185 |
186 | return err
187 | }
188 |
189 | type NullableMetadataObject struct {
190 | value *MetadataObject
191 | isSet bool
192 | }
193 |
194 | func (v NullableMetadataObject) Get() *MetadataObject {
195 | return v.value
196 | }
197 |
198 | func (v *NullableMetadataObject) Set(val *MetadataObject) {
199 | v.value = val
200 | v.isSet = true
201 | }
202 |
203 | func (v NullableMetadataObject) IsSet() bool {
204 | return v.isSet
205 | }
206 |
207 | func (v *NullableMetadataObject) Unset() {
208 | v.value = nil
209 | v.isSet = false
210 | }
211 |
212 | func NewNullableMetadataObject(val *MetadataObject) *NullableMetadataObject {
213 | return &NullableMetadataObject{value: val, isSet: true}
214 | }
215 |
216 | func (v NullableMetadataObject) MarshalJSON() ([]byte, error) {
217 | return json.Marshal(v.value)
218 | }
219 |
220 | func (v *NullableMetadataObject) UnmarshalJSON(src []byte) error {
221 | v.isSet = true
222 | return json.Unmarshal(src, &v.value)
223 | }
224 |
```
--------------------------------------------------------------------------------
/model/model_expression_config_filters_inner.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ExpressionConfigFiltersInner type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ExpressionConfigFiltersInner{}
19 |
20 | // ExpressionConfigFiltersInner struct for ExpressionConfigFiltersInner
21 | type ExpressionConfigFiltersInner struct {
22 | Key *string `json:"key,omitempty"`
23 | Value []string `json:"value,omitempty"`
24 | Operator *string `json:"operator,omitempty"`
25 | }
26 |
27 | // NewExpressionConfigFiltersInner instantiates a new ExpressionConfigFiltersInner object
28 | // This constructor will assign default values to properties that have it defined,
29 | // and makes sure properties required by API are set, but the set of arguments
30 | // will change when the set of required properties is changed
31 | func NewExpressionConfigFiltersInner() *ExpressionConfigFiltersInner {
32 | this := ExpressionConfigFiltersInner{}
33 | return &this
34 | }
35 |
36 | // NewExpressionConfigFiltersInnerWithDefaults instantiates a new ExpressionConfigFiltersInner object
37 | // This constructor will only assign default values to properties that have it defined,
38 | // but it doesn't guarantee that properties required by API are set
39 | func NewExpressionConfigFiltersInnerWithDefaults() *ExpressionConfigFiltersInner {
40 | this := ExpressionConfigFiltersInner{}
41 | return &this
42 | }
43 |
44 | // GetKey returns the Key field value if set, zero value otherwise.
45 | func (o *ExpressionConfigFiltersInner) GetKey() string {
46 | if o == nil || IsNil(o.Key) {
47 | var ret string
48 | return ret
49 | }
50 | return *o.Key
51 | }
52 |
53 | // GetKeyOk returns a tuple with the Key field value if set, nil otherwise
54 | // and a boolean to check if the value has been set.
55 | func (o *ExpressionConfigFiltersInner) GetKeyOk() (*string, bool) {
56 | if o == nil || IsNil(o.Key) {
57 | return nil, false
58 | }
59 | return o.Key, true
60 | }
61 |
62 | // HasKey returns a boolean if a field has been set.
63 | func (o *ExpressionConfigFiltersInner) HasKey() bool {
64 | if o != nil && !IsNil(o.Key) {
65 | return true
66 | }
67 |
68 | return false
69 | }
70 |
71 | // SetKey gets a reference to the given string and assigns it to the Key field.
72 | func (o *ExpressionConfigFiltersInner) SetKey(v string) {
73 | o.Key = &v
74 | }
75 |
76 | // GetValue returns the Value field value if set, zero value otherwise.
77 | func (o *ExpressionConfigFiltersInner) GetValue() []string {
78 | if o == nil || IsNil(o.Value) {
79 | var ret []string
80 | return ret
81 | }
82 | return o.Value
83 | }
84 |
85 | // GetValueOk returns a tuple with the Value field value if set, nil otherwise
86 | // and a boolean to check if the value has been set.
87 | func (o *ExpressionConfigFiltersInner) GetValueOk() ([]string, bool) {
88 | if o == nil || IsNil(o.Value) {
89 | return nil, false
90 | }
91 | return o.Value, true
92 | }
93 |
94 | // HasValue returns a boolean if a field has been set.
95 | func (o *ExpressionConfigFiltersInner) HasValue() bool {
96 | if o != nil && !IsNil(o.Value) {
97 | return true
98 | }
99 |
100 | return false
101 | }
102 |
103 | // SetValue gets a reference to the given []string and assigns it to the Value field.
104 | func (o *ExpressionConfigFiltersInner) SetValue(v []string) {
105 | o.Value = v
106 | }
107 |
108 | // GetOperator returns the Operator field value if set, zero value otherwise.
109 | func (o *ExpressionConfigFiltersInner) GetOperator() string {
110 | if o == nil || IsNil(o.Operator) {
111 | var ret string
112 | return ret
113 | }
114 | return *o.Operator
115 | }
116 |
117 | // GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise
118 | // and a boolean to check if the value has been set.
119 | func (o *ExpressionConfigFiltersInner) GetOperatorOk() (*string, bool) {
120 | if o == nil || IsNil(o.Operator) {
121 | return nil, false
122 | }
123 | return o.Operator, true
124 | }
125 |
126 | // HasOperator returns a boolean if a field has been set.
127 | func (o *ExpressionConfigFiltersInner) HasOperator() bool {
128 | if o != nil && !IsNil(o.Operator) {
129 | return true
130 | }
131 |
132 | return false
133 | }
134 |
135 | // SetOperator gets a reference to the given string and assigns it to the Operator field.
136 | func (o *ExpressionConfigFiltersInner) SetOperator(v string) {
137 | o.Operator = &v
138 | }
139 |
140 | func (o ExpressionConfigFiltersInner) MarshalJSON() ([]byte, error) {
141 | toSerialize,err := o.ToMap()
142 | if err != nil {
143 | return []byte{}, err
144 | }
145 | return json.Marshal(toSerialize)
146 | }
147 |
148 | func (o ExpressionConfigFiltersInner) ToMap() (map[string]interface{}, error) {
149 | toSerialize := map[string]interface{}{}
150 | if !IsNil(o.Key) {
151 | toSerialize["key"] = o.Key
152 | }
153 | if !IsNil(o.Value) {
154 | toSerialize["value"] = o.Value
155 | }
156 | if !IsNil(o.Operator) {
157 | toSerialize["operator"] = o.Operator
158 | }
159 | return toSerialize, nil
160 | }
161 |
162 | type NullableExpressionConfigFiltersInner struct {
163 | value *ExpressionConfigFiltersInner
164 | isSet bool
165 | }
166 |
167 | func (v NullableExpressionConfigFiltersInner) Get() *ExpressionConfigFiltersInner {
168 | return v.value
169 | }
170 |
171 | func (v *NullableExpressionConfigFiltersInner) Set(val *ExpressionConfigFiltersInner) {
172 | v.value = val
173 | v.isSet = true
174 | }
175 |
176 | func (v NullableExpressionConfigFiltersInner) IsSet() bool {
177 | return v.isSet
178 | }
179 |
180 | func (v *NullableExpressionConfigFiltersInner) Unset() {
181 | v.value = nil
182 | v.isSet = false
183 | }
184 |
185 | func NewNullableExpressionConfigFiltersInner(val *ExpressionConfigFiltersInner) *NullableExpressionConfigFiltersInner {
186 | return &NullableExpressionConfigFiltersInner{value: val, isSet: true}
187 | }
188 |
189 | func (v NullableExpressionConfigFiltersInner) MarshalJSON() ([]byte, error) {
190 | return json.Marshal(v.value)
191 | }
192 |
193 | func (v *NullableExpressionConfigFiltersInner) UnmarshalJSON(src []byte) error {
194 | v.isSet = true
195 | return json.Unmarshal(src, &v.value)
196 | }
197 |
198 |
199 |
```
--------------------------------------------------------------------------------
/model/model_expression_config_metoro_timeseries_definition.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ExpressionConfigMetoroTimeseriesDefinition type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ExpressionConfigMetoroTimeseriesDefinition{}
19 |
20 | // ExpressionConfigMetoroTimeseriesDefinition Metoro-specific timeseries definition
21 | type ExpressionConfigMetoroTimeseriesDefinition struct {
22 | // List of timeseries specifiers
23 | TimeseriesSpecifiers []TimeseriesSpecifier `json:"timeseriesSpecifiers,omitempty"`
24 | // A formula to combine multiple timeseries
25 | Formula *string `json:"formula,omitempty"`
26 | }
27 |
28 | // NewExpressionConfigMetoroTimeseriesDefinition instantiates a new ExpressionConfigMetoroTimeseriesDefinition object
29 | // This constructor will assign default values to properties that have it defined,
30 | // and makes sure properties required by API are set, but the set of arguments
31 | // will change when the set of required properties is changed
32 | func NewExpressionConfigMetoroTimeseriesDefinition() *ExpressionConfigMetoroTimeseriesDefinition {
33 | this := ExpressionConfigMetoroTimeseriesDefinition{}
34 | return &this
35 | }
36 |
37 | // NewExpressionConfigMetoroTimeseriesDefinitionWithDefaults instantiates a new ExpressionConfigMetoroTimeseriesDefinition object
38 | // This constructor will only assign default values to properties that have it defined,
39 | // but it doesn't guarantee that properties required by API are set
40 | func NewExpressionConfigMetoroTimeseriesDefinitionWithDefaults() *ExpressionConfigMetoroTimeseriesDefinition {
41 | this := ExpressionConfigMetoroTimeseriesDefinition{}
42 | return &this
43 | }
44 |
45 | // GetTimeseriesSpecifiers returns the TimeseriesSpecifiers field value if set, zero value otherwise.
46 | func (o *ExpressionConfigMetoroTimeseriesDefinition) GetTimeseriesSpecifiers() []TimeseriesSpecifier {
47 | if o == nil || IsNil(o.TimeseriesSpecifiers) {
48 | var ret []TimeseriesSpecifier
49 | return ret
50 | }
51 | return o.TimeseriesSpecifiers
52 | }
53 |
54 | // GetTimeseriesSpecifiersOk returns a tuple with the TimeseriesSpecifiers field value if set, nil otherwise
55 | // and a boolean to check if the value has been set.
56 | func (o *ExpressionConfigMetoroTimeseriesDefinition) GetTimeseriesSpecifiersOk() ([]TimeseriesSpecifier, bool) {
57 | if o == nil || IsNil(o.TimeseriesSpecifiers) {
58 | return nil, false
59 | }
60 | return o.TimeseriesSpecifiers, true
61 | }
62 |
63 | // HasTimeseriesSpecifiers returns a boolean if a field has been set.
64 | func (o *ExpressionConfigMetoroTimeseriesDefinition) HasTimeseriesSpecifiers() bool {
65 | if o != nil && !IsNil(o.TimeseriesSpecifiers) {
66 | return true
67 | }
68 |
69 | return false
70 | }
71 |
72 | // SetTimeseriesSpecifiers gets a reference to the given []TimeseriesSpecifier and assigns it to the TimeseriesSpecifiers field.
73 | func (o *ExpressionConfigMetoroTimeseriesDefinition) SetTimeseriesSpecifiers(v []TimeseriesSpecifier) {
74 | o.TimeseriesSpecifiers = v
75 | }
76 |
77 | // GetFormula returns the Formula field value if set, zero value otherwise.
78 | func (o *ExpressionConfigMetoroTimeseriesDefinition) GetFormula() string {
79 | if o == nil || IsNil(o.Formula) {
80 | var ret string
81 | return ret
82 | }
83 | return *o.Formula
84 | }
85 |
86 | // GetFormulaOk returns a tuple with the Formula field value if set, nil otherwise
87 | // and a boolean to check if the value has been set.
88 | func (o *ExpressionConfigMetoroTimeseriesDefinition) GetFormulaOk() (*string, bool) {
89 | if o == nil || IsNil(o.Formula) {
90 | return nil, false
91 | }
92 | return o.Formula, true
93 | }
94 |
95 | // HasFormula returns a boolean if a field has been set.
96 | func (o *ExpressionConfigMetoroTimeseriesDefinition) HasFormula() bool {
97 | if o != nil && !IsNil(o.Formula) {
98 | return true
99 | }
100 |
101 | return false
102 | }
103 |
104 | // SetFormula gets a reference to the given string and assigns it to the Formula field.
105 | func (o *ExpressionConfigMetoroTimeseriesDefinition) SetFormula(v string) {
106 | o.Formula = &v
107 | }
108 |
109 | func (o ExpressionConfigMetoroTimeseriesDefinition) MarshalJSON() ([]byte, error) {
110 | toSerialize,err := o.ToMap()
111 | if err != nil {
112 | return []byte{}, err
113 | }
114 | return json.Marshal(toSerialize)
115 | }
116 |
117 | func (o ExpressionConfigMetoroTimeseriesDefinition) ToMap() (map[string]interface{}, error) {
118 | toSerialize := map[string]interface{}{}
119 | if !IsNil(o.TimeseriesSpecifiers) {
120 | toSerialize["timeseriesSpecifiers"] = o.TimeseriesSpecifiers
121 | }
122 | if !IsNil(o.Formula) {
123 | toSerialize["formula"] = o.Formula
124 | }
125 | return toSerialize, nil
126 | }
127 |
128 | type NullableExpressionConfigMetoroTimeseriesDefinition struct {
129 | value *ExpressionConfigMetoroTimeseriesDefinition
130 | isSet bool
131 | }
132 |
133 | func (v NullableExpressionConfigMetoroTimeseriesDefinition) Get() *ExpressionConfigMetoroTimeseriesDefinition {
134 | return v.value
135 | }
136 |
137 | func (v *NullableExpressionConfigMetoroTimeseriesDefinition) Set(val *ExpressionConfigMetoroTimeseriesDefinition) {
138 | v.value = val
139 | v.isSet = true
140 | }
141 |
142 | func (v NullableExpressionConfigMetoroTimeseriesDefinition) IsSet() bool {
143 | return v.isSet
144 | }
145 |
146 | func (v *NullableExpressionConfigMetoroTimeseriesDefinition) Unset() {
147 | v.value = nil
148 | v.isSet = false
149 | }
150 |
151 | func NewNullableExpressionConfigMetoroTimeseriesDefinition(val *ExpressionConfigMetoroTimeseriesDefinition) *NullableExpressionConfigMetoroTimeseriesDefinition {
152 | return &NullableExpressionConfigMetoroTimeseriesDefinition{value: val, isSet: true}
153 | }
154 |
155 | func (v NullableExpressionConfigMetoroTimeseriesDefinition) MarshalJSON() ([]byte, error) {
156 | return json.Marshal(v.value)
157 | }
158 |
159 | func (v *NullableExpressionConfigMetoroTimeseriesDefinition) UnmarshalJSON(src []byte) error {
160 | v.isSet = true
161 | return json.Unmarshal(src, &v.value)
162 | }
163 |
164 |
165 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_filters_inner.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the TimeseriesSpecifierFiltersInner type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &TimeseriesSpecifierFiltersInner{}
19 |
20 | // TimeseriesSpecifierFiltersInner struct for TimeseriesSpecifierFiltersInner
21 | type TimeseriesSpecifierFiltersInner struct {
22 | // Filter key
23 | Key *string `json:"key,omitempty"`
24 | // Filter values
25 | Value []string `json:"value,omitempty"`
26 | // Filter operator
27 | Operator *string `json:"operator,omitempty"`
28 | }
29 |
30 | // NewTimeseriesSpecifierFiltersInner instantiates a new TimeseriesSpecifierFiltersInner object
31 | // This constructor will assign default values to properties that have it defined,
32 | // and makes sure properties required by API are set, but the set of arguments
33 | // will change when the set of required properties is changed
34 | func NewTimeseriesSpecifierFiltersInner() *TimeseriesSpecifierFiltersInner {
35 | this := TimeseriesSpecifierFiltersInner{}
36 | return &this
37 | }
38 |
39 | // NewTimeseriesSpecifierFiltersInnerWithDefaults instantiates a new TimeseriesSpecifierFiltersInner object
40 | // This constructor will only assign default values to properties that have it defined,
41 | // but it doesn't guarantee that properties required by API are set
42 | func NewTimeseriesSpecifierFiltersInnerWithDefaults() *TimeseriesSpecifierFiltersInner {
43 | this := TimeseriesSpecifierFiltersInner{}
44 | return &this
45 | }
46 |
47 | // GetKey returns the Key field value if set, zero value otherwise.
48 | func (o *TimeseriesSpecifierFiltersInner) GetKey() string {
49 | if o == nil || IsNil(o.Key) {
50 | var ret string
51 | return ret
52 | }
53 | return *o.Key
54 | }
55 |
56 | // GetKeyOk returns a tuple with the Key field value if set, nil otherwise
57 | // and a boolean to check if the value has been set.
58 | func (o *TimeseriesSpecifierFiltersInner) GetKeyOk() (*string, bool) {
59 | if o == nil || IsNil(o.Key) {
60 | return nil, false
61 | }
62 | return o.Key, true
63 | }
64 |
65 | // HasKey returns a boolean if a field has been set.
66 | func (o *TimeseriesSpecifierFiltersInner) HasKey() bool {
67 | if o != nil && !IsNil(o.Key) {
68 | return true
69 | }
70 |
71 | return false
72 | }
73 |
74 | // SetKey gets a reference to the given string and assigns it to the Key field.
75 | func (o *TimeseriesSpecifierFiltersInner) SetKey(v string) {
76 | o.Key = &v
77 | }
78 |
79 | // GetValue returns the Value field value if set, zero value otherwise.
80 | func (o *TimeseriesSpecifierFiltersInner) GetValue() []string {
81 | if o == nil || IsNil(o.Value) {
82 | var ret []string
83 | return ret
84 | }
85 | return o.Value
86 | }
87 |
88 | // GetValueOk returns a tuple with the Value field value if set, nil otherwise
89 | // and a boolean to check if the value has been set.
90 | func (o *TimeseriesSpecifierFiltersInner) GetValueOk() ([]string, bool) {
91 | if o == nil || IsNil(o.Value) {
92 | return nil, false
93 | }
94 | return o.Value, true
95 | }
96 |
97 | // HasValue returns a boolean if a field has been set.
98 | func (o *TimeseriesSpecifierFiltersInner) HasValue() bool {
99 | if o != nil && !IsNil(o.Value) {
100 | return true
101 | }
102 |
103 | return false
104 | }
105 |
106 | // SetValue gets a reference to the given []string and assigns it to the Value field.
107 | func (o *TimeseriesSpecifierFiltersInner) SetValue(v []string) {
108 | o.Value = v
109 | }
110 |
111 | // GetOperator returns the Operator field value if set, zero value otherwise.
112 | func (o *TimeseriesSpecifierFiltersInner) GetOperator() string {
113 | if o == nil || IsNil(o.Operator) {
114 | var ret string
115 | return ret
116 | }
117 | return *o.Operator
118 | }
119 |
120 | // GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise
121 | // and a boolean to check if the value has been set.
122 | func (o *TimeseriesSpecifierFiltersInner) GetOperatorOk() (*string, bool) {
123 | if o == nil || IsNil(o.Operator) {
124 | return nil, false
125 | }
126 | return o.Operator, true
127 | }
128 |
129 | // HasOperator returns a boolean if a field has been set.
130 | func (o *TimeseriesSpecifierFiltersInner) HasOperator() bool {
131 | if o != nil && !IsNil(o.Operator) {
132 | return true
133 | }
134 |
135 | return false
136 | }
137 |
138 | // SetOperator gets a reference to the given string and assigns it to the Operator field.
139 | func (o *TimeseriesSpecifierFiltersInner) SetOperator(v string) {
140 | o.Operator = &v
141 | }
142 |
143 | func (o TimeseriesSpecifierFiltersInner) MarshalJSON() ([]byte, error) {
144 | toSerialize,err := o.ToMap()
145 | if err != nil {
146 | return []byte{}, err
147 | }
148 | return json.Marshal(toSerialize)
149 | }
150 |
151 | func (o TimeseriesSpecifierFiltersInner) ToMap() (map[string]interface{}, error) {
152 | toSerialize := map[string]interface{}{}
153 | if !IsNil(o.Key) {
154 | toSerialize["key"] = o.Key
155 | }
156 | if !IsNil(o.Value) {
157 | toSerialize["value"] = o.Value
158 | }
159 | if !IsNil(o.Operator) {
160 | toSerialize["operator"] = o.Operator
161 | }
162 | return toSerialize, nil
163 | }
164 |
165 | type NullableTimeseriesSpecifierFiltersInner struct {
166 | value *TimeseriesSpecifierFiltersInner
167 | isSet bool
168 | }
169 |
170 | func (v NullableTimeseriesSpecifierFiltersInner) Get() *TimeseriesSpecifierFiltersInner {
171 | return v.value
172 | }
173 |
174 | func (v *NullableTimeseriesSpecifierFiltersInner) Set(val *TimeseriesSpecifierFiltersInner) {
175 | v.value = val
176 | v.isSet = true
177 | }
178 |
179 | func (v NullableTimeseriesSpecifierFiltersInner) IsSet() bool {
180 | return v.isSet
181 | }
182 |
183 | func (v *NullableTimeseriesSpecifierFiltersInner) Unset() {
184 | v.value = nil
185 | v.isSet = false
186 | }
187 |
188 | func NewNullableTimeseriesSpecifierFiltersInner(val *TimeseriesSpecifierFiltersInner) *NullableTimeseriesSpecifierFiltersInner {
189 | return &NullableTimeseriesSpecifierFiltersInner{value: val, isSet: true}
190 | }
191 |
192 | func (v NullableTimeseriesSpecifierFiltersInner) MarshalJSON() ([]byte, error) {
193 | return json.Marshal(v.value)
194 | }
195 |
196 | func (v *NullableTimeseriesSpecifierFiltersInner) UnmarshalJSON(src []byte) error {
197 | v.isSet = true
198 | return json.Unmarshal(src, &v.value)
199 | }
200 |
201 |
202 |
```
--------------------------------------------------------------------------------
/model/model_timeseries_specifier_function.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro Alerts API
3 |
4 | API for managing alerts in the Metoro observability platform.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | "bytes"
16 | "fmt"
17 | )
18 |
19 | // checks if the TimeseriesSpecifierFunction type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &TimeseriesSpecifierFunction{}
21 |
22 | // TimeseriesSpecifierFunction Function to apply to the timeseries
23 | type TimeseriesSpecifierFunction struct {
24 | // Type of function to apply
25 | FunctionType string `json:"functionType"`
26 | MathExpression *TimeseriesSpecifierFunctionsMathExpression `json:"mathExpression,omitempty"`
27 | }
28 |
29 | type _TimeseriesSpecifierFunction TimeseriesSpecifierFunction
30 |
31 | // NewTimeseriesSpecifierFunction instantiates a new TimeseriesSpecifierFunction object
32 | // This constructor will assign default values to properties that have it defined,
33 | // and makes sure properties required by API are set, but the set of arguments
34 | // will change when the set of required properties is changed
35 | func NewTimeseriesSpecifierFunction(functionType string) *TimeseriesSpecifierFunction {
36 | this := TimeseriesSpecifierFunction{}
37 | this.FunctionType = functionType
38 | return &this
39 | }
40 |
41 | // NewTimeseriesSpecifierFunctionWithDefaults instantiates a new TimeseriesSpecifierFunction object
42 | // This constructor will only assign default values to properties that have it defined,
43 | // but it doesn't guarantee that properties required by API are set
44 | func NewTimeseriesSpecifierFunctionWithDefaults() *TimeseriesSpecifierFunction {
45 | this := TimeseriesSpecifierFunction{}
46 | return &this
47 | }
48 |
49 | // GetFunctionType returns the FunctionType field value
50 | func (o *TimeseriesSpecifierFunction) GetFunctionType() string {
51 | if o == nil {
52 | var ret string
53 | return ret
54 | }
55 |
56 | return o.FunctionType
57 | }
58 |
59 | // GetFunctionTypeOk returns a tuple with the FunctionType field value
60 | // and a boolean to check if the value has been set.
61 | func (o *TimeseriesSpecifierFunction) GetFunctionTypeOk() (*string, bool) {
62 | if o == nil {
63 | return nil, false
64 | }
65 | return &o.FunctionType, true
66 | }
67 |
68 | // SetFunctionType sets field value
69 | func (o *TimeseriesSpecifierFunction) SetFunctionType(v string) {
70 | o.FunctionType = v
71 | }
72 |
73 | // GetMathExpression returns the MathExpression field value if set, zero value otherwise.
74 | func (o *TimeseriesSpecifierFunction) GetMathExpression() TimeseriesSpecifierFunctionsMathExpression {
75 | if o == nil || IsNil(o.MathExpression) {
76 | var ret TimeseriesSpecifierFunctionsMathExpression
77 | return ret
78 | }
79 | return *o.MathExpression
80 | }
81 |
82 | // GetMathExpressionOk returns a tuple with the MathExpression field value if set, nil otherwise
83 | // and a boolean to check if the value has been set.
84 | func (o *TimeseriesSpecifierFunction) GetMathExpressionOk() (*TimeseriesSpecifierFunctionsMathExpression, bool) {
85 | if o == nil || IsNil(o.MathExpression) {
86 | return nil, false
87 | }
88 | return o.MathExpression, true
89 | }
90 |
91 | // HasMathExpression returns a boolean if a field has been set.
92 | func (o *TimeseriesSpecifierFunction) HasMathExpression() bool {
93 | if o != nil && !IsNil(o.MathExpression) {
94 | return true
95 | }
96 |
97 | return false
98 | }
99 |
100 | // SetMathExpression gets a reference to the given TimeseriesSpecifierFunctionsMathExpression and assigns it to the MathExpression field.
101 | func (o *TimeseriesSpecifierFunction) SetMathExpression(v TimeseriesSpecifierFunctionsMathExpression) {
102 | o.MathExpression = &v
103 | }
104 |
105 | func (o TimeseriesSpecifierFunction) MarshalJSON() ([]byte, error) {
106 | toSerialize,err := o.ToMap()
107 | if err != nil {
108 | return []byte{}, err
109 | }
110 | return json.Marshal(toSerialize)
111 | }
112 |
113 | func (o TimeseriesSpecifierFunction) ToMap() (map[string]interface{}, error) {
114 | toSerialize := map[string]interface{}{}
115 | toSerialize["functionType"] = o.FunctionType
116 | if !IsNil(o.MathExpression) {
117 | toSerialize["mathExpression"] = o.MathExpression
118 | }
119 | return toSerialize, nil
120 | }
121 |
122 | func (o *TimeseriesSpecifierFunction) UnmarshalJSON(data []byte) (err error) {
123 | // This validates that all required properties are included in the JSON object
124 | // by unmarshalling the object into a generic map with string keys and checking
125 | // that every required field exists as a key in the generic map.
126 | requiredProperties := []string{
127 | "functionType",
128 | }
129 |
130 | allProperties := make(map[string]interface{})
131 |
132 | err = json.Unmarshal(data, &allProperties)
133 |
134 | if err != nil {
135 | return err;
136 | }
137 |
138 | for _, requiredProperty := range(requiredProperties) {
139 | if _, exists := allProperties[requiredProperty]; !exists {
140 | return fmt.Errorf("no value given for required property %v", requiredProperty)
141 | }
142 | }
143 |
144 | varTimeseriesSpecifierFunction := _TimeseriesSpecifierFunction{}
145 |
146 | decoder := json.NewDecoder(bytes.NewReader(data))
147 | decoder.DisallowUnknownFields()
148 | err = decoder.Decode(&varTimeseriesSpecifierFunction)
149 |
150 | if err != nil {
151 | return err
152 | }
153 |
154 | *o = TimeseriesSpecifierFunction(varTimeseriesSpecifierFunction)
155 |
156 | return err
157 | }
158 |
159 | type NullableTimeseriesSpecifierFunction struct {
160 | value *TimeseriesSpecifierFunction
161 | isSet bool
162 | }
163 |
164 | func (v NullableTimeseriesSpecifierFunction) Get() *TimeseriesSpecifierFunction {
165 | return v.value
166 | }
167 |
168 | func (v *NullableTimeseriesSpecifierFunction) Set(val *TimeseriesSpecifierFunction) {
169 | v.value = val
170 | v.isSet = true
171 | }
172 |
173 | func (v NullableTimeseriesSpecifierFunction) IsSet() bool {
174 | return v.isSet
175 | }
176 |
177 | func (v *NullableTimeseriesSpecifierFunction) Unset() {
178 | v.value = nil
179 | v.isSet = false
180 | }
181 |
182 | func NewNullableTimeseriesSpecifierFunction(val *TimeseriesSpecifierFunction) *NullableTimeseriesSpecifierFunction {
183 | return &NullableTimeseriesSpecifierFunction{value: val, isSet: true}
184 | }
185 |
186 | func (v NullableTimeseriesSpecifierFunction) MarshalJSON() ([]byte, error) {
187 | return json.Marshal(v.value)
188 | }
189 |
190 | func (v *NullableTimeseriesSpecifierFunction) UnmarshalJSON(src []byte) error {
191 | v.isSet = true
192 | return json.Unmarshal(src, &v.value)
193 | }
194 |
195 |
196 |
```
--------------------------------------------------------------------------------
/model/model_condition.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the Condition type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &Condition{}
21 |
22 | // Condition struct for Condition
23 | type Condition struct {
24 | // Name of the condition
25 | Name string `json:"name"`
26 | Type *ConditionType `json:"type,omitempty"`
27 | Static *StaticCondition `json:"static,omitempty"`
28 | // Actions to take when condition is met
29 | Actions []Action `json:"actions,omitempty"`
30 | }
31 |
32 | type _Condition Condition
33 |
34 | // NewCondition instantiates a new Condition object
35 | // This constructor will assign default values to properties that have it defined,
36 | // and makes sure properties required by API are set, but the set of arguments
37 | // will change when the set of required properties is changed
38 | func NewCondition(name string) *Condition {
39 | this := Condition{}
40 | this.Name = name
41 | return &this
42 | }
43 |
44 | // NewConditionWithDefaults instantiates a new Condition object
45 | // This constructor will only assign default values to properties that have it defined,
46 | // but it doesn't guarantee that properties required by API are set
47 | func NewConditionWithDefaults() *Condition {
48 | this := Condition{}
49 | return &this
50 | }
51 |
52 | // GetName returns the Name field value
53 | func (o *Condition) GetName() string {
54 | if o == nil {
55 | var ret string
56 | return ret
57 | }
58 |
59 | return o.Name
60 | }
61 |
62 | // GetNameOk returns a tuple with the Name field value
63 | // and a boolean to check if the value has been set.
64 | func (o *Condition) GetNameOk() (*string, bool) {
65 | if o == nil {
66 | return nil, false
67 | }
68 | return &o.Name, true
69 | }
70 |
71 | // SetName sets field value
72 | func (o *Condition) SetName(v string) {
73 | o.Name = v
74 | }
75 |
76 | // GetType returns the Type field value if set, zero value otherwise.
77 | func (o *Condition) GetType() ConditionType {
78 | if o == nil || IsNil(o.Type) {
79 | var ret ConditionType
80 | return ret
81 | }
82 | return *o.Type
83 | }
84 |
85 | // GetTypeOk returns a tuple with the Type field value if set, nil otherwise
86 | // and a boolean to check if the value has been set.
87 | func (o *Condition) GetTypeOk() (*ConditionType, bool) {
88 | if o == nil || IsNil(o.Type) {
89 | return nil, false
90 | }
91 | return o.Type, true
92 | }
93 |
94 | // HasType returns a boolean if a field has been set.
95 | func (o *Condition) HasType() bool {
96 | if o != nil && !IsNil(o.Type) {
97 | return true
98 | }
99 |
100 | return false
101 | }
102 |
103 | // SetType gets a reference to the given ConditionType and assigns it to the Type field.
104 | func (o *Condition) SetType(v ConditionType) {
105 | o.Type = &v
106 | }
107 |
108 | // GetStatic returns the Static field value if set, zero value otherwise.
109 | func (o *Condition) GetStatic() StaticCondition {
110 | if o == nil || IsNil(o.Static) {
111 | var ret StaticCondition
112 | return ret
113 | }
114 | return *o.Static
115 | }
116 |
117 | // GetStaticOk returns a tuple with the Static field value if set, nil otherwise
118 | // and a boolean to check if the value has been set.
119 | func (o *Condition) GetStaticOk() (*StaticCondition, bool) {
120 | if o == nil || IsNil(o.Static) {
121 | return nil, false
122 | }
123 | return o.Static, true
124 | }
125 |
126 | // HasStatic returns a boolean if a field has been set.
127 | func (o *Condition) HasStatic() bool {
128 | if o != nil && !IsNil(o.Static) {
129 | return true
130 | }
131 |
132 | return false
133 | }
134 |
135 | // SetStatic gets a reference to the given StaticCondition and assigns it to the Static field.
136 | func (o *Condition) SetStatic(v StaticCondition) {
137 | o.Static = &v
138 | }
139 |
140 | // GetActions returns the Actions field value if set, zero value otherwise.
141 | func (o *Condition) GetActions() []Action {
142 | if o == nil || IsNil(o.Actions) {
143 | var ret []Action
144 | return ret
145 | }
146 | return o.Actions
147 | }
148 |
149 | // GetActionsOk returns a tuple with the Actions field value if set, nil otherwise
150 | // and a boolean to check if the value has been set.
151 | func (o *Condition) GetActionsOk() ([]Action, bool) {
152 | if o == nil || IsNil(o.Actions) {
153 | return nil, false
154 | }
155 | return o.Actions, true
156 | }
157 |
158 | // HasActions returns a boolean if a field has been set.
159 | func (o *Condition) HasActions() bool {
160 | if o != nil && !IsNil(o.Actions) {
161 | return true
162 | }
163 |
164 | return false
165 | }
166 |
167 | // SetActions gets a reference to the given []Action and assigns it to the Actions field.
168 | func (o *Condition) SetActions(v []Action) {
169 | o.Actions = v
170 | }
171 |
172 | func (o Condition) MarshalJSON() ([]byte, error) {
173 | toSerialize, err := o.ToMap()
174 | if err != nil {
175 | return []byte{}, err
176 | }
177 | return json.Marshal(toSerialize)
178 | }
179 |
180 | func (o Condition) ToMap() (map[string]interface{}, error) {
181 | toSerialize := map[string]interface{}{}
182 | toSerialize["name"] = o.Name
183 | if !IsNil(o.Type) {
184 | toSerialize["type"] = o.Type
185 | }
186 | if !IsNil(o.Static) {
187 | toSerialize["static"] = o.Static
188 | }
189 | if !IsNil(o.Actions) {
190 | toSerialize["actions"] = o.Actions
191 | }
192 | return toSerialize, nil
193 | }
194 |
195 | func (o *Condition) UnmarshalJSON(data []byte) (err error) {
196 | // This validates that all required properties are included in the JSON object
197 | // by unmarshalling the object into a generic map with string keys and checking
198 | // that every required field exists as a key in the generic map.
199 | requiredProperties := []string{
200 | "name",
201 | }
202 |
203 | allProperties := make(map[string]interface{})
204 |
205 | err = json.Unmarshal(data, &allProperties)
206 |
207 | if err != nil {
208 | return err
209 | }
210 |
211 | for _, requiredProperty := range requiredProperties {
212 | if _, exists := allProperties[requiredProperty]; !exists {
213 | return fmt.Errorf("no value given for required property %v", requiredProperty)
214 | }
215 | }
216 |
217 | varCondition := _Condition{}
218 |
219 | decoder := json.NewDecoder(bytes.NewReader(data))
220 | decoder.DisallowUnknownFields()
221 | err = decoder.Decode(&varCondition)
222 |
223 | if err != nil {
224 | return err
225 | }
226 |
227 | *o = Condition(varCondition)
228 |
229 | return err
230 | }
231 |
232 | type NullableCondition struct {
233 | value *Condition
234 | isSet bool
235 | }
236 |
237 | func (v NullableCondition) Get() *Condition {
238 | return v.value
239 | }
240 |
241 | func (v *NullableCondition) Set(val *Condition) {
242 | v.value = val
243 | v.isSet = true
244 | }
245 |
246 | func (v NullableCondition) IsSet() bool {
247 | return v.isSet
248 | }
249 |
250 | func (v *NullableCondition) Unset() {
251 | v.value = nil
252 | v.isSet = false
253 | }
254 |
255 | func NewNullableCondition(val *Condition) *NullableCondition {
256 | return &NullableCondition{value: val, isSet: true}
257 | }
258 |
259 | func (v NullableCondition) MarshalJSON() ([]byte, error) {
260 | return json.Marshal(v.value)
261 | }
262 |
263 | func (v *NullableCondition) UnmarshalJSON(src []byte) error {
264 | v.isSet = true
265 | return json.Unmarshal(src, &v.value)
266 | }
267 |
```
--------------------------------------------------------------------------------
/images/Metoro_square.svg:
--------------------------------------------------------------------------------
```
1 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 595.28 595.28"><defs><style>.n{fill:none;}.o{fill:url(#k);}.p{fill:url(#j);}.q{fill:url(#i);}.r{fill:url(#h);}.s{fill:url(#l);}.t{fill:url(#g);}.u{fill:url(#f);}.v{fill:url(#e);}.w{fill:url(#d);}.x{fill:url(#c);}.y{fill:url(#b);}.z{fill:#50d086;}</style><linearGradient id="b" x1="345.76" y1="292.51" x2="362.34" y2="275.94" gradientUnits="userSpaceOnUse"><stop offset=".38" stop-color="#5b96f7"/><stop offset="1" stop-color="#37cb89"/></linearGradient><linearGradient id="c" x1="249.79" y1="253.86" x2="266.36" y2="237.29" xlink:href="#b"/><linearGradient id="d" x1="215.15" y1="354.44" x2="356.12" y2="213.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#5b96f7"/><stop offset=".42" stop-color="#34b1e6"/><stop offset="1" stop-color="#37cb89"/></linearGradient><linearGradient id="e" x1="193.98" y1="206.73" x2="193.98" y2="63.37" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#5b96f7"/><stop offset="1" stop-color="#34b1e6"/></linearGradient><linearGradient id="f" x1="285.32" y1="161.4" x2="285.32" y2="18.05" gradientUnits="userSpaceOnUse"><stop offset=".31" stop-color="#34b1e6"/><stop offset="1" stop-color="#37cb89"/></linearGradient><linearGradient id="g" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/><linearGradient id="h" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/><linearGradient id="i" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/><linearGradient id="j" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/><linearGradient id="k" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/><linearGradient id="l" x1="19.94" y1="488.8" x2="578.22" y2="488.8" xlink:href="#d"/></defs><g id="a"><path class="y" d="M365.77,284.22c0,6.47-5.25,11.72-11.72,11.72s-11.72-5.25-11.72-11.72,5.25-11.72,11.72-11.72,11.72,5.25,11.72,11.72Z"/><path class="x" d="M269.8,245.57c0,6.47-5.25,11.72-11.72,11.72s-11.72-5.25-11.72-11.72,5.25-11.72,11.72-11.72,11.72,5.25,11.72,11.72Z"/><path class="w" d="M285.64,184.27c-55.05,0-99.68,44.63-99.68,99.68,0,9.12,1.23,17.96,3.53,26.35,13.58.44,24.46,11.58,24.46,25.27,0,4.93-1.41,9.52-3.85,13.41,18.28,21.22,45.34,34.65,75.55,34.65,55.05,0,99.68-44.63,99.68-99.68s-44.63-99.68-99.68-99.68ZM230.83,245.59c0-15.06,12.21-27.26,27.26-27.26s27.26,12.21,27.26,27.26-12.21,27.26-27.26,27.26-27.26-12.21-27.26-27.26ZM277.6,334.46c-8.58,0-15.54-6.96-15.54-15.54s6.96-15.54,15.54-15.54,15.54,6.96,15.54,15.54-6.96,15.54-15.54,15.54ZM312.19,242.02c-6.47,0-11.72-5.25-11.72-11.72s5.25-11.72,11.72-11.72,11.72,5.25,11.72,11.72-5.25,11.72-11.72,11.72ZM354.08,308.22c-13.22,0-23.93-10.72-23.93-23.93s10.72-23.93,23.93-23.93,23.93,10.72,23.93,23.93-10.72,23.93-23.93,23.93Z"/><path class="z" d="M387.67,201.3c0,3-2.43,5.43-5.43,5.43s-5.43-2.43-5.43-5.43V68.8c0-3,2.43-5.43,5.43-5.43s5.43,2.43,5.43,5.43v132.5Z"/><path class="v" d="M199.41,201.3c0,3-2.43,5.43-5.43,5.43s-5.43-2.43-5.43-5.43V68.8c0-3,2.43-5.43,5.43-5.43s5.43,2.43,5.43,5.43v132.5Z"/><path class="u" d="M290.74,155.98c0,3-2.43,5.43-5.43,5.43s-5.43-2.43-5.43-5.43V23.48c0-3,2.43-5.43,5.43-5.43s5.43,2.43,5.43,5.43v132.5Z"/><path class="t" d="M19.94,428.29h31.1l32.85,80.14h1.4l32.85-80.14h31.1v119.27h-24.46v-77.63h-.99l-30.87,77.05h-16.66l-30.87-77.34h-.99v77.92h-24.46v-119.27Z"/><path class="r" d="M210.27,549.31c-9.2,0-17.11-1.87-23.73-5.62-6.62-3.75-11.72-9.07-15.29-15.96s-5.36-15.05-5.36-24.49,1.79-17.28,5.36-24.23c3.57-6.95,8.61-12.37,15.11-16.25,6.5-3.88,14.14-5.82,22.92-5.82,5.9,0,11.4.94,16.51,2.82,5.1,1.88,9.57,4.71,13.39,8.47,3.82,3.77,6.8,8.49,8.94,14.18,2.13,5.69,3.2,12.34,3.2,19.95v6.81h-75.54v-15.38h52.18c0-3.57-.78-6.74-2.33-9.49-1.55-2.76-3.7-4.92-6.44-6.49-2.74-1.57-5.91-2.36-9.52-2.36s-7.1.86-9.99,2.59c-2.89,1.73-5.15,4.04-6.79,6.93s-2.47,6.11-2.5,9.64v14.62c0,4.43.82,8.25,2.47,11.47s3.99,5.71,7.02,7.45,6.62,2.62,10.77,2.62c2.76,0,5.28-.39,7.57-1.17,2.29-.78,4.25-1.94,5.88-3.49s2.87-3.46,3.73-5.71l22.95,1.51c-1.17,5.51-3.54,10.32-7.13,14.41-3.59,4.1-8.21,7.28-13.86,9.55-5.65,2.27-12.16,3.41-19.54,3.41Z"/><path class="q" d="M315.09,458.11v18.64h-53.87v-18.64h53.87ZM273.45,436.68h24.81v83.4c0,2.29.35,4.07,1.05,5.33.7,1.26,1.68,2.15,2.94,2.65,1.26.5,2.73.76,4.4.76,1.17,0,2.33-.11,3.49-.32,1.17-.21,2.06-.38,2.68-.5l3.9,18.46c-1.24.39-2.99.84-5.24,1.37-2.25.52-4.99.84-8.21.96-5.98.23-11.21-.56-15.7-2.39-4.48-1.82-7.97-4.66-10.45-8.5-2.49-3.84-3.71-8.7-3.67-14.56v-86.66Z"/><path class="p" d="M370.71,549.31c-9.05,0-16.86-1.93-23.44-5.79-6.58-3.86-11.66-9.26-15.23-16.19-3.57-6.93-5.36-14.98-5.36-24.14s1.79-17.33,5.36-24.26c3.57-6.93,8.65-12.33,15.23-16.19s14.39-5.79,23.44-5.79,16.86,1.93,23.44,5.79c6.58,3.86,11.66,9.26,15.23,16.19,3.57,6.93,5.36,15.02,5.36,24.26s-1.79,17.21-5.36,24.14c-3.57,6.93-8.65,12.33-15.23,16.19-6.58,3.86-14.39,5.79-23.44,5.79ZM370.83,530.09c4.12,0,7.55-1.17,10.31-3.52,2.76-2.35,4.84-5.56,6.26-9.64,1.42-4.08,2.12-8.72,2.12-13.92s-.71-9.84-2.12-13.92c-1.42-4.08-3.5-7.3-6.26-9.67-2.76-2.37-6.19-3.55-10.31-3.55s-7.64,1.18-10.45,3.55c-2.82,2.37-4.93,5.59-6.35,9.67-1.42,4.08-2.13,8.72-2.13,13.92s.71,9.84,2.13,13.92c1.42,4.08,3.53,7.29,6.35,9.64,2.81,2.35,6.3,3.52,10.45,3.52Z"/><path class="o" d="M430.93,547.56v-89.45h24.05v15.61h.93c1.63-5.55,4.37-9.75,8.21-12.61s8.27-4.28,13.28-4.28c1.24,0,2.58.08,4.02.23,1.44.16,2.7.37,3.79.64v22.01c-1.16-.35-2.78-.66-4.83-.93-2.06-.27-3.94-.41-5.65-.41-3.65,0-6.9.79-9.75,2.36-2.85,1.57-5.11,3.76-6.76,6.55-1.65,2.8-2.48,6.02-2.48,9.67v50.61h-24.81Z"/><path class="s" d="M534.19,549.31c-9.05,0-16.86-1.93-23.44-5.79-6.58-3.86-11.66-9.26-15.23-16.19-3.57-6.93-5.36-14.98-5.36-24.14s1.79-17.33,5.36-24.26c3.57-6.93,8.65-12.33,15.23-16.19s14.39-5.79,23.44-5.79,16.86,1.93,23.44,5.79c6.58,3.86,11.66,9.26,15.23,16.19,3.57,6.93,5.36,15.02,5.36,24.26s-1.79,17.21-5.36,24.14c-3.57,6.93-8.65,12.33-15.23,16.19-6.58,3.86-14.39,5.79-23.44,5.79ZM534.3,530.09c4.12,0,7.55-1.17,10.31-3.52,2.76-2.35,4.84-5.56,6.26-9.64,1.42-4.08,2.12-8.72,2.12-13.92s-.71-9.84-2.12-13.92c-1.42-4.08-3.5-7.3-6.26-9.67-2.76-2.37-6.19-3.55-10.31-3.55s-7.64,1.18-10.45,3.55c-2.82,2.37-4.93,5.59-6.35,9.67-1.42,4.08-2.13,8.72-2.13,13.92s.71,9.84,2.13,13.92c1.42,4.08,3.53,7.29,6.35,9.64,2.81,2.35,6.3,3.52,10.45,3.52Z"/></g><g id="m"><rect class="n" width="595.28" height="595.28"/></g></svg>
```
--------------------------------------------------------------------------------
/model/model_action_webhook_destination.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "encoding/json"
15 | )
16 |
17 | // checks if the ActionWebhookDestination type satisfies the MappedNullable interface at compile time
18 | var _ MappedNullable = &ActionWebhookDestination{}
19 |
20 | // ActionWebhookDestination struct for ActionWebhookDestination
21 | type ActionWebhookDestination struct {
22 | // UUID of the webhook configuration to use for notifying that the alert is triggered
23 | Uuid *string `json:"uuid,omitempty"`
24 | // Name of the webhook configuration to use for notifying that the alert is triggered
25 | Name *string `json:"name,omitempty"`
26 | // UUID of the webhook configuration to use for notifying that the alert is resolved
27 | ResolvedUuid *string `json:"resolved_uuid,omitempty"`
28 | // Name of the webhook configuration to use for notifying that the alert is resolved
29 | ResolvedName *string `json:"resolved_name,omitempty"`
30 | }
31 |
32 | // NewActionWebhookDestination instantiates a new ActionWebhookDestination object
33 | // This constructor will assign default values to properties that have it defined,
34 | // and makes sure properties required by API are set, but the set of arguments
35 | // will change when the set of required properties is changed
36 | func NewActionWebhookDestination() *ActionWebhookDestination {
37 | this := ActionWebhookDestination{}
38 | return &this
39 | }
40 |
41 | // NewActionWebhookDestinationWithDefaults instantiates a new ActionWebhookDestination object
42 | // This constructor will only assign default values to properties that have it defined,
43 | // but it doesn't guarantee that properties required by API are set
44 | func NewActionWebhookDestinationWithDefaults() *ActionWebhookDestination {
45 | this := ActionWebhookDestination{}
46 | return &this
47 | }
48 |
49 | // GetUuid returns the Uuid field value if set, zero value otherwise.
50 | func (o *ActionWebhookDestination) GetUuid() string {
51 | if o == nil || IsNil(o.Uuid) {
52 | var ret string
53 | return ret
54 | }
55 | return *o.Uuid
56 | }
57 |
58 | // GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise
59 | // and a boolean to check if the value has been set.
60 | func (o *ActionWebhookDestination) GetUuidOk() (*string, bool) {
61 | if o == nil || IsNil(o.Uuid) {
62 | return nil, false
63 | }
64 | return o.Uuid, true
65 | }
66 |
67 | // HasUuid returns a boolean if a field has been set.
68 | func (o *ActionWebhookDestination) HasUuid() bool {
69 | if o != nil && !IsNil(o.Uuid) {
70 | return true
71 | }
72 |
73 | return false
74 | }
75 |
76 | // SetUuid gets a reference to the given string and assigns it to the Uuid field.
77 | func (o *ActionWebhookDestination) SetUuid(v string) {
78 | o.Uuid = &v
79 | }
80 |
81 | // GetName returns the Name field value if set, zero value otherwise.
82 | func (o *ActionWebhookDestination) GetName() string {
83 | if o == nil || IsNil(o.Name) {
84 | var ret string
85 | return ret
86 | }
87 | return *o.Name
88 | }
89 |
90 | // GetNameOk returns a tuple with the Name field value if set, nil otherwise
91 | // and a boolean to check if the value has been set.
92 | func (o *ActionWebhookDestination) GetNameOk() (*string, bool) {
93 | if o == nil || IsNil(o.Name) {
94 | return nil, false
95 | }
96 | return o.Name, true
97 | }
98 |
99 | // HasName returns a boolean if a field has been set.
100 | func (o *ActionWebhookDestination) HasName() bool {
101 | if o != nil && !IsNil(o.Name) {
102 | return true
103 | }
104 |
105 | return false
106 | }
107 |
108 | // SetName gets a reference to the given string and assigns it to the Name field.
109 | func (o *ActionWebhookDestination) SetName(v string) {
110 | o.Name = &v
111 | }
112 |
113 | // GetResolvedUuid returns the ResolvedUuid field value if set, zero value otherwise.
114 | func (o *ActionWebhookDestination) GetResolvedUuid() string {
115 | if o == nil || IsNil(o.ResolvedUuid) {
116 | var ret string
117 | return ret
118 | }
119 | return *o.ResolvedUuid
120 | }
121 |
122 | // GetResolvedUuidOk returns a tuple with the ResolvedUuid field value if set, nil otherwise
123 | // and a boolean to check if the value has been set.
124 | func (o *ActionWebhookDestination) GetResolvedUuidOk() (*string, bool) {
125 | if o == nil || IsNil(o.ResolvedUuid) {
126 | return nil, false
127 | }
128 | return o.ResolvedUuid, true
129 | }
130 |
131 | // HasResolvedUuid returns a boolean if a field has been set.
132 | func (o *ActionWebhookDestination) HasResolvedUuid() bool {
133 | if o != nil && !IsNil(o.ResolvedUuid) {
134 | return true
135 | }
136 |
137 | return false
138 | }
139 |
140 | // SetResolvedUuid gets a reference to the given string and assigns it to the ResolvedUuid field.
141 | func (o *ActionWebhookDestination) SetResolvedUuid(v string) {
142 | o.ResolvedUuid = &v
143 | }
144 |
145 | // GetResolvedName returns the ResolvedName field value if set, zero value otherwise.
146 | func (o *ActionWebhookDestination) GetResolvedName() string {
147 | if o == nil || IsNil(o.ResolvedName) {
148 | var ret string
149 | return ret
150 | }
151 | return *o.ResolvedName
152 | }
153 |
154 | // GetResolvedNameOk returns a tuple with the ResolvedName field value if set, nil otherwise
155 | // and a boolean to check if the value has been set.
156 | func (o *ActionWebhookDestination) GetResolvedNameOk() (*string, bool) {
157 | if o == nil || IsNil(o.ResolvedName) {
158 | return nil, false
159 | }
160 | return o.ResolvedName, true
161 | }
162 |
163 | // HasResolvedName returns a boolean if a field has been set.
164 | func (o *ActionWebhookDestination) HasResolvedName() bool {
165 | if o != nil && !IsNil(o.ResolvedName) {
166 | return true
167 | }
168 |
169 | return false
170 | }
171 |
172 | // SetResolvedName gets a reference to the given string and assigns it to the ResolvedName field.
173 | func (o *ActionWebhookDestination) SetResolvedName(v string) {
174 | o.ResolvedName = &v
175 | }
176 |
177 | func (o ActionWebhookDestination) MarshalJSON() ([]byte, error) {
178 | toSerialize,err := o.ToMap()
179 | if err != nil {
180 | return []byte{}, err
181 | }
182 | return json.Marshal(toSerialize)
183 | }
184 |
185 | func (o ActionWebhookDestination) ToMap() (map[string]interface{}, error) {
186 | toSerialize := map[string]interface{}{}
187 | if !IsNil(o.Uuid) {
188 | toSerialize["uuid"] = o.Uuid
189 | }
190 | if !IsNil(o.Name) {
191 | toSerialize["name"] = o.Name
192 | }
193 | if !IsNil(o.ResolvedUuid) {
194 | toSerialize["resolved_uuid"] = o.ResolvedUuid
195 | }
196 | if !IsNil(o.ResolvedName) {
197 | toSerialize["resolved_name"] = o.ResolvedName
198 | }
199 | return toSerialize, nil
200 | }
201 |
202 | type NullableActionWebhookDestination struct {
203 | value *ActionWebhookDestination
204 | isSet bool
205 | }
206 |
207 | func (v NullableActionWebhookDestination) Get() *ActionWebhookDestination {
208 | return v.value
209 | }
210 |
211 | func (v *NullableActionWebhookDestination) Set(val *ActionWebhookDestination) {
212 | v.value = val
213 | v.isSet = true
214 | }
215 |
216 | func (v NullableActionWebhookDestination) IsSet() bool {
217 | return v.isSet
218 | }
219 |
220 | func (v *NullableActionWebhookDestination) Unset() {
221 | v.value = nil
222 | v.isSet = false
223 | }
224 |
225 | func NewNullableActionWebhookDestination(val *ActionWebhookDestination) *NullableActionWebhookDestination {
226 | return &NullableActionWebhookDestination{value: val, isSet: true}
227 | }
228 |
229 | func (v NullableActionWebhookDestination) MarshalJSON() ([]byte, error) {
230 | return json.Marshal(v.value)
231 | }
232 |
233 | func (v *NullableActionWebhookDestination) UnmarshalJSON(src []byte) error {
234 | v.isSet = true
235 | return json.Unmarshal(src, &v.value)
236 | }
237 |
238 |
239 |
```
--------------------------------------------------------------------------------
/model/utils.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | "reflect"
18 | "time"
19 | )
20 |
21 | // PtrBool is a helper routine that returns a pointer to given boolean value.
22 | func PtrBool(v bool) *bool { return &v }
23 |
24 | // PtrInt is a helper routine that returns a pointer to given integer value.
25 | func PtrInt(v int) *int { return &v }
26 |
27 | // PtrInt32 is a helper routine that returns a pointer to given integer value.
28 | func PtrInt32(v int32) *int32 { return &v }
29 |
30 | // PtrInt64 is a helper routine that returns a pointer to given integer value.
31 | func PtrInt64(v int64) *int64 { return &v }
32 |
33 | // PtrFloat32 is a helper routine that returns a pointer to given float value.
34 | func PtrFloat32(v float32) *float32 { return &v }
35 |
36 | // PtrFloat64 is a helper routine that returns a pointer to given float value.
37 | func PtrFloat64(v float64) *float64 { return &v }
38 |
39 | // PtrString is a helper routine that returns a pointer to given string value.
40 | func PtrString(v string) *string { return &v }
41 |
42 | // PtrTime is helper routine that returns a pointer to given Time value.
43 | func PtrTime(v time.Time) *time.Time { return &v }
44 |
45 | type NullableBool struct {
46 | value *bool
47 | isSet bool
48 | }
49 |
50 | func (v NullableBool) Get() *bool {
51 | return v.value
52 | }
53 |
54 | func (v *NullableBool) Set(val *bool) {
55 | v.value = val
56 | v.isSet = true
57 | }
58 |
59 | func (v NullableBool) IsSet() bool {
60 | return v.isSet
61 | }
62 |
63 | func (v *NullableBool) Unset() {
64 | v.value = nil
65 | v.isSet = false
66 | }
67 |
68 | func NewNullableBool(val *bool) *NullableBool {
69 | return &NullableBool{value: val, isSet: true}
70 | }
71 |
72 | func (v NullableBool) MarshalJSON() ([]byte, error) {
73 | return json.Marshal(v.value)
74 | }
75 |
76 | func (v *NullableBool) UnmarshalJSON(src []byte) error {
77 | v.isSet = true
78 | return json.Unmarshal(src, &v.value)
79 | }
80 |
81 | type NullableInt struct {
82 | value *int
83 | isSet bool
84 | }
85 |
86 | func (v NullableInt) Get() *int {
87 | return v.value
88 | }
89 |
90 | func (v *NullableInt) Set(val *int) {
91 | v.value = val
92 | v.isSet = true
93 | }
94 |
95 | func (v NullableInt) IsSet() bool {
96 | return v.isSet
97 | }
98 |
99 | func (v *NullableInt) Unset() {
100 | v.value = nil
101 | v.isSet = false
102 | }
103 |
104 | func NewNullableInt(val *int) *NullableInt {
105 | return &NullableInt{value: val, isSet: true}
106 | }
107 |
108 | func (v NullableInt) MarshalJSON() ([]byte, error) {
109 | return json.Marshal(v.value)
110 | }
111 |
112 | func (v *NullableInt) UnmarshalJSON(src []byte) error {
113 | v.isSet = true
114 | return json.Unmarshal(src, &v.value)
115 | }
116 |
117 | type NullableInt32 struct {
118 | value *int32
119 | isSet bool
120 | }
121 |
122 | func (v NullableInt32) Get() *int32 {
123 | return v.value
124 | }
125 |
126 | func (v *NullableInt32) Set(val *int32) {
127 | v.value = val
128 | v.isSet = true
129 | }
130 |
131 | func (v NullableInt32) IsSet() bool {
132 | return v.isSet
133 | }
134 |
135 | func (v *NullableInt32) Unset() {
136 | v.value = nil
137 | v.isSet = false
138 | }
139 |
140 | func NewNullableInt32(val *int32) *NullableInt32 {
141 | return &NullableInt32{value: val, isSet: true}
142 | }
143 |
144 | func (v NullableInt32) MarshalJSON() ([]byte, error) {
145 | return json.Marshal(v.value)
146 | }
147 |
148 | func (v *NullableInt32) UnmarshalJSON(src []byte) error {
149 | v.isSet = true
150 | return json.Unmarshal(src, &v.value)
151 | }
152 |
153 | type NullableInt64 struct {
154 | value *int64
155 | isSet bool
156 | }
157 |
158 | func (v NullableInt64) Get() *int64 {
159 | return v.value
160 | }
161 |
162 | func (v *NullableInt64) Set(val *int64) {
163 | v.value = val
164 | v.isSet = true
165 | }
166 |
167 | func (v NullableInt64) IsSet() bool {
168 | return v.isSet
169 | }
170 |
171 | func (v *NullableInt64) Unset() {
172 | v.value = nil
173 | v.isSet = false
174 | }
175 |
176 | func NewNullableInt64(val *int64) *NullableInt64 {
177 | return &NullableInt64{value: val, isSet: true}
178 | }
179 |
180 | func (v NullableInt64) MarshalJSON() ([]byte, error) {
181 | return json.Marshal(v.value)
182 | }
183 |
184 | func (v *NullableInt64) UnmarshalJSON(src []byte) error {
185 | v.isSet = true
186 | return json.Unmarshal(src, &v.value)
187 | }
188 |
189 | type NullableFloat32 struct {
190 | value *float32
191 | isSet bool
192 | }
193 |
194 | func (v NullableFloat32) Get() *float32 {
195 | return v.value
196 | }
197 |
198 | func (v *NullableFloat32) Set(val *float32) {
199 | v.value = val
200 | v.isSet = true
201 | }
202 |
203 | func (v NullableFloat32) IsSet() bool {
204 | return v.isSet
205 | }
206 |
207 | func (v *NullableFloat32) Unset() {
208 | v.value = nil
209 | v.isSet = false
210 | }
211 |
212 | func NewNullableFloat32(val *float32) *NullableFloat32 {
213 | return &NullableFloat32{value: val, isSet: true}
214 | }
215 |
216 | func (v NullableFloat32) MarshalJSON() ([]byte, error) {
217 | return json.Marshal(v.value)
218 | }
219 |
220 | func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
221 | v.isSet = true
222 | return json.Unmarshal(src, &v.value)
223 | }
224 |
225 | type NullableFloat64 struct {
226 | value *float64
227 | isSet bool
228 | }
229 |
230 | func (v NullableFloat64) Get() *float64 {
231 | return v.value
232 | }
233 |
234 | func (v *NullableFloat64) Set(val *float64) {
235 | v.value = val
236 | v.isSet = true
237 | }
238 |
239 | func (v NullableFloat64) IsSet() bool {
240 | return v.isSet
241 | }
242 |
243 | func (v *NullableFloat64) Unset() {
244 | v.value = nil
245 | v.isSet = false
246 | }
247 |
248 | func NewNullableFloat64(val *float64) *NullableFloat64 {
249 | return &NullableFloat64{value: val, isSet: true}
250 | }
251 |
252 | func (v NullableFloat64) MarshalJSON() ([]byte, error) {
253 | return json.Marshal(v.value)
254 | }
255 |
256 | func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
257 | v.isSet = true
258 | return json.Unmarshal(src, &v.value)
259 | }
260 |
261 | type NullableString struct {
262 | value *string
263 | isSet bool
264 | }
265 |
266 | func (v NullableString) Get() *string {
267 | return v.value
268 | }
269 |
270 | func (v *NullableString) Set(val *string) {
271 | v.value = val
272 | v.isSet = true
273 | }
274 |
275 | func (v NullableString) IsSet() bool {
276 | return v.isSet
277 | }
278 |
279 | func (v *NullableString) Unset() {
280 | v.value = nil
281 | v.isSet = false
282 | }
283 |
284 | func NewNullableString(val *string) *NullableString {
285 | return &NullableString{value: val, isSet: true}
286 | }
287 |
288 | func (v NullableString) MarshalJSON() ([]byte, error) {
289 | return json.Marshal(v.value)
290 | }
291 |
292 | func (v *NullableString) UnmarshalJSON(src []byte) error {
293 | v.isSet = true
294 | return json.Unmarshal(src, &v.value)
295 | }
296 |
297 | type NullableTime struct {
298 | value *time.Time
299 | isSet bool
300 | }
301 |
302 | func (v NullableTime) Get() *time.Time {
303 | return v.value
304 | }
305 |
306 | func (v *NullableTime) Set(val *time.Time) {
307 | v.value = val
308 | v.isSet = true
309 | }
310 |
311 | func (v NullableTime) IsSet() bool {
312 | return v.isSet
313 | }
314 |
315 | func (v *NullableTime) Unset() {
316 | v.value = nil
317 | v.isSet = false
318 | }
319 |
320 | func NewNullableTime(val *time.Time) *NullableTime {
321 | return &NullableTime{value: val, isSet: true}
322 | }
323 |
324 | func (v NullableTime) MarshalJSON() ([]byte, error) {
325 | return json.Marshal(v.value)
326 | }
327 |
328 | func (v *NullableTime) UnmarshalJSON(src []byte) error {
329 | v.isSet = true
330 | return json.Unmarshal(src, &v.value)
331 | }
332 |
333 | // IsNil checks if an input is nil
334 | func IsNil(i interface{}) bool {
335 | if i == nil {
336 | return true
337 | }
338 | switch reflect.TypeOf(i).Kind() {
339 | case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
340 | return reflect.ValueOf(i).IsNil()
341 | case reflect.Array:
342 | return reflect.ValueOf(i).IsZero()
343 | }
344 | return false
345 | }
346 |
347 | type MappedNullable interface {
348 | ToMap() (map[string]interface{}, error)
349 | }
350 |
351 | // A wrapper for strict JSON decoding
352 | func newStrictDecoder(data []byte) *json.Decoder {
353 | dec := json.NewDecoder(bytes.NewBuffer(data))
354 | dec.DisallowUnknownFields()
355 | return dec
356 | }
357 |
358 | // Prevent trying to import "fmt"
359 | func reportError(format string, a ...interface{}) error {
360 | return fmt.Errorf(format, a...)
361 | }
362 |
```
--------------------------------------------------------------------------------
/utils/time_utils_test.go:
--------------------------------------------------------------------------------
```go
1 | package utils
2 |
3 | import (
4 | "strings"
5 | "testing"
6 | "time"
7 | )
8 |
9 | func TestCalculateTimeRange(t *testing.T) {
10 | // Set IS_PROD for tests that need to validate 30-day window
11 | t.Setenv("IS_PROD", "true")
12 |
13 | // Helper function to create pointers
14 | strPtr := func(s string) *string { return &s }
15 | intPtr := func(i int) *int { return &i }
16 | timeWindowPtr := func(tw TimeWindow) *TimeWindow { return &tw }
17 |
18 | tests := []struct {
19 | name string
20 | config TimeConfig
21 | wantPeriod *time.Duration // Expected time difference between start and end for relative time
22 | wantStartTime *time.Time // Expected exact start time for absolute time
23 | wantEndTime *time.Time // Expected exact end time for absolute time
24 | wantErr bool
25 | errMsg string
26 | }{
27 | // Relative time tests
28 | {
29 | name: "relative - 5 minutes",
30 | config: TimeConfig{
31 | Type: RelativeTimeRange,
32 | TimePeriod: intPtr(5),
33 | TimeWindow: timeWindowPtr(Minutes),
34 | },
35 | wantPeriod: func() *time.Duration {
36 | d := 5 * time.Minute
37 | return &d
38 | }(),
39 | },
40 | {
41 | name: "relative - 2 hours",
42 | config: TimeConfig{
43 | Type: RelativeTimeRange,
44 | TimePeriod: intPtr(2),
45 | TimeWindow: timeWindowPtr(Hours),
46 | },
47 | wantPeriod: func() *time.Duration {
48 | d := 2 * time.Hour
49 | return &d
50 | }(),
51 | },
52 | {
53 | name: "relative - missing time period",
54 | config: TimeConfig{
55 | Type: RelativeTimeRange,
56 | TimeWindow: timeWindowPtr(Minutes),
57 | },
58 | wantErr: true,
59 | errMsg: "time_period and time_window are required for relative time range",
60 | },
61 | {
62 | name: "relative - invalid time window",
63 | config: TimeConfig{
64 | Type: RelativeTimeRange,
65 | TimePeriod: intPtr(5),
66 | TimeWindow: timeWindowPtr("invalid"),
67 | },
68 | wantErr: true,
69 | errMsg: "invalid time window: invalid",
70 | },
71 | {
72 | name: "relative - exceeds 30 days",
73 | config: TimeConfig{
74 | Type: RelativeTimeRange,
75 | TimePeriod: intPtr(31),
76 | TimeWindow: timeWindowPtr(Days),
77 | },
78 | wantErr: true,
79 | errMsg: "time range cannot exceed 30 days",
80 | },
81 | {
82 | name: "relative - exactly 30 days",
83 | config: TimeConfig{
84 | Type: RelativeTimeRange,
85 | TimePeriod: intPtr(30),
86 | TimeWindow: timeWindowPtr(Days),
87 | },
88 | wantPeriod: func() *time.Duration {
89 | d := 30 * 24 * time.Hour
90 | return &d
91 | }(),
92 | },
93 |
94 | // Absolute time tests
95 | {
96 | name: "absolute - valid time range",
97 | config: TimeConfig{
98 | Type: AbsoluteTimeRange,
99 | StartTime: strPtr(time.Now().Add(-24 * time.Hour).Format(time.RFC3339)),
100 | EndTime: strPtr(time.Now().Add(-23 * time.Hour).Format(time.RFC3339)),
101 | },
102 | wantStartTime: func() *time.Time {
103 | t := time.Now().Add(-24 * time.Hour)
104 | return &t
105 | }(),
106 | wantEndTime: func() *time.Time {
107 | t := time.Now().Add(-23 * time.Hour)
108 | return &t
109 | }(),
110 | },
111 | {
112 | name: "absolute - missing start time",
113 | config: TimeConfig{
114 | Type: AbsoluteTimeRange,
115 | EndTime: strPtr("2024-12-12T15:00:00Z"),
116 | },
117 | wantErr: true,
118 | errMsg: "start_time and end_time are required for absolute time range",
119 | },
120 | {
121 | name: "absolute - invalid start time format",
122 | config: TimeConfig{
123 | Type: AbsoluteTimeRange,
124 | StartTime: strPtr("invalid"),
125 | EndTime: strPtr("2024-12-12T15:00:00Z"),
126 | },
127 | wantErr: true,
128 | errMsg: "invalid start_time format",
129 | },
130 | {
131 | name: "absolute - end time before start time",
132 | config: TimeConfig{
133 | Type: AbsoluteTimeRange,
134 | StartTime: strPtr("2024-12-12T15:00:00Z"),
135 | EndTime: strPtr("2024-12-12T14:00:00Z"),
136 | },
137 | wantErr: true,
138 | errMsg: "end_time cannot be before start_time",
139 | },
140 | {
141 | name: "absolute - exceeds 30 days",
142 | config: TimeConfig{
143 | Type: AbsoluteTimeRange,
144 | StartTime: strPtr(time.Now().Add(-31 * 24 * time.Hour).Format(time.RFC3339)),
145 | EndTime: strPtr(time.Now().Format(time.RFC3339)),
146 | },
147 | wantErr: true,
148 | errMsg: "time range cannot exceed 30 days",
149 | },
150 | {
151 | name: "absolute - exactly 30 days ago",
152 | config: TimeConfig{
153 | Type: AbsoluteTimeRange,
154 | StartTime: strPtr(time.Now().Add(-30*24*time.Hour + 1*time.Hour).Format(time.RFC3339)),
155 | EndTime: strPtr(time.Now().Add(-29 * 24 * time.Hour).Format(time.RFC3339)),
156 | },
157 | wantStartTime: func() *time.Time {
158 | t := time.Now().Add(-30*24*time.Hour + 1*time.Hour)
159 | return &t
160 | }(),
161 | wantEndTime: func() *time.Time {
162 | t := time.Now().Add(-29 * 24 * time.Hour)
163 | return &t
164 | }(),
165 | },
166 |
167 | // Invalid type test
168 | {
169 | name: "invalid time range type",
170 | config: TimeConfig{
171 | Type: "invalid",
172 | },
173 | wantErr: true,
174 | errMsg: "invalid time range type: invalid",
175 | },
176 | }
177 |
178 | for _, tt := range tests {
179 | t.Run(tt.name, func(t *testing.T) {
180 | startTime, endTime, err := CalculateTimeRange(tt.config)
181 |
182 | // Check error cases
183 | if tt.wantErr {
184 | if err == nil {
185 | t.Errorf("CalculateTimeRange() error = nil, wantErr %v", tt.wantErr)
186 | return
187 | }
188 | if tt.errMsg != "" && !strings.Contains(err.Error(), tt.errMsg) {
189 | t.Errorf("CalculateTimeRange() error = %v, want error containing %v", err, tt.errMsg)
190 | }
191 | return
192 | }
193 |
194 | if err != nil {
195 | t.Errorf("CalculateTimeRange() unexpected error = %v", err)
196 | return
197 | }
198 |
199 | // For relative time tests
200 | if tt.wantPeriod != nil {
201 | startTimeObj := time.Unix(startTime, 0)
202 | endTimeObj := time.Unix(endTime, 0)
203 | gotPeriod := endTimeObj.Sub(startTimeObj)
204 | if gotPeriod != *tt.wantPeriod {
205 | t.Errorf("CalculateTimeRange() time period = %v, want %v", gotPeriod, *tt.wantPeriod)
206 | }
207 |
208 | // Check if endTime is approximately now (within 1 second tolerance)
209 | nowUnix := time.Now().Unix()
210 | if diff := abs(endTime - nowUnix); diff > 1 {
211 | t.Errorf("CalculateTimeRange() endTime is not close enough to current time. diff = %v seconds", diff)
212 | }
213 | }
214 |
215 | // For absolute time tests
216 | if tt.wantStartTime != nil && tt.wantEndTime != nil {
217 | // For dynamic times (using time.Now()), check time range validity and approximate values
218 | if strings.Contains(tt.name, "30 days ago") || strings.Contains(tt.name, "valid time range") {
219 | // Just check the time range is valid
220 | if endTime < startTime {
221 | t.Errorf("CalculateTimeRange() endTime < startTime")
222 | }
223 | // Check approximate values (within 2 seconds tolerance)
224 | if diff := abs(startTime - tt.wantStartTime.Unix()); diff > 2 {
225 | t.Errorf("CalculateTimeRange() startTime difference too large: %v seconds", diff)
226 | }
227 | if diff := abs(endTime - tt.wantEndTime.Unix()); diff > 2 {
228 | t.Errorf("CalculateTimeRange() endTime difference too large: %v seconds", diff)
229 | }
230 | } else {
231 | // For static times, check exact match
232 | if startTime != tt.wantStartTime.Unix() {
233 | t.Errorf("CalculateTimeRange() startTime = %v, want %v", startTime, tt.wantStartTime.Unix())
234 | }
235 | if endTime != tt.wantEndTime.Unix() {
236 | t.Errorf("CalculateTimeRange() endTime = %v, want %v", endTime, tt.wantEndTime.Unix())
237 | }
238 | }
239 | }
240 | })
241 | }
242 | }
243 |
244 | func abs(x int64) int64 {
245 | if x < 0 {
246 | return -x
247 | }
248 | return x
249 | }
250 |
```
--------------------------------------------------------------------------------
/model/model_persistence_settings.go:
--------------------------------------------------------------------------------
```go
1 | /*
2 | Metoro API
3 |
4 | API for managing Metoro environments, alerts, and dashboards.
5 |
6 | API version: 1.0.0
7 | */
8 |
9 | // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
10 |
11 | package model
12 |
13 | import (
14 | "bytes"
15 | "encoding/json"
16 | "fmt"
17 | )
18 |
19 | // checks if the PersistenceSettings type satisfies the MappedNullable interface at compile time
20 | var _ MappedNullable = &PersistenceSettings{}
21 |
22 | // PersistenceSettings struct for PersistenceSettings
23 | type PersistenceSettings struct {
24 | // Number of data points that must breach the threshold within the evaluation window to trigger an alert.
25 | DatapointsToAlarm int64 `json:"datapointsToAlarm"`
26 | // Total number of data points in the evaluation window. If your bucketSize is 60 (seconds) and datapointsInEvaluationWindow is 5, then the evaluation window is 5 minutes.
27 | DatapointsInEvaluationWindow int64 `json:"datapointsInEvaluationWindow"`
28 | // Determines how missing data points are treated - either as breaching the threshold or not breaching.
29 | MissingDatapointBehavior *string `json:"missingDatapointBehavior,omitempty"`
30 | }
31 |
32 | type _PersistenceSettings PersistenceSettings
33 |
34 | // NewPersistenceSettings instantiates a new PersistenceSettings object
35 | // This constructor will assign default values to properties that have it defined,
36 | // and makes sure properties required by API are set, but the set of arguments
37 | // will change when the set of required properties is changed
38 | func NewPersistenceSettings(datapointsToAlarm int64, datapointsInEvaluationWindow int64) *PersistenceSettings {
39 | this := PersistenceSettings{}
40 | this.DatapointsToAlarm = datapointsToAlarm
41 | this.DatapointsInEvaluationWindow = datapointsInEvaluationWindow
42 | var missingDatapointBehavior string = "notBreaching"
43 | this.MissingDatapointBehavior = &missingDatapointBehavior
44 | return &this
45 | }
46 |
47 | // NewPersistenceSettingsWithDefaults instantiates a new PersistenceSettings object
48 | // This constructor will only assign default values to properties that have it defined,
49 | // but it doesn't guarantee that properties required by API are set
50 | func NewPersistenceSettingsWithDefaults() *PersistenceSettings {
51 | this := PersistenceSettings{}
52 | var missingDatapointBehavior string = "notBreaching"
53 | this.MissingDatapointBehavior = &missingDatapointBehavior
54 | return &this
55 | }
56 |
57 | // GetDatapointsToAlarm returns the DatapointsToAlarm field value
58 | func (o *PersistenceSettings) GetDatapointsToAlarm() int64 {
59 | if o == nil {
60 | var ret int64
61 | return ret
62 | }
63 |
64 | return o.DatapointsToAlarm
65 | }
66 |
67 | // GetDatapointsToAlarmOk returns a tuple with the DatapointsToAlarm field value
68 | // and a boolean to check if the value has been set.
69 | func (o *PersistenceSettings) GetDatapointsToAlarmOk() (*int64, bool) {
70 | if o == nil {
71 | return nil, false
72 | }
73 | return &o.DatapointsToAlarm, true
74 | }
75 |
76 | // SetDatapointsToAlarm sets field value
77 | func (o *PersistenceSettings) SetDatapointsToAlarm(v int64) {
78 | o.DatapointsToAlarm = v
79 | }
80 |
81 | // GetDatapointsInEvaluationWindow returns the DatapointsInEvaluationWindow field value
82 | func (o *PersistenceSettings) GetDatapointsInEvaluationWindow() int64 {
83 | if o == nil {
84 | var ret int64
85 | return ret
86 | }
87 |
88 | return o.DatapointsInEvaluationWindow
89 | }
90 |
91 | // GetDatapointsInEvaluationWindowOk returns a tuple with the DatapointsInEvaluationWindow field value
92 | // and a boolean to check if the value has been set.
93 | func (o *PersistenceSettings) GetDatapointsInEvaluationWindowOk() (*int64, bool) {
94 | if o == nil {
95 | return nil, false
96 | }
97 | return &o.DatapointsInEvaluationWindow, true
98 | }
99 |
100 | // SetDatapointsInEvaluationWindow sets field value
101 | func (o *PersistenceSettings) SetDatapointsInEvaluationWindow(v int64) {
102 | o.DatapointsInEvaluationWindow = v
103 | }
104 |
105 | // GetMissingDatapointBehavior returns the MissingDatapointBehavior field value if set, zero value otherwise.
106 | func (o *PersistenceSettings) GetMissingDatapointBehavior() string {
107 | if o == nil || IsNil(o.MissingDatapointBehavior) {
108 | var ret string
109 | return ret
110 | }
111 | return *o.MissingDatapointBehavior
112 | }
113 |
114 | // GetMissingDatapointBehaviorOk returns a tuple with the MissingDatapointBehavior field value if set, nil otherwise
115 | // and a boolean to check if the value has been set.
116 | func (o *PersistenceSettings) GetMissingDatapointBehaviorOk() (*string, bool) {
117 | if o == nil || IsNil(o.MissingDatapointBehavior) {
118 | return nil, false
119 | }
120 | return o.MissingDatapointBehavior, true
121 | }
122 |
123 | // HasMissingDatapointBehavior returns a boolean if a field has been set.
124 | func (o *PersistenceSettings) HasMissingDatapointBehavior() bool {
125 | if o != nil && !IsNil(o.MissingDatapointBehavior) {
126 | return true
127 | }
128 |
129 | return false
130 | }
131 |
132 | // SetMissingDatapointBehavior gets a reference to the given string and assigns it to the MissingDatapointBehavior field.
133 | func (o *PersistenceSettings) SetMissingDatapointBehavior(v string) {
134 | o.MissingDatapointBehavior = &v
135 | }
136 |
137 | func (o PersistenceSettings) MarshalJSON() ([]byte, error) {
138 | toSerialize, err := o.ToMap()
139 | if err != nil {
140 | return []byte{}, err
141 | }
142 | return json.Marshal(toSerialize)
143 | }
144 |
145 | func (o PersistenceSettings) ToMap() (map[string]interface{}, error) {
146 | toSerialize := map[string]interface{}{}
147 | toSerialize["datapointsToAlarm"] = o.DatapointsToAlarm
148 | toSerialize["datapointsInEvaluationWindow"] = o.DatapointsInEvaluationWindow
149 | if !IsNil(o.MissingDatapointBehavior) {
150 | toSerialize["missingDatapointBehavior"] = o.MissingDatapointBehavior
151 | }
152 | return toSerialize, nil
153 | }
154 |
155 | func (o *PersistenceSettings) UnmarshalJSON(data []byte) (err error) {
156 | // This validates that all required properties are included in the JSON object
157 | // by unmarshalling the object into a generic map with string keys and checking
158 | // that every required field exists as a key in the generic map.
159 | requiredProperties := []string{
160 | "datapointsToAlarm",
161 | "datapointsInEvaluationWindow",
162 | }
163 |
164 | allProperties := make(map[string]interface{})
165 |
166 | err = json.Unmarshal(data, &allProperties)
167 |
168 | if err != nil {
169 | return err
170 | }
171 |
172 | for _, requiredProperty := range requiredProperties {
173 | if _, exists := allProperties[requiredProperty]; !exists {
174 | return fmt.Errorf("no value given for required property %v", requiredProperty)
175 | }
176 | }
177 |
178 | varPersistenceSettings := _PersistenceSettings{}
179 |
180 | decoder := json.NewDecoder(bytes.NewReader(data))
181 | decoder.DisallowUnknownFields()
182 | err = decoder.Decode(&varPersistenceSettings)
183 |
184 | if err != nil {
185 | return err
186 | }
187 |
188 | *o = PersistenceSettings(varPersistenceSettings)
189 |
190 | return err
191 | }
192 |
193 | type NullablePersistenceSettings struct {
194 | value *PersistenceSettings
195 | isSet bool
196 | }
197 |
198 | func (v NullablePersistenceSettings) Get() *PersistenceSettings {
199 | return v.value
200 | }
201 |
202 | func (v *NullablePersistenceSettings) Set(val *PersistenceSettings) {
203 | v.value = val
204 | v.isSet = true
205 | }
206 |
207 | func (v NullablePersistenceSettings) IsSet() bool {
208 | return v.isSet
209 | }
210 |
211 | func (v *NullablePersistenceSettings) Unset() {
212 | v.value = nil
213 | v.isSet = false
214 | }
215 |
216 | func NewNullablePersistenceSettings(val *PersistenceSettings) *NullablePersistenceSettings {
217 | return &NullablePersistenceSettings{value: val, isSet: true}
218 | }
219 |
220 | func (v NullablePersistenceSettings) MarshalJSON() ([]byte, error) {
221 | return json.Marshal(v.value)
222 | }
223 |
224 | func (v *NullablePersistenceSettings) UnmarshalJSON(src []byte) error {
225 | v.isSet = true
226 | return json.Unmarshal(src, &v.value)
227 | }
228 |
```