diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md index 52911e4cc5e4..6c96c16025d4 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md +++ b/services/preview/monitor/mgmt/2018-09-01/insights/CHANGELOG.md @@ -1,2 +1,123 @@ -# Change History +# Unreleased Content +## Breaking Changes + +### Removed Funcs + +1. MetricNamespacesClient.List(context.Context, string, string) (MetricNamespaceCollection, error) +1. MetricNamespacesClient.ListPreparer(context.Context, string, string) (*http.Request, error) +1. MetricNamespacesClient.ListResponder(*http.Response) (MetricNamespaceCollection, error) +1. MetricNamespacesClient.ListSender(*http.Request) (*http.Response, error) +1. NewMetricNamespacesClient(string) MetricNamespacesClient +1. NewMetricNamespacesClientWithBaseURI(string, string) MetricNamespacesClient + +### Struct Changes + +#### Removed Structs + +1. MetricNamespace +1. MetricNamespaceCollection +1. MetricNamespaceName +1. MetricNamespacesClient + +#### Removed Struct Fields + +1. MetricAlertResourcePatch.*MetricAlertProperties + +### Signature Changes + +#### Const Types + +1. High changed type from DynamicThresholdSensitivity to BaselineSensitivity +1. Low changed type from DynamicThresholdSensitivity to BaselineSensitivity +1. Medium changed type from DynamicThresholdSensitivity to BaselineSensitivity + +#### Struct Fields + +1. DynamicMetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +1. MetricCriteria.TimeAggregation changed type from interface{} to AggregationTypeEnum +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. DynamicThresholdSensitivity.DynamicThresholdSensitivityHigh +1. DynamicThresholdSensitivity.DynamicThresholdSensitivityLow +1. DynamicThresholdSensitivity.DynamicThresholdSensitivityMedium + +### New Funcs + +1. *MetricAlertPropertiesPatch.UnmarshalJSON([]byte) error +1. BaselinesClient.List(context.Context, string, string, string, string, *string, string, string, string, ResultType) (MetricBaselinesResponse, error) +1. BaselinesClient.ListPreparer(context.Context, string, string, string, string, *string, string, string, string, ResultType) (*http.Request, error) +1. BaselinesClient.ListResponder(*http.Response) (MetricBaselinesResponse, error) +1. BaselinesClient.ListSender(*http.Request) (*http.Response, error) +1. MetricAlertPropertiesPatch.MarshalJSON() ([]byte, error) +1. NewBaselinesClient(string) BaselinesClient +1. NewBaselinesClientWithBaseURI(string, string) BaselinesClient +1. PossibleAggregationTypeEnumValues() []AggregationTypeEnum +1. PossibleBaselineSensitivityValues() []BaselineSensitivity + +### Struct Changes + +#### New Structs + +1. BaselineMetadata +1. BaselinesClient +1. ErrorContract +1. MetricAlertPropertiesPatch +1. MetricBaselinesResponse +1. MetricSingleDimension +1. SingleBaseline +1. SingleMetricBaseline +1. TimeSeriesBaseline + +#### 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. MetricAlertProperties.IsMigrated +1. MetricAlertResource.Etag +1. MetricAlertResource.Kind +1. MetricAlertResourcePatch.*MetricAlertPropertiesPatch +1. MetricDefinition.Category +1. MetricDefinition.DisplayDescription +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-09-01/insights/_meta.json b/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json index a6b36639daea..31e0aef43a10 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json +++ b/services/preview/monitor/mgmt/2018-09-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "014ea46f886eb8083c7a7b97f23ff2388c4f1e69", "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", "tag": "package-2018-09", "use": "@microsoft.azure/autorest.go@2.1.180", diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go b/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go index 20bdb629e8c1..b34bdb57f014 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/actiongroups.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go index 44aaf3ef1e4a..959d56c034a6 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogalerts.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/activitylogs.go b/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go index 16dd215e6ad9..468cd15e3148 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/activitylogs.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go index c3bf26828d8e..8ae4293a8f6f 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertruleincidents.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/alertrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go index f5a2ab682384..0aa96a0200bb 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/alertrules.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go index 86f253d0fb89..a7197859ce03 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/autoscalesettings.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/baselines.go b/services/preview/monitor/mgmt/2018-09-01/insights/baselines.go new file mode 100644 index 000000000000..ec2e680e8d6e --- /dev/null +++ b/services/preview/monitor/mgmt/2018-09-01/insights/baselines.go @@ -0,0 +1,143 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BaselinesClient is the monitor Management Client +type BaselinesClient struct { + BaseClient +} + +// NewBaselinesClient creates an instance of the BaselinesClient client. +func NewBaselinesClient(subscriptionID string) BaselinesClient { + return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { + return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List **Lists the metric baseline values for a resource**. +// Parameters: +// resourceURI - the identifier of the resource. +// metricnames - the names of the metrics (comma separated) to retrieve. +// metricnamespace - metric namespace to query metric definitions for. +// 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. +// aggregation - the list of aggregation types (comma separated) to retrieve. +// sensitivities - the list of sensitivities (comma separated) to retrieve. +// 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 +// ‘*’**. +// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. +func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2018-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if len(sensitivities) > 0 { + queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BaselinesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/enums.go b/services/preview/monitor/mgmt/2018-09-01/insights/enums.go index 1bab3243cf63..932e7e3bc01a 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/enums.go +++ b/services/preview/monitor/mgmt/2018-09-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 @@ -50,6 +71,23 @@ func PossibleAlertSeverityValues() []AlertSeverity { return []AlertSeverity{Four, One, Three, Two, Zero} } +// BaselineSensitivity enumerates the values for baseline sensitivity. +type BaselineSensitivity string + +const ( + // High ... + High BaselineSensitivity = "High" + // Low ... + Low BaselineSensitivity = "Low" + // Medium ... + Medium BaselineSensitivity = "Medium" +) + +// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. +func PossibleBaselineSensitivityValues() []BaselineSensitivity { + return []BaselineSensitivity{High, Low, Medium} +} + // CategoryType enumerates the values for category type. type CategoryType string @@ -96,13 +134,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. @@ -162,17 +204,17 @@ func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { type DynamicThresholdSensitivity string const ( - // High ... - High DynamicThresholdSensitivity = "High" - // Low ... - Low DynamicThresholdSensitivity = "Low" - // Medium ... - Medium DynamicThresholdSensitivity = "Medium" + // DynamicThresholdSensitivityHigh ... + DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" + // DynamicThresholdSensitivityLow ... + DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityMedium ... + DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" ) // PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{High, Low, Medium} + return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} } // Enabled enumerates the values for enabled. diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go index 84152c80c3ca..e1365dca489b 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/insightsapi/interfaces.go @@ -184,9 +184,9 @@ type ScheduledQueryRulesClientAPI interface { var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) -// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. -type MetricNamespacesClientAPI interface { - List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) +// BaselinesClientAPI contains the set of methods on the BaselinesClient type. +type BaselinesClientAPI interface { + List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) } -var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) +var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go b/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go index ad1500b87bc9..64fda18dde7c 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/logprofiles.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/metricalerts.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go index 94231b6fa34e..94db8b0ea238 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalerts.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go index 43cfaed42765..7644133efea3 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricalertsstatus.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/metricbaseline.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go index d395fc67bc59..2965d001818e 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricbaseline.go +++ b/services/preview/monitor/mgmt/2018-09-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-09-01/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go deleted file mode 100644 index f2ef47baf802..000000000000 --- a/services/preview/monitor/mgmt/2018-09-01/insights/metricnamespaces.go +++ /dev/null @@ -1,109 +0,0 @@ -package insights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MetricNamespacesClient is the monitor Management Client -type MetricNamespacesClient struct { - BaseClient -} - -// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. -func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { - return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { - return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the metric namespaces for the resource. -// Parameters: -// resourceURI - the identifier of the resource. -// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. -func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceURI, startTime) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2017-12-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MetricNamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/models.go b/services/preview/monitor/mgmt/2018-09-01/insights/models.go index b88cc6b7f566..f688430312e0 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/models.go @@ -214,6 +214,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. @@ -294,6 +298,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 + } } } @@ -439,6 +461,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. @@ -519,6 +545,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 + } } } @@ -587,10 +631,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. @@ -606,10 +654,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 } @@ -643,6 +695,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 @@ -660,6 +721,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) @@ -698,6 +767,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. @@ -778,6 +851,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 + } } } @@ -922,6 +1013,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. @@ -1002,6 +1097,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 + } } } @@ -1259,6 +1372,16 @@ 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"` +} + +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` } // BaselineMetadataValue represents a baseline metadata value. @@ -1578,7 +1701,7 @@ type Dimension struct { type DynamicMetricCriteria struct { // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' Operator DynamicThresholdOperator `json:"operator,omitempty"` - // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High' + // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` @@ -1592,8 +1715,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. @@ -1627,7 +1750,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 { @@ -1751,7 +1874,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 @@ -1838,6 +1961,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 @@ -2243,7 +2372,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"` @@ -2289,6 +2418,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. @@ -2369,6 +2502,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 + } } } @@ -2430,8 +2581,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 true. + 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. @@ -2452,6 +2611,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 } @@ -2474,6 +2639,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 @@ -2483,6 +2666,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 @@ -2563,6 +2764,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. @@ -2643,6 +2848,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 + } } } @@ -2876,6 +3099,10 @@ 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"` + // 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"` // 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"` // Timeseries - the time series returned when a data query is performed. @@ -2886,7 +3113,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"` } @@ -3147,9 +3374,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"` @@ -3159,6 +3386,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. @@ -3314,6 +3543,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 + } } } @@ -3335,6 +3771,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. @@ -3415,6 +3855,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 + } } } @@ -3432,8 +3890,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. @@ -3442,8 +3900,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) } @@ -3468,12 +3926,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 } } } @@ -3631,6 +4089,19 @@ type MetricAvailability struct { Retention *string `json:"retention,omitempty"` } +// MetricBaselinesResponse a list of metric baselines. +type MetricBaselinesResponse struct { + autorest.Response `json:"-"` + // 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 *string `json:"namespace,omitempty"` + // Value - The baseline for each time series that was queried. + Value *[]SingleMetricBaseline `json:"value,omitempty"` +} + // MetricCriteria criterion to filter metrics. type MetricCriteria struct { // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' @@ -3645,8 +4116,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. @@ -3674,7 +4145,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 { @@ -3780,7 +4251,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 @@ -3830,6 +4301,10 @@ 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"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,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"` // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' @@ -3861,31 +4336,6 @@ type MetricDimension struct { Values *[]string `json:"values,omitempty"` } -// MetricNamespace metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // ID - The ID of the metricNamespace. - ID *string `json:"id,omitempty"` - // Type - The type of the namespace. - Type *string `json:"type,omitempty"` - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // Properties - Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName `json:"properties,omitempty"` -} - -// MetricNamespaceCollection represents collection of metric namespaces. -type MetricNamespaceCollection struct { - autorest.Response `json:"-"` - // Value - The values for the metric namespaces. - Value *[]MetricNamespace `json:"value,omitempty"` -} - -// MetricNamespaceName the fully qualified metric namespace name. -type MetricNamespaceName struct { - // MetricNamespaceName - The metric namespace name. - MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` -} - // MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. type MetricSettings struct { // TimeGrain - the timegrain of the metric in ISO8601 format. @@ -3898,6 +4348,14 @@ type MetricSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } +// MetricSingleDimension the metric dimension name and value. +type MetricSingleDimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Value - Value of the dimension. + Value *string `json:"value,omitempty"` +} + // MetricTrigger the trigger that results in a scaling action. type MetricTrigger struct { // MetricName - the name of the metric that defines what the rule monitors. @@ -3920,6 +4378,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. @@ -3955,8 +4415,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. @@ -4019,7 +4479,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 { @@ -4107,7 +4567,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 @@ -4218,6 +4678,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. @@ -4235,15 +4699,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"` @@ -4483,6 +4947,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"` } @@ -4535,6 +5005,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 } @@ -4637,6 +5116,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"` } @@ -4675,6 +5160,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 } @@ -4708,6 +5202,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"` } @@ -4722,6 +5222,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 } @@ -4855,6 +5364,28 @@ type SenderAuthorization struct { Scope *string `json:"scope,omitempty"` } +// SingleBaseline the baseline values for a single sensitivity value. +type SingleBaseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' + Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// SingleMetricBaseline the baseline results of a single metric. +type SingleMetricBaseline struct { + // ID - The metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - The resource type of the metric baseline resource. + Type *string `json:"type,omitempty"` + // MetricName - The name of the metric for which the baselines were retrieved. + MetricName *string `json:"metricName,omitempty"` + // Baselines - The baseline for each time series that was queried. + Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` +} + // SmsReceiver an SMS receiver. type SmsReceiver struct { // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. @@ -5026,6 +5557,20 @@ func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { return nil } +// TimeSeriesBaseline the baseline values for a single time series. +type TimeSeriesBaseline struct { + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Dimensions - The dimensions of this time series. + Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` + // Timestamps - The list of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Data - The baseline values for each sensitivity. + Data *[]SingleBaseline `json:"data,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` +} + // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. type TimeSeriesElement struct { // Metadatavalues - the metadata values returned if $filter was specified in the call. @@ -5056,7 +5601,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-09-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go index c9d43964ecb0..c6dab9c1e3c8 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-09-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") diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index c18be6e1b515..396dcd5ff359 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -11,7 +11,8 @@ } }, "advancedOptions": { - "cloneDir": "src/github.com/Azure/azure-sdk-for-go" + "cloneDir": "src/github.com/Azure/azure-sdk-for-go", + "breakingChangeTracking": true }, "initOptions": { "initScript": { diff --git a/tools/generator/pipeline/model.go b/tools/generator/pipeline/model.go index 577b5aae5c2e..51ec5ee79f9b 100644 --- a/tools/generator/pipeline/model.go +++ b/tools/generator/pipeline/model.go @@ -85,8 +85,8 @@ type PackageResult struct { // Changelog ... type Changelog struct { - Content *string `json:"content,omitempty"` - HasBreakingChange *bool `json:"hasBreakingChange,omitempty"` + Content *string `json:"content,omitempty"` + HasBreakingChange *bool `json:"hasBreakingChange,omitempty"` BreakingChangeItems *[]string `json:"breakingChangeItems,omitempty"` }