From 33e8fbfa4d8989933e306aace26393669247d9a2 Mon Sep 17 00:00:00 2001 From: Eric Choi Date: Wed, 7 Aug 2024 18:14:53 -0700 Subject: [PATCH] Removed a modified file from pull request --- .../model_create_metric_ruleset_request.go | 59 +++------- .../model_create_metric_ruleset_response.go | 65 +++-------- metric_ruleset/model_destination.go | 56 ++++++++++ .../model_get_metric_ruleset_response.go | 65 +++-------- .../model_get_metric_rulesets_response.go | 8 +- metric_ruleset/model_metric_ruleset.go | 102 +++--------------- .../model_update_metric_ruleset_response.go | 65 +++-------- metric_ruleset_test.go | 48 +-------- 8 files changed, 132 insertions(+), 336 deletions(-) create mode 100644 metric_ruleset/model_destination.go diff --git a/metric_ruleset/model_create_metric_ruleset_request.go b/metric_ruleset/model_create_metric_ruleset_request.go index 4ab85ec..bafaeb1 100644 --- a/metric_ruleset/model_create_metric_ruleset_request.go +++ b/metric_ruleset/model_create_metric_ruleset_request.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -18,8 +18,6 @@ import ( type CreateMetricRulesetRequest struct { // Aggregation rules in the ruleset AggregationRules []AggregationRule `json:"aggregationRules,omitempty"` - // List of exception rules. Exception rules reroute a metric time series (MTS) from an archival route to a real-time route if the MTS contains values that match those of a specified filter. - ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Name of the metric MetricName string `json:"metricName"` RoutingRule RoutingRule `json:"routingRule"` @@ -60,7 +58,7 @@ func (o *CreateMetricRulesetRequest) GetAggregationRules() []AggregationRule { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetRequest) GetAggregationRulesOk() ([]AggregationRule, bool) { if o == nil || isNil(o.AggregationRules) { - return nil, false + return nil, false } return o.AggregationRules, true } @@ -79,38 +77,6 @@ func (o *CreateMetricRulesetRequest) SetAggregationRules(v []AggregationRule) { o.AggregationRules = v } -// GetExceptionRules returns the ExceptionRules field value if set, zero value otherwise. -func (o *CreateMetricRulesetRequest) GetExceptionRules() []ExceptionRule { - if o == nil || isNil(o.ExceptionRules) { - var ret []ExceptionRule - return ret - } - return o.ExceptionRules -} - -// GetExceptionRulesOk returns a tuple with the ExceptionRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateMetricRulesetRequest) GetExceptionRulesOk() ([]ExceptionRule, bool) { - if o == nil || isNil(o.ExceptionRules) { - return nil, false - } - return o.ExceptionRules, true -} - -// HasExceptionRules returns a boolean if a field has been set. -func (o *CreateMetricRulesetRequest) HasExceptionRules() bool { - if o != nil && !isNil(o.ExceptionRules) { - return true - } - - return false -} - -// SetExceptionRules gets a reference to the given []ExceptionRule and assigns it to the ExceptionRules field. -func (o *CreateMetricRulesetRequest) SetExceptionRules(v []ExceptionRule) { - o.ExceptionRules = v -} - // GetMetricName returns the MetricName field value func (o *CreateMetricRulesetRequest) GetMetricName() string { if o == nil { @@ -125,7 +91,7 @@ func (o *CreateMetricRulesetRequest) GetMetricName() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetRequest) GetMetricNameOk() (*string, bool) { if o == nil { - return nil, false + return nil, false } return &o.MetricName, true } @@ -149,7 +115,7 @@ func (o *CreateMetricRulesetRequest) GetRoutingRule() RoutingRule { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetRequest) GetRoutingRuleOk() (*RoutingRule, bool) { if o == nil { - return nil, false + return nil, false } return &o.RoutingRule, true } @@ -173,7 +139,7 @@ func (o *CreateMetricRulesetRequest) GetVersion() int64 { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetRequest) GetVersionOk() (*int64, bool) { if o == nil { - return nil, false + return nil, false } return &o.Version, true } @@ -188,12 +154,15 @@ func (o CreateMetricRulesetRequest) MarshalJSON() ([]byte, error) { if !isNil(o.AggregationRules) { toSerialize["aggregationRules"] = o.AggregationRules } - if !isNil(o.ExceptionRules) { - toSerialize["exceptionRules"] = o.ExceptionRules + if true { + toSerialize["metricName"] = o.MetricName + } + if true { + toSerialize["routingRule"] = o.RoutingRule + } + if true { + toSerialize["version"] = o.Version } - toSerialize["metricName"] = o.MetricName - 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..18d7fb6 100644 --- a/metric_ruleset/model_create_metric_ruleset_response.go +++ b/metric_ruleset/model_create_metric_ruleset_response.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,10 +22,8 @@ type CreateMetricRulesetResponse struct { Creator *string `json:"creator,omitempty"` // Name of the user who created this metric ruleset CreatorName *string `json:"creatorName,omitempty"` - // Ruleset creation timestamp + // Date and time when this ruleset was created Created *int64 `json:"created,omitempty"` - // List of exception rules. Exception rules reroute a metric time series (MTS) from an archival route to a real-time route if the MTS contains values that match those of a specified filter. - ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Ruleset ID Id *string `json:"id,omitempty"` // ID of the user who last updated the ruleset @@ -71,7 +69,7 @@ func (o *CreateMetricRulesetResponse) GetAggregationRules() []AggregationRule { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetAggregationRulesOk() ([]AggregationRule, bool) { if o == nil || isNil(o.AggregationRules) { - return nil, false + return nil, false } return o.AggregationRules, true } @@ -103,7 +101,7 @@ func (o *CreateMetricRulesetResponse) GetCreator() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetCreatorOk() (*string, bool) { if o == nil || isNil(o.Creator) { - return nil, false + return nil, false } return o.Creator, true } @@ -135,7 +133,7 @@ func (o *CreateMetricRulesetResponse) GetCreatorName() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetCreatorNameOk() (*string, bool) { if o == nil || isNil(o.CreatorName) { - return nil, false + return nil, false } return o.CreatorName, true } @@ -167,7 +165,7 @@ func (o *CreateMetricRulesetResponse) GetCreated() int64 { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetCreatedOk() (*int64, bool) { if o == nil || isNil(o.Created) { - return nil, false + return nil, false } return o.Created, true } @@ -186,38 +184,6 @@ func (o *CreateMetricRulesetResponse) SetCreated(v int64) { o.Created = &v } -// GetExceptionRules returns the ExceptionRules field value if set, zero value otherwise. -func (o *CreateMetricRulesetResponse) GetExceptionRules() []ExceptionRule { - if o == nil || isNil(o.ExceptionRules) { - var ret []ExceptionRule - return ret - } - return o.ExceptionRules -} - -// GetExceptionRulesOk returns a tuple with the ExceptionRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateMetricRulesetResponse) GetExceptionRulesOk() ([]ExceptionRule, bool) { - if o == nil || isNil(o.ExceptionRules) { - return nil, false - } - return o.ExceptionRules, true -} - -// HasExceptionRules returns a boolean if a field has been set. -func (o *CreateMetricRulesetResponse) HasExceptionRules() bool { - if o != nil && !isNil(o.ExceptionRules) { - return true - } - - return false -} - -// SetExceptionRules gets a reference to the given []ExceptionRule and assigns it to the ExceptionRules field. -func (o *CreateMetricRulesetResponse) SetExceptionRules(v []ExceptionRule) { - o.ExceptionRules = v -} - // GetId returns the Id field value if set, zero value otherwise. func (o *CreateMetricRulesetResponse) GetId() string { if o == nil || isNil(o.Id) { @@ -231,7 +197,7 @@ func (o *CreateMetricRulesetResponse) GetId() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetIdOk() (*string, bool) { if o == nil || isNil(o.Id) { - return nil, false + return nil, false } return o.Id, true } @@ -263,7 +229,7 @@ func (o *CreateMetricRulesetResponse) GetLastUpdatedBy() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetLastUpdatedByOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedBy) { - return nil, false + return nil, false } return o.LastUpdatedBy, true } @@ -295,7 +261,7 @@ func (o *CreateMetricRulesetResponse) GetLastUpdatedByName() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetLastUpdatedByNameOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedByName) { - return nil, false + return nil, false } return o.LastUpdatedByName, true } @@ -327,7 +293,7 @@ func (o *CreateMetricRulesetResponse) GetLastUpdated() int64 { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetLastUpdatedOk() (*int64, bool) { if o == nil || isNil(o.LastUpdated) { - return nil, false + return nil, false } return o.LastUpdated, true } @@ -359,7 +325,7 @@ func (o *CreateMetricRulesetResponse) GetMetricName() string { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetMetricNameOk() (*string, bool) { if o == nil || isNil(o.MetricName) { - return nil, false + return nil, false } return o.MetricName, true } @@ -391,7 +357,7 @@ func (o *CreateMetricRulesetResponse) GetRoutingRule() RoutingRule { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetRoutingRuleOk() (*RoutingRule, bool) { if o == nil || isNil(o.RoutingRule) { - return nil, false + return nil, false } return o.RoutingRule, true } @@ -423,7 +389,7 @@ func (o *CreateMetricRulesetResponse) GetVersion() int64 { // and a boolean to check if the value has been set. func (o *CreateMetricRulesetResponse) GetVersionOk() (*int64, bool) { if o == nil || isNil(o.Version) { - return nil, false + return nil, false } return o.Version, true } @@ -456,9 +422,6 @@ func (o CreateMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.Created) { toSerialize["created"] = o.Created } - if !isNil(o.ExceptionRules) { - toSerialize["exceptionRules"] = o.ExceptionRules - } if !isNil(o.Id) { toSerialize["id"] = o.Id } diff --git a/metric_ruleset/model_destination.go b/metric_ruleset/model_destination.go new file mode 100644 index 0000000..79849c0 --- /dev/null +++ b/metric_ruleset/model_destination.go @@ -0,0 +1,56 @@ +/* +Metric Ingest Ruleset API + +Metric ingest ruleset API + +API version: 3.0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package metric_ruleset + +import ( + "encoding/json" + "fmt" +) + +// Destination The routing destination for your data points +type Destination string + +// List of Destination +const ( + UNKNOWN Destination = "Unknown" + REALTIME_13_MO Destination = "Realtime_13MO" + REALTIME_3_MO Destination = "Realtime_3MO" + HCM Destination = "HCM" + FULL_FIDELITY Destination = "FullFidelity" + DROP Destination = "Drop" +) + +// All allowed values of Destination enum +var AllowedDestinationEnumValues = []Destination{ + "Unknown", + "Realtime_13MO", + "Realtime_3MO", + "HCM", + "FullFidelity", + "Drop", +} + +func (v *Destination) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Destination(value) + for _, existing := range AllowedDestinationEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Destination", value) +} diff --git a/metric_ruleset/model_get_metric_ruleset_response.go b/metric_ruleset/model_get_metric_ruleset_response.go index a994637..aebf6a9 100644 --- a/metric_ruleset/model_get_metric_ruleset_response.go +++ b/metric_ruleset/model_get_metric_ruleset_response.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,10 +22,8 @@ type GetMetricRulesetResponse struct { Creator *string `json:"creator,omitempty"` // Name of the user who created this metric ruleset CreatorName *string `json:"creatorName,omitempty"` - // Ruleset creation timestamp + // Date and time when this ruleset was created Created *int64 `json:"created,omitempty"` - // List of exception rules. Exception rules reroute a metric time series (MTS) from an archival route to a real-time route if the MTS contains values that match those of a specified filter. - ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Ruleset ID Id *string `json:"id,omitempty"` // ID of the user who last updated the ruleset @@ -71,7 +69,7 @@ func (o *GetMetricRulesetResponse) GetAggregationRules() []AggregationRule { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetAggregationRulesOk() ([]AggregationRule, bool) { if o == nil || isNil(o.AggregationRules) { - return nil, false + return nil, false } return o.AggregationRules, true } @@ -103,7 +101,7 @@ func (o *GetMetricRulesetResponse) GetCreator() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetCreatorOk() (*string, bool) { if o == nil || isNil(o.Creator) { - return nil, false + return nil, false } return o.Creator, true } @@ -135,7 +133,7 @@ func (o *GetMetricRulesetResponse) GetCreatorName() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetCreatorNameOk() (*string, bool) { if o == nil || isNil(o.CreatorName) { - return nil, false + return nil, false } return o.CreatorName, true } @@ -167,7 +165,7 @@ func (o *GetMetricRulesetResponse) GetCreated() int64 { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetCreatedOk() (*int64, bool) { if o == nil || isNil(o.Created) { - return nil, false + return nil, false } return o.Created, true } @@ -186,38 +184,6 @@ func (o *GetMetricRulesetResponse) SetCreated(v int64) { o.Created = &v } -// GetExceptionRules returns the ExceptionRules field value if set, zero value otherwise. -func (o *GetMetricRulesetResponse) GetExceptionRules() []ExceptionRule { - if o == nil || isNil(o.ExceptionRules) { - var ret []ExceptionRule - return ret - } - return o.ExceptionRules -} - -// GetExceptionRulesOk returns a tuple with the ExceptionRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetMetricRulesetResponse) GetExceptionRulesOk() ([]ExceptionRule, bool) { - if o == nil || isNil(o.ExceptionRules) { - return nil, false - } - return o.ExceptionRules, true -} - -// HasExceptionRules returns a boolean if a field has been set. -func (o *GetMetricRulesetResponse) HasExceptionRules() bool { - if o != nil && !isNil(o.ExceptionRules) { - return true - } - - return false -} - -// SetExceptionRules gets a reference to the given []ExceptionRule and assigns it to the ExceptionRules field. -func (o *GetMetricRulesetResponse) SetExceptionRules(v []ExceptionRule) { - o.ExceptionRules = v -} - // GetId returns the Id field value if set, zero value otherwise. func (o *GetMetricRulesetResponse) GetId() string { if o == nil || isNil(o.Id) { @@ -231,7 +197,7 @@ func (o *GetMetricRulesetResponse) GetId() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetIdOk() (*string, bool) { if o == nil || isNil(o.Id) { - return nil, false + return nil, false } return o.Id, true } @@ -263,7 +229,7 @@ func (o *GetMetricRulesetResponse) GetLastUpdatedBy() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetLastUpdatedByOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedBy) { - return nil, false + return nil, false } return o.LastUpdatedBy, true } @@ -295,7 +261,7 @@ func (o *GetMetricRulesetResponse) GetLastUpdatedByName() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetLastUpdatedByNameOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedByName) { - return nil, false + return nil, false } return o.LastUpdatedByName, true } @@ -327,7 +293,7 @@ func (o *GetMetricRulesetResponse) GetLastUpdated() int64 { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetLastUpdatedOk() (*int64, bool) { if o == nil || isNil(o.LastUpdated) { - return nil, false + return nil, false } return o.LastUpdated, true } @@ -359,7 +325,7 @@ func (o *GetMetricRulesetResponse) GetMetricName() string { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetMetricNameOk() (*string, bool) { if o == nil || isNil(o.MetricName) { - return nil, false + return nil, false } return o.MetricName, true } @@ -391,7 +357,7 @@ func (o *GetMetricRulesetResponse) GetRoutingRule() RoutingRule { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetRoutingRuleOk() (*RoutingRule, bool) { if o == nil || isNil(o.RoutingRule) { - return nil, false + return nil, false } return o.RoutingRule, true } @@ -423,7 +389,7 @@ func (o *GetMetricRulesetResponse) GetVersion() int64 { // and a boolean to check if the value has been set. func (o *GetMetricRulesetResponse) GetVersionOk() (*int64, bool) { if o == nil || isNil(o.Version) { - return nil, false + return nil, false } return o.Version, true } @@ -456,9 +422,6 @@ func (o GetMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.Created) { toSerialize["created"] = o.Created } - if !isNil(o.ExceptionRules) { - toSerialize["exceptionRules"] = o.ExceptionRules - } if !isNil(o.Id) { toSerialize["id"] = o.Id } diff --git a/metric_ruleset/model_get_metric_rulesets_response.go b/metric_ruleset/model_get_metric_rulesets_response.go index ca3e65a..259eef0 100644 --- a/metric_ruleset/model_get_metric_rulesets_response.go +++ b/metric_ruleset/model_get_metric_rulesets_response.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -52,7 +52,7 @@ func (o *GetMetricRulesetsResponse) GetCount() int32 { // and a boolean to check if the value has been set. func (o *GetMetricRulesetsResponse) GetCountOk() (*int32, bool) { if o == nil || isNil(o.Count) { - return nil, false + return nil, false } return o.Count, true } @@ -84,7 +84,7 @@ func (o *GetMetricRulesetsResponse) GetResults() []MetricRuleset { // and a boolean to check if the value has been set. func (o *GetMetricRulesetsResponse) GetResultsOk() ([]MetricRuleset, bool) { if o == nil || isNil(o.Results) { - return nil, false + return nil, false } return o.Results, true } diff --git a/metric_ruleset/model_metric_ruleset.go b/metric_ruleset/model_metric_ruleset.go index 50def0d..3fc57bb 100644 --- a/metric_ruleset/model_metric_ruleset.go +++ b/metric_ruleset/model_metric_ruleset.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,10 +22,8 @@ type MetricRuleset struct { Creator *string `json:"creator,omitempty"` // Name of the user who created this metric ruleset CreatorName *string `json:"creatorName,omitempty"` - // Ruleset creation timestamp + // Date and time when this ruleset was created Created *int64 `json:"created,omitempty"` - // List of exception rules. Exception rules reroute a metric time series (MTS) from an archival route to a real-time route if the MTS contains values that match those of a specified filter. - ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Ruleset ID Id *string `json:"id,omitempty"` // ID of the user who last updated the ruleset @@ -39,8 +37,6 @@ type MetricRuleset struct { RoutingRule *RoutingRule `json:"routingRule,omitempty"` // Version of the ruleset Version *int64 `json:"version,omitempty"` - // Information about the metric ruleset. - Description *string `json:"description,omitempty"` } // NewMetricRuleset instantiates a new MetricRuleset object @@ -73,7 +69,7 @@ func (o *MetricRuleset) GetAggregationRules() []AggregationRule { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetAggregationRulesOk() ([]AggregationRule, bool) { if o == nil || isNil(o.AggregationRules) { - return nil, false + return nil, false } return o.AggregationRules, true } @@ -105,7 +101,7 @@ func (o *MetricRuleset) GetCreator() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetCreatorOk() (*string, bool) { if o == nil || isNil(o.Creator) { - return nil, false + return nil, false } return o.Creator, true } @@ -137,7 +133,7 @@ func (o *MetricRuleset) GetCreatorName() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetCreatorNameOk() (*string, bool) { if o == nil || isNil(o.CreatorName) { - return nil, false + return nil, false } return o.CreatorName, true } @@ -169,7 +165,7 @@ func (o *MetricRuleset) GetCreated() int64 { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetCreatedOk() (*int64, bool) { if o == nil || isNil(o.Created) { - return nil, false + return nil, false } return o.Created, true } @@ -188,38 +184,6 @@ func (o *MetricRuleset) SetCreated(v int64) { o.Created = &v } -// GetExceptionRules returns the ExceptionRules field value if set, zero value otherwise. -func (o *MetricRuleset) GetExceptionRules() []ExceptionRule { - if o == nil || isNil(o.ExceptionRules) { - var ret []ExceptionRule - return ret - } - return o.ExceptionRules -} - -// GetExceptionRulesOk returns a tuple with the ExceptionRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *MetricRuleset) GetExceptionRulesOk() ([]ExceptionRule, bool) { - if o == nil || isNil(o.ExceptionRules) { - return nil, false - } - return o.ExceptionRules, true -} - -// HasExceptionRules returns a boolean if a field has been set. -func (o *MetricRuleset) HasExceptionRules() bool { - if o != nil && !isNil(o.ExceptionRules) { - return true - } - - return false -} - -// SetExceptionRules gets a reference to the given []ExceptionRule and assigns it to the ExceptionRules field. -func (o *MetricRuleset) SetExceptionRules(v []ExceptionRule) { - o.ExceptionRules = v -} - // GetId returns the Id field value if set, zero value otherwise. func (o *MetricRuleset) GetId() string { if o == nil || isNil(o.Id) { @@ -233,7 +197,7 @@ func (o *MetricRuleset) GetId() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetIdOk() (*string, bool) { if o == nil || isNil(o.Id) { - return nil, false + return nil, false } return o.Id, true } @@ -265,7 +229,7 @@ func (o *MetricRuleset) GetLastUpdatedBy() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetLastUpdatedByOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedBy) { - return nil, false + return nil, false } return o.LastUpdatedBy, true } @@ -297,7 +261,7 @@ func (o *MetricRuleset) GetLastUpdatedByName() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetLastUpdatedByNameOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedByName) { - return nil, false + return nil, false } return o.LastUpdatedByName, true } @@ -329,7 +293,7 @@ func (o *MetricRuleset) GetLastUpdated() int64 { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetLastUpdatedOk() (*int64, bool) { if o == nil || isNil(o.LastUpdated) { - return nil, false + return nil, false } return o.LastUpdated, true } @@ -361,7 +325,7 @@ func (o *MetricRuleset) GetMetricName() string { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetMetricNameOk() (*string, bool) { if o == nil || isNil(o.MetricName) { - return nil, false + return nil, false } return o.MetricName, true } @@ -393,7 +357,7 @@ func (o *MetricRuleset) GetRoutingRule() RoutingRule { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetRoutingRuleOk() (*RoutingRule, bool) { if o == nil || isNil(o.RoutingRule) { - return nil, false + return nil, false } return o.RoutingRule, true } @@ -425,7 +389,7 @@ func (o *MetricRuleset) GetVersion() int64 { // and a boolean to check if the value has been set. func (o *MetricRuleset) GetVersionOk() (*int64, bool) { if o == nil || isNil(o.Version) { - return nil, false + return nil, false } return o.Version, true } @@ -444,38 +408,6 @@ func (o *MetricRuleset) SetVersion(v int64) { o.Version = &v } -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *MetricRuleset) 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 *MetricRuleset) 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 *MetricRuleset) 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 *MetricRuleset) SetDescription(v string) { - o.Description = &v -} - func (o MetricRuleset) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if !isNil(o.AggregationRules) { @@ -490,9 +422,6 @@ func (o MetricRuleset) MarshalJSON() ([]byte, error) { if !isNil(o.Created) { toSerialize["created"] = o.Created } - if !isNil(o.ExceptionRules) { - toSerialize["exceptionRules"] = o.ExceptionRules - } if !isNil(o.Id) { toSerialize["id"] = o.Id } @@ -514,9 +443,6 @@ func (o MetricRuleset) MarshalJSON() ([]byte, error) { if !isNil(o.Version) { toSerialize["version"] = o.Version } - if !isNil(o.Description) { - toSerialize["description"] = o.Description - } return json.Marshal(toSerialize) } diff --git a/metric_ruleset/model_update_metric_ruleset_response.go b/metric_ruleset/model_update_metric_ruleset_response.go index 19ec57e..bf26ba8 100644 --- a/metric_ruleset/model_update_metric_ruleset_response.go +++ b/metric_ruleset/model_update_metric_ruleset_response.go @@ -1,9 +1,9 @@ /* Metric Ruleset API - Metric ruleset API +Metric ruleset API -API version: 3.3.0 +API version: 3.0.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -22,10 +22,8 @@ type UpdateMetricRulesetResponse struct { Creator *string `json:"creator,omitempty"` // Name of the user who created this metric ruleset CreatorName *string `json:"creatorName,omitempty"` - // Ruleset creation timestamp + // Date and time when this ruleset was created Created *int64 `json:"created,omitempty"` - // List of exception rules. Exception rules reroute a metric time series (MTS) from an archival route to a real-time route if the MTS contains values that match those of a specified filter. - ExceptionRules []ExceptionRule `json:"exceptionRules,omitempty"` // Ruleset ID Id *string `json:"id,omitempty"` // ID of the user who last updated the ruleset @@ -71,7 +69,7 @@ func (o *UpdateMetricRulesetResponse) GetAggregationRules() []AggregationRule { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetAggregationRulesOk() ([]AggregationRule, bool) { if o == nil || isNil(o.AggregationRules) { - return nil, false + return nil, false } return o.AggregationRules, true } @@ -103,7 +101,7 @@ func (o *UpdateMetricRulesetResponse) GetCreator() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetCreatorOk() (*string, bool) { if o == nil || isNil(o.Creator) { - return nil, false + return nil, false } return o.Creator, true } @@ -135,7 +133,7 @@ func (o *UpdateMetricRulesetResponse) GetCreatorName() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetCreatorNameOk() (*string, bool) { if o == nil || isNil(o.CreatorName) { - return nil, false + return nil, false } return o.CreatorName, true } @@ -167,7 +165,7 @@ func (o *UpdateMetricRulesetResponse) GetCreated() int64 { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetCreatedOk() (*int64, bool) { if o == nil || isNil(o.Created) { - return nil, false + return nil, false } return o.Created, true } @@ -186,38 +184,6 @@ func (o *UpdateMetricRulesetResponse) SetCreated(v int64) { o.Created = &v } -// GetExceptionRules returns the ExceptionRules field value if set, zero value otherwise. -func (o *UpdateMetricRulesetResponse) GetExceptionRules() []ExceptionRule { - if o == nil || isNil(o.ExceptionRules) { - var ret []ExceptionRule - return ret - } - return o.ExceptionRules -} - -// GetExceptionRulesOk returns a tuple with the ExceptionRules field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateMetricRulesetResponse) GetExceptionRulesOk() ([]ExceptionRule, bool) { - if o == nil || isNil(o.ExceptionRules) { - return nil, false - } - return o.ExceptionRules, true -} - -// HasExceptionRules returns a boolean if a field has been set. -func (o *UpdateMetricRulesetResponse) HasExceptionRules() bool { - if o != nil && !isNil(o.ExceptionRules) { - return true - } - - return false -} - -// SetExceptionRules gets a reference to the given []ExceptionRule and assigns it to the ExceptionRules field. -func (o *UpdateMetricRulesetResponse) SetExceptionRules(v []ExceptionRule) { - o.ExceptionRules = v -} - // GetId returns the Id field value if set, zero value otherwise. func (o *UpdateMetricRulesetResponse) GetId() string { if o == nil || isNil(o.Id) { @@ -231,7 +197,7 @@ func (o *UpdateMetricRulesetResponse) GetId() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetIdOk() (*string, bool) { if o == nil || isNil(o.Id) { - return nil, false + return nil, false } return o.Id, true } @@ -263,7 +229,7 @@ func (o *UpdateMetricRulesetResponse) GetLastUpdatedBy() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetLastUpdatedByOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedBy) { - return nil, false + return nil, false } return o.LastUpdatedBy, true } @@ -295,7 +261,7 @@ func (o *UpdateMetricRulesetResponse) GetLastUpdatedByName() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetLastUpdatedByNameOk() (*string, bool) { if o == nil || isNil(o.LastUpdatedByName) { - return nil, false + return nil, false } return o.LastUpdatedByName, true } @@ -327,7 +293,7 @@ func (o *UpdateMetricRulesetResponse) GetLastUpdated() int64 { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetLastUpdatedOk() (*int64, bool) { if o == nil || isNil(o.LastUpdated) { - return nil, false + return nil, false } return o.LastUpdated, true } @@ -359,7 +325,7 @@ func (o *UpdateMetricRulesetResponse) GetMetricName() string { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetMetricNameOk() (*string, bool) { if o == nil || isNil(o.MetricName) { - return nil, false + return nil, false } return o.MetricName, true } @@ -391,7 +357,7 @@ func (o *UpdateMetricRulesetResponse) GetRoutingRule() RoutingRule { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetRoutingRuleOk() (*RoutingRule, bool) { if o == nil || isNil(o.RoutingRule) { - return nil, false + return nil, false } return o.RoutingRule, true } @@ -423,7 +389,7 @@ func (o *UpdateMetricRulesetResponse) GetVersion() int64 { // and a boolean to check if the value has been set. func (o *UpdateMetricRulesetResponse) GetVersionOk() (*int64, bool) { if o == nil || isNil(o.Version) { - return nil, false + return nil, false } return o.Version, true } @@ -456,9 +422,6 @@ func (o UpdateMetricRulesetResponse) MarshalJSON() ([]byte, error) { if !isNil(o.Created) { toSerialize["created"] = o.Created } - if !isNil(o.ExceptionRules) { - toSerialize["exceptionRules"] = o.ExceptionRules - } if !isNil(o.Id) { toSerialize["id"] = o.Id } diff --git a/metric_ruleset_test.go b/metric_ruleset_test.go index 42dd3af..abaf17c 100644 --- a/metric_ruleset_test.go +++ b/metric_ruleset_test.go @@ -9,55 +9,13 @@ import ( "github.com/stretchr/testify/assert" ) -func TestCreateArchivedMetricRuleset(t *testing.T) { - teardown := setup() - defer teardown() - - mux.HandleFunc(MetricRulesetApiURL, verifyRequest(t, http.MethodPost, true, http.StatusOK, nil, "metric_ruleset/create_archived_ruleset_success.json")) - - dest := "Archived" - ruleName := "TestRule" - filterNot := false - filterPropertyValue := "container_id" - result, err := client.CreateMetricRuleset(context.Background(), &metric_ruleset.CreateMetricRulesetRequest{ - MetricName: "container_cpu_utilization", - Version: 1, - ExceptionRules: []metric_ruleset.ExceptionRule{ - { - Name: ruleName, - Enabled: true, - Matcher: metric_ruleset.DimensionMatcher{ - Type: "dimension", - Filters: []metric_ruleset.PropertyFilter{ - { - NOT: &filterNot, - Property: &filterPropertyValue, - PropertyValue: []string{"cont_a", "cont_b"}, - }, - }, - }, - }, - }, - RoutingRule: metric_ruleset.RoutingRule{ - Destination: (*string)(&dest), - }, - }) - - assert.NoError(t, err, "Unexpected error creating metric ruleset") - assert.Equal(t, "container_cpu_utilization", *result.MetricName, "MetricName does not match") - assert.Equal(t, 1, len(result.ExceptionRules), "Unexpected length of exception rules array") - 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") -} - func TestCreateMetricRuleset(t *testing.T) { teardown := setup() defer teardown() mux.HandleFunc(MetricRulesetApiURL, verifyRequest(t, http.MethodPost, true, http.StatusOK, nil, "metric_ruleset/create_ruleset_success.json")) - dest := "RealTime" + dest := metric_ruleset.FULL_FIDELITY dropDimensions := false ruleName := "TestRule" result, err := client.CreateMetricRuleset(context.Background(), &metric_ruleset.CreateMetricRulesetRequest{ @@ -69,7 +27,6 @@ func TestCreateMetricRuleset(t *testing.T) { Enabled: true, Matcher: metric_ruleset.MetricMatcher{ DimensionMatcher: &metric_ruleset.DimensionMatcher{ - Type: "dimension", Filters: []metric_ruleset.PropertyFilter{}, }, }, @@ -92,7 +49,6 @@ func TestCreateMetricRuleset(t *testing.T) { assert.Equal(t, "container_cpu_utilization", *result.MetricName, "MetricName does not match") assert.Equal(t, 1, len(result.AggregationRules), "Unexpected length of aggregation rules array") assert.Equal(t, "rollup", result.AggregationRules[0].Aggregator.RollupAggregator.Type, "Aggregation Rule type does not match expected") - assert.Equal(t, dest, *result.RoutingRule.Destination, "RoutingRule destination does not match expected") } func TestGetMetricRuleset(t *testing.T) { @@ -113,7 +69,7 @@ func TestUpdateMetricRuleset(t *testing.T) { mux.HandleFunc(MetricRulesetApiURL+"/TestId", verifyRequest(t, http.MethodPut, true, http.StatusOK, nil, "metric_ruleset/update_ruleset_success.json")) metricName := "container_cpu_utilization" - dest := "Drop" + dest := metric_ruleset.DROP version := int64(2) dropDimensions := false ruleName := "UpdatedName"