diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md index ceed4a081085..bd9319d361c4 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2018-03-01/insights/CHANGELOG.md @@ -1,8 +1,128 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. Unit.UnitBitsPerSecond +1. Unit.UnitByteSeconds +1. Unit.UnitBytes +1. Unit.UnitBytesPerSecond +1. Unit.UnitCores +1. Unit.UnitCount +1. Unit.UnitCountPerSecond +1. Unit.UnitMilliCores +1. Unit.UnitMilliSeconds +1. Unit.UnitNanoCores +1. Unit.UnitPercent +1. Unit.UnitSeconds +1. Unit.UnitUnspecified + +### Removed Funcs + +1. PossibleUnitValues() []Unit + +### Struct Changes + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties + +### Signature Changes + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. Metric.Unit changed type from Unit to MetricUnit +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricDefinition.Unit changed type from Unit to MetricUnit +1. MultiMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum ## Additive Changes +### New Constants + +1. AggregationTypeEnum.AggregationTypeEnumAverage +1. AggregationTypeEnum.AggregationTypeEnumCount +1. AggregationTypeEnum.AggregationTypeEnumMaximum +1. AggregationTypeEnum.AggregationTypeEnumMinimum +1. AggregationTypeEnum.AggregationTypeEnumTotal +1. ConditionalOperator.ConditionalOperatorGreaterThanOrEqual +1. ConditionalOperator.ConditionalOperatorLessThanOrEqual +1. MetricClass.Availability +1. MetricClass.Errors +1. MetricClass.Latency +1. MetricClass.Saturation +1. MetricClass.Transactions +1. MetricUnit.MetricUnitBitsPerSecond +1. MetricUnit.MetricUnitByteSeconds +1. MetricUnit.MetricUnitBytes +1. MetricUnit.MetricUnitBytesPerSecond +1. MetricUnit.MetricUnitCores +1. MetricUnit.MetricUnitCount +1. MetricUnit.MetricUnitCountPerSecond +1. MetricUnit.MetricUnitMilliCores +1. MetricUnit.MetricUnitMilliSeconds +1. MetricUnit.MetricUnitNanoCores +1. MetricUnit.MetricUnitPercent +1. MetricUnit.MetricUnitSeconds +1. MetricUnit.MetricUnitUnspecified + ### New Funcs -1. Incident.MarshalJSON() ([]byte, error) -1. ProxyOnlyResource.MarshalJSON() ([]byte, error) +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleMetricClassValues() []MetricClass +1. PossibleMetricUnitValues() []MetricUnit + +### Struct Changes + +#### New Structs + +1. ErrorContract +1. MetricAlertPropertiesPatch + +#### New Struct Fields + +1. ActionGroupResource.Etag +1. ActionGroupResource.Kind +1. ActivityLogAlertResource.Etag +1. ActivityLogAlertResource.Kind +1. AlertRule.Action +1. AlertRule.ProvisioningState +1. AlertRuleResource.Etag +1. AlertRuleResource.Kind +1. AutoscaleSettingResource.Etag +1. AutoscaleSettingResource.Kind +1. Baseline.Timestamps +1. LogProfileResource.Etag +1. LogProfileResource.Kind +1. LogSearchRule.AutoMitigate +1. LogSearchRule.CreatedWithAPIVersion +1. LogSearchRule.DisplayName +1. LogSearchRule.IsLegacyLogAnalyticsRule +1. LogSearchRuleResource.Etag +1. LogSearchRuleResource.Kind +1. Metric.DisplayDescription +1. Metric.ErrorCode +1. Metric.ErrorMessage +1. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +1. MetricDefinition.MetricClass +1. MetricTrigger.DividePerInstance +1. Resource.Etag +1. Resource.Kind +1. RuleDataSource.LegacyResourceID +1. RuleDataSource.MetricNamespace +1. RuleDataSource.ResourceLocation +1. RuleManagementEventDataSource.LegacyResourceID +1. RuleManagementEventDataSource.MetricNamespace +1. RuleManagementEventDataSource.ResourceLocation +1. RuleMetricDataSource.LegacyResourceID +1. RuleMetricDataSource.MetricNamespace +1. RuleMetricDataSource.ResourceLocation diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json index 9bbcce398b18..a25dae0830db 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2018-03-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1202df7725a695d39cbc40475cab611f1d6aa5fd", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2018-03", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go index 43753cb5b294..1002fc81a520 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/actiongroups.go @@ -53,7 +53,9 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } @@ -135,6 +137,12 @@ func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") @@ -214,7 +222,9 @@ func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGro } if err := validation.Validate([]validation.Validation{ {TargetValue: enableRequest, - Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } @@ -295,6 +305,12 @@ func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") @@ -370,6 +386,12 @@ func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -442,6 +464,12 @@ func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (resu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -517,6 +545,12 @@ func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go index 44aaf3ef1e4a..959d56c034a6 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go @@ -49,6 +49,8 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: activityLogAlert, Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, @@ -137,6 +139,12 @@ func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") @@ -212,6 +220,12 @@ func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") @@ -287,6 +301,12 @@ func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +379,12 @@ func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + req, err := client.ListBySubscriptionIDPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") @@ -434,6 +460,12 @@ func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) if err != nil { err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go index 16dd215e6ad9..468cd15e3148 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/activitylogs.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -60,6 +61,12 @@ func (client ActivityLogsClient) List(ctx context.Context, filter string, select tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, selectParameter) if err != nil { diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go index c3bf26828d8e..8ae4293a8f6f 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/alertruleincidents.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -47,6 +48,12 @@ func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") @@ -124,6 +131,12 @@ func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go index f5a2ab682384..0aa96a0200bb 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/alertrules.go @@ -52,7 +52,9 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -95,7 +97,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -134,6 +136,12 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") @@ -172,7 +180,7 @@ func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -209,6 +217,12 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") @@ -247,7 +261,7 @@ func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -284,6 +298,12 @@ func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -321,7 +341,7 @@ func (client AlertRulesClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -356,6 +376,12 @@ func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result A tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -392,7 +418,7 @@ func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) ( preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -431,6 +457,12 @@ func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName str tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") @@ -470,7 +502,7 @@ func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroup autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), autorest.WithJSON(alertRulesResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go index 86f253d0fb89..a7197859ce03 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/autoscalesettings.go @@ -53,7 +53,9 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } @@ -135,6 +137,12 @@ func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") @@ -210,6 +218,12 @@ func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") @@ -285,6 +299,12 @@ func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { @@ -399,6 +419,12 @@ func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (r tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { @@ -516,6 +542,12 @@ func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupN tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/enums.go b/services/preview/monitor/mgmt/2018-03-01/insights/enums.go index 1bab3243cf63..67fba0ed8c76 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/enums.go @@ -29,6 +29,27 @@ func PossibleAggregationTypeValues() []AggregationType { return []AggregationType{Average, Count, Maximum, Minimum, None, Total} } +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + // AlertSeverity enumerates the values for alert severity. type AlertSeverity string @@ -96,13 +117,17 @@ const ( ConditionalOperatorEqual ConditionalOperator = "Equal" // ConditionalOperatorGreaterThan ... ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" // ConditionalOperatorLessThan ... ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" ) // PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorLessThan} + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} } // ConditionOperator enumerates the values for condition operator. @@ -211,6 +236,27 @@ func PossibleEventLevelValues() []EventLevel { return []EventLevel{Critical, Error, Informational, Verbose, Warning} } +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // Availability ... + Availability MetricClass = "Availability" + // Errors ... + Errors MetricClass = "Errors" + // Latency ... + Latency MetricClass = "Latency" + // Saturation ... + Saturation MetricClass = "Saturation" + // Transactions ... + Transactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{Availability, Errors, Latency, Saturation, Transactions} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string @@ -245,6 +291,43 @@ func PossibleMetricTriggerTypeValues() []MetricTriggerType { return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} } +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -557,40 +640,3 @@ const ( func PossibleTimeAggregationTypeValues() []TimeAggregationType { return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} } - -// Unit enumerates the values for unit. -type Unit string - -const ( - // UnitBitsPerSecond ... - UnitBitsPerSecond Unit = "BitsPerSecond" - // UnitBytes ... - UnitBytes Unit = "Bytes" - // UnitByteSeconds ... - UnitByteSeconds Unit = "ByteSeconds" - // UnitBytesPerSecond ... - UnitBytesPerSecond Unit = "BytesPerSecond" - // UnitCores ... - UnitCores Unit = "Cores" - // UnitCount ... - UnitCount Unit = "Count" - // UnitCountPerSecond ... - UnitCountPerSecond Unit = "CountPerSecond" - // UnitMilliCores ... - UnitMilliCores Unit = "MilliCores" - // UnitMilliSeconds ... - UnitMilliSeconds Unit = "MilliSeconds" - // UnitNanoCores ... - UnitNanoCores Unit = "NanoCores" - // UnitPercent ... - UnitPercent Unit = "Percent" - // UnitSeconds ... - UnitSeconds Unit = "Seconds" - // UnitUnspecified ... - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns an array of possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{UnitBitsPerSecond, UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCores, UnitCount, UnitCountPerSecond, UnitMilliCores, UnitMilliSeconds, UnitNanoCores, UnitPercent, UnitSeconds, UnitUnspecified} -} diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go index ad1500b87bc9..64fda18dde7c 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/logprofiles.go @@ -56,7 +56,9 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, }}, - }}}}}); err != nil { + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } @@ -136,6 +138,12 @@ func (client LogProfilesClient) Delete(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") @@ -209,6 +217,12 @@ func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, logProfileName) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") @@ -281,6 +295,12 @@ func (client LogProfilesClient) List(ctx context.Context) (result LogProfileColl tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") @@ -355,6 +375,12 @@ func (client LogProfilesClient) Update(ctx context.Context, logProfileName strin tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) if err != nil { err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go index 94231b6fa34e..94db8b0ea238 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricalerts.go @@ -48,11 +48,13 @@ func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGro }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { @@ -137,6 +139,12 @@ func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") @@ -212,6 +220,12 @@ func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName stri tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") @@ -287,6 +301,12 @@ func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resour tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -359,6 +379,12 @@ func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") @@ -434,6 +460,12 @@ func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go index 43cfaed42765..7644133efea3 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricalertsstatus.go @@ -10,6 +10,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -46,6 +47,12 @@ func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "List", err.Error()) + } + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") @@ -123,6 +130,12 @@ func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceG tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) if err != nil { err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go index d395fc67bc59..2965d001818e 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricbaseline.go @@ -93,7 +93,7 @@ func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/calculatebaseline", pathParameters), autorest.WithJSON(timeSeriesInformation), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -193,7 +193,7 @@ func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/baseline/{metricName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go index 69fc2e0b465a..c316b154fe7e 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metricdefinitions.go @@ -85,7 +85,7 @@ func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resource preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go b/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go index 97687a09b498..f2329253c944 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/metrics.go @@ -36,7 +36,8 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // timespan - the timespan of the query. It is a string with the following format // 'startDateTime_ISO/endDateTime_ISO'. // interval - the interval (i.e. timegrain) of the query. -// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** // aggregation - the list of aggregation types (comma separated) to retrieve. // top - the maximum number of records to retrieve. // Valid only if $filter is specified. @@ -44,13 +45,16 @@ func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsC // orderby - the aggregation to use for sorting results and the direction of the sort. // Only one order can be specified. // Examples: sum asc. -// filter - the **$filter** is used to reduce the set of metric data returned.
Example:
Metric contains -// metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ -// and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C -// eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different -// metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq -// ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq -// ‘*’**. +// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains +// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B +// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = +// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - +// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - +// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** // resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the // operation's description for details. // metricnamespace - metric namespace to query metric definitions for. @@ -128,7 +132,7 @@ func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", pathParameters), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/models.go b/services/preview/monitor/mgmt/2018-03-01/insights/models.go index f9cabd91d30a..32facf3203e8 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/models.go @@ -212,6 +212,10 @@ type ActionGroupResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActionGroupResource. @@ -292,6 +296,24 @@ func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { } agr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agr.Etag = &etag + } } } @@ -437,6 +459,10 @@ type ActivityLogAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for ActivityLogAlertResource. @@ -517,6 +543,24 @@ func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { } alar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + alar.Etag = &etag + } } } @@ -585,10 +629,14 @@ type AlertRule struct { Name *string `json:"name,omitempty"` // Description - the description of the alert rule that will be included in the alert email. Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` // IsEnabled - the flag that indicates whether the alert rule is enabled. IsEnabled *bool `json:"isEnabled,omitempty"` // Condition - the condition that results in the alert rule being activated. Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Actions *[]BasicRuleAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. @@ -604,10 +652,14 @@ func (ar AlertRule) MarshalJSON() ([]byte, error) { if ar.Description != nil { objectMap["description"] = ar.Description } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } if ar.IsEnabled != nil { objectMap["isEnabled"] = ar.IsEnabled } objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action if ar.Actions != nil { objectMap["actions"] = ar.Actions } @@ -641,6 +693,15 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Description = &description } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } case "isEnabled": if v != nil { var isEnabled bool @@ -658,6 +719,14 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { } ar.Condition = condition } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } case "actions": if v != nil { actions, err := unmarshalBasicRuleActionArray(*v) @@ -696,6 +765,10 @@ type AlertRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AlertRuleResource. @@ -776,6 +849,24 @@ func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { } arr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } } } @@ -912,6 +1003,10 @@ type AutoscaleSettingResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for AutoscaleSettingResource. @@ -992,6 +1087,24 @@ func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { } asr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } } } @@ -1249,6 +1362,8 @@ type Baseline struct { LowThresholds *[]float64 `json:"lowThresholds,omitempty"` // HighThresholds - The high thresholds of the baseline. HighThresholds *[]float64 `json:"highThresholds,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` } // BaselineMetadataValue represents a baseline metadata value. @@ -1582,8 +1697,8 @@ type DynamicMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -1617,7 +1732,7 @@ func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { if dmc.MetricNamespace != nil { objectMap["metricNamespace"] = dmc.MetricNamespace } - if dmc.TimeAggregation != nil { + if dmc.TimeAggregation != "" { objectMap["timeAggregation"] = dmc.TimeAggregation } if dmc.Dimensions != nil { @@ -1741,7 +1856,7 @@ func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -1828,6 +1943,12 @@ type EnableRequest struct { ReceiverName *string `json:"receiverName,omitempty"` } +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorResponse describes the format of Error response. type ErrorResponse struct { // Code - Error code @@ -2239,7 +2360,7 @@ type LogicAppReceiver struct { // LogMetricTrigger a log metrics trigger descriptor. type LogMetricTrigger struct { - // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - The threshold of the metric trigger. Threshold *float64 `json:"threshold,omitempty"` @@ -2285,6 +2406,10 @@ type LogProfileResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogProfileResource. @@ -2365,6 +2490,24 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { } lpr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } } } @@ -2426,8 +2569,16 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { // LogSearchRule log Search Rule Definition type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` // Description - The description of the Log Search rule. Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False' Enabled Enabled `json:"enabled,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. @@ -2448,6 +2599,12 @@ func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { if lsr.Description != nil { objectMap["description"] = lsr.Description } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } if lsr.Enabled != "" { objectMap["enabled"] = lsr.Enabled } @@ -2470,6 +2627,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } case "description": if v != nil { var description string @@ -2479,6 +2654,24 @@ func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { } lsr.Description = &description } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } case "enabled": if v != nil { var enabled Enabled @@ -2559,6 +2752,10 @@ type LogSearchRuleResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for LogSearchRuleResource. @@ -2639,6 +2836,24 @@ func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { } lsrr.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } } } @@ -2872,8 +3087,14 @@ type Metric struct { Type *string `json:"type,omitempty"` // Name - the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // Timeseries - the time series returned when a data query is performed. Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` } @@ -2882,7 +3103,7 @@ type Metric struct { type MetricAlertAction struct { // ActionGroupID - the id of the action group to use. ActionGroupID *string `json:"actionGroupId,omitempty"` - // WebHookProperties - The properties of a webhook object. + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. WebHookProperties map[string]*string `json:"webHookProperties"` } @@ -3143,9 +3364,9 @@ type MetricAlertProperties struct { EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. WindowSize *string `json:"windowSize,omitempty"` - // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceType *string `json:"targetResourceType,omitempty"` - // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` // Criteria - defines the specific alert criteria information. Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` @@ -3155,6 +3376,8 @@ type MetricAlertProperties struct { Actions *[]MetricAlertAction `json:"actions,omitempty"` // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertProperties. @@ -3310,6 +3533,213 @@ func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { } mapVar.LastUpdatedTime = &lastUpdatedTime } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } } } @@ -3331,6 +3761,10 @@ type MetricAlertResource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResource. @@ -3411,6 +3845,24 @@ func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { } mar.Tags = tags } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } } } @@ -3428,8 +3880,8 @@ type MetricAlertResourceCollection struct { type MetricAlertResourcePatch struct { // Tags - Resource tags Tags map[string]*string `json:"tags"` - // MetricAlertProperties - The alert rule properties of the resource. - *MetricAlertProperties `json:"properties,omitempty"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for MetricAlertResourcePatch. @@ -3438,8 +3890,8 @@ func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { if marp.Tags != nil { objectMap["tags"] = marp.Tags } - if marp.MetricAlertProperties != nil { - objectMap["properties"] = marp.MetricAlertProperties + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch } return json.Marshal(objectMap) } @@ -3464,12 +3916,12 @@ func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var metricAlertProperties MetricAlertProperties - err = json.Unmarshal(*v, &metricAlertProperties) + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) if err != nil { return err } - marp.MetricAlertProperties = &metricAlertProperties + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch } } } @@ -3641,8 +4093,8 @@ type MetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3670,7 +4122,7 @@ func (mc MetricCriteria) MarshalJSON() ([]byte, error) { if mc.MetricNamespace != nil { objectMap["metricNamespace"] = mc.MetricNamespace } - if mc.TimeAggregation != nil { + if mc.TimeAggregation != "" { objectMap["timeAggregation"] = mc.TimeAggregation } if mc.Dimensions != nil { @@ -3776,7 +4228,7 @@ func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -3826,8 +4278,14 @@ type MetricDefinition struct { Namespace *string `json:"namespace,omitempty"` // Name - the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` - // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond' - Unit Unit `json:"unit,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'Availability', 'Transactions', 'Errors', 'Latency', 'Saturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` // SupportedAggregationTypes - the collection of what aggregation types are supported. @@ -3891,6 +4349,8 @@ type MetricTrigger struct { Threshold *float64 `json:"threshold,omitempty"` // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` } // MetricValue represents a metric value. @@ -3926,8 +4386,8 @@ type MultiMetricCriteria struct { MetricName *string `json:"metricName,omitempty"` // MetricNamespace - Namespace of the metric. MetricNamespace *string `json:"metricNamespace,omitempty"` - // TimeAggregation - the criteria time aggregation types. - TimeAggregation interface{} `json:"timeAggregation,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` // Dimensions - List of dimension conditions. Dimensions *[]MetricDimension `json:"dimensions,omitempty"` // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. @@ -3990,7 +4450,7 @@ func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { if mmc.MetricNamespace != nil { objectMap["metricNamespace"] = mmc.MetricNamespace } - if mmc.TimeAggregation != nil { + if mmc.TimeAggregation != "" { objectMap["timeAggregation"] = mmc.TimeAggregation } if mmc.Dimensions != nil { @@ -4078,7 +4538,7 @@ func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { } case "timeAggregation": if v != nil { - var timeAggregation interface{} + var timeAggregation AggregationTypeEnum err = json.Unmarshal(*v, &timeAggregation) if err != nil { return err @@ -4195,6 +4655,10 @@ type Resource struct { Location *string `json:"location,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` } // MarshalJSON is the custom marshaler for Resource. @@ -4212,15 +4676,15 @@ func (r Resource) MarshalJSON() ([]byte, error) { // Response the response to a metrics query. type Response struct { autorest.Response `json:"-"` - // Cost - The integer value representing the cost of the query, for data case. + // Cost - The integer value representing the relative cost of the query. Cost *float64 `json:"cost,omitempty"` // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. Timespan *string `json:"timespan,omitempty"` // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. Interval *string `json:"interval,omitempty"` - // Namespace - The namespace of the metrics been queried + // Namespace - The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` - // Resourceregion - The region of the resource been queried for metrics. + // Resourceregion - The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` // Value - the value of the collection. Value *[]Metric `json:"value,omitempty"` @@ -4460,6 +4924,12 @@ type BasicRuleDataSource interface { type RuleDataSource struct { // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4512,6 +4982,15 @@ func (rds RuleDataSource) MarshalJSON() ([]byte, error) { if rds.ResourceURI != nil { objectMap["resourceUri"] = rds.ResourceURI } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } if rds.OdataType != "" { objectMap["odata.type"] = rds.OdataType } @@ -4614,6 +5093,12 @@ type RuleManagementEventDataSource struct { Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4652,6 +5137,15 @@ func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { if rmeds.ResourceURI != nil { objectMap["resourceUri"] = rmeds.ResourceURI } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } if rmeds.OdataType != "" { objectMap["odata.type"] = rmeds.OdataType } @@ -4685,6 +5179,12 @@ type RuleMetricDataSource struct { MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` } @@ -4699,6 +5199,15 @@ func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { if rmds.ResourceURI != nil { objectMap["resourceUri"] = rmds.ResourceURI } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } if rmds.OdataType != "" { objectMap["odata.type"] = rmds.OdataType } @@ -5033,7 +5542,7 @@ type TimeWindow struct { // TriggerCondition the condition that results in the Log Search rule. type TriggerCondition struct { - // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` // Threshold - Result or count threshold based on which rule should be triggered. Threshold *float64 `json:"threshold,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go index c9d43964ecb0..c6dab9c1e3c8 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go @@ -49,6 +49,8 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, @@ -139,6 +141,12 @@ func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") @@ -214,6 +222,12 @@ func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") @@ -291,6 +305,12 @@ func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -369,6 +389,12 @@ func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + req, err := client.ListBySubscriptionPreparer(ctx, filter) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") @@ -447,6 +473,12 @@ func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request")