-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instana/resource-sli-config.go
Outdated
SliConfigFieldMetricConfiguration: SliConfigMetricConfiguration, | ||
SliConfigFieldSliEntity: SliConfigSliEntity, | ||
}, | ||
SchemaVersion: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial schema version should be 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misconception on my part, initial schema version set to 0
instana/resource-sli-config.go
Outdated
SliConfigFieldSliEntity: SliConfigSliEntity, | ||
}, | ||
SchemaVersion: 1, | ||
StateUpgraders: []schema.StateUpgrader{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the initial version no state upgrader is required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misconception on my part, state upgrader removed
instana/resource-sli-config.go
Outdated
func mapStateToDataObjectForSliConfig(d *schema.ResourceData, formatter utils.ResourceNameFormatter) (restapi.InstanaDataObject, error) { | ||
metricConfigurationsList := d.Get(SliConfigFieldMetricConfiguration).([]interface{}) | ||
var metricConfiguration restapi.MetricConfiguration | ||
if len(metricConfigurationsList) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be moved into a separate method mapMetricConfigurationEntityFromState()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored into separate method
instana/resource-sli-config.go
Outdated
|
||
sliEntitiesList := d.Get(SliConfigFieldSliEntity).([]interface{}) | ||
var sliEntity restapi.SliEntity | ||
if len(sliEntitiesList) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be moved into a separate method mapSliEntityListFromState()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored into separate method
instana/resource-sli-config.go
Outdated
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { | ||
v := val.(float64) | ||
if v <= 0 { | ||
errs = append(errs, fmt.Errorf("Metric threshold must be higher than 0")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grammar: "must be greater than"
test case missing for the validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation of the resource is missing in docs/resources
instana/resource-sli-config.go
Outdated
return d.Get(SliConfigFieldFullName).(string) | ||
} | ||
|
||
func sliConfigSchemaV0() *schema.Resource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not needed anymore
@@ -56,3 +57,7 @@ func (api *baseInstanaAPI) AlertingChannels() RestResource { | |||
func (api *baseInstanaAPI) AlertingConfigurations() RestResource { | |||
return NewRestResource(AlertsResourcePath, NewAlertingConfigurationUnmarshaller(), api.client) | |||
} | |||
|
|||
func (api *baseInstanaAPI) SliConfigs() RestResource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test missing
No description provided.