Skip to content

Commit

Permalink
Fixed default optional settings; tests are passing now
Browse files Browse the repository at this point in the history
  • Loading branch information
nexxai committed Sep 5, 2019
1 parent c70160a commit e37e116
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 8 additions & 3 deletions azurerm/resource_arm_stream_analytics_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ func resourceArmStreamAnalyticsJob() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(-1, 1814399),
Default: 5,
},

"events_out_of_order_max_delay_in_seconds": {
// portal allows for up to 9m 59s
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 599),
Default: 0,
},

"events_out_of_order_policy": {
Expand All @@ -82,16 +84,17 @@ func resourceArmStreamAnalyticsJob() *schema.Resource {
string(streamanalytics.Adjust),
string(streamanalytics.Drop),
}, false),
Default: string(streamanalytics.Adjust),
},

"output_error_policy": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
string(streamanalytics.OutputErrorPolicyDrop),
string(streamanalytics.OutputErrorPolicyStop),
}, false),
Default: string(streamanalytics.OutputErrorPolicyDrop),
},

"streaming_units": {
Expand Down Expand Up @@ -140,7 +143,6 @@ func resourceArmStreamAnalyticsJobCreateUpdate(d *schema.ResourceData, meta inte
}

compatibilityLevel := d.Get("compatibility_level").(string)
dataLocale := d.Get("data_locale").(string)
eventsLateArrivalMaxDelayInSeconds := d.Get("events_late_arrival_max_delay_in_seconds").(int)
eventsOutOfOrderMaxDelayInSeconds := d.Get("events_out_of_order_max_delay_in_seconds").(int)
eventsOutOfOrderPolicy := d.Get("events_out_of_order_policy").(string)
Expand All @@ -167,7 +169,6 @@ func resourceArmStreamAnalyticsJobCreateUpdate(d *schema.ResourceData, meta inte
Name: streamanalytics.Standard,
},
CompatibilityLevel: streamanalytics.CompatibilityLevel(compatibilityLevel),
DataLocale: utils.String(dataLocale),
EventsLateArrivalMaxDelayInSeconds: utils.Int32(int32(eventsLateArrivalMaxDelayInSeconds)),
EventsOutOfOrderMaxDelayInSeconds: utils.Int32(int32(eventsOutOfOrderMaxDelayInSeconds)),
EventsOutOfOrderPolicy: streamanalytics.EventsOutOfOrderPolicy(eventsOutOfOrderPolicy),
Expand All @@ -176,6 +177,10 @@ func resourceArmStreamAnalyticsJobCreateUpdate(d *schema.ResourceData, meta inte
Tags: tags.Expand(t),
}

if dataLocale, ok := d.GetOk("data_locale"); ok {
props.StreamingJobProperties.DataLocale = utils.String(dataLocale.(string))
}

if d.IsNewResource() {
props.StreamingJobProperties.Transformation = &transformation

Expand Down
1 change: 1 addition & 0 deletions azurerm/resource_arm_stream_analytics_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ resource "azurerm_stream_analytics_job" "import" {
output_error_policy = "${azurerm_stream_analytics_job.test.output_error_policy}"
streaming_units = "${azurerm_stream_analytics_job.test.streaming_units}"
transformation_query = "${azurerm_stream_analytics_job.test.transformation_query}"
tags = "${azurerm_stream_analytics_job.test.tags}"
}
`, template)
}
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/stream_analytics_job.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ The following arguments are supported:

* `data_locale` - (Optional) Specifies the Data Locale of the Job, which [should be a supported .NET Culture](https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx).

* `events_late_arrival_max_delay_in_seconds` - (Optional) Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s).
* `events_late_arrival_max_delay_in_seconds` - (Optional) Specifies the maximum tolerable delay in seconds where events arriving late could be included. Supported range is `-1` (indefinite) to `1814399` (20d 23h 59m 59s). Default is `0`.

* `events_out_of_order_max_delay_in_seconds` - (Optional) Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s).
* `events_out_of_order_max_delay_in_seconds` - (Optional) Specifies the maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. Supported range is `0` to `599` (9m 59s). Default is `5`.

* `events_out_of_order_policy` - (Optional) Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`.
* `events_out_of_order_policy` - (Optional) Specifies the policy which should be applied to events which arrive out of order in the input event stream. Possible values are `Adjust` and `Drop`. Default is `Adjust`.

* `output_error_policy` - (Optional) Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`.
* `output_error_policy` - (Optional) Specifies the policy which should be applied to events which arrive at the output and cannot be written to the external storage due to being malformed (such as missing column values, column values of wrong type or size). Possible values are `Drop` and `Stop`. Default is `Drop`.

* `streaming_units` - (Required) Specifies the number of streaming units that the streaming job uses. Supported values are `1`, `3`, `6` and multiples of `6` up to `120`.

Expand Down

0 comments on commit e37e116

Please sign in to comment.