diff --git a/metric_ruleset/model_aggregation_rule.go b/metric_ruleset/model_aggregation_rule.go index 5eaf881..e35336f 100644 --- a/metric_ruleset/model_aggregation_rule.go +++ b/metric_ruleset/model_aggregation_rule.go @@ -3,7 +3,7 @@ Metric Ruleset API Metric ruleset API -API version: 3.0.1 +API version: 3.3.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,6 +22,8 @@ type AggregationRule struct { // Status of this aggregation rule Enabled bool `json:"enabled"` Aggregator MetricAggregator `json:"aggregator"` + // Information about an aggregation rule. + Description *string `json:"description,omitempty"` } // NewAggregationRule instantiates a new AggregationRule object @@ -154,19 +156,48 @@ func (o *AggregationRule) SetAggregator(v MetricAggregator) { o.Aggregator = v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AggregationRule) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AggregationRule) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AggregationRule) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AggregationRule) SetDescription(v string) { + o.Description = &v +} + func (o AggregationRule) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if !isNil(o.Name) { toSerialize["name"] = o.Name } - if true { - toSerialize["matcher"] = o.Matcher - } - if true { - toSerialize["enabled"] = o.Enabled - } - if true { - toSerialize["aggregator"] = o.Aggregator + toSerialize["matcher"] = o.Matcher + toSerialize["enabled"] = o.Enabled + toSerialize["aggregator"] = o.Aggregator + if !isNil(o.Description) { + toSerialize["description"] = o.Description } return json.Marshal(toSerialize) } diff --git a/metric_ruleset/model_create_metric_ruleset_request.go b/metric_ruleset/model_create_metric_ruleset_request.go index 4ab85ec..e7024e5 100644 --- a/metric_ruleset/model_create_metric_ruleset_request.go +++ b/metric_ruleset/model_create_metric_ruleset_request.go @@ -22,6 +22,8 @@ type CreateMetricRulesetRequest struct { ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Name of the metric MetricName string `json:"metricName"` + // Information about the metric ruleset. + Description *string `json:"description,omitempty"` RoutingRule RoutingRule `json:"routingRule"` // Version of the ruleset Version int64 `json:"version"` @@ -135,6 +137,38 @@ func (o *CreateMetricRulesetRequest) SetMetricName(v string) { o.MetricName = v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateMetricRulesetRequest) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateMetricRulesetRequest) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateMetricRulesetRequest) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateMetricRulesetRequest) SetDescription(v string) { + o.Description = &v +} + // GetRoutingRule returns the RoutingRule field value func (o *CreateMetricRulesetRequest) GetRoutingRule() RoutingRule { if o == nil { @@ -192,6 +226,9 @@ func (o CreateMetricRulesetRequest) MarshalJSON() ([]byte, error) { toSerialize["exceptionRules"] = o.ExceptionRules } toSerialize["metricName"] = o.MetricName + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } toSerialize["routingRule"] = o.RoutingRule toSerialize["version"] = o.Version return json.Marshal(toSerialize) diff --git a/metric_ruleset/model_create_metric_ruleset_response.go b/metric_ruleset/model_create_metric_ruleset_response.go index 94a75e1..e15e111 100644 --- a/metric_ruleset/model_create_metric_ruleset_response.go +++ b/metric_ruleset/model_create_metric_ruleset_response.go @@ -36,6 +36,8 @@ type CreateMetricRulesetResponse struct { LastUpdated *int64 `json:"lastUpdated,omitempty"` // Name of the metric MetricName *string `json:"metricName,omitempty"` + // Information about the metric ruleset. + Description *string `json:"description,omitempty"` RoutingRule *RoutingRule `json:"routingRule,omitempty"` // Version of the ruleset Version *int64 `json:"version,omitempty"` @@ -378,6 +380,38 @@ func (o *CreateMetricRulesetResponse) SetMetricName(v string) { o.MetricName = &v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateMetricRulesetResponse) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateMetricRulesetResponse) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateMetricRulesetResponse) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateMetricRulesetResponse) SetDescription(v string) { + o.Description = &v +} + // GetRoutingRule returns the RoutingRule field value if set, zero value otherwise. func (o *CreateMetricRulesetResponse) GetRoutingRule() RoutingRule { if o == nil || isNil(o.RoutingRule) { @@ -474,6 +508,9 @@ func (o CreateMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.MetricName) { toSerialize["metricName"] = o.MetricName } + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } if !isNil(o.RoutingRule) { toSerialize["routingRule"] = o.RoutingRule } diff --git a/metric_ruleset/model_get_metric_ruleset_response.go b/metric_ruleset/model_get_metric_ruleset_response.go index a994637..871bf45 100644 --- a/metric_ruleset/model_get_metric_ruleset_response.go +++ b/metric_ruleset/model_get_metric_ruleset_response.go @@ -36,6 +36,8 @@ type GetMetricRulesetResponse struct { LastUpdated *int64 `json:"lastUpdated,omitempty"` // Name of the metric MetricName *string `json:"metricName,omitempty"` + // Information about an aggregation rule. + Description *string `json:"description,omitempty"` RoutingRule *RoutingRule `json:"routingRule,omitempty"` // Version of the ruleset Version *int64 `json:"version,omitempty"` @@ -378,6 +380,38 @@ func (o *GetMetricRulesetResponse) SetMetricName(v string) { o.MetricName = &v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetMetricRulesetResponse) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMetricRulesetResponse) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *GetMetricRulesetResponse) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *GetMetricRulesetResponse) SetDescription(v string) { + o.Description = &v +} + // GetRoutingRule returns the RoutingRule field value if set, zero value otherwise. func (o *GetMetricRulesetResponse) GetRoutingRule() RoutingRule { if o == nil || isNil(o.RoutingRule) { @@ -474,6 +508,9 @@ func (o GetMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.MetricName) { toSerialize["metricName"] = o.MetricName } + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } if !isNil(o.RoutingRule) { toSerialize["routingRule"] = o.RoutingRule } diff --git a/metric_ruleset/model_update_metric_ruleset_request.go b/metric_ruleset/model_update_metric_ruleset_request.go index abd0757..ae97956 100644 --- a/metric_ruleset/model_update_metric_ruleset_request.go +++ b/metric_ruleset/model_update_metric_ruleset_request.go @@ -3,7 +3,7 @@ Metric Ruleset API Metric ruleset API -API version: 3.0.1 +API version: 3.3.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,6 +22,8 @@ type UpdateMetricRulesetRequest struct { ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Name of the metric MetricName *string `json:"metricName,omitempty"` + // Information about an aggregation rule. + Description *string `json:"description,omitempty"` RoutingRule *RoutingRule `json:"routingRule,omitempty"` // Version of the ruleset Version *int64 `json:"version,omitempty"` @@ -140,6 +142,38 @@ func (o *UpdateMetricRulesetRequest) SetMetricName(v string) { o.MetricName = &v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateMetricRulesetRequest) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateMetricRulesetRequest) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateMetricRulesetRequest) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateMetricRulesetRequest) SetDescription(v string) { + o.Description = &v +} + // GetRoutingRule returns the RoutingRule field value if set, zero value otherwise. func (o *UpdateMetricRulesetRequest) GetRoutingRule() RoutingRule { if o == nil || isNil(o.RoutingRule) { @@ -215,6 +249,9 @@ func (o UpdateMetricRulesetRequest) MarshalJSON() ([]byte, error) { if !isNil(o.MetricName) { toSerialize["metricName"] = o.MetricName } + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } if !isNil(o.RoutingRule) { toSerialize["routingRule"] = o.RoutingRule } diff --git a/metric_ruleset/model_update_metric_ruleset_response.go b/metric_ruleset/model_update_metric_ruleset_response.go index 19ec57e..f1d86c1 100644 --- a/metric_ruleset/model_update_metric_ruleset_response.go +++ b/metric_ruleset/model_update_metric_ruleset_response.go @@ -36,6 +36,8 @@ type UpdateMetricRulesetResponse struct { LastUpdated *int64 `json:"lastUpdated,omitempty"` // Name of the metric MetricName *string `json:"metricName,omitempty"` + // Information about an aggregation rule. + Description *string `json:"description,omitempty"` RoutingRule *RoutingRule `json:"routingRule,omitempty"` // Version of the ruleset Version *int64 `json:"version,omitempty"` @@ -378,6 +380,38 @@ func (o *UpdateMetricRulesetResponse) SetMetricName(v string) { o.MetricName = &v } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateMetricRulesetResponse) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateMetricRulesetResponse) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateMetricRulesetResponse) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateMetricRulesetResponse) SetDescription(v string) { + o.Description = &v +} + // GetRoutingRule returns the RoutingRule field value if set, zero value otherwise. func (o *UpdateMetricRulesetResponse) GetRoutingRule() RoutingRule { if o == nil || isNil(o.RoutingRule) { @@ -474,6 +508,9 @@ func (o UpdateMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.MetricName) { toSerialize["metricName"] = o.MetricName } + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } if !isNil(o.RoutingRule) { toSerialize["routingRule"] = o.RoutingRule } diff --git a/metric_ruleset_test.go b/metric_ruleset_test.go index 42dd3af..4f29e82 100644 --- a/metric_ruleset_test.go +++ b/metric_ruleset_test.go @@ -16,16 +16,21 @@ func TestCreateArchivedMetricRuleset(t *testing.T) { mux.HandleFunc(MetricRulesetApiURL, verifyRequest(t, http.MethodPost, true, http.StatusOK, nil, "metric_ruleset/create_archived_ruleset_success.json")) dest := "Archived" + metricName := "container_cpu_utilization" ruleName := "TestRule" + rulesetDescription := "Metric ruleset for container_cpu_utilization" + exceptionRuleDescription := "exception rule 1" filterNot := false filterPropertyValue := "container_id" result, err := client.CreateMetricRuleset(context.Background(), &metric_ruleset.CreateMetricRulesetRequest{ - MetricName: "container_cpu_utilization", - Version: 1, + MetricName: metricName, + Description: &rulesetDescription, + Version: 1, ExceptionRules: []metric_ruleset.ExceptionRule{ { - Name: ruleName, - Enabled: true, + Name: ruleName, + Description: &exceptionRuleDescription, + Enabled: true, Matcher: metric_ruleset.DimensionMatcher{ Type: "dimension", Filters: []metric_ruleset.PropertyFilter{ @@ -44,8 +49,11 @@ func TestCreateArchivedMetricRuleset(t *testing.T) { }) assert.NoError(t, err, "Unexpected error creating metric ruleset") - assert.Equal(t, "container_cpu_utilization", *result.MetricName, "MetricName does not match") + assert.Equal(t, metricName, *result.MetricName, "MetricName does not match") + assert.Equal(t, rulesetDescription, *result.Description, "Description does not match") assert.Equal(t, 1, len(result.ExceptionRules), "Unexpected length of exception rules array") + assert.Equal(t, ruleName, result.ExceptionRules[0].Name, "Exception rule name does not match") + assert.Equal(t, &exceptionRuleDescription, result.ExceptionRules[0].Description, "Exception rule description does not match") assert.Equal(t, 1, len(result.ExceptionRules[0].Matcher.Filters), "Unexpected length of exception rule filter array") assert.Equal(t, 2, len(result.ExceptionRules[0].Matcher.Filters[0].PropertyValue), "Unexpected length of exception rule filter property values array") assert.Equal(t, dest, *result.RoutingRule.Destination, "RoutingRule destination does not match expected") diff --git a/testdata/fixtures/metric_ruleset/create_archived_ruleset_success.json b/testdata/fixtures/metric_ruleset/create_archived_ruleset_success.json index ea32c56..3cc18c1 100644 --- a/testdata/fixtures/metric_ruleset/create_archived_ruleset_success.json +++ b/testdata/fixtures/metric_ruleset/create_archived_ruleset_success.json @@ -10,7 +10,8 @@ } ], "type": "dimension" }, - "name": "TestRule" + "name": "TestRule", + "description": "exception rule 1" } ], "created": 1674598662022, @@ -21,6 +22,7 @@ "lastUpdatedBy": "TestUpdatedId", "lastUpdatedByName": "TestName", "metricName": "container_cpu_utilization", + "description": "Metric ruleset for container_cpu_utilization", "routingRule": { "destination": "Archived" },