From d13237be221d4a5bb285afffe7332a18422e7ffb Mon Sep 17 00:00:00 2001 From: AndreiBarbuOz Date: Fri, 20 Dec 2024 08:36:38 -0800 Subject: [PATCH] Bump monitor API version --- .golangci.yml | 1 + docs/hugo/content/reference/_index.md | 8 + .../hugo/content/reference/insights/_index.md | 8 + ...cheduled_query_rule_extension_types_gen.go | 8 +- .../scheduled_query_rule_types_gen.go | 286 +- .../scheduled_query_rule_types_gen_test.go | 35 +- .../storage/scheduled_query_rule_types_gen.go | 2350 +++++++- .../scheduled_query_rule_types_gen_test.go | 636 ++- .../v1api20220615/storage/structure.txt | 14 + .../storage/autoscale_setting_types_gen.go | 92 + .../autoscale_setting_types_gen_test.go | 43 + .../v1api20221001/storage/structure.txt | 1 + .../scheduled_query_rule_spec_types_gen.go | 286 + ...cheduled_query_rule_spec_types_gen_test.go | 728 +++ .../scheduled_query_rule_status_types_gen.go | 365 ++ ...eduled_query_rule_status_types_gen_test.go | 817 +++ .../insights/v1api20231201/arm/structure.txt | 162 + v2/api/insights/v1api20231201/doc.go | 10 + .../v1api20231201/groupversion_info_gen.go | 32 + .../scheduled_query_rule_types_gen.go | 4907 +++++++++++++++++ .../scheduled_query_rule_types_gen_test.go | 2417 ++++++++ .../storage/groupversion_info_gen.go | 32 + .../storage/scheduled_query_rule_types_gen.go | 453 ++ .../scheduled_query_rule_types_gen_test.go | 1454 +++++ .../v1api20231201/storage/structure.txt | 139 + .../storage/zz_generated.deepcopy.go | 1090 ++++ v2/api/insights/v1api20231201/structure.txt | 171 + .../v1api20231201/zz_generated.deepcopy.go | 948 ++++ v2/api/insights/versions_matrix.md | 406 +- v2/azure-arm.yaml | 13 + .../controllers/controller_resources_gen.go | 8 +- 31 files changed, 17266 insertions(+), 654 deletions(-) create mode 100644 v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen.go create mode 100644 v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen_test.go create mode 100644 v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen.go create mode 100644 v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen_test.go create mode 100644 v2/api/insights/v1api20231201/arm/structure.txt create mode 100644 v2/api/insights/v1api20231201/doc.go create mode 100644 v2/api/insights/v1api20231201/groupversion_info_gen.go create mode 100644 v2/api/insights/v1api20231201/scheduled_query_rule_types_gen.go create mode 100644 v2/api/insights/v1api20231201/scheduled_query_rule_types_gen_test.go create mode 100644 v2/api/insights/v1api20231201/storage/groupversion_info_gen.go create mode 100644 v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen.go create mode 100644 v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen_test.go create mode 100644 v2/api/insights/v1api20231201/storage/structure.txt create mode 100644 v2/api/insights/v1api20231201/storage/zz_generated.deepcopy.go create mode 100644 v2/api/insights/v1api20231201/structure.txt create mode 100644 v2/api/insights/v1api20231201/zz_generated.deepcopy.go diff --git a/.golangci.yml b/.golangci.yml index fac90694680..abf23165eec 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,6 +20,7 @@ linters: # The below rules are disabled due to bug with go1.18 and generics: https://github.com/golangci/golangci-lint/issues/2859 - stylecheck - musttag # Extremely slow, at least on CI machines + - recvcheck linters-settings: exhaustive: diff --git a/docs/hugo/content/reference/_index.md b/docs/hugo/content/reference/_index.md index 292916b217c..60cd032951d 100644 --- a/docs/hugo/content/reference/_index.md +++ b/docs/hugo/content/reference/_index.md @@ -416,6 +416,14 @@ These resource(s) are available for use in the current release of ASO. Different To install the CRDs for these resources, your ASO configuration must include `insights.azure.com/*` as a one of the configured CRD patterns. See [CRD Management in ASO](https://azure.github.io/azure-service-operator/guide/crd-management/) for details on doing this for both [Helm](https://azure.github.io/azure-service-operator/guide/crd-management/#helm) and [YAML](https://azure.github.io/azure-service-operator/guide/crd-management/#yaml) based installations. +### Next Release + +Development of these new resources is complete and they will be available in the next release of ASO. + +| Resource | ARM Version | CRD Version | Supported From | Sample | +|--------------------|-------------|---------------|----------------|--------| +| ScheduledQueryRule | 2023-12-01 | v1api20231201 | v2.12.0 | - | + ### Released These resource(s) are available for use in the current release of ASO. Different versions of a given resource reflect different versions of the Azure ARM API. diff --git a/docs/hugo/content/reference/insights/_index.md b/docs/hugo/content/reference/insights/_index.md index ce1798d156b..1fa3541abfc 100644 --- a/docs/hugo/content/reference/insights/_index.md +++ b/docs/hugo/content/reference/insights/_index.md @@ -5,6 +5,14 @@ no_list: true --- To install the CRDs for these resources, your ASO configuration must include `insights.azure.com/*` as a one of the configured CRD patterns. See [CRD Management in ASO](https://azure.github.io/azure-service-operator/guide/crd-management/) for details on doing this for both [Helm](https://azure.github.io/azure-service-operator/guide/crd-management/#helm) and [YAML](https://azure.github.io/azure-service-operator/guide/crd-management/#yaml) based installations. +### Next Release + +Development of these new resources is complete and they will be available in the next release of ASO. + +| Resource | ARM Version | CRD Version | Supported From | Sample | +|--------------------|-------------|---------------|----------------|--------| +| ScheduledQueryRule | 2023-12-01 | v1api20231201 | v2.12.0 | - | + ### Released These resource(s) are available for use in the current release of ASO. Different versions of a given resource reflect different versions of the Azure ARM API. diff --git a/v2/api/insights/customizations/scheduled_query_rule_extension_types_gen.go b/v2/api/insights/customizations/scheduled_query_rule_extension_types_gen.go index b2c9e8fd7c8..f2e0c160de5 100644 --- a/v2/api/insights/customizations/scheduled_query_rule_extension_types_gen.go +++ b/v2/api/insights/customizations/scheduled_query_rule_extension_types_gen.go @@ -5,7 +5,9 @@ package customizations import ( v20220615 "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615" - storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/storage" + v20220615s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/storage" + v20231201 "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201" + v20231201s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" ) @@ -16,5 +18,7 @@ type ScheduledQueryRuleExtension struct { func (extension *ScheduledQueryRuleExtension) GetExtendedResources() []genruntime.KubernetesResource { return []genruntime.KubernetesResource{ &v20220615.ScheduledQueryRule{}, - &storage.ScheduledQueryRule{}} + &v20220615s.ScheduledQueryRule{}, + &v20231201.ScheduledQueryRule{}, + &v20231201s.ScheduledQueryRule{}} } diff --git a/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen.go b/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen.go index b069cebe921..4c96cfd7949 100644 --- a/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen.go +++ b/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen.go @@ -53,22 +53,36 @@ var _ conversion.Convertible = &ScheduledQueryRule{} // ConvertFrom populates our ScheduledQueryRule from the provided hub ScheduledQueryRule func (rule *ScheduledQueryRule) ConvertFrom(hub conversion.Hub) error { - source, ok := hub.(*storage.ScheduledQueryRule) - if !ok { - return fmt.Errorf("expected insights/v1api20220615/storage/ScheduledQueryRule but received %T instead", hub) + // intermediate variable for conversion + var source storage.ScheduledQueryRule + + err := source.ConvertFrom(hub) + if err != nil { + return eris.Wrap(err, "converting from hub to source") + } + + err = rule.AssignProperties_From_ScheduledQueryRule(&source) + if err != nil { + return eris.Wrap(err, "converting from source to rule") } - return rule.AssignProperties_From_ScheduledQueryRule(source) + return nil } // ConvertTo populates the provided hub ScheduledQueryRule from our ScheduledQueryRule func (rule *ScheduledQueryRule) ConvertTo(hub conversion.Hub) error { - destination, ok := hub.(*storage.ScheduledQueryRule) - if !ok { - return fmt.Errorf("expected insights/v1api20220615/storage/ScheduledQueryRule but received %T instead", hub) + // intermediate variable for conversion + var destination storage.ScheduledQueryRule + err := rule.AssignProperties_To_ScheduledQueryRule(&destination) + if err != nil { + return eris.Wrap(err, "converting to destination from rule") + } + err = destination.ConvertTo(hub) + if err != nil { + return eris.Wrap(err, "converting from destination to hub") } - return rule.AssignProperties_To_ScheduledQueryRule(destination) + return nil } // +kubebuilder:webhook:path=/mutate-insights-azure-com-v1api20220615-scheduledqueryrule,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=insights.azure.com,resources=scheduledqueryrules,verbs=create;update,versions=v1api20220615,name=default.v1api20220615.scheduledqueryrules.insights.azure.com,admissionReviewVersions=v1 @@ -114,17 +128,6 @@ func (rule *ScheduledQueryRule) SecretDestinationExpressions() []*core.Destinati return rule.Spec.OperatorSpec.SecretExpressions } -var _ genruntime.ImportableResource = &ScheduledQueryRule{} - -// InitializeSpec initializes the spec for this resource from the given status -func (rule *ScheduledQueryRule) InitializeSpec(status genruntime.ConvertibleStatus) error { - if s, ok := status.(*ScheduledQueryRule_STATUS); ok { - return rule.Spec.Initialize_From_ScheduledQueryRule_STATUS(s) - } - - return fmt.Errorf("expected Status of type ScheduledQueryRule_STATUS but received %T instead", status) -} - var _ genruntime.KubernetesResource = &ScheduledQueryRule{} // AzureName returns the Azure name of the resource @@ -1124,112 +1127,6 @@ func (rule *ScheduledQueryRule_Spec) AssignProperties_To_ScheduledQueryRule_Spec return nil } -// Initialize_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_STATUS -func (rule *ScheduledQueryRule_Spec) Initialize_From_ScheduledQueryRule_STATUS(source *ScheduledQueryRule_STATUS) error { - - // Actions - if source.Actions != nil { - var action Actions - err := action.Initialize_From_Actions_STATUS(source.Actions) - if err != nil { - return eris.Wrap(err, "calling Initialize_From_Actions_STATUS() to populate field Actions") - } - rule.Actions = &action - } else { - rule.Actions = nil - } - - // AutoMitigate - if source.AutoMitigate != nil { - autoMitigate := *source.AutoMitigate - rule.AutoMitigate = &autoMitigate - } else { - rule.AutoMitigate = nil - } - - // CheckWorkspaceAlertsStorageConfigured - if source.CheckWorkspaceAlertsStorageConfigured != nil { - checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured - rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured - } else { - rule.CheckWorkspaceAlertsStorageConfigured = nil - } - - // Criteria - if source.Criteria != nil { - var criterion ScheduledQueryRuleCriteria - err := criterion.Initialize_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria) - if err != nil { - return eris.Wrap(err, "calling Initialize_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") - } - rule.Criteria = &criterion - } else { - rule.Criteria = nil - } - - // Description - rule.Description = genruntime.ClonePointerToString(source.Description) - - // DisplayName - rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) - - // Enabled - if source.Enabled != nil { - enabled := *source.Enabled - rule.Enabled = &enabled - } else { - rule.Enabled = nil - } - - // EvaluationFrequency - rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) - - // Kind - if source.Kind != nil { - kind := genruntime.ToEnum(string(*source.Kind), scheduledQueryRule_Kind_Spec_Values) - rule.Kind = &kind - } else { - rule.Kind = nil - } - - // Location - rule.Location = genruntime.ClonePointerToString(source.Location) - - // MuteActionsDuration - rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) - - // OverrideQueryTimeRange - rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) - - // Severity - if source.Severity != nil { - severity := ScheduledQueryRuleProperties_Severity(*source.Severity) - rule.Severity = &severity - } else { - rule.Severity = nil - } - - // SkipQueryValidation - if source.SkipQueryValidation != nil { - skipQueryValidation := *source.SkipQueryValidation - rule.SkipQueryValidation = &skipQueryValidation - } else { - rule.SkipQueryValidation = nil - } - - // Tags - rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) - - // TargetResourceTypes - rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) - - // WindowSize - rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) - - // No error - return nil -} - // OriginalVersion returns the original API version used to create the resource. func (rule *ScheduledQueryRule_Spec) OriginalVersion() string { return GroupVersion.Version @@ -2074,16 +1971,6 @@ func (actions *Actions) AssignProperties_To_Actions(destination *storage.Actions return nil } -// Initialize_From_Actions_STATUS populates our Actions from the provided source Actions_STATUS -func (actions *Actions) Initialize_From_Actions_STATUS(source *Actions_STATUS) error { - - // CustomProperties - actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) - - // No error - return nil -} - // Actions to invoke when the alert fires. type Actions_STATUS struct { // ActionGroups: Action Group resource Ids to invoke when the alert fires. @@ -2297,31 +2184,6 @@ func (criteria *ScheduledQueryRuleCriteria) AssignProperties_To_ScheduledQueryRu return nil } -// Initialize_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria_STATUS -func (criteria *ScheduledQueryRuleCriteria) Initialize_From_ScheduledQueryRuleCriteria_STATUS(source *ScheduledQueryRuleCriteria_STATUS) error { - - // AllOf - if source.AllOf != nil { - allOfList := make([]Condition, len(source.AllOf)) - for allOfIndex, allOfItem := range source.AllOf { - // Shadow the loop variable to avoid aliasing - allOfItem := allOfItem - var allOf Condition - err := allOf.Initialize_From_Condition_STATUS(&allOfItem) - if err != nil { - return eris.Wrap(err, "calling Initialize_From_Condition_STATUS() to populate field AllOf") - } - allOfList[allOfIndex] = allOf - } - criteria.AllOf = allOfList - } else { - criteria.AllOf = nil - } - - // No error - return nil -} - // The rule criteria that defines the conditions of the scheduled query rule. type ScheduledQueryRuleCriteria_STATUS struct { // AllOf: A list of conditions to evaluate against the specified scopes @@ -3059,76 +2921,6 @@ func (condition *Condition) AssignProperties_To_Condition(destination *storage.C return nil } -// Initialize_From_Condition_STATUS populates our Condition from the provided source Condition_STATUS -func (condition *Condition) Initialize_From_Condition_STATUS(source *Condition_STATUS) error { - - // Dimensions - if source.Dimensions != nil { - dimensionList := make([]Dimension, len(source.Dimensions)) - for dimensionIndex, dimensionItem := range source.Dimensions { - // Shadow the loop variable to avoid aliasing - dimensionItem := dimensionItem - var dimension Dimension - err := dimension.Initialize_From_Dimension_STATUS(&dimensionItem) - if err != nil { - return eris.Wrap(err, "calling Initialize_From_Dimension_STATUS() to populate field Dimensions") - } - dimensionList[dimensionIndex] = dimension - } - condition.Dimensions = dimensionList - } else { - condition.Dimensions = nil - } - - // FailingPeriods - if source.FailingPeriods != nil { - var failingPeriod Condition_FailingPeriods - err := failingPeriod.Initialize_From_Condition_FailingPeriods_STATUS(source.FailingPeriods) - if err != nil { - return eris.Wrap(err, "calling Initialize_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") - } - condition.FailingPeriods = &failingPeriod - } else { - condition.FailingPeriods = nil - } - - // MetricMeasureColumn - condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) - - // MetricName - condition.MetricName = genruntime.ClonePointerToString(source.MetricName) - - // Operator - if source.Operator != nil { - operator := genruntime.ToEnum(string(*source.Operator), condition_Operator_Values) - condition.Operator = &operator - } else { - condition.Operator = nil - } - - // Query - condition.Query = genruntime.ClonePointerToString(source.Query) - - // Threshold - if source.Threshold != nil { - threshold := *source.Threshold - condition.Threshold = &threshold - } else { - condition.Threshold = nil - } - - // TimeAggregation - if source.TimeAggregation != nil { - timeAggregation := genruntime.ToEnum(string(*source.TimeAggregation), condition_TimeAggregation_Values) - condition.TimeAggregation = &timeAggregation - } else { - condition.TimeAggregation = nil - } - - // No error - return nil -} - // A condition of the scheduled query rule. type Condition_STATUS struct { // Dimensions: List of Dimensions conditions @@ -3534,19 +3326,6 @@ func (periods *Condition_FailingPeriods) AssignProperties_To_Condition_FailingPe return nil } -// Initialize_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods_STATUS -func (periods *Condition_FailingPeriods) Initialize_From_Condition_FailingPeriods_STATUS(source *Condition_FailingPeriods_STATUS) error { - - // MinFailingPeriodsToAlert - periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) - - // NumberOfEvaluationPeriods - periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) - - // No error - return nil -} - type Condition_FailingPeriods_STATUS struct { // MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to // numberOfEvaluationPeriods. Default value is 1 @@ -3832,27 +3611,6 @@ func (dimension *Dimension) AssignProperties_To_Dimension(destination *storage.D return nil } -// Initialize_From_Dimension_STATUS populates our Dimension from the provided source Dimension_STATUS -func (dimension *Dimension) Initialize_From_Dimension_STATUS(source *Dimension_STATUS) error { - - // Name - dimension.Name = genruntime.ClonePointerToString(source.Name) - - // Operator - if source.Operator != nil { - operator := genruntime.ToEnum(string(*source.Operator), dimension_Operator_Values) - dimension.Operator = &operator - } else { - dimension.Operator = nil - } - - // Values - dimension.Values = genruntime.CloneSliceOfString(source.Values) - - // No error - return nil -} - // Dimension splitting and filtering definition type Dimension_STATUS struct { // Name: Name of the dimension diff --git a/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen_test.go b/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen_test.go index d6e8db8dbaf..c57595f5480 100644 --- a/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen_test.go +++ b/v2/api/insights/v1api20220615/scheduled_query_rule_types_gen_test.go @@ -5,7 +5,8 @@ package v1api20220615 import ( "encoding/json" - storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/storage" + v20220615s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20220615/storage" + v20231201s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/kr/pretty" @@ -35,7 +36,7 @@ func RunPropertyAssignmentTestForActions(subject Actions) string { copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Actions + var other v20220615s.Actions err := copied.AssignProperties_To_Actions(&other) if err != nil { return err.Error() @@ -139,7 +140,7 @@ func RunPropertyAssignmentTestForActions_STATUS(subject Actions_STATUS) string { copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Actions_STATUS + var other v20220615s.Actions_STATUS err := copied.AssignProperties_To_Actions_STATUS(&other) if err != nil { return err.Error() @@ -244,7 +245,7 @@ func RunPropertyAssignmentTestForCondition(subject Condition) string { copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Condition + var other v20220615s.Condition err := copied.AssignProperties_To_Condition(&other) if err != nil { return err.Error() @@ -376,7 +377,7 @@ func RunPropertyAssignmentTestForCondition_FailingPeriods(subject Condition_Fail copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Condition_FailingPeriods + var other v20220615s.Condition_FailingPeriods err := copied.AssignProperties_To_Condition_FailingPeriods(&other) if err != nil { return err.Error() @@ -480,7 +481,7 @@ func RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS(subject Conditi copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Condition_FailingPeriods_STATUS + var other v20220615s.Condition_FailingPeriods_STATUS err := copied.AssignProperties_To_Condition_FailingPeriods_STATUS(&other) if err != nil { return err.Error() @@ -584,7 +585,7 @@ func RunPropertyAssignmentTestForCondition_STATUS(subject Condition_STATUS) stri copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Condition_STATUS + var other v20220615s.Condition_STATUS err := copied.AssignProperties_To_Condition_STATUS(&other) if err != nil { return err.Error() @@ -717,7 +718,7 @@ func RunPropertyAssignmentTestForDimension(subject Dimension) string { copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Dimension + var other v20220615s.Dimension err := copied.AssignProperties_To_Dimension(&other) if err != nil { return err.Error() @@ -821,7 +822,7 @@ func RunPropertyAssignmentTestForDimension_STATUS(subject Dimension_STATUS) stri copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.Dimension_STATUS + var other v20220615s.Dimension_STATUS err := copied.AssignProperties_To_Dimension_STATUS(&other) if err != nil { return err.Error() @@ -926,7 +927,7 @@ func RunResourceConversionTestForScheduledQueryRule(subject ScheduledQueryRule) copied := subject.DeepCopy() // Convert to our hub version - var hub storage.ScheduledQueryRule + var hub v20231201s.ScheduledQueryRule err := copied.ConvertTo(&hub) if err != nil { return err.Error() @@ -968,7 +969,7 @@ func RunPropertyAssignmentTestForScheduledQueryRule(subject ScheduledQueryRule) copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRule + var other v20220615s.ScheduledQueryRule err := copied.AssignProperties_To_ScheduledQueryRule(&other) if err != nil { return err.Error() @@ -1071,7 +1072,7 @@ func RunPropertyAssignmentTestForScheduledQueryRuleCriteria(subject ScheduledQue copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRuleCriteria + var other v20220615s.ScheduledQueryRuleCriteria err := copied.AssignProperties_To_ScheduledQueryRuleCriteria(&other) if err != nil { return err.Error() @@ -1174,7 +1175,7 @@ func RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS(subject Sched copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRuleCriteria_STATUS + var other v20220615s.ScheduledQueryRuleCriteria_STATUS err := copied.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&other) if err != nil { return err.Error() @@ -1277,7 +1278,7 @@ func RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec(subject Schedule copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRuleOperatorSpec + var other v20220615s.ScheduledQueryRuleOperatorSpec err := copied.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&other) if err != nil { return err.Error() @@ -1374,7 +1375,7 @@ func RunPropertyAssignmentTestForScheduledQueryRule_STATUS(subject ScheduledQuer copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRule_STATUS + var other v20220615s.ScheduledQueryRule_STATUS err := copied.AssignProperties_To_ScheduledQueryRule_STATUS(&other) if err != nil { return err.Error() @@ -1522,7 +1523,7 @@ func RunPropertyAssignmentTestForScheduledQueryRule_Spec(subject ScheduledQueryR copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.ScheduledQueryRule_Spec + var other v20220615s.ScheduledQueryRule_Spec err := copied.AssignProperties_To_ScheduledQueryRule_Spec(&other) if err != nil { return err.Error() @@ -1663,7 +1664,7 @@ func RunPropertyAssignmentTestForSystemData_STATUS(subject SystemData_STATUS) st copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.SystemData_STATUS + var other v20220615s.SystemData_STATUS err := copied.AssignProperties_To_SystemData_STATUS(&other) if err != nil { return err.Error() diff --git a/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen.go b/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen.go index 863c324e655..d2cf0735cdf 100644 --- a/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen.go +++ b/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen.go @@ -4,7 +4,9 @@ package storage import ( - storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20221001/storage" + "fmt" + v20221001s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20221001/storage" + v20231201s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps" @@ -13,14 +15,11 @@ import ( "github.com/rotisserie/eris" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/conversion" ) -// +kubebuilder:rbac:groups=insights.azure.com,resources=scheduledqueryrules,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=insights.azure.com,resources={scheduledqueryrules/status,scheduledqueryrules/finalizers},verbs=get;update;patch - // +kubebuilder:object:root=true // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" // +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" @@ -48,6 +47,28 @@ func (rule *ScheduledQueryRule) SetConditions(conditions conditions.Conditions) rule.Status.Conditions = conditions } +var _ conversion.Convertible = &ScheduledQueryRule{} + +// ConvertFrom populates our ScheduledQueryRule from the provided hub ScheduledQueryRule +func (rule *ScheduledQueryRule) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*v20231201s.ScheduledQueryRule) + if !ok { + return fmt.Errorf("expected insights/v1api20231201/storage/ScheduledQueryRule but received %T instead", hub) + } + + return rule.AssignProperties_From_ScheduledQueryRule(source) +} + +// ConvertTo populates the provided hub ScheduledQueryRule from our ScheduledQueryRule +func (rule *ScheduledQueryRule) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*v20231201s.ScheduledQueryRule) + if !ok { + return fmt.Errorf("expected insights/v1api20231201/storage/ScheduledQueryRule but received %T instead", hub) + } + + return rule.AssignProperties_To_ScheduledQueryRule(destination) +} + var _ configmaps.Exporter = &ScheduledQueryRule{} // ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property @@ -143,8 +164,75 @@ func (rule *ScheduledQueryRule) SetStatus(status genruntime.ConvertibleStatus) e return nil } -// Hub marks that this ScheduledQueryRule is the hub type for conversion -func (rule *ScheduledQueryRule) Hub() {} +// AssignProperties_From_ScheduledQueryRule populates our ScheduledQueryRule from the provided source ScheduledQueryRule +func (rule *ScheduledQueryRule) AssignProperties_From_ScheduledQueryRule(source *v20231201s.ScheduledQueryRule) error { + + // ObjectMeta + rule.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec ScheduledQueryRule_Spec + err := spec.AssignProperties_From_ScheduledQueryRule_Spec(&source.Spec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_Spec() to populate field Spec") + } + rule.Spec = spec + + // Status + var status ScheduledQueryRule_STATUS + err = status.AssignProperties_From_ScheduledQueryRule_STATUS(&source.Status) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_STATUS() to populate field Status") + } + rule.Status = status + + // Invoke the augmentConversionForScheduledQueryRule interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule); ok { + err := augmentedRule.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRule populates the provided destination ScheduledQueryRule from our ScheduledQueryRule +func (rule *ScheduledQueryRule) AssignProperties_To_ScheduledQueryRule(destination *v20231201s.ScheduledQueryRule) error { + + // ObjectMeta + destination.ObjectMeta = *rule.ObjectMeta.DeepCopy() + + // Spec + var spec v20231201s.ScheduledQueryRule_Spec + err := rule.Spec.AssignProperties_To_ScheduledQueryRule_Spec(&spec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_Spec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status v20231201s.ScheduledQueryRule_STATUS + err = rule.Status.AssignProperties_To_ScheduledQueryRule_STATUS(&status) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_STATUS() to populate field Status") + } + destination.Status = status + + // Invoke the augmentConversionForScheduledQueryRule interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule); ok { + err := augmentedRule.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} // OriginalGVK returns a GroupValueKind for the original API version used to create the resource func (rule *ScheduledQueryRule) OriginalGVK() *schema.GroupVersionKind { @@ -172,6 +260,11 @@ type APIVersion string const APIVersion_Value = APIVersion("2022-06-15") +type augmentConversionForScheduledQueryRule interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRule) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRule) error +} + // Storage version of v1api20220615.ScheduledQueryRule_Spec type ScheduledQueryRule_Spec struct { Actions *Actions `json:"actions,omitempty"` @@ -211,158 +304,210 @@ var _ genruntime.ConvertibleSpec = &ScheduledQueryRule_Spec{} // ConvertSpecFrom populates our ScheduledQueryRule_Spec from the provided source func (rule *ScheduledQueryRule_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { - if source == rule { - return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + src, ok := source.(*v20231201s.ScheduledQueryRule_Spec) + if ok { + // Populate our instance from source + return rule.AssignProperties_From_ScheduledQueryRule_Spec(src) + } + + // Convert to an intermediate form + src = &v20231201s.ScheduledQueryRule_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertSpecFrom()") } - return source.ConvertSpecTo(rule) + // Update our instance from src + err = rule.AssignProperties_From_ScheduledQueryRule_Spec(src) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil } // ConvertSpecTo populates the provided destination from our ScheduledQueryRule_Spec func (rule *ScheduledQueryRule_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { - if destination == rule { - return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + dst, ok := destination.(*v20231201s.ScheduledQueryRule_Spec) + if ok { + // Populate destination from our instance + return rule.AssignProperties_To_ScheduledQueryRule_Spec(dst) } - return destination.ConvertSpecFrom(rule) -} + // Convert to an intermediate form + dst = &v20231201s.ScheduledQueryRule_Spec{} + err := rule.AssignProperties_To_ScheduledQueryRule_Spec(dst) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()") + } -// Storage version of v1api20220615.ScheduledQueryRule_STATUS -type ScheduledQueryRule_STATUS struct { - Actions *Actions_STATUS `json:"actions,omitempty"` - AutoMitigate *bool `json:"autoMitigate,omitempty"` - CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` - Conditions []conditions.Condition `json:"conditions,omitempty"` - CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"` - Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"` - Description *string `json:"description,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Etag *string `json:"etag,omitempty"` - EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` - Id *string `json:"id,omitempty"` - IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` - IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` - Name *string `json:"name,omitempty"` - OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` - Scopes []string `json:"scopes,omitempty"` - Severity *int `json:"severity,omitempty"` - SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` - SystemData *SystemData_STATUS `json:"systemData,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` - Type *string `json:"type,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` + // Update dst from our instance + err = dst.ConvertSpecTo(destination) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertSpecTo()") + } + + return nil } -var _ genruntime.ConvertibleStatus = &ScheduledQueryRule_STATUS{} +// AssignProperties_From_ScheduledQueryRule_Spec populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) AssignProperties_From_ScheduledQueryRule_Spec(source *v20231201s.ScheduledQueryRule_Spec) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) -// ConvertStatusFrom populates our ScheduledQueryRule_STATUS from the provided source -func (rule *ScheduledQueryRule_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { - if source == rule { - return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + // Actions + if source.Actions != nil { + var action Actions + err := action.AssignProperties_From_Actions(source.Actions) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Actions() to populate field Actions") + } + rule.Actions = &action + } else { + rule.Actions = nil } - return source.ConvertStatusTo(rule) -} + // AutoMitigate + if source.AutoMitigate != nil { + autoMitigate := *source.AutoMitigate + rule.AutoMitigate = &autoMitigate + } else { + rule.AutoMitigate = nil + } -// ConvertStatusTo populates the provided destination from our ScheduledQueryRule_STATUS -func (rule *ScheduledQueryRule_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { - if destination == rule { - return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + // AzureName + rule.AzureName = source.AzureName + + // CheckWorkspaceAlertsStorageConfigured + if source.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + rule.CheckWorkspaceAlertsStorageConfigured = nil } - return destination.ConvertStatusFrom(rule) -} + // Criteria + if source.Criteria != nil { + var criterion ScheduledQueryRuleCriteria + err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria(source.Criteria) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria() to populate field Criteria") + } + rule.Criteria = &criterion + } else { + rule.Criteria = nil + } -// Storage version of v1api20220615.Actions -// Actions to invoke when the alert fires. -type Actions struct { - ActionGroupsReferences []genruntime.ResourceReference `armReference:"ActionGroups" json:"actionGroupsReferences,omitempty"` - CustomProperties map[string]string `json:"customProperties,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` -} + // Description + rule.Description = genruntime.ClonePointerToString(source.Description) -// Storage version of v1api20220615.Actions_STATUS -// Actions to invoke when the alert fires. -type Actions_STATUS struct { - ActionGroups []string `json:"actionGroups,omitempty"` - CustomProperties map[string]string `json:"customProperties,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` -} + // DisplayName + rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) -// Storage version of v1api20220615.ScheduledQueryRuleCriteria -// The rule criteria that defines the conditions of the scheduled query rule. -type ScheduledQueryRuleCriteria struct { - AllOf []Condition `json:"allOf,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` -} + // Enabled + if source.Enabled != nil { + enabled := *source.Enabled + rule.Enabled = &enabled + } else { + rule.Enabled = nil + } -// Storage version of v1api20220615.ScheduledQueryRuleCriteria_STATUS -// The rule criteria that defines the conditions of the scheduled query rule. -type ScheduledQueryRuleCriteria_STATUS struct { - AllOf []Condition_STATUS `json:"allOf,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` -} + // EvaluationFrequency + rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) -// Storage version of v1api20220615.ScheduledQueryRuleOperatorSpec -// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure -type ScheduledQueryRuleOperatorSpec struct { - ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` - SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"` -} + // Identity + if source.Identity != nil { + propertyBag.Add("Identity", *source.Identity) + } else { + propertyBag.Remove("Identity") + } -// Storage version of v1api20220615.SystemData_STATUS -// Metadata pertaining to creation and last modification of the resource. -type SystemData_STATUS struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *string `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *string `json:"lastModifiedByType,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` -} + // Kind + rule.Kind = genruntime.ClonePointerToString(source.Kind) -// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS -func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error { - // Clone the existing property bag - propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + // Location + rule.Location = genruntime.ClonePointerToString(source.Location) - // CreatedAt - data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt) + // MuteActionsDuration + rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) - // CreatedBy - data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy) + // OperatorSpec + if source.OperatorSpec != nil { + var operatorSpec ScheduledQueryRuleOperatorSpec + err := operatorSpec.AssignProperties_From_ScheduledQueryRuleOperatorSpec(source.OperatorSpec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec") + } + rule.OperatorSpec = &operatorSpec + } else { + rule.OperatorSpec = nil + } - // CreatedByType - data.CreatedByType = genruntime.ClonePointerToString(source.CreatedByType) + // OriginalVersion + rule.OriginalVersion = source.OriginalVersion - // LastModifiedAt - data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt) + // OverrideQueryTimeRange + rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) - // LastModifiedBy - data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy) + // Owner + if source.Owner != nil { + owner := source.Owner.Copy() + rule.Owner = &owner + } else { + rule.Owner = nil + } - // LastModifiedByType - data.LastModifiedByType = genruntime.ClonePointerToString(source.LastModifiedByType) + // ResolveConfiguration + if source.ResolveConfiguration != nil { + propertyBag.Add("ResolveConfiguration", *source.ResolveConfiguration) + } else { + propertyBag.Remove("ResolveConfiguration") + } + + // ScopesReferences + if source.ScopesReferences != nil { + scopesReferenceList := make([]genruntime.ResourceReference, len(source.ScopesReferences)) + for scopesReferenceIndex, scopesReferenceItem := range source.ScopesReferences { + // Shadow the loop variable to avoid aliasing + scopesReferenceItem := scopesReferenceItem + scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy() + } + rule.ScopesReferences = scopesReferenceList + } else { + rule.ScopesReferences = nil + } + + // Severity + rule.Severity = genruntime.ClonePointerToInt(source.Severity) + + // SkipQueryValidation + if source.SkipQueryValidation != nil { + skipQueryValidation := *source.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } else { + rule.SkipQueryValidation = nil + } + + // Tags + rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TargetResourceTypes + rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) + + // WindowSize + rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) // Update the property bag if len(propertyBag) > 0 { - data.PropertyBag = propertyBag + rule.PropertyBag = propertyBag } else { - data.PropertyBag = nil + rule.PropertyBag = nil } - // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion - var dataAsAny any = data - if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { - err := augmentedData.AssignPropertiesFrom(source) + // Invoke the augmentConversionForScheduledQueryRule_Spec interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule_Spec); ok { + err := augmentedRule.AssignPropertiesFrom(source) if err != nil { return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") } @@ -372,70 +517,1485 @@ func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *s return nil } -// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS -func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *storage.SystemData_STATUS) error { +// AssignProperties_To_ScheduledQueryRule_Spec populates the provided destination ScheduledQueryRule_Spec from our ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) AssignProperties_To_ScheduledQueryRule_Spec(destination *v20231201s.ScheduledQueryRule_Spec) error { // Clone the existing property bag - propertyBag := genruntime.NewPropertyBag(data.PropertyBag) + propertyBag := genruntime.NewPropertyBag(rule.PropertyBag) - // CreatedAt - destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt) + // Actions + if rule.Actions != nil { + var action v20231201s.Actions + err := rule.Actions.AssignProperties_To_Actions(&action) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Actions() to populate field Actions") + } + destination.Actions = &action + } else { + destination.Actions = nil + } - // CreatedBy - destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy) + // AutoMitigate + if rule.AutoMitigate != nil { + autoMitigate := *rule.AutoMitigate + destination.AutoMitigate = &autoMitigate + } else { + destination.AutoMitigate = nil + } - // CreatedByType - destination.CreatedByType = genruntime.ClonePointerToString(data.CreatedByType) + // AzureName + destination.AzureName = rule.AzureName - // LastModifiedAt - destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt) + // CheckWorkspaceAlertsStorageConfigured + if rule.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured + destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + destination.CheckWorkspaceAlertsStorageConfigured = nil + } - // LastModifiedBy - destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy) + // Criteria + if rule.Criteria != nil { + var criterion v20231201s.ScheduledQueryRuleCriteria + err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria(&criterion) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria() to populate field Criteria") + } + destination.Criteria = &criterion + } else { + destination.Criteria = nil + } - // LastModifiedByType - destination.LastModifiedByType = genruntime.ClonePointerToString(data.LastModifiedByType) + // Description + destination.Description = genruntime.ClonePointerToString(rule.Description) - // Update the property bag - if len(propertyBag) > 0 { - destination.PropertyBag = propertyBag + // DisplayName + destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName) + + // Enabled + if rule.Enabled != nil { + enabled := *rule.Enabled + destination.Enabled = &enabled } else { - destination.PropertyBag = nil + destination.Enabled = nil } - // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion - var dataAsAny any = data - if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { - err := augmentedData.AssignPropertiesTo(destination) + // EvaluationFrequency + destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency) + + // Identity + if propertyBag.Contains("Identity") { + var identity v20231201s.Identity + err := propertyBag.Pull("Identity", &identity) if err != nil { - return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + return eris.Wrap(err, "pulling 'Identity' from propertyBag") } + + destination.Identity = &identity + } else { + destination.Identity = nil } - // No error - return nil -} + // Kind + destination.Kind = genruntime.ClonePointerToString(rule.Kind) -type augmentConversionForSystemData_STATUS interface { - AssignPropertiesFrom(src *storage.SystemData_STATUS) error - AssignPropertiesTo(dst *storage.SystemData_STATUS) error -} + // Location + destination.Location = genruntime.ClonePointerToString(rule.Location) -// Storage version of v1api20220615.Condition -// A condition of the scheduled query rule. -type Condition struct { - Dimensions []Dimension `json:"dimensions,omitempty"` - FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"` - MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` - MetricName *string `json:"metricName,omitempty"` - Operator *string `json:"operator,omitempty"` - PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` - Query *string `json:"query,omitempty"` + // MuteActionsDuration + destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration) - // ResourceIdColumnReference: The column containing the resource id. The content of the column must be a uri formatted as - // resource id. Relevant only for rules of the kind LogAlert. - ResourceIdColumnReference *genruntime.ResourceReference `armReference:"ResourceIdColumn" json:"resourceIdColumnReference,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - TimeAggregation *string `json:"timeAggregation,omitempty"` + // OperatorSpec + if rule.OperatorSpec != nil { + var operatorSpec v20231201s.ScheduledQueryRuleOperatorSpec + err := rule.OperatorSpec.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&operatorSpec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec") + } + destination.OperatorSpec = &operatorSpec + } else { + destination.OperatorSpec = nil + } + + // OriginalVersion + destination.OriginalVersion = rule.OriginalVersion + + // OverrideQueryTimeRange + destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange) + + // Owner + if rule.Owner != nil { + owner := rule.Owner.Copy() + destination.Owner = &owner + } else { + destination.Owner = nil + } + + // ResolveConfiguration + if propertyBag.Contains("ResolveConfiguration") { + var resolveConfiguration v20231201s.RuleResolveConfiguration + err := propertyBag.Pull("ResolveConfiguration", &resolveConfiguration) + if err != nil { + return eris.Wrap(err, "pulling 'ResolveConfiguration' from propertyBag") + } + + destination.ResolveConfiguration = &resolveConfiguration + } else { + destination.ResolveConfiguration = nil + } + + // ScopesReferences + if rule.ScopesReferences != nil { + scopesReferenceList := make([]genruntime.ResourceReference, len(rule.ScopesReferences)) + for scopesReferenceIndex, scopesReferenceItem := range rule.ScopesReferences { + // Shadow the loop variable to avoid aliasing + scopesReferenceItem := scopesReferenceItem + scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy() + } + destination.ScopesReferences = scopesReferenceList + } else { + destination.ScopesReferences = nil + } + + // Severity + destination.Severity = genruntime.ClonePointerToInt(rule.Severity) + + // SkipQueryValidation + if rule.SkipQueryValidation != nil { + skipQueryValidation := *rule.SkipQueryValidation + destination.SkipQueryValidation = &skipQueryValidation + } else { + destination.SkipQueryValidation = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags) + + // TargetResourceTypes + destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes) + + // WindowSize + destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRule_Spec interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule_Spec); ok { + err := augmentedRule.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.ScheduledQueryRule_STATUS +type ScheduledQueryRule_STATUS struct { + Actions *Actions_STATUS `json:"actions,omitempty"` + AutoMitigate *bool `json:"autoMitigate,omitempty"` + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + Conditions []conditions.Condition `json:"conditions,omitempty"` + CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"` + Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Etag *string `json:"etag,omitempty"` + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + Id *string `json:"id,omitempty"` + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + Name *string `json:"name,omitempty"` + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Scopes []string `json:"scopes,omitempty"` + Severity *int `json:"severity,omitempty"` + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + SystemData *SystemData_STATUS `json:"systemData,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + Type *string `json:"type,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &ScheduledQueryRule_STATUS{} + +// ConvertStatusFrom populates our ScheduledQueryRule_STATUS from the provided source +func (rule *ScheduledQueryRule_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v20231201s.ScheduledQueryRule_STATUS) + if ok { + // Populate our instance from source + return rule.AssignProperties_From_ScheduledQueryRule_STATUS(src) + } + + // Convert to an intermediate form + src = &v20231201s.ScheduledQueryRule_STATUS{} + err := src.ConvertStatusFrom(source) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = rule.AssignProperties_From_ScheduledQueryRule_STATUS(src) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v20231201s.ScheduledQueryRule_STATUS) + if ok { + // Populate destination from our instance + return rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst) + } + + // Convert to an intermediate form + dst = &v20231201s.ScheduledQueryRule_STATUS{} + err := rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +// AssignProperties_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_STATUS from the provided source ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) AssignProperties_From_ScheduledQueryRule_STATUS(source *v20231201s.ScheduledQueryRule_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Actions + if source.Actions != nil { + var action Actions_STATUS + err := action.AssignProperties_From_Actions_STATUS(source.Actions) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Actions_STATUS() to populate field Actions") + } + rule.Actions = &action + } else { + rule.Actions = nil + } + + // AutoMitigate + if source.AutoMitigate != nil { + autoMitigate := *source.AutoMitigate + rule.AutoMitigate = &autoMitigate + } else { + rule.AutoMitigate = nil + } + + // CheckWorkspaceAlertsStorageConfigured + if source.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + rule.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Conditions + rule.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // CreatedWithApiVersion + rule.CreatedWithApiVersion = genruntime.ClonePointerToString(source.CreatedWithApiVersion) + + // Criteria + if source.Criteria != nil { + var criterion ScheduledQueryRuleCriteria_STATUS + err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") + } + rule.Criteria = &criterion + } else { + rule.Criteria = nil + } + + // Description + rule.Description = genruntime.ClonePointerToString(source.Description) + + // DisplayName + rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) + + // Enabled + if source.Enabled != nil { + enabled := *source.Enabled + rule.Enabled = &enabled + } else { + rule.Enabled = nil + } + + // Etag + rule.Etag = genruntime.ClonePointerToString(source.Etag) + + // EvaluationFrequency + rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) + + // Id + rule.Id = genruntime.ClonePointerToString(source.Id) + + // Identity + if source.Identity != nil { + propertyBag.Add("Identity", *source.Identity) + } else { + propertyBag.Remove("Identity") + } + + // IsLegacyLogAnalyticsRule + if source.IsLegacyLogAnalyticsRule != nil { + isLegacyLogAnalyticsRule := *source.IsLegacyLogAnalyticsRule + rule.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } else { + rule.IsLegacyLogAnalyticsRule = nil + } + + // IsWorkspaceAlertsStorageConfigured + if source.IsWorkspaceAlertsStorageConfigured != nil { + isWorkspaceAlertsStorageConfigured := *source.IsWorkspaceAlertsStorageConfigured + rule.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured + } else { + rule.IsWorkspaceAlertsStorageConfigured = nil + } + + // Kind + rule.Kind = genruntime.ClonePointerToString(source.Kind) + + // Location + rule.Location = genruntime.ClonePointerToString(source.Location) + + // MuteActionsDuration + rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) + + // Name + rule.Name = genruntime.ClonePointerToString(source.Name) + + // OverrideQueryTimeRange + rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) + + // ResolveConfiguration + if source.ResolveConfiguration != nil { + propertyBag.Add("ResolveConfiguration", *source.ResolveConfiguration) + } else { + propertyBag.Remove("ResolveConfiguration") + } + + // Scopes + rule.Scopes = genruntime.CloneSliceOfString(source.Scopes) + + // Severity + rule.Severity = genruntime.ClonePointerToInt(source.Severity) + + // SkipQueryValidation + if source.SkipQueryValidation != nil { + skipQueryValidation := *source.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } else { + rule.SkipQueryValidation = nil + } + + // SystemData + if source.SystemData != nil { + var systemDataSTATUSStash v20221001s.SystemData_STATUS + err := systemDataSTATUSStash.AssignProperties_From_SystemData_STATUS(source.SystemData) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData_STATUSStash from SystemData") + } + var systemDatum SystemData_STATUS + err = systemDatum.AssignProperties_From_SystemData_STATUS(&systemDataSTATUSStash) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData from SystemData_STATUSStash") + } + rule.SystemData = &systemDatum + } else { + rule.SystemData = nil + } + + // Tags + rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TargetResourceTypes + rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) + + // Type + rule.Type = genruntime.ClonePointerToString(source.Type) + + // WindowSize + rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) + + // Update the property bag + if len(propertyBag) > 0 { + rule.PropertyBag = propertyBag + } else { + rule.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRule_STATUS interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule_STATUS); ok { + err := augmentedRule.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRule_STATUS populates the provided destination ScheduledQueryRule_STATUS from our ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) AssignProperties_To_ScheduledQueryRule_STATUS(destination *v20231201s.ScheduledQueryRule_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(rule.PropertyBag) + + // Actions + if rule.Actions != nil { + var action v20231201s.Actions_STATUS + err := rule.Actions.AssignProperties_To_Actions_STATUS(&action) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Actions_STATUS() to populate field Actions") + } + destination.Actions = &action + } else { + destination.Actions = nil + } + + // AutoMitigate + if rule.AutoMitigate != nil { + autoMitigate := *rule.AutoMitigate + destination.AutoMitigate = &autoMitigate + } else { + destination.AutoMitigate = nil + } + + // CheckWorkspaceAlertsStorageConfigured + if rule.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured + destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + destination.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(rule.Conditions) + + // CreatedWithApiVersion + destination.CreatedWithApiVersion = genruntime.ClonePointerToString(rule.CreatedWithApiVersion) + + // Criteria + if rule.Criteria != nil { + var criterion v20231201s.ScheduledQueryRuleCriteria_STATUS + err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&criterion) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") + } + destination.Criteria = &criterion + } else { + destination.Criteria = nil + } + + // Description + destination.Description = genruntime.ClonePointerToString(rule.Description) + + // DisplayName + destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName) + + // Enabled + if rule.Enabled != nil { + enabled := *rule.Enabled + destination.Enabled = &enabled + } else { + destination.Enabled = nil + } + + // Etag + destination.Etag = genruntime.ClonePointerToString(rule.Etag) + + // EvaluationFrequency + destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency) + + // Id + destination.Id = genruntime.ClonePointerToString(rule.Id) + + // Identity + if propertyBag.Contains("Identity") { + var identity v20231201s.Identity_STATUS + err := propertyBag.Pull("Identity", &identity) + if err != nil { + return eris.Wrap(err, "pulling 'Identity' from propertyBag") + } + + destination.Identity = &identity + } else { + destination.Identity = nil + } + + // IsLegacyLogAnalyticsRule + if rule.IsLegacyLogAnalyticsRule != nil { + isLegacyLogAnalyticsRule := *rule.IsLegacyLogAnalyticsRule + destination.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } else { + destination.IsLegacyLogAnalyticsRule = nil + } + + // IsWorkspaceAlertsStorageConfigured + if rule.IsWorkspaceAlertsStorageConfigured != nil { + isWorkspaceAlertsStorageConfigured := *rule.IsWorkspaceAlertsStorageConfigured + destination.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured + } else { + destination.IsWorkspaceAlertsStorageConfigured = nil + } + + // Kind + destination.Kind = genruntime.ClonePointerToString(rule.Kind) + + // Location + destination.Location = genruntime.ClonePointerToString(rule.Location) + + // MuteActionsDuration + destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration) + + // Name + destination.Name = genruntime.ClonePointerToString(rule.Name) + + // OverrideQueryTimeRange + destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange) + + // ResolveConfiguration + if propertyBag.Contains("ResolveConfiguration") { + var resolveConfiguration v20231201s.RuleResolveConfiguration_STATUS + err := propertyBag.Pull("ResolveConfiguration", &resolveConfiguration) + if err != nil { + return eris.Wrap(err, "pulling 'ResolveConfiguration' from propertyBag") + } + + destination.ResolveConfiguration = &resolveConfiguration + } else { + destination.ResolveConfiguration = nil + } + + // Scopes + destination.Scopes = genruntime.CloneSliceOfString(rule.Scopes) + + // Severity + destination.Severity = genruntime.ClonePointerToInt(rule.Severity) + + // SkipQueryValidation + if rule.SkipQueryValidation != nil { + skipQueryValidation := *rule.SkipQueryValidation + destination.SkipQueryValidation = &skipQueryValidation + } else { + destination.SkipQueryValidation = nil + } + + // SystemData + if rule.SystemData != nil { + var systemDataSTATUSStash v20221001s.SystemData_STATUS + err := rule.SystemData.AssignProperties_To_SystemData_STATUS(&systemDataSTATUSStash) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData_STATUSStash from SystemData") + } + var systemDatum v20231201s.SystemData_STATUS + err = systemDataSTATUSStash.AssignProperties_To_SystemData_STATUS(&systemDatum) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData from SystemData_STATUSStash") + } + destination.SystemData = &systemDatum + } else { + destination.SystemData = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags) + + // TargetResourceTypes + destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes) + + // Type + destination.Type = genruntime.ClonePointerToString(rule.Type) + + // WindowSize + destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRule_STATUS interface (if implemented) to customize the conversion + var ruleAsAny any = rule + if augmentedRule, ok := ruleAsAny.(augmentConversionForScheduledQueryRule_STATUS); ok { + err := augmentedRule.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.Actions +// Actions to invoke when the alert fires. +type Actions struct { + ActionGroupsReferences []genruntime.ResourceReference `armReference:"ActionGroups" json:"actionGroupsReferences,omitempty"` + CustomProperties map[string]string `json:"customProperties,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// AssignProperties_From_Actions populates our Actions from the provided source Actions +func (actions *Actions) AssignProperties_From_Actions(source *v20231201s.Actions) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // ActionGroupsReferences + if source.ActionGroupsReferences != nil { + actionGroupsReferenceList := make([]genruntime.ResourceReference, len(source.ActionGroupsReferences)) + for actionGroupsReferenceIndex, actionGroupsReferenceItem := range source.ActionGroupsReferences { + // Shadow the loop variable to avoid aliasing + actionGroupsReferenceItem := actionGroupsReferenceItem + actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy() + } + actions.ActionGroupsReferences = actionGroupsReferenceList + } else { + actions.ActionGroupsReferences = nil + } + + // ActionProperties + if len(source.ActionProperties) > 0 { + propertyBag.Add("ActionProperties", source.ActionProperties) + } else { + propertyBag.Remove("ActionProperties") + } + + // CustomProperties + actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + actions.PropertyBag = propertyBag + } else { + actions.PropertyBag = nil + } + + // Invoke the augmentConversionForActions interface (if implemented) to customize the conversion + var actionsAsAny any = actions + if augmentedActions, ok := actionsAsAny.(augmentConversionForActions); ok { + err := augmentedActions.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Actions populates the provided destination Actions from our Actions +func (actions *Actions) AssignProperties_To_Actions(destination *v20231201s.Actions) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(actions.PropertyBag) + + // ActionGroupsReferences + if actions.ActionGroupsReferences != nil { + actionGroupsReferenceList := make([]genruntime.ResourceReference, len(actions.ActionGroupsReferences)) + for actionGroupsReferenceIndex, actionGroupsReferenceItem := range actions.ActionGroupsReferences { + // Shadow the loop variable to avoid aliasing + actionGroupsReferenceItem := actionGroupsReferenceItem + actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy() + } + destination.ActionGroupsReferences = actionGroupsReferenceList + } else { + destination.ActionGroupsReferences = nil + } + + // ActionProperties + if propertyBag.Contains("ActionProperties") { + var actionProperty map[string]string + err := propertyBag.Pull("ActionProperties", &actionProperty) + if err != nil { + return eris.Wrap(err, "pulling 'ActionProperties' from propertyBag") + } + + destination.ActionProperties = actionProperty + } else { + destination.ActionProperties = nil + } + + // CustomProperties + destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForActions interface (if implemented) to customize the conversion + var actionsAsAny any = actions + if augmentedActions, ok := actionsAsAny.(augmentConversionForActions); ok { + err := augmentedActions.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.Actions_STATUS +// Actions to invoke when the alert fires. +type Actions_STATUS struct { + ActionGroups []string `json:"actionGroups,omitempty"` + CustomProperties map[string]string `json:"customProperties,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// AssignProperties_From_Actions_STATUS populates our Actions_STATUS from the provided source Actions_STATUS +func (actions *Actions_STATUS) AssignProperties_From_Actions_STATUS(source *v20231201s.Actions_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // ActionGroups + actions.ActionGroups = genruntime.CloneSliceOfString(source.ActionGroups) + + // ActionProperties + if len(source.ActionProperties) > 0 { + propertyBag.Add("ActionProperties", source.ActionProperties) + } else { + propertyBag.Remove("ActionProperties") + } + + // CustomProperties + actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + actions.PropertyBag = propertyBag + } else { + actions.PropertyBag = nil + } + + // Invoke the augmentConversionForActions_STATUS interface (if implemented) to customize the conversion + var actionsAsAny any = actions + if augmentedActions, ok := actionsAsAny.(augmentConversionForActions_STATUS); ok { + err := augmentedActions.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Actions_STATUS populates the provided destination Actions_STATUS from our Actions_STATUS +func (actions *Actions_STATUS) AssignProperties_To_Actions_STATUS(destination *v20231201s.Actions_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(actions.PropertyBag) + + // ActionGroups + destination.ActionGroups = genruntime.CloneSliceOfString(actions.ActionGroups) + + // ActionProperties + if propertyBag.Contains("ActionProperties") { + var actionProperty map[string]string + err := propertyBag.Pull("ActionProperties", &actionProperty) + if err != nil { + return eris.Wrap(err, "pulling 'ActionProperties' from propertyBag") + } + + destination.ActionProperties = actionProperty + } else { + destination.ActionProperties = nil + } + + // CustomProperties + destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForActions_STATUS interface (if implemented) to customize the conversion + var actionsAsAny any = actions + if augmentedActions, ok := actionsAsAny.(augmentConversionForActions_STATUS); ok { + err := augmentedActions.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +type augmentConversionForScheduledQueryRule_Spec interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRule_Spec) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRule_Spec) error +} + +type augmentConversionForScheduledQueryRule_STATUS interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRule_STATUS) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRule_STATUS) error +} + +// Storage version of v1api20220615.ScheduledQueryRuleCriteria +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + AllOf []Condition `json:"allOf,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// AssignProperties_From_ScheduledQueryRuleCriteria populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria +func (criteria *ScheduledQueryRuleCriteria) AssignProperties_From_ScheduledQueryRuleCriteria(source *v20231201s.ScheduledQueryRuleCriteria) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // AllOf + if source.AllOf != nil { + allOfList := make([]Condition, len(source.AllOf)) + for allOfIndex, allOfItem := range source.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf Condition + err := allOf.AssignProperties_From_Condition(&allOfItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + criteria.AllOf = allOfList + } else { + criteria.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + criteria.PropertyBag = propertyBag + } else { + criteria.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleCriteria interface (if implemented) to customize the conversion + var criteriaAsAny any = criteria + if augmentedCriteria, ok := criteriaAsAny.(augmentConversionForScheduledQueryRuleCriteria); ok { + err := augmentedCriteria.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleCriteria populates the provided destination ScheduledQueryRuleCriteria from our ScheduledQueryRuleCriteria +func (criteria *ScheduledQueryRuleCriteria) AssignProperties_To_ScheduledQueryRuleCriteria(destination *v20231201s.ScheduledQueryRuleCriteria) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(criteria.PropertyBag) + + // AllOf + if criteria.AllOf != nil { + allOfList := make([]v20231201s.Condition, len(criteria.AllOf)) + for allOfIndex, allOfItem := range criteria.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf v20231201s.Condition + err := allOfItem.AssignProperties_To_Condition(&allOf) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + destination.AllOf = allOfList + } else { + destination.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleCriteria interface (if implemented) to customize the conversion + var criteriaAsAny any = criteria + if augmentedCriteria, ok := criteriaAsAny.(augmentConversionForScheduledQueryRuleCriteria); ok { + err := augmentedCriteria.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.ScheduledQueryRuleCriteria_STATUS +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria_STATUS struct { + AllOf []Condition_STATUS `json:"allOf,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// AssignProperties_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria_STATUS from the provided source ScheduledQueryRuleCriteria_STATUS +func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source *v20231201s.ScheduledQueryRuleCriteria_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // AllOf + if source.AllOf != nil { + allOfList := make([]Condition_STATUS, len(source.AllOf)) + for allOfIndex, allOfItem := range source.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf Condition_STATUS + err := allOf.AssignProperties_From_Condition_STATUS(&allOfItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_STATUS() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + criteria.AllOf = allOfList + } else { + criteria.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + criteria.PropertyBag = propertyBag + } else { + criteria.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleCriteria_STATUS interface (if implemented) to customize the conversion + var criteriaAsAny any = criteria + if augmentedCriteria, ok := criteriaAsAny.(augmentConversionForScheduledQueryRuleCriteria_STATUS); ok { + err := augmentedCriteria.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleCriteria_STATUS populates the provided destination ScheduledQueryRuleCriteria_STATUS from our ScheduledQueryRuleCriteria_STATUS +func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(destination *v20231201s.ScheduledQueryRuleCriteria_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(criteria.PropertyBag) + + // AllOf + if criteria.AllOf != nil { + allOfList := make([]v20231201s.Condition_STATUS, len(criteria.AllOf)) + for allOfIndex, allOfItem := range criteria.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf v20231201s.Condition_STATUS + err := allOfItem.AssignProperties_To_Condition_STATUS(&allOf) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_STATUS() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + destination.AllOf = allOfList + } else { + destination.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleCriteria_STATUS interface (if implemented) to customize the conversion + var criteriaAsAny any = criteria + if augmentedCriteria, ok := criteriaAsAny.(augmentConversionForScheduledQueryRuleCriteria_STATUS); ok { + err := augmentedCriteria.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.ScheduledQueryRuleOperatorSpec +// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure +type ScheduledQueryRuleOperatorSpec struct { + ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"` +} + +// AssignProperties_From_ScheduledQueryRuleOperatorSpec populates our ScheduledQueryRuleOperatorSpec from the provided source ScheduledQueryRuleOperatorSpec +func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_From_ScheduledQueryRuleOperatorSpec(source *v20231201s.ScheduledQueryRuleOperatorSpec) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // ConfigMapExpressions + if source.ConfigMapExpressions != nil { + configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions)) + for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions { + // Shadow the loop variable to avoid aliasing + configMapExpressionItem := configMapExpressionItem + if configMapExpressionItem != nil { + configMapExpression := *configMapExpressionItem.DeepCopy() + configMapExpressionList[configMapExpressionIndex] = &configMapExpression + } else { + configMapExpressionList[configMapExpressionIndex] = nil + } + } + operator.ConfigMapExpressions = configMapExpressionList + } else { + operator.ConfigMapExpressions = nil + } + + // SecretExpressions + if source.SecretExpressions != nil { + secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions)) + for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions { + // Shadow the loop variable to avoid aliasing + secretExpressionItem := secretExpressionItem + if secretExpressionItem != nil { + secretExpression := *secretExpressionItem.DeepCopy() + secretExpressionList[secretExpressionIndex] = &secretExpression + } else { + secretExpressionList[secretExpressionIndex] = nil + } + } + operator.SecretExpressions = secretExpressionList + } else { + operator.SecretExpressions = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + operator.PropertyBag = propertyBag + } else { + operator.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleOperatorSpec interface (if implemented) to customize the conversion + var operatorAsAny any = operator + if augmentedOperator, ok := operatorAsAny.(augmentConversionForScheduledQueryRuleOperatorSpec); ok { + err := augmentedOperator.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleOperatorSpec populates the provided destination ScheduledQueryRuleOperatorSpec from our ScheduledQueryRuleOperatorSpec +func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_To_ScheduledQueryRuleOperatorSpec(destination *v20231201s.ScheduledQueryRuleOperatorSpec) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(operator.PropertyBag) + + // ConfigMapExpressions + if operator.ConfigMapExpressions != nil { + configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions)) + for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions { + // Shadow the loop variable to avoid aliasing + configMapExpressionItem := configMapExpressionItem + if configMapExpressionItem != nil { + configMapExpression := *configMapExpressionItem.DeepCopy() + configMapExpressionList[configMapExpressionIndex] = &configMapExpression + } else { + configMapExpressionList[configMapExpressionIndex] = nil + } + } + destination.ConfigMapExpressions = configMapExpressionList + } else { + destination.ConfigMapExpressions = nil + } + + // SecretExpressions + if operator.SecretExpressions != nil { + secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions)) + for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions { + // Shadow the loop variable to avoid aliasing + secretExpressionItem := secretExpressionItem + if secretExpressionItem != nil { + secretExpression := *secretExpressionItem.DeepCopy() + secretExpressionList[secretExpressionIndex] = &secretExpression + } else { + secretExpressionList[secretExpressionIndex] = nil + } + } + destination.SecretExpressions = secretExpressionList + } else { + destination.SecretExpressions = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForScheduledQueryRuleOperatorSpec interface (if implemented) to customize the conversion + var operatorAsAny any = operator + if augmentedOperator, ok := operatorAsAny.(augmentConversionForScheduledQueryRuleOperatorSpec); ok { + err := augmentedOperator.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +// Storage version of v1api20220615.SystemData_STATUS +// Metadata pertaining to creation and last modification of the resource. +type SystemData_STATUS struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *v20221001s.SystemData_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // CreatedAt + data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt) + + // CreatedBy + data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy) + + // CreatedByType + data.CreatedByType = genruntime.ClonePointerToString(source.CreatedByType) + + // LastModifiedAt + data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt) + + // LastModifiedBy + data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy) + + // LastModifiedByType + data.LastModifiedByType = genruntime.ClonePointerToString(source.LastModifiedByType) + + // Update the property bag + if len(propertyBag) > 0 { + data.PropertyBag = propertyBag + } else { + data.PropertyBag = nil + } + + // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion + var dataAsAny any = data + if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { + err := augmentedData.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *v20221001s.SystemData_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(data.PropertyBag) + + // CreatedAt + destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt) + + // CreatedBy + destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy) + + // CreatedByType + destination.CreatedByType = genruntime.ClonePointerToString(data.CreatedByType) + + // LastModifiedAt + destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt) + + // LastModifiedBy + destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy) + + // LastModifiedByType + destination.LastModifiedByType = genruntime.ClonePointerToString(data.LastModifiedByType) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion + var dataAsAny any = data + if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { + err := augmentedData.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +type augmentConversionForActions interface { + AssignPropertiesFrom(src *v20231201s.Actions) error + AssignPropertiesTo(dst *v20231201s.Actions) error +} + +type augmentConversionForActions_STATUS interface { + AssignPropertiesFrom(src *v20231201s.Actions_STATUS) error + AssignPropertiesTo(dst *v20231201s.Actions_STATUS) error +} + +type augmentConversionForScheduledQueryRuleCriteria interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRuleCriteria) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRuleCriteria) error +} + +type augmentConversionForScheduledQueryRuleCriteria_STATUS interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRuleCriteria_STATUS) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRuleCriteria_STATUS) error +} + +type augmentConversionForScheduledQueryRuleOperatorSpec interface { + AssignPropertiesFrom(src *v20231201s.ScheduledQueryRuleOperatorSpec) error + AssignPropertiesTo(dst *v20231201s.ScheduledQueryRuleOperatorSpec) error +} + +type augmentConversionForSystemData_STATUS interface { + AssignPropertiesFrom(src *v20221001s.SystemData_STATUS) error + AssignPropertiesTo(dst *v20221001s.SystemData_STATUS) error +} + +// Storage version of v1api20220615.Condition +// A condition of the scheduled query rule. +type Condition struct { + Dimensions []Dimension `json:"dimensions,omitempty"` + FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"` + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + MetricName *string `json:"metricName,omitempty"` + Operator *string `json:"operator,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Query *string `json:"query,omitempty"` + + // ResourceIdColumnReference: The column containing the resource id. The content of the column must be a uri formatted as + // resource id. Relevant only for rules of the kind LogAlert. + ResourceIdColumnReference *genruntime.ResourceReference `armReference:"ResourceIdColumn" json:"resourceIdColumnReference,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + TimeAggregation *string `json:"timeAggregation,omitempty"` +} + +// AssignProperties_From_Condition populates our Condition from the provided source Condition +func (condition *Condition) AssignProperties_From_Condition(source *v20231201s.Condition) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Dimensions + if source.Dimensions != nil { + dimensionList := make([]Dimension, len(source.Dimensions)) + for dimensionIndex, dimensionItem := range source.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension Dimension + err := dimension.AssignProperties_From_Dimension(&dimensionItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Dimension() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + condition.Dimensions = dimensionList + } else { + condition.Dimensions = nil + } + + // FailingPeriods + if source.FailingPeriods != nil { + var failingPeriod Condition_FailingPeriods + err := failingPeriod.AssignProperties_From_Condition_FailingPeriods(source.FailingPeriods) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods() to populate field FailingPeriods") + } + condition.FailingPeriods = &failingPeriod + } else { + condition.FailingPeriods = nil + } + + // MetricMeasureColumn + condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) + + // MetricName + condition.MetricName = genruntime.ClonePointerToString(source.MetricName) + + // Operator + condition.Operator = genruntime.ClonePointerToString(source.Operator) + + // Query + condition.Query = genruntime.ClonePointerToString(source.Query) + + // ResourceIdColumnReference + if source.ResourceIdColumnReference != nil { + resourceIdColumnReference := source.ResourceIdColumnReference.Copy() + condition.ResourceIdColumnReference = &resourceIdColumnReference + } else { + condition.ResourceIdColumnReference = nil + } + + // Threshold + if source.Threshold != nil { + threshold := *source.Threshold + condition.Threshold = &threshold + } else { + condition.Threshold = nil + } + + // TimeAggregation + condition.TimeAggregation = genruntime.ClonePointerToString(source.TimeAggregation) + + // Update the property bag + if len(propertyBag) > 0 { + condition.PropertyBag = propertyBag + } else { + condition.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition interface (if implemented) to customize the conversion + var conditionAsAny any = condition + if augmentedCondition, ok := conditionAsAny.(augmentConversionForCondition); ok { + err := augmentedCondition.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Condition populates the provided destination Condition from our Condition +func (condition *Condition) AssignProperties_To_Condition(destination *v20231201s.Condition) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(condition.PropertyBag) + + // Dimensions + if condition.Dimensions != nil { + dimensionList := make([]v20231201s.Dimension, len(condition.Dimensions)) + for dimensionIndex, dimensionItem := range condition.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension v20231201s.Dimension + err := dimensionItem.AssignProperties_To_Dimension(&dimension) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Dimension() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + destination.Dimensions = dimensionList + } else { + destination.Dimensions = nil + } + + // FailingPeriods + if condition.FailingPeriods != nil { + var failingPeriod v20231201s.Condition_FailingPeriods + err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods(&failingPeriod) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods() to populate field FailingPeriods") + } + destination.FailingPeriods = &failingPeriod + } else { + destination.FailingPeriods = nil + } + + // MetricMeasureColumn + destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn) + + // MetricName + destination.MetricName = genruntime.ClonePointerToString(condition.MetricName) + + // Operator + destination.Operator = genruntime.ClonePointerToString(condition.Operator) + + // Query + destination.Query = genruntime.ClonePointerToString(condition.Query) + + // ResourceIdColumnReference + if condition.ResourceIdColumnReference != nil { + resourceIdColumnReference := condition.ResourceIdColumnReference.Copy() + destination.ResourceIdColumnReference = &resourceIdColumnReference + } else { + destination.ResourceIdColumnReference = nil + } + + // Threshold + if condition.Threshold != nil { + threshold := *condition.Threshold + destination.Threshold = &threshold + } else { + destination.Threshold = nil + } + + // TimeAggregation + destination.TimeAggregation = genruntime.ClonePointerToString(condition.TimeAggregation) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition interface (if implemented) to customize the conversion + var conditionAsAny any = condition + if augmentedCondition, ok := conditionAsAny.(augmentConversionForCondition); ok { + err := augmentedCondition.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil } // Storage version of v1api20220615.Condition_STATUS @@ -453,6 +2013,178 @@ type Condition_STATUS struct { TimeAggregation *string `json:"timeAggregation,omitempty"` } +// AssignProperties_From_Condition_STATUS populates our Condition_STATUS from the provided source Condition_STATUS +func (condition *Condition_STATUS) AssignProperties_From_Condition_STATUS(source *v20231201s.Condition_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Dimensions + if source.Dimensions != nil { + dimensionList := make([]Dimension_STATUS, len(source.Dimensions)) + for dimensionIndex, dimensionItem := range source.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension Dimension_STATUS + err := dimension.AssignProperties_From_Dimension_STATUS(&dimensionItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Dimension_STATUS() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + condition.Dimensions = dimensionList + } else { + condition.Dimensions = nil + } + + // FailingPeriods + if source.FailingPeriods != nil { + var failingPeriod Condition_FailingPeriods_STATUS + err := failingPeriod.AssignProperties_From_Condition_FailingPeriods_STATUS(source.FailingPeriods) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") + } + condition.FailingPeriods = &failingPeriod + } else { + condition.FailingPeriods = nil + } + + // MetricMeasureColumn + condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) + + // MetricName + condition.MetricName = genruntime.ClonePointerToString(source.MetricName) + + // Operator + condition.Operator = genruntime.ClonePointerToString(source.Operator) + + // Query + condition.Query = genruntime.ClonePointerToString(source.Query) + + // ResourceIdColumn + condition.ResourceIdColumn = genruntime.ClonePointerToString(source.ResourceIdColumn) + + // Threshold + if source.Threshold != nil { + threshold := *source.Threshold + condition.Threshold = &threshold + } else { + condition.Threshold = nil + } + + // TimeAggregation + condition.TimeAggregation = genruntime.ClonePointerToString(source.TimeAggregation) + + // Update the property bag + if len(propertyBag) > 0 { + condition.PropertyBag = propertyBag + } else { + condition.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_STATUS interface (if implemented) to customize the conversion + var conditionAsAny any = condition + if augmentedCondition, ok := conditionAsAny.(augmentConversionForCondition_STATUS); ok { + err := augmentedCondition.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Condition_STATUS populates the provided destination Condition_STATUS from our Condition_STATUS +func (condition *Condition_STATUS) AssignProperties_To_Condition_STATUS(destination *v20231201s.Condition_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(condition.PropertyBag) + + // Dimensions + if condition.Dimensions != nil { + dimensionList := make([]v20231201s.Dimension_STATUS, len(condition.Dimensions)) + for dimensionIndex, dimensionItem := range condition.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension v20231201s.Dimension_STATUS + err := dimensionItem.AssignProperties_To_Dimension_STATUS(&dimension) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Dimension_STATUS() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + destination.Dimensions = dimensionList + } else { + destination.Dimensions = nil + } + + // FailingPeriods + if condition.FailingPeriods != nil { + var failingPeriod v20231201s.Condition_FailingPeriods_STATUS + err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods_STATUS(&failingPeriod) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") + } + destination.FailingPeriods = &failingPeriod + } else { + destination.FailingPeriods = nil + } + + // MetricMeasureColumn + destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn) + + // MetricName + destination.MetricName = genruntime.ClonePointerToString(condition.MetricName) + + // Operator + destination.Operator = genruntime.ClonePointerToString(condition.Operator) + + // Query + destination.Query = genruntime.ClonePointerToString(condition.Query) + + // ResourceIdColumn + destination.ResourceIdColumn = genruntime.ClonePointerToString(condition.ResourceIdColumn) + + // Threshold + if condition.Threshold != nil { + threshold := *condition.Threshold + destination.Threshold = &threshold + } else { + destination.Threshold = nil + } + + // TimeAggregation + destination.TimeAggregation = genruntime.ClonePointerToString(condition.TimeAggregation) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_STATUS interface (if implemented) to customize the conversion + var conditionAsAny any = condition + if augmentedCondition, ok := conditionAsAny.(augmentConversionForCondition_STATUS); ok { + err := augmentedCondition.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +type augmentConversionForCondition interface { + AssignPropertiesFrom(src *v20231201s.Condition) error + AssignPropertiesTo(dst *v20231201s.Condition) error +} + +type augmentConversionForCondition_STATUS interface { + AssignPropertiesFrom(src *v20231201s.Condition_STATUS) error + AssignPropertiesTo(dst *v20231201s.Condition_STATUS) error +} + // Storage version of v1api20220615.Condition_FailingPeriods type Condition_FailingPeriods struct { MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` @@ -460,6 +2192,68 @@ type Condition_FailingPeriods struct { PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } +// AssignProperties_From_Condition_FailingPeriods populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods +func (periods *Condition_FailingPeriods) AssignProperties_From_Condition_FailingPeriods(source *v20231201s.Condition_FailingPeriods) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + periods.PropertyBag = propertyBag + } else { + periods.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_FailingPeriods interface (if implemented) to customize the conversion + var periodsAsAny any = periods + if augmentedPeriods, ok := periodsAsAny.(augmentConversionForCondition_FailingPeriods); ok { + err := augmentedPeriods.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Condition_FailingPeriods populates the provided destination Condition_FailingPeriods from our Condition_FailingPeriods +func (periods *Condition_FailingPeriods) AssignProperties_To_Condition_FailingPeriods(destination *v20231201s.Condition_FailingPeriods) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(periods.PropertyBag) + + // MinFailingPeriodsToAlert + destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_FailingPeriods interface (if implemented) to customize the conversion + var periodsAsAny any = periods + if augmentedPeriods, ok := periodsAsAny.(augmentConversionForCondition_FailingPeriods); ok { + err := augmentedPeriods.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + // Storage version of v1api20220615.Condition_FailingPeriods_STATUS type Condition_FailingPeriods_STATUS struct { MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` @@ -467,6 +2261,68 @@ type Condition_FailingPeriods_STATUS struct { PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } +// AssignProperties_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods_STATUS from the provided source Condition_FailingPeriods_STATUS +func (periods *Condition_FailingPeriods_STATUS) AssignProperties_From_Condition_FailingPeriods_STATUS(source *v20231201s.Condition_FailingPeriods_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + periods.PropertyBag = propertyBag + } else { + periods.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_FailingPeriods_STATUS interface (if implemented) to customize the conversion + var periodsAsAny any = periods + if augmentedPeriods, ok := periodsAsAny.(augmentConversionForCondition_FailingPeriods_STATUS); ok { + err := augmentedPeriods.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Condition_FailingPeriods_STATUS populates the provided destination Condition_FailingPeriods_STATUS from our Condition_FailingPeriods_STATUS +func (periods *Condition_FailingPeriods_STATUS) AssignProperties_To_Condition_FailingPeriods_STATUS(destination *v20231201s.Condition_FailingPeriods_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(periods.PropertyBag) + + // MinFailingPeriodsToAlert + destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForCondition_FailingPeriods_STATUS interface (if implemented) to customize the conversion + var periodsAsAny any = periods + if augmentedPeriods, ok := periodsAsAny.(augmentConversionForCondition_FailingPeriods_STATUS); ok { + err := augmentedPeriods.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + // Storage version of v1api20220615.Dimension // Dimension splitting and filtering definition type Dimension struct { @@ -476,6 +2332,74 @@ type Dimension struct { Values []string `json:"values,omitempty"` } +// AssignProperties_From_Dimension populates our Dimension from the provided source Dimension +func (dimension *Dimension) AssignProperties_From_Dimension(source *v20231201s.Dimension) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Name + dimension.Name = genruntime.ClonePointerToString(source.Name) + + // Operator + dimension.Operator = genruntime.ClonePointerToString(source.Operator) + + // Values + dimension.Values = genruntime.CloneSliceOfString(source.Values) + + // Update the property bag + if len(propertyBag) > 0 { + dimension.PropertyBag = propertyBag + } else { + dimension.PropertyBag = nil + } + + // Invoke the augmentConversionForDimension interface (if implemented) to customize the conversion + var dimensionAsAny any = dimension + if augmentedDimension, ok := dimensionAsAny.(augmentConversionForDimension); ok { + err := augmentedDimension.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Dimension populates the provided destination Dimension from our Dimension +func (dimension *Dimension) AssignProperties_To_Dimension(destination *v20231201s.Dimension) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(dimension.PropertyBag) + + // Name + destination.Name = genruntime.ClonePointerToString(dimension.Name) + + // Operator + destination.Operator = genruntime.ClonePointerToString(dimension.Operator) + + // Values + destination.Values = genruntime.CloneSliceOfString(dimension.Values) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForDimension interface (if implemented) to customize the conversion + var dimensionAsAny any = dimension + if augmentedDimension, ok := dimensionAsAny.(augmentConversionForDimension); ok { + err := augmentedDimension.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + // Storage version of v1api20220615.Dimension_STATUS // Dimension splitting and filtering definition type Dimension_STATUS struct { @@ -485,6 +2409,94 @@ type Dimension_STATUS struct { Values []string `json:"values,omitempty"` } +// AssignProperties_From_Dimension_STATUS populates our Dimension_STATUS from the provided source Dimension_STATUS +func (dimension *Dimension_STATUS) AssignProperties_From_Dimension_STATUS(source *v20231201s.Dimension_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Name + dimension.Name = genruntime.ClonePointerToString(source.Name) + + // Operator + dimension.Operator = genruntime.ClonePointerToString(source.Operator) + + // Values + dimension.Values = genruntime.CloneSliceOfString(source.Values) + + // Update the property bag + if len(propertyBag) > 0 { + dimension.PropertyBag = propertyBag + } else { + dimension.PropertyBag = nil + } + + // Invoke the augmentConversionForDimension_STATUS interface (if implemented) to customize the conversion + var dimensionAsAny any = dimension + if augmentedDimension, ok := dimensionAsAny.(augmentConversionForDimension_STATUS); ok { + err := augmentedDimension.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_Dimension_STATUS populates the provided destination Dimension_STATUS from our Dimension_STATUS +func (dimension *Dimension_STATUS) AssignProperties_To_Dimension_STATUS(destination *v20231201s.Dimension_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(dimension.PropertyBag) + + // Name + destination.Name = genruntime.ClonePointerToString(dimension.Name) + + // Operator + destination.Operator = genruntime.ClonePointerToString(dimension.Operator) + + // Values + destination.Values = genruntime.CloneSliceOfString(dimension.Values) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForDimension_STATUS interface (if implemented) to customize the conversion + var dimensionAsAny any = dimension + if augmentedDimension, ok := dimensionAsAny.(augmentConversionForDimension_STATUS); ok { + err := augmentedDimension.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +type augmentConversionForCondition_FailingPeriods interface { + AssignPropertiesFrom(src *v20231201s.Condition_FailingPeriods) error + AssignPropertiesTo(dst *v20231201s.Condition_FailingPeriods) error +} + +type augmentConversionForCondition_FailingPeriods_STATUS interface { + AssignPropertiesFrom(src *v20231201s.Condition_FailingPeriods_STATUS) error + AssignPropertiesTo(dst *v20231201s.Condition_FailingPeriods_STATUS) error +} + +type augmentConversionForDimension interface { + AssignPropertiesFrom(src *v20231201s.Dimension) error + AssignPropertiesTo(dst *v20231201s.Dimension) error +} + +type augmentConversionForDimension_STATUS interface { + AssignPropertiesFrom(src *v20231201s.Dimension_STATUS) error + AssignPropertiesTo(dst *v20231201s.Dimension_STATUS) error +} + func init() { SchemeBuilder.Register(&ScheduledQueryRule{}, &ScheduledQueryRuleList{}) } diff --git a/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen_test.go b/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen_test.go index 670951eee9d..b082f013133 100644 --- a/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen_test.go +++ b/v2/api/insights/v1api20220615/storage/scheduled_query_rule_types_gen_test.go @@ -5,7 +5,8 @@ package storage import ( "encoding/json" - storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20221001/storage" + v20221001s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20221001/storage" + v20231201s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/kr/pretty" @@ -18,6 +19,48 @@ import ( "testing" ) +func Test_Actions_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Actions to Actions via AssignProperties_To_Actions & AssignProperties_From_Actions returns original", + prop.ForAll(RunPropertyAssignmentTestForActions, ActionsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForActions tests if a specific instance of Actions can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForActions(subject Actions) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Actions + err := copied.AssignProperties_To_Actions(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Actions + err = actual.AssignProperties_From_Actions(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Actions_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -80,6 +123,48 @@ func AddIndependentPropertyGeneratorsForActions(gens map[string]gopter.Gen) { gen.AlphaString()) } +func Test_Actions_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Actions_STATUS to Actions_STATUS via AssignProperties_To_Actions_STATUS & AssignProperties_From_Actions_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForActions_STATUS, Actions_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForActions_STATUS tests if a specific instance of Actions_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForActions_STATUS(subject Actions_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Actions_STATUS + err := copied.AssignProperties_To_Actions_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Actions_STATUS + err = actual.AssignProperties_From_Actions_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Actions_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -143,6 +228,48 @@ func AddIndependentPropertyGeneratorsForActions_STATUS(gens map[string]gopter.Ge gen.AlphaString()) } +func Test_Condition_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition to Condition via AssignProperties_To_Condition & AssignProperties_From_Condition returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition, ConditionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition tests if a specific instance of Condition can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition(subject Condition) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Condition + err := copied.AssignProperties_To_Condition(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition + err = actual.AssignProperties_From_Condition(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Condition_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -223,6 +350,48 @@ func AddRelatedPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriodsGenerator()) } +func Test_Condition_FailingPeriods_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_FailingPeriods to Condition_FailingPeriods via AssignProperties_To_Condition_FailingPeriods & AssignProperties_From_Condition_FailingPeriods returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_FailingPeriods, Condition_FailingPeriodsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_FailingPeriods tests if a specific instance of Condition_FailingPeriods can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_FailingPeriods(subject Condition_FailingPeriods) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Condition_FailingPeriods + err := copied.AssignProperties_To_Condition_FailingPeriods(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_FailingPeriods + err = actual.AssignProperties_From_Condition_FailingPeriods(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Condition_FailingPeriods_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -285,6 +454,48 @@ func AddIndependentPropertyGeneratorsForCondition_FailingPeriods(gens map[string gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) } +func Test_Condition_FailingPeriods_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_FailingPeriods_STATUS to Condition_FailingPeriods_STATUS via AssignProperties_To_Condition_FailingPeriods_STATUS & AssignProperties_From_Condition_FailingPeriods_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS, Condition_FailingPeriods_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS tests if a specific instance of Condition_FailingPeriods_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS(subject Condition_FailingPeriods_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Condition_FailingPeriods_STATUS + err := copied.AssignProperties_To_Condition_FailingPeriods_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_FailingPeriods_STATUS + err = actual.AssignProperties_From_Condition_FailingPeriods_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Condition_FailingPeriods_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -347,6 +558,48 @@ func AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(gens map gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) } +func Test_Condition_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_STATUS to Condition_STATUS via AssignProperties_To_Condition_STATUS & AssignProperties_From_Condition_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_STATUS, Condition_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_STATUS tests if a specific instance of Condition_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_STATUS(subject Condition_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Condition_STATUS + err := copied.AssignProperties_To_Condition_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_STATUS + err = actual.AssignProperties_From_Condition_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Condition_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -428,6 +681,48 @@ func AddRelatedPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriods_STATUSGenerator()) } +func Test_Dimension_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Dimension to Dimension via AssignProperties_To_Dimension & AssignProperties_From_Dimension returns original", + prop.ForAll(RunPropertyAssignmentTestForDimension, DimensionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDimension tests if a specific instance of Dimension can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForDimension(subject Dimension) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Dimension + err := copied.AssignProperties_To_Dimension(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Dimension + err = actual.AssignProperties_From_Dimension(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Dimension_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -490,6 +785,48 @@ func AddIndependentPropertyGeneratorsForDimension(gens map[string]gopter.Gen) { gens["Values"] = gen.SliceOf(gen.AlphaString()) } +func Test_Dimension_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Dimension_STATUS to Dimension_STATUS via AssignProperties_To_Dimension_STATUS & AssignProperties_From_Dimension_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForDimension_STATUS, Dimension_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDimension_STATUS tests if a specific instance of Dimension_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForDimension_STATUS(subject Dimension_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.Dimension_STATUS + err := copied.AssignProperties_To_Dimension_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Dimension_STATUS + err = actual.AssignProperties_From_Dimension_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_Dimension_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -552,6 +889,91 @@ func AddIndependentPropertyGeneratorsForDimension_STATUS(gens map[string]gopter. gens["Values"] = gen.SliceOf(gen.AlphaString()) } +func Test_ScheduledQueryRule_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + parameters.MinSuccessfulTests = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule to hub returns original", + prop.ForAll(RunResourceConversionTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForScheduledQueryRule tests if a specific instance of ScheduledQueryRule round trips to the hub storage version and back losslessly +func RunResourceConversionTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub v20231201s.ScheduledQueryRule + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual ScheduledQueryRule + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRule_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule to ScheduledQueryRule via AssignProperties_To_ScheduledQueryRule & AssignProperties_From_ScheduledQueryRule returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule tests if a specific instance of ScheduledQueryRule can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRule + err := copied.AssignProperties_To_ScheduledQueryRule(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule + err = actual.AssignProperties_From_ScheduledQueryRule(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRule_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -613,6 +1035,48 @@ func AddRelatedPropertyGeneratorsForScheduledQueryRule(gens map[string]gopter.Ge gens["Status"] = ScheduledQueryRule_STATUSGenerator() } +func Test_ScheduledQueryRuleCriteria_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleCriteria to ScheduledQueryRuleCriteria via AssignProperties_To_ScheduledQueryRuleCriteria & AssignProperties_From_ScheduledQueryRuleCriteria returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleCriteria, ScheduledQueryRuleCriteriaGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleCriteria tests if a specific instance of ScheduledQueryRuleCriteria can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleCriteria(subject ScheduledQueryRuleCriteria) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRuleCriteria + err := copied.AssignProperties_To_ScheduledQueryRuleCriteria(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleCriteria + err = actual.AssignProperties_From_ScheduledQueryRuleCriteria(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRuleCriteria_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -674,6 +1138,48 @@ func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(gens map[string]g gens["AllOf"] = gen.SliceOf(ConditionGenerator()) } +func Test_ScheduledQueryRuleCriteria_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleCriteria_STATUS to ScheduledQueryRuleCriteria_STATUS via AssignProperties_To_ScheduledQueryRuleCriteria_STATUS & AssignProperties_From_ScheduledQueryRuleCriteria_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS, ScheduledQueryRuleCriteria_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS tests if a specific instance of ScheduledQueryRuleCriteria_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS(subject ScheduledQueryRuleCriteria_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRuleCriteria_STATUS + err := copied.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleCriteria_STATUS + err = actual.AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRuleCriteria_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -735,6 +1241,48 @@ func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(gens map[s gens["AllOf"] = gen.SliceOf(Condition_STATUSGenerator()) } +func Test_ScheduledQueryRuleOperatorSpec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleOperatorSpec to ScheduledQueryRuleOperatorSpec via AssignProperties_To_ScheduledQueryRuleOperatorSpec & AssignProperties_From_ScheduledQueryRuleOperatorSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec, ScheduledQueryRuleOperatorSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec tests if a specific instance of ScheduledQueryRuleOperatorSpec can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec(subject ScheduledQueryRuleOperatorSpec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRuleOperatorSpec + err := copied.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleOperatorSpec + err = actual.AssignProperties_From_ScheduledQueryRuleOperatorSpec(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRuleOperatorSpec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -790,6 +1338,48 @@ func ScheduledQueryRuleOperatorSpecGenerator() gopter.Gen { return scheduledQueryRuleOperatorSpecGenerator } +func Test_ScheduledQueryRule_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule_STATUS to ScheduledQueryRule_STATUS via AssignProperties_To_ScheduledQueryRule_STATUS & AssignProperties_From_ScheduledQueryRule_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule_STATUS, ScheduledQueryRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule_STATUS tests if a specific instance of ScheduledQueryRule_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule_STATUS(subject ScheduledQueryRule_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRule_STATUS + err := copied.AssignProperties_To_ScheduledQueryRule_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule_STATUS + err = actual.AssignProperties_From_ScheduledQueryRule_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRule_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -891,6 +1481,48 @@ func AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]go gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) } +func Test_ScheduledQueryRule_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule_Spec to ScheduledQueryRule_Spec via AssignProperties_To_ScheduledQueryRule_Spec & AssignProperties_From_ScheduledQueryRule_Spec returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule_Spec, ScheduledQueryRule_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule_Spec tests if a specific instance of ScheduledQueryRule_Spec can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule_Spec(subject ScheduledQueryRule_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20231201s.ScheduledQueryRule_Spec + err := copied.AssignProperties_To_ScheduledQueryRule_Spec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule_Spec + err = actual.AssignProperties_From_ScheduledQueryRule_Spec(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ScheduledQueryRule_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -1003,7 +1635,7 @@ func RunPropertyAssignmentTestForSystemData_STATUS(subject SystemData_STATUS) st copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other storage.SystemData_STATUS + var other v20221001s.SystemData_STATUS err := copied.AssignProperties_To_SystemData_STATUS(&other) if err != nil { return err.Error() diff --git a/v2/api/insights/v1api20220615/storage/structure.txt b/v2/api/insights/v1api20220615/storage/structure.txt index 5a0ea549890..9d5d53ce048 100644 --- a/v2/api/insights/v1api20220615/storage/structure.txt +++ b/v2/api/insights/v1api20220615/storage/structure.txt @@ -206,4 +206,18 @@ Webtest: Resource ├── PropertyBag: genruntime.PropertyBag ├── SSLCertRemainingLifetimeCheck: *int └── SSLCheck: *bool +augmentConversionForActions: Interface +augmentConversionForActions_STATUS: Interface +augmentConversionForCondition: Interface +augmentConversionForCondition_FailingPeriods: Interface +augmentConversionForCondition_FailingPeriods_STATUS: Interface +augmentConversionForCondition_STATUS: Interface +augmentConversionForDimension: Interface +augmentConversionForDimension_STATUS: Interface +augmentConversionForScheduledQueryRule: Interface +augmentConversionForScheduledQueryRuleCriteria: Interface +augmentConversionForScheduledQueryRuleCriteria_STATUS: Interface +augmentConversionForScheduledQueryRuleOperatorSpec: Interface +augmentConversionForScheduledQueryRule_STATUS: Interface +augmentConversionForScheduledQueryRule_Spec: Interface augmentConversionForSystemData_STATUS: Interface diff --git a/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen.go b/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen.go index 24b6d25134a..57071c62b5c 100644 --- a/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen.go +++ b/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen.go @@ -4,6 +4,7 @@ package storage import ( + storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps" @@ -333,6 +334,97 @@ type SystemData_STATUS struct { PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } +// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // CreatedAt + data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt) + + // CreatedBy + data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy) + + // CreatedByType + data.CreatedByType = genruntime.ClonePointerToString(source.CreatedByType) + + // LastModifiedAt + data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt) + + // LastModifiedBy + data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy) + + // LastModifiedByType + data.LastModifiedByType = genruntime.ClonePointerToString(source.LastModifiedByType) + + // Update the property bag + if len(propertyBag) > 0 { + data.PropertyBag = propertyBag + } else { + data.PropertyBag = nil + } + + // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion + var dataAsAny any = data + if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { + err := augmentedData.AssignPropertiesFrom(source) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion") + } + } + + // No error + return nil +} + +// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *storage.SystemData_STATUS) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(data.PropertyBag) + + // CreatedAt + destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt) + + // CreatedBy + destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy) + + // CreatedByType + destination.CreatedByType = genruntime.ClonePointerToString(data.CreatedByType) + + // LastModifiedAt + destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt) + + // LastModifiedBy + destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy) + + // LastModifiedByType + destination.LastModifiedByType = genruntime.ClonePointerToString(data.LastModifiedByType) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion + var dataAsAny any = data + if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok { + err := augmentedData.AssignPropertiesTo(destination) + if err != nil { + return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion") + } + } + + // No error + return nil +} + +type augmentConversionForSystemData_STATUS interface { + AssignPropertiesFrom(src *storage.SystemData_STATUS) error + AssignPropertiesTo(dst *storage.SystemData_STATUS) error +} + // Storage version of v1api20221001.EmailNotification // Email notification of an autoscale event. type EmailNotification struct { diff --git a/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen_test.go b/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen_test.go index 20e3279545b..3236cea61f1 100644 --- a/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen_test.go +++ b/v2/api/insights/v1api20221001/storage/autoscale_setting_types_gen_test.go @@ -5,6 +5,7 @@ package storage import ( "encoding/json" + storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/kr/pretty" @@ -1805,6 +1806,48 @@ func AddRelatedPropertyGeneratorsForScaleRule_STATUS(gens map[string]gopter.Gen) gens["ScaleAction"] = gen.PtrOf(ScaleAction_STATUSGenerator()) } +func Test_SystemData_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SystemData_STATUS to SystemData_STATUS via AssignProperties_To_SystemData_STATUS & AssignProperties_From_SystemData_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForSystemData_STATUS, SystemData_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSystemData_STATUS tests if a specific instance of SystemData_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForSystemData_STATUS(subject SystemData_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.SystemData_STATUS + err := copied.AssignProperties_To_SystemData_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SystemData_STATUS + err = actual.AssignProperties_From_SystemData_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_SystemData_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() diff --git a/v2/api/insights/v1api20221001/storage/structure.txt b/v2/api/insights/v1api20221001/storage/structure.txt index 29ce98e61e4..f8dd2eca521 100644 --- a/v2/api/insights/v1api20221001/storage/structure.txt +++ b/v2/api/insights/v1api20221001/storage/structure.txt @@ -168,3 +168,4 @@ AutoscaleSetting: Resource ├── TargetResourceLocation: *string ├── TargetResourceUri: *string └── Type: *string +augmentConversionForSystemData_STATUS: Interface diff --git a/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen.go b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen.go new file mode 100644 index 00000000000..62637e3ae50 --- /dev/null +++ b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen.go @@ -0,0 +1,286 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type ScheduledQueryRule_Spec struct { + // Identity: The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + + // Kind: Indicates the type of scheduled query rule. The default is LogAlert. + Kind *ScheduledQueryRule_Kind_Spec `json:"kind,omitempty"` + + // Location: The geo-location where the resource lives + Location *string `json:"location,omitempty"` + Name string `json:"name,omitempty"` + + // Properties: The rule properties of the resource. + Properties *ScheduledQueryRuleProperties `json:"properties,omitempty"` + + // Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &ScheduledQueryRule_Spec{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2023-12-01" +func (rule ScheduledQueryRule_Spec) GetAPIVersion() string { + return "2023-12-01" +} + +// GetName returns the Name of the resource +func (rule *ScheduledQueryRule_Spec) GetName() string { + return rule.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/scheduledQueryRules" +func (rule *ScheduledQueryRule_Spec) GetType() string { + return "Microsoft.Insights/scheduledQueryRules" +} + +// Identity for the resource. +type Identity struct { + // Type: Type of managed service identity. + Type *Identity_Type `json:"type,omitempty"` + UserAssignedIdentities map[string]UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"` +} + +// +kubebuilder:validation:Enum={"LogAlert","LogToMetric"} +type ScheduledQueryRule_Kind_Spec string + +const ( + ScheduledQueryRule_Kind_Spec_LogAlert = ScheduledQueryRule_Kind_Spec("LogAlert") + ScheduledQueryRule_Kind_Spec_LogToMetric = ScheduledQueryRule_Kind_Spec("LogToMetric") +) + +// Mapping from string to ScheduledQueryRule_Kind_Spec +var scheduledQueryRule_Kind_Spec_Values = map[string]ScheduledQueryRule_Kind_Spec{ + "logalert": ScheduledQueryRule_Kind_Spec_LogAlert, + "logtometric": ScheduledQueryRule_Kind_Spec_LogToMetric, +} + +// scheduled query rule Definition +type ScheduledQueryRuleProperties struct { + // Actions: Actions to invoke when the alert fires. + Actions *Actions `json:"actions,omitempty"` + + // AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true. + // Relevant only for rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in + // the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + + // Criteria: The rule criteria that defines the conditions of the scheduled query rule. + Criteria *ScheduledQueryRuleCriteria `json:"criteria,omitempty"` + + // Description: The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + + // DisplayName: The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + + // Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + + // EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant + // and required only for rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + + // MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. + // Relevant only for rules of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + + // OverrideQueryTimeRange: If specified then overrides the query time range (default is + // WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // ResolveConfiguration: Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + ResolveConfiguration *RuleResolveConfiguration `json:"resolveConfiguration,omitempty"` + Scopes []string `json:"scopes,omitempty"` + + // Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only + // for rules of the kind LogAlert. + Severity *ScheduledQueryRuleProperties_Severity `json:"severity,omitempty"` + + // SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is + // false. Relevant only for rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + + // TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example + // if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert + // will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of + // the kind LogAlert + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + + // WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). + // Relevant and required only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` +} + +// Actions to invoke when the alert fires. +type Actions struct { + ActionGroups []string `json:"actionGroups,omitempty"` + + // ActionProperties: The properties of an action properties. + ActionProperties map[string]string `json:"actionProperties,omitempty"` + + // CustomProperties: The properties of an alert payload. + CustomProperties map[string]string `json:"customProperties,omitempty"` +} + +// +kubebuilder:validation:Enum={"None","SystemAssigned","UserAssigned"} +type Identity_Type string + +const ( + Identity_Type_None = Identity_Type("None") + Identity_Type_SystemAssigned = Identity_Type("SystemAssigned") + Identity_Type_UserAssigned = Identity_Type("UserAssigned") +) + +// Mapping from string to Identity_Type +var identity_Type_Values = map[string]Identity_Type{ + "none": Identity_Type_None, + "systemassigned": Identity_Type_SystemAssigned, + "userassigned": Identity_Type_UserAssigned, +} + +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + // AutoResolved: The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool `json:"autoResolved,omitempty"` + + // TimeToResolve: The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented + // in ISO 8601 duration format. + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + // AllOf: A list of conditions to evaluate against the specified scopes + AllOf []Condition `json:"allOf,omitempty"` +} + +// +kubebuilder:validation:Enum={0,1,2,3,4} +type ScheduledQueryRuleProperties_Severity int + +const ( + ScheduledQueryRuleProperties_Severity_0 = ScheduledQueryRuleProperties_Severity(0) + ScheduledQueryRuleProperties_Severity_1 = ScheduledQueryRuleProperties_Severity(1) + ScheduledQueryRuleProperties_Severity_2 = ScheduledQueryRuleProperties_Severity(2) + ScheduledQueryRuleProperties_Severity_3 = ScheduledQueryRuleProperties_Severity(3) + ScheduledQueryRuleProperties_Severity_4 = ScheduledQueryRuleProperties_Severity(4) +) + +// Information about the user assigned identity for the resource +type UserAssignedIdentityDetails struct { +} + +// A condition of the scheduled query rule. +type Condition struct { + // Dimensions: List of Dimensions conditions + Dimensions []Dimension `json:"dimensions,omitempty"` + + // FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an + // alert. Relevant only for rules of the kind LogAlert. + FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"` + + // MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + + // MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` + + // Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *Condition_Operator `json:"operator,omitempty"` + + // Query: Log query alert + Query *string `json:"query,omitempty"` + ResourceIdColumn *string `json:"resourceIdColumn,omitempty"` + + // Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind + // LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + + // TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *Condition_TimeAggregation `json:"timeAggregation,omitempty"` +} + +type Condition_FailingPeriods struct { + // MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to + // numberOfEvaluationPeriods. Default value is 1 + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + + // NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the + // aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` +} + +// +kubebuilder:validation:Enum={"Equals","GreaterThan","GreaterThanOrEqual","LessThan","LessThanOrEqual"} +type Condition_Operator string + +const ( + Condition_Operator_Equals = Condition_Operator("Equals") + Condition_Operator_GreaterThan = Condition_Operator("GreaterThan") + Condition_Operator_GreaterThanOrEqual = Condition_Operator("GreaterThanOrEqual") + Condition_Operator_LessThan = Condition_Operator("LessThan") + Condition_Operator_LessThanOrEqual = Condition_Operator("LessThanOrEqual") +) + +// Mapping from string to Condition_Operator +var condition_Operator_Values = map[string]Condition_Operator{ + "equals": Condition_Operator_Equals, + "greaterthan": Condition_Operator_GreaterThan, + "greaterthanorequal": Condition_Operator_GreaterThanOrEqual, + "lessthan": Condition_Operator_LessThan, + "lessthanorequal": Condition_Operator_LessThanOrEqual, +} + +// +kubebuilder:validation:Enum={"Average","Count","Maximum","Minimum","Total"} +type Condition_TimeAggregation string + +const ( + Condition_TimeAggregation_Average = Condition_TimeAggregation("Average") + Condition_TimeAggregation_Count = Condition_TimeAggregation("Count") + Condition_TimeAggregation_Maximum = Condition_TimeAggregation("Maximum") + Condition_TimeAggregation_Minimum = Condition_TimeAggregation("Minimum") + Condition_TimeAggregation_Total = Condition_TimeAggregation("Total") +) + +// Mapping from string to Condition_TimeAggregation +var condition_TimeAggregation_Values = map[string]Condition_TimeAggregation{ + "average": Condition_TimeAggregation_Average, + "count": Condition_TimeAggregation_Count, + "maximum": Condition_TimeAggregation_Maximum, + "minimum": Condition_TimeAggregation_Minimum, + "total": Condition_TimeAggregation_Total, +} + +// Dimension splitting and filtering definition +type Dimension struct { + // Name: Name of the dimension + Name *string `json:"name,omitempty"` + + // Operator: Operator for dimension values + Operator *Dimension_Operator `json:"operator,omitempty"` + + // Values: List of dimension values + Values []string `json:"values,omitempty"` +} + +// +kubebuilder:validation:Enum={"Exclude","Include"} +type Dimension_Operator string + +const ( + Dimension_Operator_Exclude = Dimension_Operator("Exclude") + Dimension_Operator_Include = Dimension_Operator("Include") +) + +// Mapping from string to Dimension_Operator +var dimension_Operator_Values = map[string]Dimension_Operator{ + "exclude": Dimension_Operator_Exclude, + "include": Dimension_Operator_Include, +} diff --git a/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen_test.go b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen_test.go new file mode 100644 index 00000000000..5596c8ba01a --- /dev/null +++ b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_spec_types_gen_test.go @@ -0,0 +1,728 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Actions_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions, ActionsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions runs a test to see if a specific instance of Actions round trips to JSON and back losslessly +func RunJSONSerializationTestForActions(subject Actions) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions instances for property testing - lazily instantiated by ActionsGenerator() +var actionsGenerator gopter.Gen + +// ActionsGenerator returns a generator of Actions instances for property testing. +func ActionsGenerator() gopter.Gen { + if actionsGenerator != nil { + return actionsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions(generators) + actionsGenerator = gen.Struct(reflect.TypeOf(Actions{}), generators) + + return actionsGenerator +} + +// AddIndependentPropertyGeneratorsForActions is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions(gens map[string]gopter.Gen) { + gens["ActionGroups"] = gen.SliceOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Condition_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition, ConditionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition runs a test to see if a specific instance of Condition round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition(subject Condition) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition instances for property testing - lazily instantiated by ConditionGenerator() +var conditionGenerator gopter.Gen + +// ConditionGenerator returns a generator of Condition instances for property testing. +// We first initialize conditionGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ConditionGenerator() gopter.Gen { + if conditionGenerator != nil { + return conditionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + AddRelatedPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + return conditionGenerator +} + +// AddIndependentPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf( + Condition_Operator_Equals, + Condition_Operator_GreaterThan, + Condition_Operator_GreaterThanOrEqual, + Condition_Operator_LessThan, + Condition_Operator_LessThanOrEqual)) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["ResourceIdColumn"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.OneConstOf( + Condition_TimeAggregation_Average, + Condition_TimeAggregation_Count, + Condition_TimeAggregation_Maximum, + Condition_TimeAggregation_Minimum, + Condition_TimeAggregation_Total)) +} + +// AddRelatedPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(DimensionGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriodsGenerator()) +} + +func Test_Condition_FailingPeriods_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods, Condition_FailingPeriodsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods runs a test to see if a specific instance of Condition_FailingPeriods round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods(subject Condition_FailingPeriods) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods instances for property testing - lazily instantiated by +// Condition_FailingPeriodsGenerator() +var condition_FailingPeriodsGenerator gopter.Gen + +// Condition_FailingPeriodsGenerator returns a generator of Condition_FailingPeriods instances for property testing. +func Condition_FailingPeriodsGenerator() gopter.Gen { + if condition_FailingPeriodsGenerator != nil { + return condition_FailingPeriodsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods(generators) + condition_FailingPeriodsGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods{}), generators) + + return condition_FailingPeriodsGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Dimension_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension, DimensionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension runs a test to see if a specific instance of Dimension round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension(subject Dimension) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension instances for property testing - lazily instantiated by DimensionGenerator() +var dimensionGenerator gopter.Gen + +// DimensionGenerator returns a generator of Dimension instances for property testing. +func DimensionGenerator() gopter.Gen { + if dimensionGenerator != nil { + return dimensionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension(generators) + dimensionGenerator = gen.Struct(reflect.TypeOf(Dimension{}), generators) + + return dimensionGenerator +} + +// AddIndependentPropertyGeneratorsForDimension is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf(Dimension_Operator_Exclude, Dimension_Operator_Include)) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Identity_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity, IdentityGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity runs a test to see if a specific instance of Identity round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity(subject Identity) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity instances for property testing - lazily instantiated by IdentityGenerator() +var identityGenerator gopter.Gen + +// IdentityGenerator returns a generator of Identity instances for property testing. +// We first initialize identityGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func IdentityGenerator() gopter.Gen { + if identityGenerator != nil { + return identityGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + AddRelatedPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + return identityGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["Type"] = gen.PtrOf(gen.OneConstOf(Identity_Type_None, Identity_Type_SystemAssigned, Identity_Type_UserAssigned)) +} + +// AddRelatedPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.MapOf( + gen.AlphaString(), + UserAssignedIdentityDetailsGenerator()) +} + +func Test_RuleResolveConfiguration_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration, RuleResolveConfigurationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration runs a test to see if a specific instance of RuleResolveConfiguration round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration(subject RuleResolveConfiguration) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration instances for property testing - lazily instantiated by +// RuleResolveConfigurationGenerator() +var ruleResolveConfigurationGenerator gopter.Gen + +// RuleResolveConfigurationGenerator returns a generator of RuleResolveConfiguration instances for property testing. +func RuleResolveConfigurationGenerator() gopter.Gen { + if ruleResolveConfigurationGenerator != nil { + return ruleResolveConfigurationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration(generators) + ruleResolveConfigurationGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration{}), generators) + + return ruleResolveConfigurationGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ScheduledQueryRuleCriteria_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria, ScheduledQueryRuleCriteriaGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria runs a test to see if a specific instance of ScheduledQueryRuleCriteria round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria(subject ScheduledQueryRuleCriteria) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteriaGenerator() +var scheduledQueryRuleCriteriaGenerator gopter.Gen + +// ScheduledQueryRuleCriteriaGenerator returns a generator of ScheduledQueryRuleCriteria instances for property testing. +func ScheduledQueryRuleCriteriaGenerator() gopter.Gen { + if scheduledQueryRuleCriteriaGenerator != nil { + return scheduledQueryRuleCriteriaGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(generators) + scheduledQueryRuleCriteriaGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria{}), generators) + + return scheduledQueryRuleCriteriaGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(ConditionGenerator()) +} + +func Test_ScheduledQueryRuleProperties_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleProperties via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleProperties, ScheduledQueryRulePropertiesGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleProperties runs a test to see if a specific instance of ScheduledQueryRuleProperties round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleProperties(subject ScheduledQueryRuleProperties) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleProperties + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleProperties instances for property testing - lazily instantiated by +// ScheduledQueryRulePropertiesGenerator() +var scheduledQueryRulePropertiesGenerator gopter.Gen + +// ScheduledQueryRulePropertiesGenerator returns a generator of ScheduledQueryRuleProperties instances for property testing. +// We first initialize scheduledQueryRulePropertiesGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRulePropertiesGenerator() gopter.Gen { + if scheduledQueryRulePropertiesGenerator != nil { + return scheduledQueryRulePropertiesGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties(generators) + scheduledQueryRulePropertiesGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleProperties{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties(generators) + scheduledQueryRulePropertiesGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleProperties{}), generators) + + return scheduledQueryRulePropertiesGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.OneConstOf( + ScheduledQueryRuleProperties_Severity_0, + ScheduledQueryRuleProperties_Severity_1, + ScheduledQueryRuleProperties_Severity_2, + ScheduledQueryRuleProperties_Severity_3, + ScheduledQueryRuleProperties_Severity_4)) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(ActionsGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteriaGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfigurationGenerator()) +} + +func Test_ScheduledQueryRule_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_Spec, ScheduledQueryRule_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_Spec runs a test to see if a specific instance of ScheduledQueryRule_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_Spec(subject ScheduledQueryRule_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_Spec instances for property testing - lazily instantiated by +// ScheduledQueryRule_SpecGenerator() +var scheduledQueryRule_SpecGenerator gopter.Gen + +// ScheduledQueryRule_SpecGenerator returns a generator of ScheduledQueryRule_Spec instances for property testing. +// We first initialize scheduledQueryRule_SpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_SpecGenerator() gopter.Gen { + if scheduledQueryRule_SpecGenerator != nil { + return scheduledQueryRule_SpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + return scheduledQueryRule_SpecGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["Kind"] = gen.PtrOf(gen.OneConstOf(ScheduledQueryRule_Kind_Spec_LogAlert, ScheduledQueryRule_Kind_Spec_LogToMetric)) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["Identity"] = gen.PtrOf(IdentityGenerator()) + gens["Properties"] = gen.PtrOf(ScheduledQueryRulePropertiesGenerator()) +} + +func Test_UserAssignedIdentityDetails_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserAssignedIdentityDetails via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserAssignedIdentityDetails, UserAssignedIdentityDetailsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserAssignedIdentityDetails runs a test to see if a specific instance of UserAssignedIdentityDetails round trips to JSON and back losslessly +func RunJSONSerializationTestForUserAssignedIdentityDetails(subject UserAssignedIdentityDetails) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserAssignedIdentityDetails + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserAssignedIdentityDetails instances for property testing - lazily instantiated by +// UserAssignedIdentityDetailsGenerator() +var userAssignedIdentityDetailsGenerator gopter.Gen + +// UserAssignedIdentityDetailsGenerator returns a generator of UserAssignedIdentityDetails instances for property testing. +func UserAssignedIdentityDetailsGenerator() gopter.Gen { + if userAssignedIdentityDetailsGenerator != nil { + return userAssignedIdentityDetailsGenerator + } + + generators := make(map[string]gopter.Gen) + userAssignedIdentityDetailsGenerator = gen.Struct(reflect.TypeOf(UserAssignedIdentityDetails{}), generators) + + return userAssignedIdentityDetailsGenerator +} diff --git a/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen.go b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen.go new file mode 100644 index 00000000000..f3fbbac4b3a --- /dev/null +++ b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen.go @@ -0,0 +1,365 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +type ScheduledQueryRule_STATUS struct { + // Etag: 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"` + + // Id: Fully qualified resource ID for the resource. Ex - + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + Id *string `json:"id,omitempty"` + + // Identity: The identity of the resource. + Identity *Identity_STATUS `json:"identity,omitempty"` + + // Kind: Indicates the type of scheduled query rule. The default is LogAlert. + Kind *ScheduledQueryRule_Kind_STATUS `json:"kind,omitempty"` + + // Location: The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Name: The name of the resource + Name *string `json:"name,omitempty"` + + // Properties: The rule properties of the resource. + Properties *ScheduledQueryRuleProperties_STATUS `json:"properties,omitempty"` + + // SystemData: SystemData of ScheduledQueryRule. + SystemData *SystemData_STATUS `json:"systemData,omitempty"` + + // Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + // Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// Identity for the resource. +type Identity_STATUS struct { + // PrincipalId: The principal ID of resource identity. + PrincipalId *string `json:"principalId,omitempty"` + + // TenantId: The tenant ID of resource. + TenantId *string `json:"tenantId,omitempty"` + + // Type: Type of managed service identity. + Type *Identity_Type_STATUS `json:"type,omitempty"` + + // UserAssignedIdentities: The list of user identities associated with the resource. The user identity dictionary key + // references will be ARM resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]UserIdentityProperties_STATUS `json:"userAssignedIdentities,omitempty"` +} + +type ScheduledQueryRule_Kind_STATUS string + +const ( + ScheduledQueryRule_Kind_STATUS_LogAlert = ScheduledQueryRule_Kind_STATUS("LogAlert") + ScheduledQueryRule_Kind_STATUS_LogToMetric = ScheduledQueryRule_Kind_STATUS("LogToMetric") +) + +// Mapping from string to ScheduledQueryRule_Kind_STATUS +var scheduledQueryRule_Kind_STATUS_Values = map[string]ScheduledQueryRule_Kind_STATUS{ + "logalert": ScheduledQueryRule_Kind_STATUS_LogAlert, + "logtometric": ScheduledQueryRule_Kind_STATUS_LogToMetric, +} + +// scheduled query rule Definition +type ScheduledQueryRuleProperties_STATUS struct { + // Actions: Actions to invoke when the alert fires. + Actions *Actions_STATUS `json:"actions,omitempty"` + + // AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true. + // Relevant only for rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in + // the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + + // CreatedWithApiVersion: The api-version used when creating this alert rule + CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"` + + // Criteria: The rule criteria that defines the conditions of the scheduled query rule. + Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"` + + // Description: The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + + // DisplayName: The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + + // Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + + // EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant + // and required only for rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + + // IsLegacyLogAnalyticsRule: True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + + // IsWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule has been configured to be + // stored in the customer's storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` + + // MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. + // Relevant only for rules of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + + // OverrideQueryTimeRange: If specified then overrides the query time range (default is + // WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // ResolveConfiguration: Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + ResolveConfiguration *RuleResolveConfiguration_STATUS `json:"resolveConfiguration,omitempty"` + + // Scopes: The list of resource id's that this scheduled query rule is scoped to. + Scopes []string `json:"scopes,omitempty"` + + // Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only + // for rules of the kind LogAlert. + Severity *ScheduledQueryRuleProperties_Severity_STATUS `json:"severity,omitempty"` + + // SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is + // false. Relevant only for rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + + // TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example + // if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert + // will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of + // the kind LogAlert + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + + // WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). + // Relevant and required only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` +} + +// Metadata pertaining to creation and last modification of the resource. +type SystemData_STATUS struct { + // CreatedAt: The timestamp of resource creation (UTC). + CreatedAt *string `json:"createdAt,omitempty"` + + // CreatedBy: The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // CreatedByType: The type of identity that created the resource. + CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` + + // LastModifiedAt: The timestamp of resource last modification (UTC) + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + + // LastModifiedBy: The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // LastModifiedByType: The type of identity that last modified the resource. + LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` +} + +// Actions to invoke when the alert fires. +type Actions_STATUS struct { + // ActionGroups: Action Group resource Ids to invoke when the alert fires. + ActionGroups []string `json:"actionGroups,omitempty"` + + // ActionProperties: The properties of an action properties. + ActionProperties map[string]string `json:"actionProperties,omitempty"` + + // CustomProperties: The properties of an alert payload. + CustomProperties map[string]string `json:"customProperties,omitempty"` +} + +type Identity_Type_STATUS string + +const ( + Identity_Type_STATUS_None = Identity_Type_STATUS("None") + Identity_Type_STATUS_SystemAssigned = Identity_Type_STATUS("SystemAssigned") + Identity_Type_STATUS_UserAssigned = Identity_Type_STATUS("UserAssigned") +) + +// Mapping from string to Identity_Type_STATUS +var identity_Type_STATUS_Values = map[string]Identity_Type_STATUS{ + "none": Identity_Type_STATUS_None, + "systemassigned": Identity_Type_STATUS_SystemAssigned, + "userassigned": Identity_Type_STATUS_UserAssigned, +} + +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration_STATUS struct { + // AutoResolved: The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool `json:"autoResolved,omitempty"` + + // TimeToResolve: The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented + // in ISO 8601 duration format. + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria_STATUS struct { + // AllOf: A list of conditions to evaluate against the specified scopes + AllOf []Condition_STATUS `json:"allOf,omitempty"` +} + +type ScheduledQueryRuleProperties_Severity_STATUS int + +const ( + ScheduledQueryRuleProperties_Severity_STATUS_0 = ScheduledQueryRuleProperties_Severity_STATUS(0) + ScheduledQueryRuleProperties_Severity_STATUS_1 = ScheduledQueryRuleProperties_Severity_STATUS(1) + ScheduledQueryRuleProperties_Severity_STATUS_2 = ScheduledQueryRuleProperties_Severity_STATUS(2) + ScheduledQueryRuleProperties_Severity_STATUS_3 = ScheduledQueryRuleProperties_Severity_STATUS(3) + ScheduledQueryRuleProperties_Severity_STATUS_4 = ScheduledQueryRuleProperties_Severity_STATUS(4) +) + +type SystemData_CreatedByType_STATUS string + +const ( + SystemData_CreatedByType_STATUS_Application = SystemData_CreatedByType_STATUS("Application") + SystemData_CreatedByType_STATUS_Key = SystemData_CreatedByType_STATUS("Key") + SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity") + SystemData_CreatedByType_STATUS_User = SystemData_CreatedByType_STATUS("User") +) + +// Mapping from string to SystemData_CreatedByType_STATUS +var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{ + "application": SystemData_CreatedByType_STATUS_Application, + "key": SystemData_CreatedByType_STATUS_Key, + "managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity, + "user": SystemData_CreatedByType_STATUS_User, +} + +type SystemData_LastModifiedByType_STATUS string + +const ( + SystemData_LastModifiedByType_STATUS_Application = SystemData_LastModifiedByType_STATUS("Application") + SystemData_LastModifiedByType_STATUS_Key = SystemData_LastModifiedByType_STATUS("Key") + SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity") + SystemData_LastModifiedByType_STATUS_User = SystemData_LastModifiedByType_STATUS("User") +) + +// Mapping from string to SystemData_LastModifiedByType_STATUS +var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{ + "application": SystemData_LastModifiedByType_STATUS_Application, + "key": SystemData_LastModifiedByType_STATUS_Key, + "managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity, + "user": SystemData_LastModifiedByType_STATUS_User, +} + +// User assigned identity properties. +type UserIdentityProperties_STATUS struct { + // ClientId: The client id of user assigned identity. + ClientId *string `json:"clientId,omitempty"` + + // PrincipalId: The principal id of user assigned identity. + PrincipalId *string `json:"principalId,omitempty"` +} + +// A condition of the scheduled query rule. +type Condition_STATUS struct { + // Dimensions: List of Dimensions conditions + Dimensions []Dimension_STATUS `json:"dimensions,omitempty"` + + // FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an + // alert. Relevant only for rules of the kind LogAlert. + FailingPeriods *Condition_FailingPeriods_STATUS `json:"failingPeriods,omitempty"` + + // MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + + // MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` + + // Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *Condition_Operator_STATUS `json:"operator,omitempty"` + + // Query: Log query alert + Query *string `json:"query,omitempty"` + + // ResourceIdColumn: The column containing the resource id. The content of the column must be a uri formatted as resource + // id. Relevant only for rules of the kind LogAlert. + ResourceIdColumn *string `json:"resourceIdColumn,omitempty"` + + // Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind + // LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + + // TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *Condition_TimeAggregation_STATUS `json:"timeAggregation,omitempty"` +} + +type Condition_FailingPeriods_STATUS struct { + // MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to + // numberOfEvaluationPeriods. Default value is 1 + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + + // NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the + // aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` +} + +type Condition_Operator_STATUS string + +const ( + Condition_Operator_STATUS_Equals = Condition_Operator_STATUS("Equals") + Condition_Operator_STATUS_GreaterThan = Condition_Operator_STATUS("GreaterThan") + Condition_Operator_STATUS_GreaterThanOrEqual = Condition_Operator_STATUS("GreaterThanOrEqual") + Condition_Operator_STATUS_LessThan = Condition_Operator_STATUS("LessThan") + Condition_Operator_STATUS_LessThanOrEqual = Condition_Operator_STATUS("LessThanOrEqual") +) + +// Mapping from string to Condition_Operator_STATUS +var condition_Operator_STATUS_Values = map[string]Condition_Operator_STATUS{ + "equals": Condition_Operator_STATUS_Equals, + "greaterthan": Condition_Operator_STATUS_GreaterThan, + "greaterthanorequal": Condition_Operator_STATUS_GreaterThanOrEqual, + "lessthan": Condition_Operator_STATUS_LessThan, + "lessthanorequal": Condition_Operator_STATUS_LessThanOrEqual, +} + +type Condition_TimeAggregation_STATUS string + +const ( + Condition_TimeAggregation_STATUS_Average = Condition_TimeAggregation_STATUS("Average") + Condition_TimeAggregation_STATUS_Count = Condition_TimeAggregation_STATUS("Count") + Condition_TimeAggregation_STATUS_Maximum = Condition_TimeAggregation_STATUS("Maximum") + Condition_TimeAggregation_STATUS_Minimum = Condition_TimeAggregation_STATUS("Minimum") + Condition_TimeAggregation_STATUS_Total = Condition_TimeAggregation_STATUS("Total") +) + +// Mapping from string to Condition_TimeAggregation_STATUS +var condition_TimeAggregation_STATUS_Values = map[string]Condition_TimeAggregation_STATUS{ + "average": Condition_TimeAggregation_STATUS_Average, + "count": Condition_TimeAggregation_STATUS_Count, + "maximum": Condition_TimeAggregation_STATUS_Maximum, + "minimum": Condition_TimeAggregation_STATUS_Minimum, + "total": Condition_TimeAggregation_STATUS_Total, +} + +// Dimension splitting and filtering definition +type Dimension_STATUS struct { + // Name: Name of the dimension + Name *string `json:"name,omitempty"` + + // Operator: Operator for dimension values + Operator *Dimension_Operator_STATUS `json:"operator,omitempty"` + + // Values: List of dimension values + Values []string `json:"values,omitempty"` +} + +type Dimension_Operator_STATUS string + +const ( + Dimension_Operator_STATUS_Exclude = Dimension_Operator_STATUS("Exclude") + Dimension_Operator_STATUS_Include = Dimension_Operator_STATUS("Include") +) + +// Mapping from string to Dimension_Operator_STATUS +var dimension_Operator_STATUS_Values = map[string]Dimension_Operator_STATUS{ + "exclude": Dimension_Operator_STATUS_Exclude, + "include": Dimension_Operator_STATUS_Include, +} diff --git a/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen_test.go b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen_test.go new file mode 100644 index 00000000000..b591aca4af5 --- /dev/null +++ b/v2/api/insights/v1api20231201/arm/scheduled_query_rule_status_types_gen_test.go @@ -0,0 +1,817 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Actions_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions_STATUS, Actions_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions_STATUS runs a test to see if a specific instance of Actions_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForActions_STATUS(subject Actions_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions_STATUS instances for property testing - lazily instantiated by Actions_STATUSGenerator() +var actions_STATUSGenerator gopter.Gen + +// Actions_STATUSGenerator returns a generator of Actions_STATUS instances for property testing. +func Actions_STATUSGenerator() gopter.Gen { + if actions_STATUSGenerator != nil { + return actions_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions_STATUS(generators) + actions_STATUSGenerator = gen.Struct(reflect.TypeOf(Actions_STATUS{}), generators) + + return actions_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForActions_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions_STATUS(gens map[string]gopter.Gen) { + gens["ActionGroups"] = gen.SliceOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Condition_FailingPeriods_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods_STATUS, Condition_FailingPeriods_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods_STATUS runs a test to see if a specific instance of Condition_FailingPeriods_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods_STATUS(subject Condition_FailingPeriods_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods_STATUS instances for property testing - lazily instantiated by +// Condition_FailingPeriods_STATUSGenerator() +var condition_FailingPeriods_STATUSGenerator gopter.Gen + +// Condition_FailingPeriods_STATUSGenerator returns a generator of Condition_FailingPeriods_STATUS instances for property testing. +func Condition_FailingPeriods_STATUSGenerator() gopter.Gen { + if condition_FailingPeriods_STATUSGenerator != nil { + return condition_FailingPeriods_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(generators) + condition_FailingPeriods_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods_STATUS{}), generators) + + return condition_FailingPeriods_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Condition_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_STATUS, Condition_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_STATUS runs a test to see if a specific instance of Condition_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_STATUS(subject Condition_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_STATUS instances for property testing - lazily instantiated by Condition_STATUSGenerator() +var condition_STATUSGenerator gopter.Gen + +// Condition_STATUSGenerator returns a generator of Condition_STATUS instances for property testing. +// We first initialize condition_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Condition_STATUSGenerator() gopter.Gen { + if condition_STATUSGenerator != nil { + return condition_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + AddRelatedPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + return condition_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf( + Condition_Operator_STATUS_Equals, + Condition_Operator_STATUS_GreaterThan, + Condition_Operator_STATUS_GreaterThanOrEqual, + Condition_Operator_STATUS_LessThan, + Condition_Operator_STATUS_LessThanOrEqual)) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["ResourceIdColumn"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.OneConstOf( + Condition_TimeAggregation_STATUS_Average, + Condition_TimeAggregation_STATUS_Count, + Condition_TimeAggregation_STATUS_Maximum, + Condition_TimeAggregation_STATUS_Minimum, + Condition_TimeAggregation_STATUS_Total)) +} + +// AddRelatedPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(Dimension_STATUSGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriods_STATUSGenerator()) +} + +func Test_Dimension_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension_STATUS, Dimension_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension_STATUS runs a test to see if a specific instance of Dimension_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension_STATUS(subject Dimension_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension_STATUS instances for property testing - lazily instantiated by Dimension_STATUSGenerator() +var dimension_STATUSGenerator gopter.Gen + +// Dimension_STATUSGenerator returns a generator of Dimension_STATUS instances for property testing. +func Dimension_STATUSGenerator() gopter.Gen { + if dimension_STATUSGenerator != nil { + return dimension_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension_STATUS(generators) + dimension_STATUSGenerator = gen.Struct(reflect.TypeOf(Dimension_STATUS{}), generators) + + return dimension_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForDimension_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension_STATUS(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf(Dimension_Operator_STATUS_Exclude, Dimension_Operator_STATUS_Include)) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Identity_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity_STATUS, Identity_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity_STATUS runs a test to see if a specific instance of Identity_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity_STATUS(subject Identity_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity_STATUS instances for property testing - lazily instantiated by Identity_STATUSGenerator() +var identity_STATUSGenerator gopter.Gen + +// Identity_STATUSGenerator returns a generator of Identity_STATUS instances for property testing. +// We first initialize identity_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Identity_STATUSGenerator() gopter.Gen { + if identity_STATUSGenerator != nil { + return identity_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + AddRelatedPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + return identity_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) + gens["TenantId"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(Identity_Type_STATUS_None, Identity_Type_STATUS_SystemAssigned, Identity_Type_STATUS_UserAssigned)) +} + +// AddRelatedPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.MapOf( + gen.AlphaString(), + UserIdentityProperties_STATUSGenerator()) +} + +func Test_RuleResolveConfiguration_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration_STATUS, RuleResolveConfiguration_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration_STATUS runs a test to see if a specific instance of RuleResolveConfiguration_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration_STATUS(subject RuleResolveConfiguration_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration_STATUS instances for property testing - lazily instantiated by +// RuleResolveConfiguration_STATUSGenerator() +var ruleResolveConfiguration_STATUSGenerator gopter.Gen + +// RuleResolveConfiguration_STATUSGenerator returns a generator of RuleResolveConfiguration_STATUS instances for property testing. +func RuleResolveConfiguration_STATUSGenerator() gopter.Gen { + if ruleResolveConfiguration_STATUSGenerator != nil { + return ruleResolveConfiguration_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(generators) + ruleResolveConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration_STATUS{}), generators) + + return ruleResolveConfiguration_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ScheduledQueryRuleCriteria_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS, ScheduledQueryRuleCriteria_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS runs a test to see if a specific instance of ScheduledQueryRuleCriteria_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS(subject ScheduledQueryRuleCriteria_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteria_STATUSGenerator() +var scheduledQueryRuleCriteria_STATUSGenerator gopter.Gen + +// ScheduledQueryRuleCriteria_STATUSGenerator returns a generator of ScheduledQueryRuleCriteria_STATUS instances for property testing. +func ScheduledQueryRuleCriteria_STATUSGenerator() gopter.Gen { + if scheduledQueryRuleCriteria_STATUSGenerator != nil { + return scheduledQueryRuleCriteria_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(generators) + scheduledQueryRuleCriteria_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria_STATUS{}), generators) + + return scheduledQueryRuleCriteria_STATUSGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(Condition_STATUSGenerator()) +} + +func Test_ScheduledQueryRuleProperties_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleProperties_STATUS, ScheduledQueryRuleProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleProperties_STATUS runs a test to see if a specific instance of ScheduledQueryRuleProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleProperties_STATUS(subject ScheduledQueryRuleProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleProperties_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleProperties_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRuleProperties_STATUSGenerator() +var scheduledQueryRuleProperties_STATUSGenerator gopter.Gen + +// ScheduledQueryRuleProperties_STATUSGenerator returns a generator of ScheduledQueryRuleProperties_STATUS instances for property testing. +// We first initialize scheduledQueryRuleProperties_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRuleProperties_STATUSGenerator() gopter.Gen { + if scheduledQueryRuleProperties_STATUSGenerator != nil { + return scheduledQueryRuleProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties_STATUS(generators) + scheduledQueryRuleProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleProperties_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties_STATUS(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties_STATUS(generators) + scheduledQueryRuleProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleProperties_STATUS{}), generators) + + return scheduledQueryRuleProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRuleProperties_STATUS(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["CreatedWithApiVersion"] = gen.PtrOf(gen.AlphaString()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["IsLegacyLogAnalyticsRule"] = gen.PtrOf(gen.Bool()) + gens["IsWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.OneConstOf( + ScheduledQueryRuleProperties_Severity_STATUS_0, + ScheduledQueryRuleProperties_Severity_STATUS_1, + ScheduledQueryRuleProperties_Severity_STATUS_2, + ScheduledQueryRuleProperties_Severity_STATUS_3, + ScheduledQueryRuleProperties_Severity_STATUS_4)) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleProperties_STATUS(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(Actions_STATUSGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteria_STATUSGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfiguration_STATUSGenerator()) +} + +func Test_ScheduledQueryRule_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_STATUS, ScheduledQueryRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_STATUS runs a test to see if a specific instance of ScheduledQueryRule_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_STATUS(subject ScheduledQueryRule_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRule_STATUSGenerator() +var scheduledQueryRule_STATUSGenerator gopter.Gen + +// ScheduledQueryRule_STATUSGenerator returns a generator of ScheduledQueryRule_STATUS instances for property testing. +// We first initialize scheduledQueryRule_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_STATUSGenerator() gopter.Gen { + if scheduledQueryRule_STATUSGenerator != nil { + return scheduledQueryRule_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + return scheduledQueryRule_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Kind"] = gen.PtrOf(gen.OneConstOf(ScheduledQueryRule_Kind_STATUS_LogAlert, ScheduledQueryRule_Kind_STATUS_LogToMetric)) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["Identity"] = gen.PtrOf(Identity_STATUSGenerator()) + gens["Properties"] = gen.PtrOf(ScheduledQueryRuleProperties_STATUSGenerator()) + gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) +} + +func Test_SystemData_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SystemData_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSystemData_STATUS, SystemData_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSystemData_STATUS runs a test to see if a specific instance of SystemData_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForSystemData_STATUS(subject SystemData_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SystemData_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SystemData_STATUS instances for property testing - lazily instantiated by SystemData_STATUSGenerator() +var systemData_STATUSGenerator gopter.Gen + +// SystemData_STATUSGenerator returns a generator of SystemData_STATUS instances for property testing. +func SystemData_STATUSGenerator() gopter.Gen { + if systemData_STATUSGenerator != nil { + return systemData_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSystemData_STATUS(generators) + systemData_STATUSGenerator = gen.Struct(reflect.TypeOf(SystemData_STATUS{}), generators) + + return systemData_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) { + gens["CreatedAt"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedBy"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedByType"] = gen.PtrOf(gen.OneConstOf( + SystemData_CreatedByType_STATUS_Application, + SystemData_CreatedByType_STATUS_Key, + SystemData_CreatedByType_STATUS_ManagedIdentity, + SystemData_CreatedByType_STATUS_User)) + gens["LastModifiedAt"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedByType"] = gen.PtrOf(gen.OneConstOf( + SystemData_LastModifiedByType_STATUS_Application, + SystemData_LastModifiedByType_STATUS_Key, + SystemData_LastModifiedByType_STATUS_ManagedIdentity, + SystemData_LastModifiedByType_STATUS_User)) +} + +func Test_UserIdentityProperties_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserIdentityProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserIdentityProperties_STATUS, UserIdentityProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserIdentityProperties_STATUS runs a test to see if a specific instance of UserIdentityProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForUserIdentityProperties_STATUS(subject UserIdentityProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserIdentityProperties_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserIdentityProperties_STATUS instances for property testing - lazily instantiated by +// UserIdentityProperties_STATUSGenerator() +var userIdentityProperties_STATUSGenerator gopter.Gen + +// UserIdentityProperties_STATUSGenerator returns a generator of UserIdentityProperties_STATUS instances for property testing. +func UserIdentityProperties_STATUSGenerator() gopter.Gen { + if userIdentityProperties_STATUSGenerator != nil { + return userIdentityProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(generators) + userIdentityProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(UserIdentityProperties_STATUS{}), generators) + + return userIdentityProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(gens map[string]gopter.Gen) { + gens["ClientId"] = gen.PtrOf(gen.AlphaString()) + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/insights/v1api20231201/arm/structure.txt b/v2/api/insights/v1api20231201/arm/structure.txt new file mode 100644 index 00000000000..3652b64a351 --- /dev/null +++ b/v2/api/insights/v1api20231201/arm/structure.txt @@ -0,0 +1,162 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/arm +------------------------------------------------------------------------- +ScheduledQueryRule_STATUS: Object (10 properties) +├── Etag: *string +├── Id: *string +├── Identity: *Object (4 properties) +│ ├── PrincipalId: *string +│ ├── TenantId: *string +│ ├── Type: *Enum (3 values) +│ │ ├── "None" +│ │ ├── "SystemAssigned" +│ │ └── "UserAssigned" +│ └── UserAssignedIdentities: map[string]Object (2 properties) +│ ├── ClientId: *string +│ └── PrincipalId: *string +├── Kind: *Enum (2 values) +│ ├── "LogAlert" +│ └── "LogToMetric" +├── Location: *string +├── Name: *string +├── Properties: *Object (19 properties) +│ ├── Actions: *Object (3 properties) +│ │ ├── ActionGroups: string[] +│ │ ├── ActionProperties: map[string]string +│ │ └── CustomProperties: map[string]string +│ ├── AutoMitigate: *bool +│ ├── CheckWorkspaceAlertsStorageConfigured: *bool +│ ├── CreatedWithApiVersion: *string +│ ├── Criteria: *Object (1 property) +│ │ └── AllOf: Object (9 properties)[] +│ │ ├── Dimensions: Object (3 properties)[] +│ │ │ ├── Name: *string +│ │ │ ├── Operator: *Enum (2 values) +│ │ │ │ ├── "Exclude" +│ │ │ │ └── "Include" +│ │ │ └── Values: string[] +│ │ ├── FailingPeriods: *Object (2 properties) +│ │ │ ├── MinFailingPeriodsToAlert: *int +│ │ │ └── NumberOfEvaluationPeriods: *int +│ │ ├── MetricMeasureColumn: *string +│ │ ├── MetricName: *string +│ │ ├── Operator: *Enum (5 values) +│ │ │ ├── "Equals" +│ │ │ ├── "GreaterThan" +│ │ │ ├── "GreaterThanOrEqual" +│ │ │ ├── "LessThan" +│ │ │ └── "LessThanOrEqual" +│ │ ├── Query: *string +│ │ ├── ResourceIdColumn: *string +│ │ ├── Threshold: *float64 +│ │ └── TimeAggregation: *Enum (5 values) +│ │ ├── "Average" +│ │ ├── "Count" +│ │ ├── "Maximum" +│ │ ├── "Minimum" +│ │ └── "Total" +│ ├── Description: *string +│ ├── DisplayName: *string +│ ├── Enabled: *bool +│ ├── EvaluationFrequency: *string +│ ├── IsLegacyLogAnalyticsRule: *bool +│ ├── IsWorkspaceAlertsStorageConfigured: *bool +│ ├── MuteActionsDuration: *string +│ ├── OverrideQueryTimeRange: *string +│ ├── ResolveConfiguration: *Object (2 properties) +│ │ ├── AutoResolved: *bool +│ │ └── TimeToResolve: *string +│ ├── Scopes: string[] +│ ├── Severity: *Enum (5 values) +│ │ ├── 0 +│ │ ├── 1 +│ │ ├── 2 +│ │ ├── 3 +│ │ └── 4 +│ ├── SkipQueryValidation: *bool +│ ├── TargetResourceTypes: string[] +│ └── WindowSize: *string +├── SystemData: *Object (6 properties) +│ ├── CreatedAt: *string +│ ├── CreatedBy: *string +│ ├── CreatedByType: *Enum (4 values) +│ │ ├── "Application" +│ │ ├── "Key" +│ │ ├── "ManagedIdentity" +│ │ └── "User" +│ ├── LastModifiedAt: *string +│ ├── LastModifiedBy: *string +│ └── LastModifiedByType: *Enum (4 values) +│ ├── "Application" +│ ├── "Key" +│ ├── "ManagedIdentity" +│ └── "User" +├── Tags: map[string]string +└── Type: *string +ScheduledQueryRule_Spec: Object (6 properties) +├── Identity: *Object (2 properties) +│ ├── Type: *Enum (3 values) +│ │ ├── "None" +│ │ ├── "SystemAssigned" +│ │ └── "UserAssigned" +│ └── UserAssignedIdentities: map[string]Object (0 properties) +├── Kind: *Enum (2 values) +│ ├── "LogAlert" +│ └── "LogToMetric" +├── Location: *string +├── Name: string +├── Properties: *Object (16 properties) +│ ├── Actions: *Object (3 properties) +│ │ ├── ActionGroups: string[] +│ │ ├── ActionProperties: map[string]string +│ │ └── CustomProperties: map[string]string +│ ├── AutoMitigate: *bool +│ ├── CheckWorkspaceAlertsStorageConfigured: *bool +│ ├── Criteria: *Object (1 property) +│ │ └── AllOf: Object (9 properties)[] +│ │ ├── Dimensions: Object (3 properties)[] +│ │ │ ├── Name: *string +│ │ │ ├── Operator: *Enum (2 values) +│ │ │ │ ├── "Exclude" +│ │ │ │ └── "Include" +│ │ │ └── Values: string[] +│ │ ├── FailingPeriods: *Object (2 properties) +│ │ │ ├── MinFailingPeriodsToAlert: *int +│ │ │ └── NumberOfEvaluationPeriods: *int +│ │ ├── MetricMeasureColumn: *string +│ │ ├── MetricName: *string +│ │ ├── Operator: *Enum (5 values) +│ │ │ ├── "Equals" +│ │ │ ├── "GreaterThan" +│ │ │ ├── "GreaterThanOrEqual" +│ │ │ ├── "LessThan" +│ │ │ └── "LessThanOrEqual" +│ │ ├── Query: *string +│ │ ├── ResourceIdColumn: *string +│ │ ├── Threshold: *float64 +│ │ └── TimeAggregation: *Enum (5 values) +│ │ ├── "Average" +│ │ ├── "Count" +│ │ ├── "Maximum" +│ │ ├── "Minimum" +│ │ └── "Total" +│ ├── Description: *string +│ ├── DisplayName: *string +│ ├── Enabled: *bool +│ ├── EvaluationFrequency: *string +│ ├── MuteActionsDuration: *string +│ ├── OverrideQueryTimeRange: *string +│ ├── ResolveConfiguration: *Object (2 properties) +│ │ ├── AutoResolved: *bool +│ │ └── TimeToResolve: *string +│ ├── Scopes: string[] +│ ├── Severity: *Enum (5 values) +│ │ ├── 0 +│ │ ├── 1 +│ │ ├── 2 +│ │ ├── 3 +│ │ └── 4 +│ ├── SkipQueryValidation: *bool +│ ├── TargetResourceTypes: string[] +│ └── WindowSize: *string +└── Tags: map[string]string diff --git a/v2/api/insights/v1api20231201/doc.go b/v2/api/insights/v1api20231201/doc.go new file mode 100644 index 00000000000..3b8e2c4ed48 --- /dev/null +++ b/v2/api/insights/v1api20231201/doc.go @@ -0,0 +1,10 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by azure-service-operator-codegen. DO NOT EDIT. + +// Package v1api20231201 contains API Schema definitions for the insights v1api20231201 API group +// +groupName=insights.azure.com +package v1api20231201 diff --git a/v2/api/insights/v1api20231201/groupversion_info_gen.go b/v2/api/insights/v1api20231201/groupversion_info_gen.go new file mode 100644 index 00000000000..52f4288fd05 --- /dev/null +++ b/v2/api/insights/v1api20231201/groupversion_info_gen.go @@ -0,0 +1,32 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by azure-service-operator-codegen. DO NOT EDIT. + +// Package v1api20231201 contains API Schema definitions for the insights v1api20231201 API group +// +kubebuilder:object:generate=true +// All object properties are optional by default, this will be overridden when needed: +// +kubebuilder:validation:Optional +// +groupName=insights.azure.com +// +versionName=v1api20231201 +package v1api20231201 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "insights.azure.com", Version: "v1api20231201"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder +) diff --git a/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen.go b/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen.go new file mode 100644 index 00000000000..15991a5722b --- /dev/null +++ b/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen.go @@ -0,0 +1,4907 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1api20231201 + +import ( + "fmt" + arm "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/arm" + storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" + "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/core" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets" + "github.com/rotisserie/eris" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/conversion" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +// Generator information: +// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2023-12-01/scheduledQueryRule_API.json +// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} +type ScheduledQueryRule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ScheduledQueryRule_Spec `json:"spec,omitempty"` + Status ScheduledQueryRule_STATUS `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &ScheduledQueryRule{} + +// GetConditions returns the conditions of the resource +func (rule *ScheduledQueryRule) GetConditions() conditions.Conditions { + return rule.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (rule *ScheduledQueryRule) SetConditions(conditions conditions.Conditions) { + rule.Status.Conditions = conditions +} + +var _ conversion.Convertible = &ScheduledQueryRule{} + +// ConvertFrom populates our ScheduledQueryRule from the provided hub ScheduledQueryRule +func (rule *ScheduledQueryRule) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*storage.ScheduledQueryRule) + if !ok { + return fmt.Errorf("expected insights/v1api20231201/storage/ScheduledQueryRule but received %T instead", hub) + } + + return rule.AssignProperties_From_ScheduledQueryRule(source) +} + +// ConvertTo populates the provided hub ScheduledQueryRule from our ScheduledQueryRule +func (rule *ScheduledQueryRule) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*storage.ScheduledQueryRule) + if !ok { + return fmt.Errorf("expected insights/v1api20231201/storage/ScheduledQueryRule but received %T instead", hub) + } + + return rule.AssignProperties_To_ScheduledQueryRule(destination) +} + +// +kubebuilder:webhook:path=/mutate-insights-azure-com-v1api20231201-scheduledqueryrule,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=insights.azure.com,resources=scheduledqueryrules,verbs=create;update,versions=v1api20231201,name=default.v1api20231201.scheduledqueryrules.insights.azure.com,admissionReviewVersions=v1 + +var _ admission.Defaulter = &ScheduledQueryRule{} + +// Default applies defaults to the ScheduledQueryRule resource +func (rule *ScheduledQueryRule) Default() { + rule.defaultImpl() + var temp any = rule + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (rule *ScheduledQueryRule) defaultAzureName() { + if rule.Spec.AzureName == "" { + rule.Spec.AzureName = rule.Name + } +} + +// defaultImpl applies the code generated defaults to the ScheduledQueryRule resource +func (rule *ScheduledQueryRule) defaultImpl() { rule.defaultAzureName() } + +var _ configmaps.Exporter = &ScheduledQueryRule{} + +// ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property +func (rule *ScheduledQueryRule) ConfigMapDestinationExpressions() []*core.DestinationExpression { + if rule.Spec.OperatorSpec == nil { + return nil + } + return rule.Spec.OperatorSpec.ConfigMapExpressions +} + +var _ secrets.Exporter = &ScheduledQueryRule{} + +// SecretDestinationExpressions returns the Spec.OperatorSpec.SecretExpressions property +func (rule *ScheduledQueryRule) SecretDestinationExpressions() []*core.DestinationExpression { + if rule.Spec.OperatorSpec == nil { + return nil + } + return rule.Spec.OperatorSpec.SecretExpressions +} + +var _ genruntime.ImportableResource = &ScheduledQueryRule{} + +// InitializeSpec initializes the spec for this resource from the given status +func (rule *ScheduledQueryRule) InitializeSpec(status genruntime.ConvertibleStatus) error { + if s, ok := status.(*ScheduledQueryRule_STATUS); ok { + return rule.Spec.Initialize_From_ScheduledQueryRule_STATUS(s) + } + + return fmt.Errorf("expected Status of type ScheduledQueryRule_STATUS but received %T instead", status) +} + +var _ genruntime.KubernetesResource = &ScheduledQueryRule{} + +// AzureName returns the Azure name of the resource +func (rule *ScheduledQueryRule) AzureName() string { + return rule.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2023-12-01" +func (rule ScheduledQueryRule) GetAPIVersion() string { + return "2023-12-01" +} + +// GetResourceScope returns the scope of the resource +func (rule *ScheduledQueryRule) GetResourceScope() genruntime.ResourceScope { + return genruntime.ResourceScopeResourceGroup +} + +// GetSpec returns the specification of this resource +func (rule *ScheduledQueryRule) GetSpec() genruntime.ConvertibleSpec { + return &rule.Spec +} + +// GetStatus returns the status of this resource +func (rule *ScheduledQueryRule) GetStatus() genruntime.ConvertibleStatus { + return &rule.Status +} + +// GetSupportedOperations returns the operations supported by the resource +func (rule *ScheduledQueryRule) GetSupportedOperations() []genruntime.ResourceOperation { + return []genruntime.ResourceOperation{ + genruntime.ResourceOperationDelete, + genruntime.ResourceOperationGet, + genruntime.ResourceOperationPut, + } +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/scheduledQueryRules" +func (rule *ScheduledQueryRule) GetType() string { + return "Microsoft.Insights/scheduledQueryRules" +} + +// NewEmptyStatus returns a new empty (blank) status +func (rule *ScheduledQueryRule) NewEmptyStatus() genruntime.ConvertibleStatus { + return &ScheduledQueryRule_STATUS{} +} + +// Owner returns the ResourceReference of the owner +func (rule *ScheduledQueryRule) Owner() *genruntime.ResourceReference { + if rule.Spec.Owner == nil { + return nil + } + + group, kind := genruntime.LookupOwnerGroupKind(rule.Spec) + return rule.Spec.Owner.AsResourceReference(group, kind) +} + +// SetStatus sets the status of this resource +func (rule *ScheduledQueryRule) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*ScheduledQueryRule_STATUS); ok { + rule.Status = *st + return nil + } + + // Convert status to required version + var st ScheduledQueryRule_STATUS + err := status.ConvertStatusTo(&st) + if err != nil { + return eris.Wrap(err, "failed to convert status") + } + + rule.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-insights-azure-com-v1api20231201-scheduledqueryrule,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=insights.azure.com,resources=scheduledqueryrules,verbs=create;update,versions=v1api20231201,name=validate.v1api20231201.scheduledqueryrules.insights.azure.com,admissionReviewVersions=v1 + +var _ admission.Validator = &ScheduledQueryRule{} + +// ValidateCreate validates the creation of the resource +func (rule *ScheduledQueryRule) ValidateCreate() (admission.Warnings, error) { + validations := rule.createValidations() + var temp any = rule + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.CreateValidations()...) + } + return genruntime.ValidateCreate(validations) +} + +// ValidateDelete validates the deletion of the resource +func (rule *ScheduledQueryRule) ValidateDelete() (admission.Warnings, error) { + validations := rule.deleteValidations() + var temp any = rule + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.DeleteValidations()...) + } + return genruntime.ValidateDelete(validations) +} + +// ValidateUpdate validates an update of the resource +func (rule *ScheduledQueryRule) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { + validations := rule.updateValidations() + var temp any = rule + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.UpdateValidations()...) + } + return genruntime.ValidateUpdate(old, validations) +} + +// createValidations validates the creation of the resource +func (rule *ScheduledQueryRule) createValidations() []func() (admission.Warnings, error) { + return []func() (admission.Warnings, error){rule.validateResourceReferences, rule.validateOwnerReference, rule.validateSecretDestinations, rule.validateConfigMapDestinations} +} + +// deleteValidations validates the deletion of the resource +func (rule *ScheduledQueryRule) deleteValidations() []func() (admission.Warnings, error) { + return nil +} + +// updateValidations validates the update of the resource +func (rule *ScheduledQueryRule) updateValidations() []func(old runtime.Object) (admission.Warnings, error) { + return []func(old runtime.Object) (admission.Warnings, error){ + func(old runtime.Object) (admission.Warnings, error) { + return rule.validateResourceReferences() + }, + rule.validateWriteOnceProperties, + func(old runtime.Object) (admission.Warnings, error) { + return rule.validateOwnerReference() + }, + func(old runtime.Object) (admission.Warnings, error) { + return rule.validateSecretDestinations() + }, + func(old runtime.Object) (admission.Warnings, error) { + return rule.validateConfigMapDestinations() + }, + } +} + +// validateConfigMapDestinations validates there are no colliding genruntime.ConfigMapDestinations +func (rule *ScheduledQueryRule) validateConfigMapDestinations() (admission.Warnings, error) { + if rule.Spec.OperatorSpec == nil { + return nil, nil + } + return configmaps.ValidateDestinations(rule, nil, rule.Spec.OperatorSpec.ConfigMapExpressions) +} + +// validateOwnerReference validates the owner field +func (rule *ScheduledQueryRule) validateOwnerReference() (admission.Warnings, error) { + return genruntime.ValidateOwner(rule) +} + +// validateResourceReferences validates all resource references +func (rule *ScheduledQueryRule) validateResourceReferences() (admission.Warnings, error) { + refs, err := reflecthelpers.FindResourceReferences(&rule.Spec) + if err != nil { + return nil, err + } + return genruntime.ValidateResourceReferences(refs) +} + +// validateSecretDestinations validates there are no colliding genruntime.SecretDestination's +func (rule *ScheduledQueryRule) validateSecretDestinations() (admission.Warnings, error) { + if rule.Spec.OperatorSpec == nil { + return nil, nil + } + return secrets.ValidateDestinations(rule, nil, rule.Spec.OperatorSpec.SecretExpressions) +} + +// validateWriteOnceProperties validates all WriteOnce properties +func (rule *ScheduledQueryRule) validateWriteOnceProperties(old runtime.Object) (admission.Warnings, error) { + oldObj, ok := old.(*ScheduledQueryRule) + if !ok { + return nil, nil + } + + return genruntime.ValidateWriteOnceProperties(oldObj, rule) +} + +// AssignProperties_From_ScheduledQueryRule populates our ScheduledQueryRule from the provided source ScheduledQueryRule +func (rule *ScheduledQueryRule) AssignProperties_From_ScheduledQueryRule(source *storage.ScheduledQueryRule) error { + + // ObjectMeta + rule.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec ScheduledQueryRule_Spec + err := spec.AssignProperties_From_ScheduledQueryRule_Spec(&source.Spec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_Spec() to populate field Spec") + } + rule.Spec = spec + + // Status + var status ScheduledQueryRule_STATUS + err = status.AssignProperties_From_ScheduledQueryRule_STATUS(&source.Status) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRule_STATUS() to populate field Status") + } + rule.Status = status + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRule populates the provided destination ScheduledQueryRule from our ScheduledQueryRule +func (rule *ScheduledQueryRule) AssignProperties_To_ScheduledQueryRule(destination *storage.ScheduledQueryRule) error { + + // ObjectMeta + destination.ObjectMeta = *rule.ObjectMeta.DeepCopy() + + // Spec + var spec storage.ScheduledQueryRule_Spec + err := rule.Spec.AssignProperties_To_ScheduledQueryRule_Spec(&spec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_Spec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status storage.ScheduledQueryRule_STATUS + err = rule.Status.AssignProperties_To_ScheduledQueryRule_STATUS(&status) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRule_STATUS() to populate field Status") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (rule *ScheduledQueryRule) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: rule.Spec.OriginalVersion(), + Kind: "ScheduledQueryRule", + } +} + +// +kubebuilder:object:root=true +// Generator information: +// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2023-12-01/scheduledQueryRule_API.json +// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} +type ScheduledQueryRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ScheduledQueryRule `json:"items"` +} + +// +kubebuilder:validation:Enum={"2023-12-01"} +type APIVersion string + +const APIVersion_Value = APIVersion("2023-12-01") + +type ScheduledQueryRule_Spec struct { + // Actions: Actions to invoke when the alert fires. + Actions *Actions `json:"actions,omitempty"` + + // AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true. + // Relevant only for rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // +kubebuilder:validation:Pattern="^[^#<>%&:\\?/{}*]{1,260}$" + // AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it + // doesn't have to be. + AzureName string `json:"azureName,omitempty"` + + // CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in + // the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + + // Criteria: The rule criteria that defines the conditions of the scheduled query rule. + Criteria *ScheduledQueryRuleCriteria `json:"criteria,omitempty"` + + // Description: The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + + // DisplayName: The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + + // Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + + // EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant + // and required only for rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + + // Identity: The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + + // Kind: Indicates the type of scheduled query rule. The default is LogAlert. + Kind *ScheduledQueryRule_Kind_Spec `json:"kind,omitempty"` + + // +kubebuilder:validation:Required + // Location: The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. + // Relevant only for rules of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + + // OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not + // passed directly to Azure + OperatorSpec *ScheduledQueryRuleOperatorSpec `json:"operatorSpec,omitempty"` + + // OverrideQueryTimeRange: If specified then overrides the query time range (default is + // WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // +kubebuilder:validation:Required + // Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a resources.azure.com/ResourceGroup resource + Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"` + + // ResolveConfiguration: Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + ResolveConfiguration *RuleResolveConfiguration `json:"resolveConfiguration,omitempty"` + + // ScopesReferences: The list of resource id's that this scheduled query rule is scoped to. + ScopesReferences []genruntime.ResourceReference `armReference:"Scopes" json:"scopesReferences,omitempty"` + + // Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only + // for rules of the kind LogAlert. + Severity *ScheduledQueryRuleProperties_Severity `json:"severity,omitempty"` + + // SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is + // false. Relevant only for rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + + // Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + // TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example + // if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert + // will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of + // the kind LogAlert + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + + // WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). + // Relevant and required only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` +} + +var _ genruntime.ARMTransformer = &ScheduledQueryRule_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (rule *ScheduledQueryRule_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if rule == nil { + return nil, nil + } + result := &arm.ScheduledQueryRule_Spec{} + + // Set property "Identity": + if rule.Identity != nil { + identity_ARM, err := (*rule.Identity).ConvertToARM(resolved) + if err != nil { + return nil, err + } + identity := *identity_ARM.(*arm.Identity) + result.Identity = &identity + } + + // Set property "Kind": + if rule.Kind != nil { + var temp string + temp = string(*rule.Kind) + kind := arm.ScheduledQueryRule_Kind_Spec(temp) + result.Kind = &kind + } + + // Set property "Location": + if rule.Location != nil { + location := *rule.Location + result.Location = &location + } + + // Set property "Name": + result.Name = resolved.Name + + // Set property "Properties": + if rule.Actions != nil || + rule.AutoMitigate != nil || + rule.CheckWorkspaceAlertsStorageConfigured != nil || + rule.Criteria != nil || + rule.Description != nil || + rule.DisplayName != nil || + rule.Enabled != nil || + rule.EvaluationFrequency != nil || + rule.MuteActionsDuration != nil || + rule.OverrideQueryTimeRange != nil || + rule.ResolveConfiguration != nil || + rule.ScopesReferences != nil || + rule.Severity != nil || + rule.SkipQueryValidation != nil || + rule.TargetResourceTypes != nil || + rule.WindowSize != nil { + result.Properties = &arm.ScheduledQueryRuleProperties{} + } + if rule.Actions != nil { + actions_ARM, err := (*rule.Actions).ConvertToARM(resolved) + if err != nil { + return nil, err + } + actions := *actions_ARM.(*arm.Actions) + result.Properties.Actions = &actions + } + if rule.AutoMitigate != nil { + autoMitigate := *rule.AutoMitigate + result.Properties.AutoMitigate = &autoMitigate + } + if rule.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured + result.Properties.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } + if rule.Criteria != nil { + criteria_ARM, err := (*rule.Criteria).ConvertToARM(resolved) + if err != nil { + return nil, err + } + criteria := *criteria_ARM.(*arm.ScheduledQueryRuleCriteria) + result.Properties.Criteria = &criteria + } + if rule.Description != nil { + description := *rule.Description + result.Properties.Description = &description + } + if rule.DisplayName != nil { + displayName := *rule.DisplayName + result.Properties.DisplayName = &displayName + } + if rule.Enabled != nil { + enabled := *rule.Enabled + result.Properties.Enabled = &enabled + } + if rule.EvaluationFrequency != nil { + evaluationFrequency := *rule.EvaluationFrequency + result.Properties.EvaluationFrequency = &evaluationFrequency + } + if rule.MuteActionsDuration != nil { + muteActionsDuration := *rule.MuteActionsDuration + result.Properties.MuteActionsDuration = &muteActionsDuration + } + if rule.OverrideQueryTimeRange != nil { + overrideQueryTimeRange := *rule.OverrideQueryTimeRange + result.Properties.OverrideQueryTimeRange = &overrideQueryTimeRange + } + if rule.ResolveConfiguration != nil { + resolveConfiguration_ARM, err := (*rule.ResolveConfiguration).ConvertToARM(resolved) + if err != nil { + return nil, err + } + resolveConfiguration := *resolveConfiguration_ARM.(*arm.RuleResolveConfiguration) + result.Properties.ResolveConfiguration = &resolveConfiguration + } + for _, item := range rule.ScopesReferences { + itemARMID, err := resolved.ResolvedReferences.Lookup(item) + if err != nil { + return nil, err + } + result.Properties.Scopes = append(result.Properties.Scopes, itemARMID) + } + if rule.Severity != nil { + var temp int + temp = int(*rule.Severity) + severity := arm.ScheduledQueryRuleProperties_Severity(temp) + result.Properties.Severity = &severity + } + if rule.SkipQueryValidation != nil { + skipQueryValidation := *rule.SkipQueryValidation + result.Properties.SkipQueryValidation = &skipQueryValidation + } + for _, item := range rule.TargetResourceTypes { + result.Properties.TargetResourceTypes = append(result.Properties.TargetResourceTypes, item) + } + if rule.WindowSize != nil { + windowSize := *rule.WindowSize + result.Properties.WindowSize = &windowSize + } + + // Set property "Tags": + if rule.Tags != nil { + result.Tags = make(map[string]string, len(rule.Tags)) + for key, value := range rule.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (rule *ScheduledQueryRule_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.ScheduledQueryRule_Spec{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (rule *ScheduledQueryRule_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.ScheduledQueryRule_Spec) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRule_Spec, got %T", armInput) + } + + // Set property "Actions": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Actions != nil { + var actions1 Actions + err := actions1.PopulateFromARM(owner, *typedInput.Properties.Actions) + if err != nil { + return err + } + actions := actions1 + rule.Actions = &actions + } + } + + // Set property "AutoMitigate": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.AutoMitigate != nil { + autoMitigate := *typedInput.Properties.AutoMitigate + rule.AutoMitigate = &autoMitigate + } + } + + // Set property "AzureName": + rule.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property "CheckWorkspaceAlertsStorageConfigured": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *typedInput.Properties.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } + } + + // Set property "Criteria": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Criteria != nil { + var criteria1 ScheduledQueryRuleCriteria + err := criteria1.PopulateFromARM(owner, *typedInput.Properties.Criteria) + if err != nil { + return err + } + criteria := criteria1 + rule.Criteria = &criteria + } + } + + // Set property "Description": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Description != nil { + description := *typedInput.Properties.Description + rule.Description = &description + } + } + + // Set property "DisplayName": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DisplayName != nil { + displayName := *typedInput.Properties.DisplayName + rule.DisplayName = &displayName + } + } + + // Set property "Enabled": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Enabled != nil { + enabled := *typedInput.Properties.Enabled + rule.Enabled = &enabled + } + } + + // Set property "EvaluationFrequency": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.EvaluationFrequency != nil { + evaluationFrequency := *typedInput.Properties.EvaluationFrequency + rule.EvaluationFrequency = &evaluationFrequency + } + } + + // Set property "Identity": + if typedInput.Identity != nil { + var identity1 Identity + err := identity1.PopulateFromARM(owner, *typedInput.Identity) + if err != nil { + return err + } + identity := identity1 + rule.Identity = &identity + } + + // Set property "Kind": + if typedInput.Kind != nil { + var temp string + temp = string(*typedInput.Kind) + kind := ScheduledQueryRule_Kind_Spec(temp) + rule.Kind = &kind + } + + // Set property "Location": + if typedInput.Location != nil { + location := *typedInput.Location + rule.Location = &location + } + + // Set property "MuteActionsDuration": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.MuteActionsDuration != nil { + muteActionsDuration := *typedInput.Properties.MuteActionsDuration + rule.MuteActionsDuration = &muteActionsDuration + } + } + + // no assignment for property "OperatorSpec" + + // Set property "OverrideQueryTimeRange": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.OverrideQueryTimeRange != nil { + overrideQueryTimeRange := *typedInput.Properties.OverrideQueryTimeRange + rule.OverrideQueryTimeRange = &overrideQueryTimeRange + } + } + + // Set property "Owner": + rule.Owner = &genruntime.KnownResourceReference{ + Name: owner.Name, + ARMID: owner.ARMID, + } + + // Set property "ResolveConfiguration": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ResolveConfiguration != nil { + var resolveConfiguration1 RuleResolveConfiguration + err := resolveConfiguration1.PopulateFromARM(owner, *typedInput.Properties.ResolveConfiguration) + if err != nil { + return err + } + resolveConfiguration := resolveConfiguration1 + rule.ResolveConfiguration = &resolveConfiguration + } + } + + // no assignment for property "ScopesReferences" + + // Set property "Severity": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Severity != nil { + var temp int + temp = int(*typedInput.Properties.Severity) + severity := ScheduledQueryRuleProperties_Severity(temp) + rule.Severity = &severity + } + } + + // Set property "SkipQueryValidation": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.SkipQueryValidation != nil { + skipQueryValidation := *typedInput.Properties.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } + } + + // Set property "Tags": + if typedInput.Tags != nil { + rule.Tags = make(map[string]string, len(typedInput.Tags)) + for key, value := range typedInput.Tags { + rule.Tags[key] = value + } + } + + // Set property "TargetResourceTypes": + // copying flattened property: + if typedInput.Properties != nil { + for _, item := range typedInput.Properties.TargetResourceTypes { + rule.TargetResourceTypes = append(rule.TargetResourceTypes, item) + } + } + + // Set property "WindowSize": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.WindowSize != nil { + windowSize := *typedInput.Properties.WindowSize + rule.WindowSize = &windowSize + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &ScheduledQueryRule_Spec{} + +// ConvertSpecFrom populates our ScheduledQueryRule_Spec from the provided source +func (rule *ScheduledQueryRule_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*storage.ScheduledQueryRule_Spec) + if ok { + // Populate our instance from source + return rule.AssignProperties_From_ScheduledQueryRule_Spec(src) + } + + // Convert to an intermediate form + src = &storage.ScheduledQueryRule_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertSpecFrom()") + } + + // Update our instance from src + err = rule.AssignProperties_From_ScheduledQueryRule_Spec(src) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil +} + +// ConvertSpecTo populates the provided destination from our ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*storage.ScheduledQueryRule_Spec) + if ok { + // Populate destination from our instance + return rule.AssignProperties_To_ScheduledQueryRule_Spec(dst) + } + + // Convert to an intermediate form + dst = &storage.ScheduledQueryRule_Spec{} + err := rule.AssignProperties_To_ScheduledQueryRule_Spec(dst) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()") + } + + // Update dst from our instance + err = dst.ConvertSpecTo(destination) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertSpecTo()") + } + + return nil +} + +// AssignProperties_From_ScheduledQueryRule_Spec populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) AssignProperties_From_ScheduledQueryRule_Spec(source *storage.ScheduledQueryRule_Spec) error { + + // Actions + if source.Actions != nil { + var action Actions + err := action.AssignProperties_From_Actions(source.Actions) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Actions() to populate field Actions") + } + rule.Actions = &action + } else { + rule.Actions = nil + } + + // AutoMitigate + if source.AutoMitigate != nil { + autoMitigate := *source.AutoMitigate + rule.AutoMitigate = &autoMitigate + } else { + rule.AutoMitigate = nil + } + + // AzureName + rule.AzureName = source.AzureName + + // CheckWorkspaceAlertsStorageConfigured + if source.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + rule.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Criteria + if source.Criteria != nil { + var criterion ScheduledQueryRuleCriteria + err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria(source.Criteria) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria() to populate field Criteria") + } + rule.Criteria = &criterion + } else { + rule.Criteria = nil + } + + // Description + rule.Description = genruntime.ClonePointerToString(source.Description) + + // DisplayName + rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) + + // Enabled + if source.Enabled != nil { + enabled := *source.Enabled + rule.Enabled = &enabled + } else { + rule.Enabled = nil + } + + // EvaluationFrequency + rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) + + // Identity + if source.Identity != nil { + var identity Identity + err := identity.AssignProperties_From_Identity(source.Identity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Identity() to populate field Identity") + } + rule.Identity = &identity + } else { + rule.Identity = nil + } + + // Kind + if source.Kind != nil { + kind := *source.Kind + kindTemp := genruntime.ToEnum(kind, scheduledQueryRule_Kind_Spec_Values) + rule.Kind = &kindTemp + } else { + rule.Kind = nil + } + + // Location + rule.Location = genruntime.ClonePointerToString(source.Location) + + // MuteActionsDuration + rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) + + // OperatorSpec + if source.OperatorSpec != nil { + var operatorSpec ScheduledQueryRuleOperatorSpec + err := operatorSpec.AssignProperties_From_ScheduledQueryRuleOperatorSpec(source.OperatorSpec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec") + } + rule.OperatorSpec = &operatorSpec + } else { + rule.OperatorSpec = nil + } + + // OverrideQueryTimeRange + rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) + + // Owner + if source.Owner != nil { + owner := source.Owner.Copy() + rule.Owner = &owner + } else { + rule.Owner = nil + } + + // ResolveConfiguration + if source.ResolveConfiguration != nil { + var resolveConfiguration RuleResolveConfiguration + err := resolveConfiguration.AssignProperties_From_RuleResolveConfiguration(source.ResolveConfiguration) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_RuleResolveConfiguration() to populate field ResolveConfiguration") + } + rule.ResolveConfiguration = &resolveConfiguration + } else { + rule.ResolveConfiguration = nil + } + + // ScopesReferences + if source.ScopesReferences != nil { + scopesReferenceList := make([]genruntime.ResourceReference, len(source.ScopesReferences)) + for scopesReferenceIndex, scopesReferenceItem := range source.ScopesReferences { + // Shadow the loop variable to avoid aliasing + scopesReferenceItem := scopesReferenceItem + scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy() + } + rule.ScopesReferences = scopesReferenceList + } else { + rule.ScopesReferences = nil + } + + // Severity + if source.Severity != nil { + severity := ScheduledQueryRuleProperties_Severity(*source.Severity) + rule.Severity = &severity + } else { + rule.Severity = nil + } + + // SkipQueryValidation + if source.SkipQueryValidation != nil { + skipQueryValidation := *source.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } else { + rule.SkipQueryValidation = nil + } + + // Tags + rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TargetResourceTypes + rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) + + // WindowSize + rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRule_Spec populates the provided destination ScheduledQueryRule_Spec from our ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) AssignProperties_To_ScheduledQueryRule_Spec(destination *storage.ScheduledQueryRule_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Actions + if rule.Actions != nil { + var action storage.Actions + err := rule.Actions.AssignProperties_To_Actions(&action) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Actions() to populate field Actions") + } + destination.Actions = &action + } else { + destination.Actions = nil + } + + // AutoMitigate + if rule.AutoMitigate != nil { + autoMitigate := *rule.AutoMitigate + destination.AutoMitigate = &autoMitigate + } else { + destination.AutoMitigate = nil + } + + // AzureName + destination.AzureName = rule.AzureName + + // CheckWorkspaceAlertsStorageConfigured + if rule.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured + destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + destination.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Criteria + if rule.Criteria != nil { + var criterion storage.ScheduledQueryRuleCriteria + err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria(&criterion) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria() to populate field Criteria") + } + destination.Criteria = &criterion + } else { + destination.Criteria = nil + } + + // Description + destination.Description = genruntime.ClonePointerToString(rule.Description) + + // DisplayName + destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName) + + // Enabled + if rule.Enabled != nil { + enabled := *rule.Enabled + destination.Enabled = &enabled + } else { + destination.Enabled = nil + } + + // EvaluationFrequency + destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency) + + // Identity + if rule.Identity != nil { + var identity storage.Identity + err := rule.Identity.AssignProperties_To_Identity(&identity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Identity() to populate field Identity") + } + destination.Identity = &identity + } else { + destination.Identity = nil + } + + // Kind + if rule.Kind != nil { + kind := string(*rule.Kind) + destination.Kind = &kind + } else { + destination.Kind = nil + } + + // Location + destination.Location = genruntime.ClonePointerToString(rule.Location) + + // MuteActionsDuration + destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration) + + // OperatorSpec + if rule.OperatorSpec != nil { + var operatorSpec storage.ScheduledQueryRuleOperatorSpec + err := rule.OperatorSpec.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&operatorSpec) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleOperatorSpec() to populate field OperatorSpec") + } + destination.OperatorSpec = &operatorSpec + } else { + destination.OperatorSpec = nil + } + + // OriginalVersion + destination.OriginalVersion = rule.OriginalVersion() + + // OverrideQueryTimeRange + destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange) + + // Owner + if rule.Owner != nil { + owner := rule.Owner.Copy() + destination.Owner = &owner + } else { + destination.Owner = nil + } + + // ResolveConfiguration + if rule.ResolveConfiguration != nil { + var resolveConfiguration storage.RuleResolveConfiguration + err := rule.ResolveConfiguration.AssignProperties_To_RuleResolveConfiguration(&resolveConfiguration) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_RuleResolveConfiguration() to populate field ResolveConfiguration") + } + destination.ResolveConfiguration = &resolveConfiguration + } else { + destination.ResolveConfiguration = nil + } + + // ScopesReferences + if rule.ScopesReferences != nil { + scopesReferenceList := make([]genruntime.ResourceReference, len(rule.ScopesReferences)) + for scopesReferenceIndex, scopesReferenceItem := range rule.ScopesReferences { + // Shadow the loop variable to avoid aliasing + scopesReferenceItem := scopesReferenceItem + scopesReferenceList[scopesReferenceIndex] = scopesReferenceItem.Copy() + } + destination.ScopesReferences = scopesReferenceList + } else { + destination.ScopesReferences = nil + } + + // Severity + if rule.Severity != nil { + severity := int(*rule.Severity) + destination.Severity = &severity + } else { + destination.Severity = nil + } + + // SkipQueryValidation + if rule.SkipQueryValidation != nil { + skipQueryValidation := *rule.SkipQueryValidation + destination.SkipQueryValidation = &skipQueryValidation + } else { + destination.SkipQueryValidation = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags) + + // TargetResourceTypes + destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes) + + // WindowSize + destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_Spec from the provided source ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_Spec) Initialize_From_ScheduledQueryRule_STATUS(source *ScheduledQueryRule_STATUS) error { + + // Actions + if source.Actions != nil { + var action Actions + err := action.Initialize_From_Actions_STATUS(source.Actions) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_Actions_STATUS() to populate field Actions") + } + rule.Actions = &action + } else { + rule.Actions = nil + } + + // AutoMitigate + if source.AutoMitigate != nil { + autoMitigate := *source.AutoMitigate + rule.AutoMitigate = &autoMitigate + } else { + rule.AutoMitigate = nil + } + + // CheckWorkspaceAlertsStorageConfigured + if source.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + rule.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Criteria + if source.Criteria != nil { + var criterion ScheduledQueryRuleCriteria + err := criterion.Initialize_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") + } + rule.Criteria = &criterion + } else { + rule.Criteria = nil + } + + // Description + rule.Description = genruntime.ClonePointerToString(source.Description) + + // DisplayName + rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) + + // Enabled + if source.Enabled != nil { + enabled := *source.Enabled + rule.Enabled = &enabled + } else { + rule.Enabled = nil + } + + // EvaluationFrequency + rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) + + // Identity + if source.Identity != nil { + var identity Identity + err := identity.Initialize_From_Identity_STATUS(source.Identity) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_Identity_STATUS() to populate field Identity") + } + rule.Identity = &identity + } else { + rule.Identity = nil + } + + // Kind + if source.Kind != nil { + kind := genruntime.ToEnum(string(*source.Kind), scheduledQueryRule_Kind_Spec_Values) + rule.Kind = &kind + } else { + rule.Kind = nil + } + + // Location + rule.Location = genruntime.ClonePointerToString(source.Location) + + // MuteActionsDuration + rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) + + // OverrideQueryTimeRange + rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) + + // ResolveConfiguration + if source.ResolveConfiguration != nil { + var resolveConfiguration RuleResolveConfiguration + err := resolveConfiguration.Initialize_From_RuleResolveConfiguration_STATUS(source.ResolveConfiguration) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_RuleResolveConfiguration_STATUS() to populate field ResolveConfiguration") + } + rule.ResolveConfiguration = &resolveConfiguration + } else { + rule.ResolveConfiguration = nil + } + + // Severity + if source.Severity != nil { + severity := ScheduledQueryRuleProperties_Severity(*source.Severity) + rule.Severity = &severity + } else { + rule.Severity = nil + } + + // SkipQueryValidation + if source.SkipQueryValidation != nil { + skipQueryValidation := *source.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } else { + rule.SkipQueryValidation = nil + } + + // Tags + rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TargetResourceTypes + rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) + + // WindowSize + rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) + + // No error + return nil +} + +// OriginalVersion returns the original API version used to create the resource. +func (rule *ScheduledQueryRule_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (rule *ScheduledQueryRule_Spec) SetAzureName(azureName string) { rule.AzureName = azureName } + +type ScheduledQueryRule_STATUS struct { + // Actions: Actions to invoke when the alert fires. + Actions *Actions_STATUS `json:"actions,omitempty"` + + // AutoMitigate: The flag that indicates whether the alert should be automatically resolved or not. The default is true. + // Relevant only for rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // CheckWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule should be stored in + // the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + + // Conditions: The observed state of the resource + Conditions []conditions.Condition `json:"conditions,omitempty"` + + // CreatedWithApiVersion: The api-version used when creating this alert rule + CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"` + + // Criteria: The rule criteria that defines the conditions of the scheduled query rule. + Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"` + + // Description: The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + + // DisplayName: The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + + // Enabled: The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + + // Etag: 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"` + + // EvaluationFrequency: How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant + // and required only for rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + + // Id: Fully qualified resource ID for the resource. Ex - + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + Id *string `json:"id,omitempty"` + + // Identity: The identity of the resource. + Identity *Identity_STATUS `json:"identity,omitempty"` + + // IsLegacyLogAnalyticsRule: True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + + // IsWorkspaceAlertsStorageConfigured: The flag which indicates whether this scheduled query rule has been configured to be + // stored in the customer's storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` + + // Kind: Indicates the type of scheduled query rule. The default is LogAlert. + Kind *ScheduledQueryRule_Kind_STATUS `json:"kind,omitempty"` + + // Location: The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // MuteActionsDuration: Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. + // Relevant only for rules of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + + // Name: The name of the resource + Name *string `json:"name,omitempty"` + + // OverrideQueryTimeRange: If specified then overrides the query time range (default is + // WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // ResolveConfiguration: Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + ResolveConfiguration *RuleResolveConfiguration_STATUS `json:"resolveConfiguration,omitempty"` + + // Scopes: The list of resource id's that this scheduled query rule is scoped to. + Scopes []string `json:"scopes,omitempty"` + + // Severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only + // for rules of the kind LogAlert. + Severity *ScheduledQueryRuleProperties_Severity_STATUS `json:"severity,omitempty"` + + // SkipQueryValidation: The flag which indicates whether the provided query should be validated or not. The default is + // false. Relevant only for rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + + // SystemData: SystemData of ScheduledQueryRule. + SystemData *SystemData_STATUS `json:"systemData,omitempty"` + + // Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + // TargetResourceTypes: List of resource type of the target resource(s) on which the alert is created/updated. For example + // if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert + // will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of + // the kind LogAlert + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + + // Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + + // WindowSize: The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). + // Relevant and required only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &ScheduledQueryRule_STATUS{} + +// ConvertStatusFrom populates our ScheduledQueryRule_STATUS from the provided source +func (rule *ScheduledQueryRule_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*storage.ScheduledQueryRule_STATUS) + if ok { + // Populate our instance from source + return rule.AssignProperties_From_ScheduledQueryRule_STATUS(src) + } + + // Convert to an intermediate form + src = &storage.ScheduledQueryRule_STATUS{} + err := src.ConvertStatusFrom(source) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = rule.AssignProperties_From_ScheduledQueryRule_STATUS(src) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*storage.ScheduledQueryRule_STATUS) + if ok { + // Populate destination from our instance + return rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst) + } + + // Convert to an intermediate form + dst = &storage.ScheduledQueryRule_STATUS{} + err := rule.AssignProperties_To_ScheduledQueryRule_STATUS(dst) + if err != nil { + return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return eris.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +var _ genruntime.FromARMConverter = &ScheduledQueryRule_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (rule *ScheduledQueryRule_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.ScheduledQueryRule_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (rule *ScheduledQueryRule_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.ScheduledQueryRule_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRule_STATUS, got %T", armInput) + } + + // Set property "Actions": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Actions != nil { + var actions1 Actions_STATUS + err := actions1.PopulateFromARM(owner, *typedInput.Properties.Actions) + if err != nil { + return err + } + actions := actions1 + rule.Actions = &actions + } + } + + // Set property "AutoMitigate": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.AutoMitigate != nil { + autoMitigate := *typedInput.Properties.AutoMitigate + rule.AutoMitigate = &autoMitigate + } + } + + // Set property "CheckWorkspaceAlertsStorageConfigured": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *typedInput.Properties.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } + } + + // no assignment for property "Conditions" + + // Set property "CreatedWithApiVersion": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.CreatedWithApiVersion != nil { + createdWithApiVersion := *typedInput.Properties.CreatedWithApiVersion + rule.CreatedWithApiVersion = &createdWithApiVersion + } + } + + // Set property "Criteria": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Criteria != nil { + var criteria1 ScheduledQueryRuleCriteria_STATUS + err := criteria1.PopulateFromARM(owner, *typedInput.Properties.Criteria) + if err != nil { + return err + } + criteria := criteria1 + rule.Criteria = &criteria + } + } + + // Set property "Description": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Description != nil { + description := *typedInput.Properties.Description + rule.Description = &description + } + } + + // Set property "DisplayName": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DisplayName != nil { + displayName := *typedInput.Properties.DisplayName + rule.DisplayName = &displayName + } + } + + // Set property "Enabled": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Enabled != nil { + enabled := *typedInput.Properties.Enabled + rule.Enabled = &enabled + } + } + + // Set property "Etag": + if typedInput.Etag != nil { + etag := *typedInput.Etag + rule.Etag = &etag + } + + // Set property "EvaluationFrequency": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.EvaluationFrequency != nil { + evaluationFrequency := *typedInput.Properties.EvaluationFrequency + rule.EvaluationFrequency = &evaluationFrequency + } + } + + // Set property "Id": + if typedInput.Id != nil { + id := *typedInput.Id + rule.Id = &id + } + + // Set property "Identity": + if typedInput.Identity != nil { + var identity1 Identity_STATUS + err := identity1.PopulateFromARM(owner, *typedInput.Identity) + if err != nil { + return err + } + identity := identity1 + rule.Identity = &identity + } + + // Set property "IsLegacyLogAnalyticsRule": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.IsLegacyLogAnalyticsRule != nil { + isLegacyLogAnalyticsRule := *typedInput.Properties.IsLegacyLogAnalyticsRule + rule.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } + } + + // Set property "IsWorkspaceAlertsStorageConfigured": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.IsWorkspaceAlertsStorageConfigured != nil { + isWorkspaceAlertsStorageConfigured := *typedInput.Properties.IsWorkspaceAlertsStorageConfigured + rule.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured + } + } + + // Set property "Kind": + if typedInput.Kind != nil { + var temp string + temp = string(*typedInput.Kind) + kind := ScheduledQueryRule_Kind_STATUS(temp) + rule.Kind = &kind + } + + // Set property "Location": + if typedInput.Location != nil { + location := *typedInput.Location + rule.Location = &location + } + + // Set property "MuteActionsDuration": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.MuteActionsDuration != nil { + muteActionsDuration := *typedInput.Properties.MuteActionsDuration + rule.MuteActionsDuration = &muteActionsDuration + } + } + + // Set property "Name": + if typedInput.Name != nil { + name := *typedInput.Name + rule.Name = &name + } + + // Set property "OverrideQueryTimeRange": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.OverrideQueryTimeRange != nil { + overrideQueryTimeRange := *typedInput.Properties.OverrideQueryTimeRange + rule.OverrideQueryTimeRange = &overrideQueryTimeRange + } + } + + // Set property "ResolveConfiguration": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ResolveConfiguration != nil { + var resolveConfiguration1 RuleResolveConfiguration_STATUS + err := resolveConfiguration1.PopulateFromARM(owner, *typedInput.Properties.ResolveConfiguration) + if err != nil { + return err + } + resolveConfiguration := resolveConfiguration1 + rule.ResolveConfiguration = &resolveConfiguration + } + } + + // Set property "Scopes": + // copying flattened property: + if typedInput.Properties != nil { + for _, item := range typedInput.Properties.Scopes { + rule.Scopes = append(rule.Scopes, item) + } + } + + // Set property "Severity": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Severity != nil { + var temp int + temp = int(*typedInput.Properties.Severity) + severity := ScheduledQueryRuleProperties_Severity_STATUS(temp) + rule.Severity = &severity + } + } + + // Set property "SkipQueryValidation": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.SkipQueryValidation != nil { + skipQueryValidation := *typedInput.Properties.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } + } + + // Set property "SystemData": + if typedInput.SystemData != nil { + var systemData1 SystemData_STATUS + err := systemData1.PopulateFromARM(owner, *typedInput.SystemData) + if err != nil { + return err + } + systemData := systemData1 + rule.SystemData = &systemData + } + + // Set property "Tags": + if typedInput.Tags != nil { + rule.Tags = make(map[string]string, len(typedInput.Tags)) + for key, value := range typedInput.Tags { + rule.Tags[key] = value + } + } + + // Set property "TargetResourceTypes": + // copying flattened property: + if typedInput.Properties != nil { + for _, item := range typedInput.Properties.TargetResourceTypes { + rule.TargetResourceTypes = append(rule.TargetResourceTypes, item) + } + } + + // Set property "Type": + if typedInput.Type != nil { + typeVar := *typedInput.Type + rule.Type = &typeVar + } + + // Set property "WindowSize": + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.WindowSize != nil { + windowSize := *typedInput.Properties.WindowSize + rule.WindowSize = &windowSize + } + } + + // No error + return nil +} + +// AssignProperties_From_ScheduledQueryRule_STATUS populates our ScheduledQueryRule_STATUS from the provided source ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) AssignProperties_From_ScheduledQueryRule_STATUS(source *storage.ScheduledQueryRule_STATUS) error { + + // Actions + if source.Actions != nil { + var action Actions_STATUS + err := action.AssignProperties_From_Actions_STATUS(source.Actions) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Actions_STATUS() to populate field Actions") + } + rule.Actions = &action + } else { + rule.Actions = nil + } + + // AutoMitigate + if source.AutoMitigate != nil { + autoMitigate := *source.AutoMitigate + rule.AutoMitigate = &autoMitigate + } else { + rule.AutoMitigate = nil + } + + // CheckWorkspaceAlertsStorageConfigured + if source.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *source.CheckWorkspaceAlertsStorageConfigured + rule.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + rule.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Conditions + rule.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // CreatedWithApiVersion + rule.CreatedWithApiVersion = genruntime.ClonePointerToString(source.CreatedWithApiVersion) + + // Criteria + if source.Criteria != nil { + var criterion ScheduledQueryRuleCriteria_STATUS + err := criterion.AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source.Criteria) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") + } + rule.Criteria = &criterion + } else { + rule.Criteria = nil + } + + // Description + rule.Description = genruntime.ClonePointerToString(source.Description) + + // DisplayName + rule.DisplayName = genruntime.ClonePointerToString(source.DisplayName) + + // Enabled + if source.Enabled != nil { + enabled := *source.Enabled + rule.Enabled = &enabled + } else { + rule.Enabled = nil + } + + // Etag + rule.Etag = genruntime.ClonePointerToString(source.Etag) + + // EvaluationFrequency + rule.EvaluationFrequency = genruntime.ClonePointerToString(source.EvaluationFrequency) + + // Id + rule.Id = genruntime.ClonePointerToString(source.Id) + + // Identity + if source.Identity != nil { + var identity Identity_STATUS + err := identity.AssignProperties_From_Identity_STATUS(source.Identity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Identity_STATUS() to populate field Identity") + } + rule.Identity = &identity + } else { + rule.Identity = nil + } + + // IsLegacyLogAnalyticsRule + if source.IsLegacyLogAnalyticsRule != nil { + isLegacyLogAnalyticsRule := *source.IsLegacyLogAnalyticsRule + rule.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } else { + rule.IsLegacyLogAnalyticsRule = nil + } + + // IsWorkspaceAlertsStorageConfigured + if source.IsWorkspaceAlertsStorageConfigured != nil { + isWorkspaceAlertsStorageConfigured := *source.IsWorkspaceAlertsStorageConfigured + rule.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured + } else { + rule.IsWorkspaceAlertsStorageConfigured = nil + } + + // Kind + if source.Kind != nil { + kind := *source.Kind + kindTemp := genruntime.ToEnum(kind, scheduledQueryRule_Kind_STATUS_Values) + rule.Kind = &kindTemp + } else { + rule.Kind = nil + } + + // Location + rule.Location = genruntime.ClonePointerToString(source.Location) + + // MuteActionsDuration + rule.MuteActionsDuration = genruntime.ClonePointerToString(source.MuteActionsDuration) + + // Name + rule.Name = genruntime.ClonePointerToString(source.Name) + + // OverrideQueryTimeRange + rule.OverrideQueryTimeRange = genruntime.ClonePointerToString(source.OverrideQueryTimeRange) + + // ResolveConfiguration + if source.ResolveConfiguration != nil { + var resolveConfiguration RuleResolveConfiguration_STATUS + err := resolveConfiguration.AssignProperties_From_RuleResolveConfiguration_STATUS(source.ResolveConfiguration) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_RuleResolveConfiguration_STATUS() to populate field ResolveConfiguration") + } + rule.ResolveConfiguration = &resolveConfiguration + } else { + rule.ResolveConfiguration = nil + } + + // Scopes + rule.Scopes = genruntime.CloneSliceOfString(source.Scopes) + + // Severity + if source.Severity != nil { + severity := ScheduledQueryRuleProperties_Severity_STATUS(*source.Severity) + rule.Severity = &severity + } else { + rule.Severity = nil + } + + // SkipQueryValidation + if source.SkipQueryValidation != nil { + skipQueryValidation := *source.SkipQueryValidation + rule.SkipQueryValidation = &skipQueryValidation + } else { + rule.SkipQueryValidation = nil + } + + // SystemData + if source.SystemData != nil { + var systemDatum SystemData_STATUS + err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData") + } + rule.SystemData = &systemDatum + } else { + rule.SystemData = nil + } + + // Tags + rule.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TargetResourceTypes + rule.TargetResourceTypes = genruntime.CloneSliceOfString(source.TargetResourceTypes) + + // Type + rule.Type = genruntime.ClonePointerToString(source.Type) + + // WindowSize + rule.WindowSize = genruntime.ClonePointerToString(source.WindowSize) + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRule_STATUS populates the provided destination ScheduledQueryRule_STATUS from our ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) AssignProperties_To_ScheduledQueryRule_STATUS(destination *storage.ScheduledQueryRule_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Actions + if rule.Actions != nil { + var action storage.Actions_STATUS + err := rule.Actions.AssignProperties_To_Actions_STATUS(&action) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Actions_STATUS() to populate field Actions") + } + destination.Actions = &action + } else { + destination.Actions = nil + } + + // AutoMitigate + if rule.AutoMitigate != nil { + autoMitigate := *rule.AutoMitigate + destination.AutoMitigate = &autoMitigate + } else { + destination.AutoMitigate = nil + } + + // CheckWorkspaceAlertsStorageConfigured + if rule.CheckWorkspaceAlertsStorageConfigured != nil { + checkWorkspaceAlertsStorageConfigured := *rule.CheckWorkspaceAlertsStorageConfigured + destination.CheckWorkspaceAlertsStorageConfigured = &checkWorkspaceAlertsStorageConfigured + } else { + destination.CheckWorkspaceAlertsStorageConfigured = nil + } + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(rule.Conditions) + + // CreatedWithApiVersion + destination.CreatedWithApiVersion = genruntime.ClonePointerToString(rule.CreatedWithApiVersion) + + // Criteria + if rule.Criteria != nil { + var criterion storage.ScheduledQueryRuleCriteria_STATUS + err := rule.Criteria.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&criterion) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_ScheduledQueryRuleCriteria_STATUS() to populate field Criteria") + } + destination.Criteria = &criterion + } else { + destination.Criteria = nil + } + + // Description + destination.Description = genruntime.ClonePointerToString(rule.Description) + + // DisplayName + destination.DisplayName = genruntime.ClonePointerToString(rule.DisplayName) + + // Enabled + if rule.Enabled != nil { + enabled := *rule.Enabled + destination.Enabled = &enabled + } else { + destination.Enabled = nil + } + + // Etag + destination.Etag = genruntime.ClonePointerToString(rule.Etag) + + // EvaluationFrequency + destination.EvaluationFrequency = genruntime.ClonePointerToString(rule.EvaluationFrequency) + + // Id + destination.Id = genruntime.ClonePointerToString(rule.Id) + + // Identity + if rule.Identity != nil { + var identity storage.Identity_STATUS + err := rule.Identity.AssignProperties_To_Identity_STATUS(&identity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Identity_STATUS() to populate field Identity") + } + destination.Identity = &identity + } else { + destination.Identity = nil + } + + // IsLegacyLogAnalyticsRule + if rule.IsLegacyLogAnalyticsRule != nil { + isLegacyLogAnalyticsRule := *rule.IsLegacyLogAnalyticsRule + destination.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } else { + destination.IsLegacyLogAnalyticsRule = nil + } + + // IsWorkspaceAlertsStorageConfigured + if rule.IsWorkspaceAlertsStorageConfigured != nil { + isWorkspaceAlertsStorageConfigured := *rule.IsWorkspaceAlertsStorageConfigured + destination.IsWorkspaceAlertsStorageConfigured = &isWorkspaceAlertsStorageConfigured + } else { + destination.IsWorkspaceAlertsStorageConfigured = nil + } + + // Kind + if rule.Kind != nil { + kind := string(*rule.Kind) + destination.Kind = &kind + } else { + destination.Kind = nil + } + + // Location + destination.Location = genruntime.ClonePointerToString(rule.Location) + + // MuteActionsDuration + destination.MuteActionsDuration = genruntime.ClonePointerToString(rule.MuteActionsDuration) + + // Name + destination.Name = genruntime.ClonePointerToString(rule.Name) + + // OverrideQueryTimeRange + destination.OverrideQueryTimeRange = genruntime.ClonePointerToString(rule.OverrideQueryTimeRange) + + // ResolveConfiguration + if rule.ResolveConfiguration != nil { + var resolveConfiguration storage.RuleResolveConfiguration_STATUS + err := rule.ResolveConfiguration.AssignProperties_To_RuleResolveConfiguration_STATUS(&resolveConfiguration) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_RuleResolveConfiguration_STATUS() to populate field ResolveConfiguration") + } + destination.ResolveConfiguration = &resolveConfiguration + } else { + destination.ResolveConfiguration = nil + } + + // Scopes + destination.Scopes = genruntime.CloneSliceOfString(rule.Scopes) + + // Severity + if rule.Severity != nil { + severity := int(*rule.Severity) + destination.Severity = &severity + } else { + destination.Severity = nil + } + + // SkipQueryValidation + if rule.SkipQueryValidation != nil { + skipQueryValidation := *rule.SkipQueryValidation + destination.SkipQueryValidation = &skipQueryValidation + } else { + destination.SkipQueryValidation = nil + } + + // SystemData + if rule.SystemData != nil { + var systemDatum storage.SystemData_STATUS + err := rule.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData") + } + destination.SystemData = &systemDatum + } else { + destination.SystemData = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(rule.Tags) + + // TargetResourceTypes + destination.TargetResourceTypes = genruntime.CloneSliceOfString(rule.TargetResourceTypes) + + // Type + destination.Type = genruntime.ClonePointerToString(rule.Type) + + // WindowSize + destination.WindowSize = genruntime.ClonePointerToString(rule.WindowSize) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Actions to invoke when the alert fires. +type Actions struct { + // ActionGroupsReferences: Action Group resource Ids to invoke when the alert fires. + ActionGroupsReferences []genruntime.ResourceReference `armReference:"ActionGroups" json:"actionGroupsReferences,omitempty"` + + // ActionProperties: The properties of an action properties. + ActionProperties map[string]string `json:"actionProperties,omitempty"` + + // CustomProperties: The properties of an alert payload. + CustomProperties map[string]string `json:"customProperties,omitempty"` +} + +var _ genruntime.ARMTransformer = &Actions{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (actions *Actions) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if actions == nil { + return nil, nil + } + result := &arm.Actions{} + + // Set property "ActionGroups": + for _, item := range actions.ActionGroupsReferences { + itemARMID, err := resolved.ResolvedReferences.Lookup(item) + if err != nil { + return nil, err + } + result.ActionGroups = append(result.ActionGroups, itemARMID) + } + + // Set property "ActionProperties": + if actions.ActionProperties != nil { + result.ActionProperties = make(map[string]string, len(actions.ActionProperties)) + for key, value := range actions.ActionProperties { + result.ActionProperties[key] = value + } + } + + // Set property "CustomProperties": + if actions.CustomProperties != nil { + result.CustomProperties = make(map[string]string, len(actions.CustomProperties)) + for key, value := range actions.CustomProperties { + result.CustomProperties[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (actions *Actions) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Actions{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (actions *Actions) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Actions) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Actions, got %T", armInput) + } + + // no assignment for property "ActionGroupsReferences" + + // Set property "ActionProperties": + if typedInput.ActionProperties != nil { + actions.ActionProperties = make(map[string]string, len(typedInput.ActionProperties)) + for key, value := range typedInput.ActionProperties { + actions.ActionProperties[key] = value + } + } + + // Set property "CustomProperties": + if typedInput.CustomProperties != nil { + actions.CustomProperties = make(map[string]string, len(typedInput.CustomProperties)) + for key, value := range typedInput.CustomProperties { + actions.CustomProperties[key] = value + } + } + + // No error + return nil +} + +// AssignProperties_From_Actions populates our Actions from the provided source Actions +func (actions *Actions) AssignProperties_From_Actions(source *storage.Actions) error { + + // ActionGroupsReferences + if source.ActionGroupsReferences != nil { + actionGroupsReferenceList := make([]genruntime.ResourceReference, len(source.ActionGroupsReferences)) + for actionGroupsReferenceIndex, actionGroupsReferenceItem := range source.ActionGroupsReferences { + // Shadow the loop variable to avoid aliasing + actionGroupsReferenceItem := actionGroupsReferenceItem + actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy() + } + actions.ActionGroupsReferences = actionGroupsReferenceList + } else { + actions.ActionGroupsReferences = nil + } + + // ActionProperties + actions.ActionProperties = genruntime.CloneMapOfStringToString(source.ActionProperties) + + // CustomProperties + actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) + + // No error + return nil +} + +// AssignProperties_To_Actions populates the provided destination Actions from our Actions +func (actions *Actions) AssignProperties_To_Actions(destination *storage.Actions) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // ActionGroupsReferences + if actions.ActionGroupsReferences != nil { + actionGroupsReferenceList := make([]genruntime.ResourceReference, len(actions.ActionGroupsReferences)) + for actionGroupsReferenceIndex, actionGroupsReferenceItem := range actions.ActionGroupsReferences { + // Shadow the loop variable to avoid aliasing + actionGroupsReferenceItem := actionGroupsReferenceItem + actionGroupsReferenceList[actionGroupsReferenceIndex] = actionGroupsReferenceItem.Copy() + } + destination.ActionGroupsReferences = actionGroupsReferenceList + } else { + destination.ActionGroupsReferences = nil + } + + // ActionProperties + destination.ActionProperties = genruntime.CloneMapOfStringToString(actions.ActionProperties) + + // CustomProperties + destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_Actions_STATUS populates our Actions from the provided source Actions_STATUS +func (actions *Actions) Initialize_From_Actions_STATUS(source *Actions_STATUS) error { + + // ActionProperties + actions.ActionProperties = genruntime.CloneMapOfStringToString(source.ActionProperties) + + // CustomProperties + actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) + + // No error + return nil +} + +// Actions to invoke when the alert fires. +type Actions_STATUS struct { + // ActionGroups: Action Group resource Ids to invoke when the alert fires. + ActionGroups []string `json:"actionGroups,omitempty"` + + // ActionProperties: The properties of an action properties. + ActionProperties map[string]string `json:"actionProperties,omitempty"` + + // CustomProperties: The properties of an alert payload. + CustomProperties map[string]string `json:"customProperties,omitempty"` +} + +var _ genruntime.FromARMConverter = &Actions_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (actions *Actions_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Actions_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (actions *Actions_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Actions_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Actions_STATUS, got %T", armInput) + } + + // Set property "ActionGroups": + for _, item := range typedInput.ActionGroups { + actions.ActionGroups = append(actions.ActionGroups, item) + } + + // Set property "ActionProperties": + if typedInput.ActionProperties != nil { + actions.ActionProperties = make(map[string]string, len(typedInput.ActionProperties)) + for key, value := range typedInput.ActionProperties { + actions.ActionProperties[key] = value + } + } + + // Set property "CustomProperties": + if typedInput.CustomProperties != nil { + actions.CustomProperties = make(map[string]string, len(typedInput.CustomProperties)) + for key, value := range typedInput.CustomProperties { + actions.CustomProperties[key] = value + } + } + + // No error + return nil +} + +// AssignProperties_From_Actions_STATUS populates our Actions_STATUS from the provided source Actions_STATUS +func (actions *Actions_STATUS) AssignProperties_From_Actions_STATUS(source *storage.Actions_STATUS) error { + + // ActionGroups + actions.ActionGroups = genruntime.CloneSliceOfString(source.ActionGroups) + + // ActionProperties + actions.ActionProperties = genruntime.CloneMapOfStringToString(source.ActionProperties) + + // CustomProperties + actions.CustomProperties = genruntime.CloneMapOfStringToString(source.CustomProperties) + + // No error + return nil +} + +// AssignProperties_To_Actions_STATUS populates the provided destination Actions_STATUS from our Actions_STATUS +func (actions *Actions_STATUS) AssignProperties_To_Actions_STATUS(destination *storage.Actions_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // ActionGroups + destination.ActionGroups = genruntime.CloneSliceOfString(actions.ActionGroups) + + // ActionProperties + destination.ActionProperties = genruntime.CloneMapOfStringToString(actions.ActionProperties) + + // CustomProperties + destination.CustomProperties = genruntime.CloneMapOfStringToString(actions.CustomProperties) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Identity for the resource. +type Identity struct { + // +kubebuilder:validation:Required + // Type: Type of managed service identity. + Type *Identity_Type `json:"type,omitempty"` + + // UserAssignedIdentities: The list of user identities associated with the resource. The user identity dictionary key + // references will be ARM resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"` +} + +var _ genruntime.ARMTransformer = &Identity{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (identity *Identity) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if identity == nil { + return nil, nil + } + result := &arm.Identity{} + + // Set property "Type": + if identity.Type != nil { + var temp string + temp = string(*identity.Type) + typeVar := arm.Identity_Type(temp) + result.Type = &typeVar + } + + // Set property "UserAssignedIdentities": + result.UserAssignedIdentities = make(map[string]arm.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities)) + for _, ident := range identity.UserAssignedIdentities { + identARMID, err := resolved.ResolvedReferences.Lookup(ident.Reference) + if err != nil { + return nil, err + } + key := identARMID + result.UserAssignedIdentities[key] = arm.UserAssignedIdentityDetails{} + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (identity *Identity) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Identity{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (identity *Identity) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Identity) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Identity, got %T", armInput) + } + + // Set property "Type": + if typedInput.Type != nil { + var temp string + temp = string(*typedInput.Type) + typeVar := Identity_Type(temp) + identity.Type = &typeVar + } + + // no assignment for property "UserAssignedIdentities" + + // No error + return nil +} + +// AssignProperties_From_Identity populates our Identity from the provided source Identity +func (identity *Identity) AssignProperties_From_Identity(source *storage.Identity) error { + + // Type + if source.Type != nil { + typeVar := *source.Type + typeTemp := genruntime.ToEnum(typeVar, identity_Type_Values) + identity.Type = &typeTemp + } else { + identity.Type = nil + } + + // UserAssignedIdentities + if source.UserAssignedIdentities != nil { + userAssignedIdentityList := make([]UserAssignedIdentityDetails, len(source.UserAssignedIdentities)) + for userAssignedIdentityIndex, userAssignedIdentityItem := range source.UserAssignedIdentities { + // Shadow the loop variable to avoid aliasing + userAssignedIdentityItem := userAssignedIdentityItem + var userAssignedIdentity UserAssignedIdentityDetails + err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentityDetails(&userAssignedIdentityItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityDetails() to populate field UserAssignedIdentities") + } + userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity + } + identity.UserAssignedIdentities = userAssignedIdentityList + } else { + identity.UserAssignedIdentities = nil + } + + // No error + return nil +} + +// AssignProperties_To_Identity populates the provided destination Identity from our Identity +func (identity *Identity) AssignProperties_To_Identity(destination *storage.Identity) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Type + if identity.Type != nil { + typeVar := string(*identity.Type) + destination.Type = &typeVar + } else { + destination.Type = nil + } + + // UserAssignedIdentities + if identity.UserAssignedIdentities != nil { + userAssignedIdentityList := make([]storage.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities)) + for userAssignedIdentityIndex, userAssignedIdentityItem := range identity.UserAssignedIdentities { + // Shadow the loop variable to avoid aliasing + userAssignedIdentityItem := userAssignedIdentityItem + var userAssignedIdentity storage.UserAssignedIdentityDetails + err := userAssignedIdentityItem.AssignProperties_To_UserAssignedIdentityDetails(&userAssignedIdentity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityDetails() to populate field UserAssignedIdentities") + } + userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity + } + destination.UserAssignedIdentities = userAssignedIdentityList + } else { + destination.UserAssignedIdentities = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_Identity_STATUS populates our Identity from the provided source Identity_STATUS +func (identity *Identity) Initialize_From_Identity_STATUS(source *Identity_STATUS) error { + + // Type + if source.Type != nil { + typeVar := genruntime.ToEnum(string(*source.Type), identity_Type_Values) + identity.Type = &typeVar + } else { + identity.Type = nil + } + + // UserAssignedIdentities + if source.UserAssignedIdentities != nil { + userAssignedIdentityList := make([]UserAssignedIdentityDetails, 0, len(source.UserAssignedIdentities)) + for userAssignedIdentitiesKey := range source.UserAssignedIdentities { + userAssignedIdentitiesRef := genruntime.CreateResourceReferenceFromARMID(userAssignedIdentitiesKey) + userAssignedIdentityList = append(userAssignedIdentityList, UserAssignedIdentityDetails{Reference: userAssignedIdentitiesRef}) + } + identity.UserAssignedIdentities = userAssignedIdentityList + } else { + identity.UserAssignedIdentities = nil + } + + // No error + return nil +} + +// Identity for the resource. +type Identity_STATUS struct { + // PrincipalId: The principal ID of resource identity. + PrincipalId *string `json:"principalId,omitempty"` + + // TenantId: The tenant ID of resource. + TenantId *string `json:"tenantId,omitempty"` + + // Type: Type of managed service identity. + Type *Identity_Type_STATUS `json:"type,omitempty"` + + // UserAssignedIdentities: The list of user identities associated with the resource. The user identity dictionary key + // references will be ARM resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]UserIdentityProperties_STATUS `json:"userAssignedIdentities,omitempty"` +} + +var _ genruntime.FromARMConverter = &Identity_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (identity *Identity_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Identity_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (identity *Identity_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Identity_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Identity_STATUS, got %T", armInput) + } + + // Set property "PrincipalId": + if typedInput.PrincipalId != nil { + principalId := *typedInput.PrincipalId + identity.PrincipalId = &principalId + } + + // Set property "TenantId": + if typedInput.TenantId != nil { + tenantId := *typedInput.TenantId + identity.TenantId = &tenantId + } + + // Set property "Type": + if typedInput.Type != nil { + var temp string + temp = string(*typedInput.Type) + typeVar := Identity_Type_STATUS(temp) + identity.Type = &typeVar + } + + // Set property "UserAssignedIdentities": + if typedInput.UserAssignedIdentities != nil { + identity.UserAssignedIdentities = make(map[string]UserIdentityProperties_STATUS, len(typedInput.UserAssignedIdentities)) + for key, value := range typedInput.UserAssignedIdentities { + var value1 UserIdentityProperties_STATUS + err := value1.PopulateFromARM(owner, value) + if err != nil { + return err + } + identity.UserAssignedIdentities[key] = value1 + } + } + + // No error + return nil +} + +// AssignProperties_From_Identity_STATUS populates our Identity_STATUS from the provided source Identity_STATUS +func (identity *Identity_STATUS) AssignProperties_From_Identity_STATUS(source *storage.Identity_STATUS) error { + + // PrincipalId + identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId) + + // TenantId + identity.TenantId = genruntime.ClonePointerToString(source.TenantId) + + // Type + if source.Type != nil { + typeVar := *source.Type + typeTemp := genruntime.ToEnum(typeVar, identity_Type_STATUS_Values) + identity.Type = &typeTemp + } else { + identity.Type = nil + } + + // UserAssignedIdentities + if source.UserAssignedIdentities != nil { + userAssignedIdentityMap := make(map[string]UserIdentityProperties_STATUS, len(source.UserAssignedIdentities)) + for userAssignedIdentityKey, userAssignedIdentityValue := range source.UserAssignedIdentities { + // Shadow the loop variable to avoid aliasing + userAssignedIdentityValue := userAssignedIdentityValue + var userAssignedIdentity UserIdentityProperties_STATUS + err := userAssignedIdentity.AssignProperties_From_UserIdentityProperties_STATUS(&userAssignedIdentityValue) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_UserIdentityProperties_STATUS() to populate field UserAssignedIdentities") + } + userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity + } + identity.UserAssignedIdentities = userAssignedIdentityMap + } else { + identity.UserAssignedIdentities = nil + } + + // No error + return nil +} + +// AssignProperties_To_Identity_STATUS populates the provided destination Identity_STATUS from our Identity_STATUS +func (identity *Identity_STATUS) AssignProperties_To_Identity_STATUS(destination *storage.Identity_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // PrincipalId + destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId) + + // TenantId + destination.TenantId = genruntime.ClonePointerToString(identity.TenantId) + + // Type + if identity.Type != nil { + typeVar := string(*identity.Type) + destination.Type = &typeVar + } else { + destination.Type = nil + } + + // UserAssignedIdentities + if identity.UserAssignedIdentities != nil { + userAssignedIdentityMap := make(map[string]storage.UserIdentityProperties_STATUS, len(identity.UserAssignedIdentities)) + for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities { + // Shadow the loop variable to avoid aliasing + userAssignedIdentityValue := userAssignedIdentityValue + var userAssignedIdentity storage.UserIdentityProperties_STATUS + err := userAssignedIdentityValue.AssignProperties_To_UserIdentityProperties_STATUS(&userAssignedIdentity) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_UserIdentityProperties_STATUS() to populate field UserAssignedIdentities") + } + userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity + } + destination.UserAssignedIdentities = userAssignedIdentityMap + } else { + destination.UserAssignedIdentities = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + // AutoResolved: The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool `json:"autoResolved,omitempty"` + + // TimeToResolve: The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented + // in ISO 8601 duration format. + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +var _ genruntime.ARMTransformer = &RuleResolveConfiguration{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (configuration *RuleResolveConfiguration) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if configuration == nil { + return nil, nil + } + result := &arm.RuleResolveConfiguration{} + + // Set property "AutoResolved": + if configuration.AutoResolved != nil { + autoResolved := *configuration.AutoResolved + result.AutoResolved = &autoResolved + } + + // Set property "TimeToResolve": + if configuration.TimeToResolve != nil { + timeToResolve := *configuration.TimeToResolve + result.TimeToResolve = &timeToResolve + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (configuration *RuleResolveConfiguration) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.RuleResolveConfiguration{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (configuration *RuleResolveConfiguration) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.RuleResolveConfiguration) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.RuleResolveConfiguration, got %T", armInput) + } + + // Set property "AutoResolved": + if typedInput.AutoResolved != nil { + autoResolved := *typedInput.AutoResolved + configuration.AutoResolved = &autoResolved + } + + // Set property "TimeToResolve": + if typedInput.TimeToResolve != nil { + timeToResolve := *typedInput.TimeToResolve + configuration.TimeToResolve = &timeToResolve + } + + // No error + return nil +} + +// AssignProperties_From_RuleResolveConfiguration populates our RuleResolveConfiguration from the provided source RuleResolveConfiguration +func (configuration *RuleResolveConfiguration) AssignProperties_From_RuleResolveConfiguration(source *storage.RuleResolveConfiguration) error { + + // AutoResolved + if source.AutoResolved != nil { + autoResolved := *source.AutoResolved + configuration.AutoResolved = &autoResolved + } else { + configuration.AutoResolved = nil + } + + // TimeToResolve + configuration.TimeToResolve = genruntime.ClonePointerToString(source.TimeToResolve) + + // No error + return nil +} + +// AssignProperties_To_RuleResolveConfiguration populates the provided destination RuleResolveConfiguration from our RuleResolveConfiguration +func (configuration *RuleResolveConfiguration) AssignProperties_To_RuleResolveConfiguration(destination *storage.RuleResolveConfiguration) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AutoResolved + if configuration.AutoResolved != nil { + autoResolved := *configuration.AutoResolved + destination.AutoResolved = &autoResolved + } else { + destination.AutoResolved = nil + } + + // TimeToResolve + destination.TimeToResolve = genruntime.ClonePointerToString(configuration.TimeToResolve) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_RuleResolveConfiguration_STATUS populates our RuleResolveConfiguration from the provided source RuleResolveConfiguration_STATUS +func (configuration *RuleResolveConfiguration) Initialize_From_RuleResolveConfiguration_STATUS(source *RuleResolveConfiguration_STATUS) error { + + // AutoResolved + if source.AutoResolved != nil { + autoResolved := *source.AutoResolved + configuration.AutoResolved = &autoResolved + } else { + configuration.AutoResolved = nil + } + + // TimeToResolve + configuration.TimeToResolve = genruntime.ClonePointerToString(source.TimeToResolve) + + // No error + return nil +} + +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration_STATUS struct { + // AutoResolved: The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool `json:"autoResolved,omitempty"` + + // TimeToResolve: The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented + // in ISO 8601 duration format. + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +var _ genruntime.FromARMConverter = &RuleResolveConfiguration_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (configuration *RuleResolveConfiguration_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.RuleResolveConfiguration_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (configuration *RuleResolveConfiguration_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.RuleResolveConfiguration_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.RuleResolveConfiguration_STATUS, got %T", armInput) + } + + // Set property "AutoResolved": + if typedInput.AutoResolved != nil { + autoResolved := *typedInput.AutoResolved + configuration.AutoResolved = &autoResolved + } + + // Set property "TimeToResolve": + if typedInput.TimeToResolve != nil { + timeToResolve := *typedInput.TimeToResolve + configuration.TimeToResolve = &timeToResolve + } + + // No error + return nil +} + +// AssignProperties_From_RuleResolveConfiguration_STATUS populates our RuleResolveConfiguration_STATUS from the provided source RuleResolveConfiguration_STATUS +func (configuration *RuleResolveConfiguration_STATUS) AssignProperties_From_RuleResolveConfiguration_STATUS(source *storage.RuleResolveConfiguration_STATUS) error { + + // AutoResolved + if source.AutoResolved != nil { + autoResolved := *source.AutoResolved + configuration.AutoResolved = &autoResolved + } else { + configuration.AutoResolved = nil + } + + // TimeToResolve + configuration.TimeToResolve = genruntime.ClonePointerToString(source.TimeToResolve) + + // No error + return nil +} + +// AssignProperties_To_RuleResolveConfiguration_STATUS populates the provided destination RuleResolveConfiguration_STATUS from our RuleResolveConfiguration_STATUS +func (configuration *RuleResolveConfiguration_STATUS) AssignProperties_To_RuleResolveConfiguration_STATUS(destination *storage.RuleResolveConfiguration_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AutoResolved + if configuration.AutoResolved != nil { + autoResolved := *configuration.AutoResolved + destination.AutoResolved = &autoResolved + } else { + destination.AutoResolved = nil + } + + // TimeToResolve + destination.TimeToResolve = genruntime.ClonePointerToString(configuration.TimeToResolve) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"LogAlert","LogToMetric"} +type ScheduledQueryRule_Kind_Spec string + +const ( + ScheduledQueryRule_Kind_Spec_LogAlert = ScheduledQueryRule_Kind_Spec("LogAlert") + ScheduledQueryRule_Kind_Spec_LogToMetric = ScheduledQueryRule_Kind_Spec("LogToMetric") +) + +// Mapping from string to ScheduledQueryRule_Kind_Spec +var scheduledQueryRule_Kind_Spec_Values = map[string]ScheduledQueryRule_Kind_Spec{ + "logalert": ScheduledQueryRule_Kind_Spec_LogAlert, + "logtometric": ScheduledQueryRule_Kind_Spec_LogToMetric, +} + +type ScheduledQueryRule_Kind_STATUS string + +const ( + ScheduledQueryRule_Kind_STATUS_LogAlert = ScheduledQueryRule_Kind_STATUS("LogAlert") + ScheduledQueryRule_Kind_STATUS_LogToMetric = ScheduledQueryRule_Kind_STATUS("LogToMetric") +) + +// Mapping from string to ScheduledQueryRule_Kind_STATUS +var scheduledQueryRule_Kind_STATUS_Values = map[string]ScheduledQueryRule_Kind_STATUS{ + "logalert": ScheduledQueryRule_Kind_STATUS_LogAlert, + "logtometric": ScheduledQueryRule_Kind_STATUS_LogToMetric, +} + +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + // AllOf: A list of conditions to evaluate against the specified scopes + AllOf []Condition `json:"allOf,omitempty"` +} + +var _ genruntime.ARMTransformer = &ScheduledQueryRuleCriteria{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (criteria *ScheduledQueryRuleCriteria) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if criteria == nil { + return nil, nil + } + result := &arm.ScheduledQueryRuleCriteria{} + + // Set property "AllOf": + for _, item := range criteria.AllOf { + item_ARM, err := item.ConvertToARM(resolved) + if err != nil { + return nil, err + } + result.AllOf = append(result.AllOf, *item_ARM.(*arm.Condition)) + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (criteria *ScheduledQueryRuleCriteria) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.ScheduledQueryRuleCriteria{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (criteria *ScheduledQueryRuleCriteria) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.ScheduledQueryRuleCriteria) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRuleCriteria, got %T", armInput) + } + + // Set property "AllOf": + for _, item := range typedInput.AllOf { + var item1 Condition + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + criteria.AllOf = append(criteria.AllOf, item1) + } + + // No error + return nil +} + +// AssignProperties_From_ScheduledQueryRuleCriteria populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria +func (criteria *ScheduledQueryRuleCriteria) AssignProperties_From_ScheduledQueryRuleCriteria(source *storage.ScheduledQueryRuleCriteria) error { + + // AllOf + if source.AllOf != nil { + allOfList := make([]Condition, len(source.AllOf)) + for allOfIndex, allOfItem := range source.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf Condition + err := allOf.AssignProperties_From_Condition(&allOfItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + criteria.AllOf = allOfList + } else { + criteria.AllOf = nil + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleCriteria populates the provided destination ScheduledQueryRuleCriteria from our ScheduledQueryRuleCriteria +func (criteria *ScheduledQueryRuleCriteria) AssignProperties_To_ScheduledQueryRuleCriteria(destination *storage.ScheduledQueryRuleCriteria) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AllOf + if criteria.AllOf != nil { + allOfList := make([]storage.Condition, len(criteria.AllOf)) + for allOfIndex, allOfItem := range criteria.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf storage.Condition + err := allOfItem.AssignProperties_To_Condition(&allOf) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + destination.AllOf = allOfList + } else { + destination.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria from the provided source ScheduledQueryRuleCriteria_STATUS +func (criteria *ScheduledQueryRuleCriteria) Initialize_From_ScheduledQueryRuleCriteria_STATUS(source *ScheduledQueryRuleCriteria_STATUS) error { + + // AllOf + if source.AllOf != nil { + allOfList := make([]Condition, len(source.AllOf)) + for allOfIndex, allOfItem := range source.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf Condition + err := allOf.Initialize_From_Condition_STATUS(&allOfItem) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_Condition_STATUS() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + criteria.AllOf = allOfList + } else { + criteria.AllOf = nil + } + + // No error + return nil +} + +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria_STATUS struct { + // AllOf: A list of conditions to evaluate against the specified scopes + AllOf []Condition_STATUS `json:"allOf,omitempty"` +} + +var _ genruntime.FromARMConverter = &ScheduledQueryRuleCriteria_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (criteria *ScheduledQueryRuleCriteria_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.ScheduledQueryRuleCriteria_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (criteria *ScheduledQueryRuleCriteria_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.ScheduledQueryRuleCriteria_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ScheduledQueryRuleCriteria_STATUS, got %T", armInput) + } + + // Set property "AllOf": + for _, item := range typedInput.AllOf { + var item1 Condition_STATUS + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + criteria.AllOf = append(criteria.AllOf, item1) + } + + // No error + return nil +} + +// AssignProperties_From_ScheduledQueryRuleCriteria_STATUS populates our ScheduledQueryRuleCriteria_STATUS from the provided source ScheduledQueryRuleCriteria_STATUS +func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(source *storage.ScheduledQueryRuleCriteria_STATUS) error { + + // AllOf + if source.AllOf != nil { + allOfList := make([]Condition_STATUS, len(source.AllOf)) + for allOfIndex, allOfItem := range source.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf Condition_STATUS + err := allOf.AssignProperties_From_Condition_STATUS(&allOfItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_STATUS() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + criteria.AllOf = allOfList + } else { + criteria.AllOf = nil + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleCriteria_STATUS populates the provided destination ScheduledQueryRuleCriteria_STATUS from our ScheduledQueryRuleCriteria_STATUS +func (criteria *ScheduledQueryRuleCriteria_STATUS) AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(destination *storage.ScheduledQueryRuleCriteria_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AllOf + if criteria.AllOf != nil { + allOfList := make([]storage.Condition_STATUS, len(criteria.AllOf)) + for allOfIndex, allOfItem := range criteria.AllOf { + // Shadow the loop variable to avoid aliasing + allOfItem := allOfItem + var allOf storage.Condition_STATUS + err := allOfItem.AssignProperties_To_Condition_STATUS(&allOf) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_STATUS() to populate field AllOf") + } + allOfList[allOfIndex] = allOf + } + destination.AllOf = allOfList + } else { + destination.AllOf = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure +type ScheduledQueryRuleOperatorSpec struct { + // ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions). + ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"` + + // SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions). + SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"` +} + +// AssignProperties_From_ScheduledQueryRuleOperatorSpec populates our ScheduledQueryRuleOperatorSpec from the provided source ScheduledQueryRuleOperatorSpec +func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_From_ScheduledQueryRuleOperatorSpec(source *storage.ScheduledQueryRuleOperatorSpec) error { + + // ConfigMapExpressions + if source.ConfigMapExpressions != nil { + configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions)) + for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions { + // Shadow the loop variable to avoid aliasing + configMapExpressionItem := configMapExpressionItem + if configMapExpressionItem != nil { + configMapExpression := *configMapExpressionItem.DeepCopy() + configMapExpressionList[configMapExpressionIndex] = &configMapExpression + } else { + configMapExpressionList[configMapExpressionIndex] = nil + } + } + operator.ConfigMapExpressions = configMapExpressionList + } else { + operator.ConfigMapExpressions = nil + } + + // SecretExpressions + if source.SecretExpressions != nil { + secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions)) + for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions { + // Shadow the loop variable to avoid aliasing + secretExpressionItem := secretExpressionItem + if secretExpressionItem != nil { + secretExpression := *secretExpressionItem.DeepCopy() + secretExpressionList[secretExpressionIndex] = &secretExpression + } else { + secretExpressionList[secretExpressionIndex] = nil + } + } + operator.SecretExpressions = secretExpressionList + } else { + operator.SecretExpressions = nil + } + + // No error + return nil +} + +// AssignProperties_To_ScheduledQueryRuleOperatorSpec populates the provided destination ScheduledQueryRuleOperatorSpec from our ScheduledQueryRuleOperatorSpec +func (operator *ScheduledQueryRuleOperatorSpec) AssignProperties_To_ScheduledQueryRuleOperatorSpec(destination *storage.ScheduledQueryRuleOperatorSpec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // ConfigMapExpressions + if operator.ConfigMapExpressions != nil { + configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions)) + for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions { + // Shadow the loop variable to avoid aliasing + configMapExpressionItem := configMapExpressionItem + if configMapExpressionItem != nil { + configMapExpression := *configMapExpressionItem.DeepCopy() + configMapExpressionList[configMapExpressionIndex] = &configMapExpression + } else { + configMapExpressionList[configMapExpressionIndex] = nil + } + } + destination.ConfigMapExpressions = configMapExpressionList + } else { + destination.ConfigMapExpressions = nil + } + + // SecretExpressions + if operator.SecretExpressions != nil { + secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions)) + for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions { + // Shadow the loop variable to avoid aliasing + secretExpressionItem := secretExpressionItem + if secretExpressionItem != nil { + secretExpression := *secretExpressionItem.DeepCopy() + secretExpressionList[secretExpressionIndex] = &secretExpression + } else { + secretExpressionList[secretExpressionIndex] = nil + } + } + destination.SecretExpressions = secretExpressionList + } else { + destination.SecretExpressions = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={0,1,2,3,4} +type ScheduledQueryRuleProperties_Severity int + +const ( + ScheduledQueryRuleProperties_Severity_0 = ScheduledQueryRuleProperties_Severity(0) + ScheduledQueryRuleProperties_Severity_1 = ScheduledQueryRuleProperties_Severity(1) + ScheduledQueryRuleProperties_Severity_2 = ScheduledQueryRuleProperties_Severity(2) + ScheduledQueryRuleProperties_Severity_3 = ScheduledQueryRuleProperties_Severity(3) + ScheduledQueryRuleProperties_Severity_4 = ScheduledQueryRuleProperties_Severity(4) +) + +type ScheduledQueryRuleProperties_Severity_STATUS int + +const ( + ScheduledQueryRuleProperties_Severity_STATUS_0 = ScheduledQueryRuleProperties_Severity_STATUS(0) + ScheduledQueryRuleProperties_Severity_STATUS_1 = ScheduledQueryRuleProperties_Severity_STATUS(1) + ScheduledQueryRuleProperties_Severity_STATUS_2 = ScheduledQueryRuleProperties_Severity_STATUS(2) + ScheduledQueryRuleProperties_Severity_STATUS_3 = ScheduledQueryRuleProperties_Severity_STATUS(3) + ScheduledQueryRuleProperties_Severity_STATUS_4 = ScheduledQueryRuleProperties_Severity_STATUS(4) +) + +// Metadata pertaining to creation and last modification of the resource. +type SystemData_STATUS struct { + // CreatedAt: The timestamp of resource creation (UTC). + CreatedAt *string `json:"createdAt,omitempty"` + + // CreatedBy: The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // CreatedByType: The type of identity that created the resource. + CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` + + // LastModifiedAt: The timestamp of resource last modification (UTC) + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + + // LastModifiedBy: The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // LastModifiedByType: The type of identity that last modified the resource. + LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` +} + +var _ genruntime.FromARMConverter = &SystemData_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.SystemData_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (data *SystemData_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.SystemData_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.SystemData_STATUS, got %T", armInput) + } + + // Set property "CreatedAt": + if typedInput.CreatedAt != nil { + createdAt := *typedInput.CreatedAt + data.CreatedAt = &createdAt + } + + // Set property "CreatedBy": + if typedInput.CreatedBy != nil { + createdBy := *typedInput.CreatedBy + data.CreatedBy = &createdBy + } + + // Set property "CreatedByType": + if typedInput.CreatedByType != nil { + var temp string + temp = string(*typedInput.CreatedByType) + createdByType := SystemData_CreatedByType_STATUS(temp) + data.CreatedByType = &createdByType + } + + // Set property "LastModifiedAt": + if typedInput.LastModifiedAt != nil { + lastModifiedAt := *typedInput.LastModifiedAt + data.LastModifiedAt = &lastModifiedAt + } + + // Set property "LastModifiedBy": + if typedInput.LastModifiedBy != nil { + lastModifiedBy := *typedInput.LastModifiedBy + data.LastModifiedBy = &lastModifiedBy + } + + // Set property "LastModifiedByType": + if typedInput.LastModifiedByType != nil { + var temp string + temp = string(*typedInput.LastModifiedByType) + lastModifiedByType := SystemData_LastModifiedByType_STATUS(temp) + data.LastModifiedByType = &lastModifiedByType + } + + // No error + return nil +} + +// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error { + + // CreatedAt + data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt) + + // CreatedBy + data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy) + + // CreatedByType + if source.CreatedByType != nil { + createdByType := *source.CreatedByType + createdByTypeTemp := genruntime.ToEnum(createdByType, systemData_CreatedByType_STATUS_Values) + data.CreatedByType = &createdByTypeTemp + } else { + data.CreatedByType = nil + } + + // LastModifiedAt + data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt) + + // LastModifiedBy + data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy) + + // LastModifiedByType + if source.LastModifiedByType != nil { + lastModifiedByType := *source.LastModifiedByType + lastModifiedByTypeTemp := genruntime.ToEnum(lastModifiedByType, systemData_LastModifiedByType_STATUS_Values) + data.LastModifiedByType = &lastModifiedByTypeTemp + } else { + data.LastModifiedByType = nil + } + + // No error + return nil +} + +// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS +func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *storage.SystemData_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // CreatedAt + destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt) + + // CreatedBy + destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy) + + // CreatedByType + if data.CreatedByType != nil { + createdByType := string(*data.CreatedByType) + destination.CreatedByType = &createdByType + } else { + destination.CreatedByType = nil + } + + // LastModifiedAt + destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt) + + // LastModifiedBy + destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy) + + // LastModifiedByType + if data.LastModifiedByType != nil { + lastModifiedByType := string(*data.LastModifiedByType) + destination.LastModifiedByType = &lastModifiedByType + } else { + destination.LastModifiedByType = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// A condition of the scheduled query rule. +type Condition struct { + // Dimensions: List of Dimensions conditions + Dimensions []Dimension `json:"dimensions,omitempty"` + + // FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an + // alert. Relevant only for rules of the kind LogAlert. + FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"` + + // MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + + // MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` + + // Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *Condition_Operator `json:"operator,omitempty"` + + // Query: Log query alert + Query *string `json:"query,omitempty"` + + // ResourceIdColumnReference: The column containing the resource id. The content of the column must be a uri formatted as + // resource id. Relevant only for rules of the kind LogAlert. + ResourceIdColumnReference *genruntime.ResourceReference `armReference:"ResourceIdColumn" json:"resourceIdColumnReference,omitempty"` + + // Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind + // LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + + // TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *Condition_TimeAggregation `json:"timeAggregation,omitempty"` +} + +var _ genruntime.ARMTransformer = &Condition{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (condition *Condition) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if condition == nil { + return nil, nil + } + result := &arm.Condition{} + + // Set property "Dimensions": + for _, item := range condition.Dimensions { + item_ARM, err := item.ConvertToARM(resolved) + if err != nil { + return nil, err + } + result.Dimensions = append(result.Dimensions, *item_ARM.(*arm.Dimension)) + } + + // Set property "FailingPeriods": + if condition.FailingPeriods != nil { + failingPeriods_ARM, err := (*condition.FailingPeriods).ConvertToARM(resolved) + if err != nil { + return nil, err + } + failingPeriods := *failingPeriods_ARM.(*arm.Condition_FailingPeriods) + result.FailingPeriods = &failingPeriods + } + + // Set property "MetricMeasureColumn": + if condition.MetricMeasureColumn != nil { + metricMeasureColumn := *condition.MetricMeasureColumn + result.MetricMeasureColumn = &metricMeasureColumn + } + + // Set property "MetricName": + if condition.MetricName != nil { + metricName := *condition.MetricName + result.MetricName = &metricName + } + + // Set property "Operator": + if condition.Operator != nil { + var temp string + temp = string(*condition.Operator) + operator := arm.Condition_Operator(temp) + result.Operator = &operator + } + + // Set property "Query": + if condition.Query != nil { + query := *condition.Query + result.Query = &query + } + + // Set property "ResourceIdColumn": + if condition.ResourceIdColumnReference != nil { + resourceIdColumnReferenceARMID, err := resolved.ResolvedReferences.Lookup(*condition.ResourceIdColumnReference) + if err != nil { + return nil, err + } + resourceIdColumnReference := resourceIdColumnReferenceARMID + result.ResourceIdColumn = &resourceIdColumnReference + } + + // Set property "Threshold": + if condition.Threshold != nil { + threshold := *condition.Threshold + result.Threshold = &threshold + } + + // Set property "TimeAggregation": + if condition.TimeAggregation != nil { + var temp string + temp = string(*condition.TimeAggregation) + timeAggregation := arm.Condition_TimeAggregation(temp) + result.TimeAggregation = &timeAggregation + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (condition *Condition) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Condition{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (condition *Condition) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Condition) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition, got %T", armInput) + } + + // Set property "Dimensions": + for _, item := range typedInput.Dimensions { + var item1 Dimension + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + condition.Dimensions = append(condition.Dimensions, item1) + } + + // Set property "FailingPeriods": + if typedInput.FailingPeriods != nil { + var failingPeriods1 Condition_FailingPeriods + err := failingPeriods1.PopulateFromARM(owner, *typedInput.FailingPeriods) + if err != nil { + return err + } + failingPeriods := failingPeriods1 + condition.FailingPeriods = &failingPeriods + } + + // Set property "MetricMeasureColumn": + if typedInput.MetricMeasureColumn != nil { + metricMeasureColumn := *typedInput.MetricMeasureColumn + condition.MetricMeasureColumn = &metricMeasureColumn + } + + // Set property "MetricName": + if typedInput.MetricName != nil { + metricName := *typedInput.MetricName + condition.MetricName = &metricName + } + + // Set property "Operator": + if typedInput.Operator != nil { + var temp string + temp = string(*typedInput.Operator) + operator := Condition_Operator(temp) + condition.Operator = &operator + } + + // Set property "Query": + if typedInput.Query != nil { + query := *typedInput.Query + condition.Query = &query + } + + // no assignment for property "ResourceIdColumnReference" + + // Set property "Threshold": + if typedInput.Threshold != nil { + threshold := *typedInput.Threshold + condition.Threshold = &threshold + } + + // Set property "TimeAggregation": + if typedInput.TimeAggregation != nil { + var temp string + temp = string(*typedInput.TimeAggregation) + timeAggregation := Condition_TimeAggregation(temp) + condition.TimeAggregation = &timeAggregation + } + + // No error + return nil +} + +// AssignProperties_From_Condition populates our Condition from the provided source Condition +func (condition *Condition) AssignProperties_From_Condition(source *storage.Condition) error { + + // Dimensions + if source.Dimensions != nil { + dimensionList := make([]Dimension, len(source.Dimensions)) + for dimensionIndex, dimensionItem := range source.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension Dimension + err := dimension.AssignProperties_From_Dimension(&dimensionItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Dimension() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + condition.Dimensions = dimensionList + } else { + condition.Dimensions = nil + } + + // FailingPeriods + if source.FailingPeriods != nil { + var failingPeriod Condition_FailingPeriods + err := failingPeriod.AssignProperties_From_Condition_FailingPeriods(source.FailingPeriods) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods() to populate field FailingPeriods") + } + condition.FailingPeriods = &failingPeriod + } else { + condition.FailingPeriods = nil + } + + // MetricMeasureColumn + condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) + + // MetricName + condition.MetricName = genruntime.ClonePointerToString(source.MetricName) + + // Operator + if source.Operator != nil { + operator := *source.Operator + operatorTemp := genruntime.ToEnum(operator, condition_Operator_Values) + condition.Operator = &operatorTemp + } else { + condition.Operator = nil + } + + // Query + condition.Query = genruntime.ClonePointerToString(source.Query) + + // ResourceIdColumnReference + if source.ResourceIdColumnReference != nil { + resourceIdColumnReference := source.ResourceIdColumnReference.Copy() + condition.ResourceIdColumnReference = &resourceIdColumnReference + } else { + condition.ResourceIdColumnReference = nil + } + + // Threshold + if source.Threshold != nil { + threshold := *source.Threshold + condition.Threshold = &threshold + } else { + condition.Threshold = nil + } + + // TimeAggregation + if source.TimeAggregation != nil { + timeAggregation := *source.TimeAggregation + timeAggregationTemp := genruntime.ToEnum(timeAggregation, condition_TimeAggregation_Values) + condition.TimeAggregation = &timeAggregationTemp + } else { + condition.TimeAggregation = nil + } + + // No error + return nil +} + +// AssignProperties_To_Condition populates the provided destination Condition from our Condition +func (condition *Condition) AssignProperties_To_Condition(destination *storage.Condition) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Dimensions + if condition.Dimensions != nil { + dimensionList := make([]storage.Dimension, len(condition.Dimensions)) + for dimensionIndex, dimensionItem := range condition.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension storage.Dimension + err := dimensionItem.AssignProperties_To_Dimension(&dimension) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Dimension() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + destination.Dimensions = dimensionList + } else { + destination.Dimensions = nil + } + + // FailingPeriods + if condition.FailingPeriods != nil { + var failingPeriod storage.Condition_FailingPeriods + err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods(&failingPeriod) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods() to populate field FailingPeriods") + } + destination.FailingPeriods = &failingPeriod + } else { + destination.FailingPeriods = nil + } + + // MetricMeasureColumn + destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn) + + // MetricName + destination.MetricName = genruntime.ClonePointerToString(condition.MetricName) + + // Operator + if condition.Operator != nil { + operator := string(*condition.Operator) + destination.Operator = &operator + } else { + destination.Operator = nil + } + + // Query + destination.Query = genruntime.ClonePointerToString(condition.Query) + + // ResourceIdColumnReference + if condition.ResourceIdColumnReference != nil { + resourceIdColumnReference := condition.ResourceIdColumnReference.Copy() + destination.ResourceIdColumnReference = &resourceIdColumnReference + } else { + destination.ResourceIdColumnReference = nil + } + + // Threshold + if condition.Threshold != nil { + threshold := *condition.Threshold + destination.Threshold = &threshold + } else { + destination.Threshold = nil + } + + // TimeAggregation + if condition.TimeAggregation != nil { + timeAggregation := string(*condition.TimeAggregation) + destination.TimeAggregation = &timeAggregation + } else { + destination.TimeAggregation = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_Condition_STATUS populates our Condition from the provided source Condition_STATUS +func (condition *Condition) Initialize_From_Condition_STATUS(source *Condition_STATUS) error { + + // Dimensions + if source.Dimensions != nil { + dimensionList := make([]Dimension, len(source.Dimensions)) + for dimensionIndex, dimensionItem := range source.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension Dimension + err := dimension.Initialize_From_Dimension_STATUS(&dimensionItem) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_Dimension_STATUS() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + condition.Dimensions = dimensionList + } else { + condition.Dimensions = nil + } + + // FailingPeriods + if source.FailingPeriods != nil { + var failingPeriod Condition_FailingPeriods + err := failingPeriod.Initialize_From_Condition_FailingPeriods_STATUS(source.FailingPeriods) + if err != nil { + return eris.Wrap(err, "calling Initialize_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") + } + condition.FailingPeriods = &failingPeriod + } else { + condition.FailingPeriods = nil + } + + // MetricMeasureColumn + condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) + + // MetricName + condition.MetricName = genruntime.ClonePointerToString(source.MetricName) + + // Operator + if source.Operator != nil { + operator := genruntime.ToEnum(string(*source.Operator), condition_Operator_Values) + condition.Operator = &operator + } else { + condition.Operator = nil + } + + // Query + condition.Query = genruntime.ClonePointerToString(source.Query) + + // Threshold + if source.Threshold != nil { + threshold := *source.Threshold + condition.Threshold = &threshold + } else { + condition.Threshold = nil + } + + // TimeAggregation + if source.TimeAggregation != nil { + timeAggregation := genruntime.ToEnum(string(*source.TimeAggregation), condition_TimeAggregation_Values) + condition.TimeAggregation = &timeAggregation + } else { + condition.TimeAggregation = nil + } + + // No error + return nil +} + +// A condition of the scheduled query rule. +type Condition_STATUS struct { + // Dimensions: List of Dimensions conditions + Dimensions []Dimension_STATUS `json:"dimensions,omitempty"` + + // FailingPeriods: The minimum number of violations required within the selected lookback time window required to raise an + // alert. Relevant only for rules of the kind LogAlert. + FailingPeriods *Condition_FailingPeriods_STATUS `json:"failingPeriods,omitempty"` + + // MetricMeasureColumn: The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + + // MetricName: The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` + + // Operator: The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *Condition_Operator_STATUS `json:"operator,omitempty"` + + // Query: Log query alert + Query *string `json:"query,omitempty"` + + // ResourceIdColumn: The column containing the resource id. The content of the column must be a uri formatted as resource + // id. Relevant only for rules of the kind LogAlert. + ResourceIdColumn *string `json:"resourceIdColumn,omitempty"` + + // Threshold: the criteria threshold value that activates the alert. Relevant and required only for rules of the kind + // LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + + // TimeAggregation: Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *Condition_TimeAggregation_STATUS `json:"timeAggregation,omitempty"` +} + +var _ genruntime.FromARMConverter = &Condition_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (condition *Condition_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Condition_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (condition *Condition_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Condition_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_STATUS, got %T", armInput) + } + + // Set property "Dimensions": + for _, item := range typedInput.Dimensions { + var item1 Dimension_STATUS + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + condition.Dimensions = append(condition.Dimensions, item1) + } + + // Set property "FailingPeriods": + if typedInput.FailingPeriods != nil { + var failingPeriods1 Condition_FailingPeriods_STATUS + err := failingPeriods1.PopulateFromARM(owner, *typedInput.FailingPeriods) + if err != nil { + return err + } + failingPeriods := failingPeriods1 + condition.FailingPeriods = &failingPeriods + } + + // Set property "MetricMeasureColumn": + if typedInput.MetricMeasureColumn != nil { + metricMeasureColumn := *typedInput.MetricMeasureColumn + condition.MetricMeasureColumn = &metricMeasureColumn + } + + // Set property "MetricName": + if typedInput.MetricName != nil { + metricName := *typedInput.MetricName + condition.MetricName = &metricName + } + + // Set property "Operator": + if typedInput.Operator != nil { + var temp string + temp = string(*typedInput.Operator) + operator := Condition_Operator_STATUS(temp) + condition.Operator = &operator + } + + // Set property "Query": + if typedInput.Query != nil { + query := *typedInput.Query + condition.Query = &query + } + + // Set property "ResourceIdColumn": + if typedInput.ResourceIdColumn != nil { + resourceIdColumn := *typedInput.ResourceIdColumn + condition.ResourceIdColumn = &resourceIdColumn + } + + // Set property "Threshold": + if typedInput.Threshold != nil { + threshold := *typedInput.Threshold + condition.Threshold = &threshold + } + + // Set property "TimeAggregation": + if typedInput.TimeAggregation != nil { + var temp string + temp = string(*typedInput.TimeAggregation) + timeAggregation := Condition_TimeAggregation_STATUS(temp) + condition.TimeAggregation = &timeAggregation + } + + // No error + return nil +} + +// AssignProperties_From_Condition_STATUS populates our Condition_STATUS from the provided source Condition_STATUS +func (condition *Condition_STATUS) AssignProperties_From_Condition_STATUS(source *storage.Condition_STATUS) error { + + // Dimensions + if source.Dimensions != nil { + dimensionList := make([]Dimension_STATUS, len(source.Dimensions)) + for dimensionIndex, dimensionItem := range source.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension Dimension_STATUS + err := dimension.AssignProperties_From_Dimension_STATUS(&dimensionItem) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Dimension_STATUS() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + condition.Dimensions = dimensionList + } else { + condition.Dimensions = nil + } + + // FailingPeriods + if source.FailingPeriods != nil { + var failingPeriod Condition_FailingPeriods_STATUS + err := failingPeriod.AssignProperties_From_Condition_FailingPeriods_STATUS(source.FailingPeriods) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_From_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") + } + condition.FailingPeriods = &failingPeriod + } else { + condition.FailingPeriods = nil + } + + // MetricMeasureColumn + condition.MetricMeasureColumn = genruntime.ClonePointerToString(source.MetricMeasureColumn) + + // MetricName + condition.MetricName = genruntime.ClonePointerToString(source.MetricName) + + // Operator + if source.Operator != nil { + operator := *source.Operator + operatorTemp := genruntime.ToEnum(operator, condition_Operator_STATUS_Values) + condition.Operator = &operatorTemp + } else { + condition.Operator = nil + } + + // Query + condition.Query = genruntime.ClonePointerToString(source.Query) + + // ResourceIdColumn + condition.ResourceIdColumn = genruntime.ClonePointerToString(source.ResourceIdColumn) + + // Threshold + if source.Threshold != nil { + threshold := *source.Threshold + condition.Threshold = &threshold + } else { + condition.Threshold = nil + } + + // TimeAggregation + if source.TimeAggregation != nil { + timeAggregation := *source.TimeAggregation + timeAggregationTemp := genruntime.ToEnum(timeAggregation, condition_TimeAggregation_STATUS_Values) + condition.TimeAggregation = &timeAggregationTemp + } else { + condition.TimeAggregation = nil + } + + // No error + return nil +} + +// AssignProperties_To_Condition_STATUS populates the provided destination Condition_STATUS from our Condition_STATUS +func (condition *Condition_STATUS) AssignProperties_To_Condition_STATUS(destination *storage.Condition_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Dimensions + if condition.Dimensions != nil { + dimensionList := make([]storage.Dimension_STATUS, len(condition.Dimensions)) + for dimensionIndex, dimensionItem := range condition.Dimensions { + // Shadow the loop variable to avoid aliasing + dimensionItem := dimensionItem + var dimension storage.Dimension_STATUS + err := dimensionItem.AssignProperties_To_Dimension_STATUS(&dimension) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Dimension_STATUS() to populate field Dimensions") + } + dimensionList[dimensionIndex] = dimension + } + destination.Dimensions = dimensionList + } else { + destination.Dimensions = nil + } + + // FailingPeriods + if condition.FailingPeriods != nil { + var failingPeriod storage.Condition_FailingPeriods_STATUS + err := condition.FailingPeriods.AssignProperties_To_Condition_FailingPeriods_STATUS(&failingPeriod) + if err != nil { + return eris.Wrap(err, "calling AssignProperties_To_Condition_FailingPeriods_STATUS() to populate field FailingPeriods") + } + destination.FailingPeriods = &failingPeriod + } else { + destination.FailingPeriods = nil + } + + // MetricMeasureColumn + destination.MetricMeasureColumn = genruntime.ClonePointerToString(condition.MetricMeasureColumn) + + // MetricName + destination.MetricName = genruntime.ClonePointerToString(condition.MetricName) + + // Operator + if condition.Operator != nil { + operator := string(*condition.Operator) + destination.Operator = &operator + } else { + destination.Operator = nil + } + + // Query + destination.Query = genruntime.ClonePointerToString(condition.Query) + + // ResourceIdColumn + destination.ResourceIdColumn = genruntime.ClonePointerToString(condition.ResourceIdColumn) + + // Threshold + if condition.Threshold != nil { + threshold := *condition.Threshold + destination.Threshold = &threshold + } else { + destination.Threshold = nil + } + + // TimeAggregation + if condition.TimeAggregation != nil { + timeAggregation := string(*condition.TimeAggregation) + destination.TimeAggregation = &timeAggregation + } else { + destination.TimeAggregation = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"None","SystemAssigned","UserAssigned"} +type Identity_Type string + +const ( + Identity_Type_None = Identity_Type("None") + Identity_Type_SystemAssigned = Identity_Type("SystemAssigned") + Identity_Type_UserAssigned = Identity_Type("UserAssigned") +) + +// Mapping from string to Identity_Type +var identity_Type_Values = map[string]Identity_Type{ + "none": Identity_Type_None, + "systemassigned": Identity_Type_SystemAssigned, + "userassigned": Identity_Type_UserAssigned, +} + +type Identity_Type_STATUS string + +const ( + Identity_Type_STATUS_None = Identity_Type_STATUS("None") + Identity_Type_STATUS_SystemAssigned = Identity_Type_STATUS("SystemAssigned") + Identity_Type_STATUS_UserAssigned = Identity_Type_STATUS("UserAssigned") +) + +// Mapping from string to Identity_Type_STATUS +var identity_Type_STATUS_Values = map[string]Identity_Type_STATUS{ + "none": Identity_Type_STATUS_None, + "systemassigned": Identity_Type_STATUS_SystemAssigned, + "userassigned": Identity_Type_STATUS_UserAssigned, +} + +type SystemData_CreatedByType_STATUS string + +const ( + SystemData_CreatedByType_STATUS_Application = SystemData_CreatedByType_STATUS("Application") + SystemData_CreatedByType_STATUS_Key = SystemData_CreatedByType_STATUS("Key") + SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity") + SystemData_CreatedByType_STATUS_User = SystemData_CreatedByType_STATUS("User") +) + +// Mapping from string to SystemData_CreatedByType_STATUS +var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{ + "application": SystemData_CreatedByType_STATUS_Application, + "key": SystemData_CreatedByType_STATUS_Key, + "managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity, + "user": SystemData_CreatedByType_STATUS_User, +} + +type SystemData_LastModifiedByType_STATUS string + +const ( + SystemData_LastModifiedByType_STATUS_Application = SystemData_LastModifiedByType_STATUS("Application") + SystemData_LastModifiedByType_STATUS_Key = SystemData_LastModifiedByType_STATUS("Key") + SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity") + SystemData_LastModifiedByType_STATUS_User = SystemData_LastModifiedByType_STATUS("User") +) + +// Mapping from string to SystemData_LastModifiedByType_STATUS +var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{ + "application": SystemData_LastModifiedByType_STATUS_Application, + "key": SystemData_LastModifiedByType_STATUS_Key, + "managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity, + "user": SystemData_LastModifiedByType_STATUS_User, +} + +// Information about the user assigned identity for the resource +type UserAssignedIdentityDetails struct { + Reference genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"` +} + +// AssignProperties_From_UserAssignedIdentityDetails populates our UserAssignedIdentityDetails from the provided source UserAssignedIdentityDetails +func (details *UserAssignedIdentityDetails) AssignProperties_From_UserAssignedIdentityDetails(source *storage.UserAssignedIdentityDetails) error { + + // Reference + details.Reference = source.Reference.Copy() + + // No error + return nil +} + +// AssignProperties_To_UserAssignedIdentityDetails populates the provided destination UserAssignedIdentityDetails from our UserAssignedIdentityDetails +func (details *UserAssignedIdentityDetails) AssignProperties_To_UserAssignedIdentityDetails(destination *storage.UserAssignedIdentityDetails) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Reference + destination.Reference = details.Reference.Copy() + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// User assigned identity properties. +type UserIdentityProperties_STATUS struct { + // ClientId: The client id of user assigned identity. + ClientId *string `json:"clientId,omitempty"` + + // PrincipalId: The principal id of user assigned identity. + PrincipalId *string `json:"principalId,omitempty"` +} + +var _ genruntime.FromARMConverter = &UserIdentityProperties_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (properties *UserIdentityProperties_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.UserIdentityProperties_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (properties *UserIdentityProperties_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.UserIdentityProperties_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.UserIdentityProperties_STATUS, got %T", armInput) + } + + // Set property "ClientId": + if typedInput.ClientId != nil { + clientId := *typedInput.ClientId + properties.ClientId = &clientId + } + + // Set property "PrincipalId": + if typedInput.PrincipalId != nil { + principalId := *typedInput.PrincipalId + properties.PrincipalId = &principalId + } + + // No error + return nil +} + +// AssignProperties_From_UserIdentityProperties_STATUS populates our UserIdentityProperties_STATUS from the provided source UserIdentityProperties_STATUS +func (properties *UserIdentityProperties_STATUS) AssignProperties_From_UserIdentityProperties_STATUS(source *storage.UserIdentityProperties_STATUS) error { + + // ClientId + properties.ClientId = genruntime.ClonePointerToString(source.ClientId) + + // PrincipalId + properties.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId) + + // No error + return nil +} + +// AssignProperties_To_UserIdentityProperties_STATUS populates the provided destination UserIdentityProperties_STATUS from our UserIdentityProperties_STATUS +func (properties *UserIdentityProperties_STATUS) AssignProperties_To_UserIdentityProperties_STATUS(destination *storage.UserIdentityProperties_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // ClientId + destination.ClientId = genruntime.ClonePointerToString(properties.ClientId) + + // PrincipalId + destination.PrincipalId = genruntime.ClonePointerToString(properties.PrincipalId) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type Condition_FailingPeriods struct { + // MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to + // numberOfEvaluationPeriods. Default value is 1 + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + + // NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the + // aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` +} + +var _ genruntime.ARMTransformer = &Condition_FailingPeriods{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (periods *Condition_FailingPeriods) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if periods == nil { + return nil, nil + } + result := &arm.Condition_FailingPeriods{} + + // Set property "MinFailingPeriodsToAlert": + if periods.MinFailingPeriodsToAlert != nil { + minFailingPeriodsToAlert := *periods.MinFailingPeriodsToAlert + result.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert + } + + // Set property "NumberOfEvaluationPeriods": + if periods.NumberOfEvaluationPeriods != nil { + numberOfEvaluationPeriods := *periods.NumberOfEvaluationPeriods + result.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (periods *Condition_FailingPeriods) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Condition_FailingPeriods{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (periods *Condition_FailingPeriods) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Condition_FailingPeriods) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_FailingPeriods, got %T", armInput) + } + + // Set property "MinFailingPeriodsToAlert": + if typedInput.MinFailingPeriodsToAlert != nil { + minFailingPeriodsToAlert := *typedInput.MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert + } + + // Set property "NumberOfEvaluationPeriods": + if typedInput.NumberOfEvaluationPeriods != nil { + numberOfEvaluationPeriods := *typedInput.NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods + } + + // No error + return nil +} + +// AssignProperties_From_Condition_FailingPeriods populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods +func (periods *Condition_FailingPeriods) AssignProperties_From_Condition_FailingPeriods(source *storage.Condition_FailingPeriods) error { + + // MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) + + // No error + return nil +} + +// AssignProperties_To_Condition_FailingPeriods populates the provided destination Condition_FailingPeriods from our Condition_FailingPeriods +func (periods *Condition_FailingPeriods) AssignProperties_To_Condition_FailingPeriods(destination *storage.Condition_FailingPeriods) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // MinFailingPeriodsToAlert + destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods from the provided source Condition_FailingPeriods_STATUS +func (periods *Condition_FailingPeriods) Initialize_From_Condition_FailingPeriods_STATUS(source *Condition_FailingPeriods_STATUS) error { + + // MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) + + // No error + return nil +} + +type Condition_FailingPeriods_STATUS struct { + // MinFailingPeriodsToAlert: The number of violations to trigger an alert. Should be smaller or equal to + // numberOfEvaluationPeriods. Default value is 1 + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + + // NumberOfEvaluationPeriods: The number of aggregated lookback points. The lookback time window is calculated based on the + // aggregation granularity (windowSize) and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` +} + +var _ genruntime.FromARMConverter = &Condition_FailingPeriods_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (periods *Condition_FailingPeriods_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Condition_FailingPeriods_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (periods *Condition_FailingPeriods_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Condition_FailingPeriods_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Condition_FailingPeriods_STATUS, got %T", armInput) + } + + // Set property "MinFailingPeriodsToAlert": + if typedInput.MinFailingPeriodsToAlert != nil { + minFailingPeriodsToAlert := *typedInput.MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = &minFailingPeriodsToAlert + } + + // Set property "NumberOfEvaluationPeriods": + if typedInput.NumberOfEvaluationPeriods != nil { + numberOfEvaluationPeriods := *typedInput.NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = &numberOfEvaluationPeriods + } + + // No error + return nil +} + +// AssignProperties_From_Condition_FailingPeriods_STATUS populates our Condition_FailingPeriods_STATUS from the provided source Condition_FailingPeriods_STATUS +func (periods *Condition_FailingPeriods_STATUS) AssignProperties_From_Condition_FailingPeriods_STATUS(source *storage.Condition_FailingPeriods_STATUS) error { + + // MinFailingPeriodsToAlert + periods.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(source.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + periods.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(source.NumberOfEvaluationPeriods) + + // No error + return nil +} + +// AssignProperties_To_Condition_FailingPeriods_STATUS populates the provided destination Condition_FailingPeriods_STATUS from our Condition_FailingPeriods_STATUS +func (periods *Condition_FailingPeriods_STATUS) AssignProperties_To_Condition_FailingPeriods_STATUS(destination *storage.Condition_FailingPeriods_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // MinFailingPeriodsToAlert + destination.MinFailingPeriodsToAlert = genruntime.ClonePointerToInt(periods.MinFailingPeriodsToAlert) + + // NumberOfEvaluationPeriods + destination.NumberOfEvaluationPeriods = genruntime.ClonePointerToInt(periods.NumberOfEvaluationPeriods) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"Equals","GreaterThan","GreaterThanOrEqual","LessThan","LessThanOrEqual"} +type Condition_Operator string + +const ( + Condition_Operator_Equals = Condition_Operator("Equals") + Condition_Operator_GreaterThan = Condition_Operator("GreaterThan") + Condition_Operator_GreaterThanOrEqual = Condition_Operator("GreaterThanOrEqual") + Condition_Operator_LessThan = Condition_Operator("LessThan") + Condition_Operator_LessThanOrEqual = Condition_Operator("LessThanOrEqual") +) + +// Mapping from string to Condition_Operator +var condition_Operator_Values = map[string]Condition_Operator{ + "equals": Condition_Operator_Equals, + "greaterthan": Condition_Operator_GreaterThan, + "greaterthanorequal": Condition_Operator_GreaterThanOrEqual, + "lessthan": Condition_Operator_LessThan, + "lessthanorequal": Condition_Operator_LessThanOrEqual, +} + +type Condition_Operator_STATUS string + +const ( + Condition_Operator_STATUS_Equals = Condition_Operator_STATUS("Equals") + Condition_Operator_STATUS_GreaterThan = Condition_Operator_STATUS("GreaterThan") + Condition_Operator_STATUS_GreaterThanOrEqual = Condition_Operator_STATUS("GreaterThanOrEqual") + Condition_Operator_STATUS_LessThan = Condition_Operator_STATUS("LessThan") + Condition_Operator_STATUS_LessThanOrEqual = Condition_Operator_STATUS("LessThanOrEqual") +) + +// Mapping from string to Condition_Operator_STATUS +var condition_Operator_STATUS_Values = map[string]Condition_Operator_STATUS{ + "equals": Condition_Operator_STATUS_Equals, + "greaterthan": Condition_Operator_STATUS_GreaterThan, + "greaterthanorequal": Condition_Operator_STATUS_GreaterThanOrEqual, + "lessthan": Condition_Operator_STATUS_LessThan, + "lessthanorequal": Condition_Operator_STATUS_LessThanOrEqual, +} + +// +kubebuilder:validation:Enum={"Average","Count","Maximum","Minimum","Total"} +type Condition_TimeAggregation string + +const ( + Condition_TimeAggregation_Average = Condition_TimeAggregation("Average") + Condition_TimeAggregation_Count = Condition_TimeAggregation("Count") + Condition_TimeAggregation_Maximum = Condition_TimeAggregation("Maximum") + Condition_TimeAggregation_Minimum = Condition_TimeAggregation("Minimum") + Condition_TimeAggregation_Total = Condition_TimeAggregation("Total") +) + +// Mapping from string to Condition_TimeAggregation +var condition_TimeAggregation_Values = map[string]Condition_TimeAggregation{ + "average": Condition_TimeAggregation_Average, + "count": Condition_TimeAggregation_Count, + "maximum": Condition_TimeAggregation_Maximum, + "minimum": Condition_TimeAggregation_Minimum, + "total": Condition_TimeAggregation_Total, +} + +type Condition_TimeAggregation_STATUS string + +const ( + Condition_TimeAggregation_STATUS_Average = Condition_TimeAggregation_STATUS("Average") + Condition_TimeAggregation_STATUS_Count = Condition_TimeAggregation_STATUS("Count") + Condition_TimeAggregation_STATUS_Maximum = Condition_TimeAggregation_STATUS("Maximum") + Condition_TimeAggregation_STATUS_Minimum = Condition_TimeAggregation_STATUS("Minimum") + Condition_TimeAggregation_STATUS_Total = Condition_TimeAggregation_STATUS("Total") +) + +// Mapping from string to Condition_TimeAggregation_STATUS +var condition_TimeAggregation_STATUS_Values = map[string]Condition_TimeAggregation_STATUS{ + "average": Condition_TimeAggregation_STATUS_Average, + "count": Condition_TimeAggregation_STATUS_Count, + "maximum": Condition_TimeAggregation_STATUS_Maximum, + "minimum": Condition_TimeAggregation_STATUS_Minimum, + "total": Condition_TimeAggregation_STATUS_Total, +} + +// Dimension splitting and filtering definition +type Dimension struct { + // +kubebuilder:validation:Required + // Name: Name of the dimension + Name *string `json:"name,omitempty"` + + // +kubebuilder:validation:Required + // Operator: Operator for dimension values + Operator *Dimension_Operator `json:"operator,omitempty"` + + // +kubebuilder:validation:Required + // Values: List of dimension values + Values []string `json:"values,omitempty"` +} + +var _ genruntime.ARMTransformer = &Dimension{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (dimension *Dimension) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if dimension == nil { + return nil, nil + } + result := &arm.Dimension{} + + // Set property "Name": + if dimension.Name != nil { + name := *dimension.Name + result.Name = &name + } + + // Set property "Operator": + if dimension.Operator != nil { + var temp string + temp = string(*dimension.Operator) + operator := arm.Dimension_Operator(temp) + result.Operator = &operator + } + + // Set property "Values": + for _, item := range dimension.Values { + result.Values = append(result.Values, item) + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (dimension *Dimension) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Dimension{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (dimension *Dimension) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Dimension) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Dimension, got %T", armInput) + } + + // Set property "Name": + if typedInput.Name != nil { + name := *typedInput.Name + dimension.Name = &name + } + + // Set property "Operator": + if typedInput.Operator != nil { + var temp string + temp = string(*typedInput.Operator) + operator := Dimension_Operator(temp) + dimension.Operator = &operator + } + + // Set property "Values": + for _, item := range typedInput.Values { + dimension.Values = append(dimension.Values, item) + } + + // No error + return nil +} + +// AssignProperties_From_Dimension populates our Dimension from the provided source Dimension +func (dimension *Dimension) AssignProperties_From_Dimension(source *storage.Dimension) error { + + // Name + dimension.Name = genruntime.ClonePointerToString(source.Name) + + // Operator + if source.Operator != nil { + operator := *source.Operator + operatorTemp := genruntime.ToEnum(operator, dimension_Operator_Values) + dimension.Operator = &operatorTemp + } else { + dimension.Operator = nil + } + + // Values + dimension.Values = genruntime.CloneSliceOfString(source.Values) + + // No error + return nil +} + +// AssignProperties_To_Dimension populates the provided destination Dimension from our Dimension +func (dimension *Dimension) AssignProperties_To_Dimension(destination *storage.Dimension) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + destination.Name = genruntime.ClonePointerToString(dimension.Name) + + // Operator + if dimension.Operator != nil { + operator := string(*dimension.Operator) + destination.Operator = &operator + } else { + destination.Operator = nil + } + + // Values + destination.Values = genruntime.CloneSliceOfString(dimension.Values) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// Initialize_From_Dimension_STATUS populates our Dimension from the provided source Dimension_STATUS +func (dimension *Dimension) Initialize_From_Dimension_STATUS(source *Dimension_STATUS) error { + + // Name + dimension.Name = genruntime.ClonePointerToString(source.Name) + + // Operator + if source.Operator != nil { + operator := genruntime.ToEnum(string(*source.Operator), dimension_Operator_Values) + dimension.Operator = &operator + } else { + dimension.Operator = nil + } + + // Values + dimension.Values = genruntime.CloneSliceOfString(source.Values) + + // No error + return nil +} + +// Dimension splitting and filtering definition +type Dimension_STATUS struct { + // Name: Name of the dimension + Name *string `json:"name,omitempty"` + + // Operator: Operator for dimension values + Operator *Dimension_Operator_STATUS `json:"operator,omitempty"` + + // Values: List of dimension values + Values []string `json:"values,omitempty"` +} + +var _ genruntime.FromARMConverter = &Dimension_STATUS{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (dimension *Dimension_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &arm.Dimension_STATUS{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (dimension *Dimension_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(arm.Dimension_STATUS) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Dimension_STATUS, got %T", armInput) + } + + // Set property "Name": + if typedInput.Name != nil { + name := *typedInput.Name + dimension.Name = &name + } + + // Set property "Operator": + if typedInput.Operator != nil { + var temp string + temp = string(*typedInput.Operator) + operator := Dimension_Operator_STATUS(temp) + dimension.Operator = &operator + } + + // Set property "Values": + for _, item := range typedInput.Values { + dimension.Values = append(dimension.Values, item) + } + + // No error + return nil +} + +// AssignProperties_From_Dimension_STATUS populates our Dimension_STATUS from the provided source Dimension_STATUS +func (dimension *Dimension_STATUS) AssignProperties_From_Dimension_STATUS(source *storage.Dimension_STATUS) error { + + // Name + dimension.Name = genruntime.ClonePointerToString(source.Name) + + // Operator + if source.Operator != nil { + operator := *source.Operator + operatorTemp := genruntime.ToEnum(operator, dimension_Operator_STATUS_Values) + dimension.Operator = &operatorTemp + } else { + dimension.Operator = nil + } + + // Values + dimension.Values = genruntime.CloneSliceOfString(source.Values) + + // No error + return nil +} + +// AssignProperties_To_Dimension_STATUS populates the provided destination Dimension_STATUS from our Dimension_STATUS +func (dimension *Dimension_STATUS) AssignProperties_To_Dimension_STATUS(destination *storage.Dimension_STATUS) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + destination.Name = genruntime.ClonePointerToString(dimension.Name) + + // Operator + if dimension.Operator != nil { + operator := string(*dimension.Operator) + destination.Operator = &operator + } else { + destination.Operator = nil + } + + // Values + destination.Values = genruntime.CloneSliceOfString(dimension.Values) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"Exclude","Include"} +type Dimension_Operator string + +const ( + Dimension_Operator_Exclude = Dimension_Operator("Exclude") + Dimension_Operator_Include = Dimension_Operator("Include") +) + +// Mapping from string to Dimension_Operator +var dimension_Operator_Values = map[string]Dimension_Operator{ + "exclude": Dimension_Operator_Exclude, + "include": Dimension_Operator_Include, +} + +type Dimension_Operator_STATUS string + +const ( + Dimension_Operator_STATUS_Exclude = Dimension_Operator_STATUS("Exclude") + Dimension_Operator_STATUS_Include = Dimension_Operator_STATUS("Include") +) + +// Mapping from string to Dimension_Operator_STATUS +var dimension_Operator_STATUS_Values = map[string]Dimension_Operator_STATUS{ + "exclude": Dimension_Operator_STATUS_Exclude, + "include": Dimension_Operator_STATUS_Include, +} + +func init() { + SchemeBuilder.Register(&ScheduledQueryRule{}, &ScheduledQueryRuleList{}) +} diff --git a/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen_test.go b/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen_test.go new file mode 100644 index 00000000000..b2aa7a04927 --- /dev/null +++ b/v2/api/insights/v1api20231201/scheduled_query_rule_types_gen_test.go @@ -0,0 +1,2417 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1api20231201 + +import ( + "encoding/json" + storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Actions_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Actions to Actions via AssignProperties_To_Actions & AssignProperties_From_Actions returns original", + prop.ForAll(RunPropertyAssignmentTestForActions, ActionsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForActions tests if a specific instance of Actions can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForActions(subject Actions) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Actions + err := copied.AssignProperties_To_Actions(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Actions + err = actual.AssignProperties_From_Actions(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Actions_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions, ActionsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions runs a test to see if a specific instance of Actions round trips to JSON and back losslessly +func RunJSONSerializationTestForActions(subject Actions) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions instances for property testing - lazily instantiated by ActionsGenerator() +var actionsGenerator gopter.Gen + +// ActionsGenerator returns a generator of Actions instances for property testing. +func ActionsGenerator() gopter.Gen { + if actionsGenerator != nil { + return actionsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions(generators) + actionsGenerator = gen.Struct(reflect.TypeOf(Actions{}), generators) + + return actionsGenerator +} + +// AddIndependentPropertyGeneratorsForActions is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions(gens map[string]gopter.Gen) { + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Actions_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Actions_STATUS to Actions_STATUS via AssignProperties_To_Actions_STATUS & AssignProperties_From_Actions_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForActions_STATUS, Actions_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForActions_STATUS tests if a specific instance of Actions_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForActions_STATUS(subject Actions_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Actions_STATUS + err := copied.AssignProperties_To_Actions_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Actions_STATUS + err = actual.AssignProperties_From_Actions_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Actions_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions_STATUS, Actions_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions_STATUS runs a test to see if a specific instance of Actions_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForActions_STATUS(subject Actions_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions_STATUS instances for property testing - lazily instantiated by Actions_STATUSGenerator() +var actions_STATUSGenerator gopter.Gen + +// Actions_STATUSGenerator returns a generator of Actions_STATUS instances for property testing. +func Actions_STATUSGenerator() gopter.Gen { + if actions_STATUSGenerator != nil { + return actions_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions_STATUS(generators) + actions_STATUSGenerator = gen.Struct(reflect.TypeOf(Actions_STATUS{}), generators) + + return actions_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForActions_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions_STATUS(gens map[string]gopter.Gen) { + gens["ActionGroups"] = gen.SliceOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Condition_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition to Condition via AssignProperties_To_Condition & AssignProperties_From_Condition returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition, ConditionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition tests if a specific instance of Condition can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition(subject Condition) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Condition + err := copied.AssignProperties_To_Condition(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition + err = actual.AssignProperties_From_Condition(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Condition_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition, ConditionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition runs a test to see if a specific instance of Condition round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition(subject Condition) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition instances for property testing - lazily instantiated by ConditionGenerator() +var conditionGenerator gopter.Gen + +// ConditionGenerator returns a generator of Condition instances for property testing. +// We first initialize conditionGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ConditionGenerator() gopter.Gen { + if conditionGenerator != nil { + return conditionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + AddRelatedPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + return conditionGenerator +} + +// AddIndependentPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf( + Condition_Operator_Equals, + Condition_Operator_GreaterThan, + Condition_Operator_GreaterThanOrEqual, + Condition_Operator_LessThan, + Condition_Operator_LessThanOrEqual)) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.OneConstOf( + Condition_TimeAggregation_Average, + Condition_TimeAggregation_Count, + Condition_TimeAggregation_Maximum, + Condition_TimeAggregation_Minimum, + Condition_TimeAggregation_Total)) +} + +// AddRelatedPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(DimensionGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriodsGenerator()) +} + +func Test_Condition_FailingPeriods_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_FailingPeriods to Condition_FailingPeriods via AssignProperties_To_Condition_FailingPeriods & AssignProperties_From_Condition_FailingPeriods returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_FailingPeriods, Condition_FailingPeriodsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_FailingPeriods tests if a specific instance of Condition_FailingPeriods can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_FailingPeriods(subject Condition_FailingPeriods) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Condition_FailingPeriods + err := copied.AssignProperties_To_Condition_FailingPeriods(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_FailingPeriods + err = actual.AssignProperties_From_Condition_FailingPeriods(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Condition_FailingPeriods_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods, Condition_FailingPeriodsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods runs a test to see if a specific instance of Condition_FailingPeriods round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods(subject Condition_FailingPeriods) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods instances for property testing - lazily instantiated by +// Condition_FailingPeriodsGenerator() +var condition_FailingPeriodsGenerator gopter.Gen + +// Condition_FailingPeriodsGenerator returns a generator of Condition_FailingPeriods instances for property testing. +func Condition_FailingPeriodsGenerator() gopter.Gen { + if condition_FailingPeriodsGenerator != nil { + return condition_FailingPeriodsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods(generators) + condition_FailingPeriodsGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods{}), generators) + + return condition_FailingPeriodsGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Condition_FailingPeriods_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_FailingPeriods_STATUS to Condition_FailingPeriods_STATUS via AssignProperties_To_Condition_FailingPeriods_STATUS & AssignProperties_From_Condition_FailingPeriods_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS, Condition_FailingPeriods_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS tests if a specific instance of Condition_FailingPeriods_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_FailingPeriods_STATUS(subject Condition_FailingPeriods_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Condition_FailingPeriods_STATUS + err := copied.AssignProperties_To_Condition_FailingPeriods_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_FailingPeriods_STATUS + err = actual.AssignProperties_From_Condition_FailingPeriods_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Condition_FailingPeriods_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods_STATUS, Condition_FailingPeriods_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods_STATUS runs a test to see if a specific instance of Condition_FailingPeriods_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods_STATUS(subject Condition_FailingPeriods_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods_STATUS instances for property testing - lazily instantiated by +// Condition_FailingPeriods_STATUSGenerator() +var condition_FailingPeriods_STATUSGenerator gopter.Gen + +// Condition_FailingPeriods_STATUSGenerator returns a generator of Condition_FailingPeriods_STATUS instances for property testing. +func Condition_FailingPeriods_STATUSGenerator() gopter.Gen { + if condition_FailingPeriods_STATUSGenerator != nil { + return condition_FailingPeriods_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(generators) + condition_FailingPeriods_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods_STATUS{}), generators) + + return condition_FailingPeriods_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Condition_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Condition_STATUS to Condition_STATUS via AssignProperties_To_Condition_STATUS & AssignProperties_From_Condition_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForCondition_STATUS, Condition_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForCondition_STATUS tests if a specific instance of Condition_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForCondition_STATUS(subject Condition_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Condition_STATUS + err := copied.AssignProperties_To_Condition_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Condition_STATUS + err = actual.AssignProperties_From_Condition_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Condition_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_STATUS, Condition_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_STATUS runs a test to see if a specific instance of Condition_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_STATUS(subject Condition_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_STATUS instances for property testing - lazily instantiated by Condition_STATUSGenerator() +var condition_STATUSGenerator gopter.Gen + +// Condition_STATUSGenerator returns a generator of Condition_STATUS instances for property testing. +// We first initialize condition_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Condition_STATUSGenerator() gopter.Gen { + if condition_STATUSGenerator != nil { + return condition_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + AddRelatedPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + return condition_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf( + Condition_Operator_STATUS_Equals, + Condition_Operator_STATUS_GreaterThan, + Condition_Operator_STATUS_GreaterThanOrEqual, + Condition_Operator_STATUS_LessThan, + Condition_Operator_STATUS_LessThanOrEqual)) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["ResourceIdColumn"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.OneConstOf( + Condition_TimeAggregation_STATUS_Average, + Condition_TimeAggregation_STATUS_Count, + Condition_TimeAggregation_STATUS_Maximum, + Condition_TimeAggregation_STATUS_Minimum, + Condition_TimeAggregation_STATUS_Total)) +} + +// AddRelatedPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(Dimension_STATUSGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriods_STATUSGenerator()) +} + +func Test_Dimension_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Dimension to Dimension via AssignProperties_To_Dimension & AssignProperties_From_Dimension returns original", + prop.ForAll(RunPropertyAssignmentTestForDimension, DimensionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDimension tests if a specific instance of Dimension can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForDimension(subject Dimension) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Dimension + err := copied.AssignProperties_To_Dimension(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Dimension + err = actual.AssignProperties_From_Dimension(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Dimension_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension, DimensionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension runs a test to see if a specific instance of Dimension round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension(subject Dimension) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension instances for property testing - lazily instantiated by DimensionGenerator() +var dimensionGenerator gopter.Gen + +// DimensionGenerator returns a generator of Dimension instances for property testing. +func DimensionGenerator() gopter.Gen { + if dimensionGenerator != nil { + return dimensionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension(generators) + dimensionGenerator = gen.Struct(reflect.TypeOf(Dimension{}), generators) + + return dimensionGenerator +} + +// AddIndependentPropertyGeneratorsForDimension is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf(Dimension_Operator_Exclude, Dimension_Operator_Include)) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Dimension_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Dimension_STATUS to Dimension_STATUS via AssignProperties_To_Dimension_STATUS & AssignProperties_From_Dimension_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForDimension_STATUS, Dimension_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDimension_STATUS tests if a specific instance of Dimension_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForDimension_STATUS(subject Dimension_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Dimension_STATUS + err := copied.AssignProperties_To_Dimension_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Dimension_STATUS + err = actual.AssignProperties_From_Dimension_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Dimension_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension_STATUS, Dimension_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension_STATUS runs a test to see if a specific instance of Dimension_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension_STATUS(subject Dimension_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension_STATUS instances for property testing - lazily instantiated by Dimension_STATUSGenerator() +var dimension_STATUSGenerator gopter.Gen + +// Dimension_STATUSGenerator returns a generator of Dimension_STATUS instances for property testing. +func Dimension_STATUSGenerator() gopter.Gen { + if dimension_STATUSGenerator != nil { + return dimension_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension_STATUS(generators) + dimension_STATUSGenerator = gen.Struct(reflect.TypeOf(Dimension_STATUS{}), generators) + + return dimension_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForDimension_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension_STATUS(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.OneConstOf(Dimension_Operator_STATUS_Exclude, Dimension_Operator_STATUS_Include)) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Identity_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Identity to Identity via AssignProperties_To_Identity & AssignProperties_From_Identity returns original", + prop.ForAll(RunPropertyAssignmentTestForIdentity, IdentityGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForIdentity tests if a specific instance of Identity can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForIdentity(subject Identity) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Identity + err := copied.AssignProperties_To_Identity(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Identity + err = actual.AssignProperties_From_Identity(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Identity_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity, IdentityGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity runs a test to see if a specific instance of Identity round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity(subject Identity) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity instances for property testing - lazily instantiated by IdentityGenerator() +var identityGenerator gopter.Gen + +// IdentityGenerator returns a generator of Identity instances for property testing. +// We first initialize identityGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func IdentityGenerator() gopter.Gen { + if identityGenerator != nil { + return identityGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + AddRelatedPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + return identityGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["Type"] = gen.PtrOf(gen.OneConstOf(Identity_Type_None, Identity_Type_SystemAssigned, Identity_Type_UserAssigned)) +} + +// AddRelatedPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.SliceOf(UserAssignedIdentityDetailsGenerator()) +} + +func Test_Identity_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Identity_STATUS to Identity_STATUS via AssignProperties_To_Identity_STATUS & AssignProperties_From_Identity_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForIdentity_STATUS, Identity_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForIdentity_STATUS tests if a specific instance of Identity_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForIdentity_STATUS(subject Identity_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.Identity_STATUS + err := copied.AssignProperties_To_Identity_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Identity_STATUS + err = actual.AssignProperties_From_Identity_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Identity_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity_STATUS, Identity_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity_STATUS runs a test to see if a specific instance of Identity_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity_STATUS(subject Identity_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity_STATUS instances for property testing - lazily instantiated by Identity_STATUSGenerator() +var identity_STATUSGenerator gopter.Gen + +// Identity_STATUSGenerator returns a generator of Identity_STATUS instances for property testing. +// We first initialize identity_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Identity_STATUSGenerator() gopter.Gen { + if identity_STATUSGenerator != nil { + return identity_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + AddRelatedPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + return identity_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) + gens["TenantId"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(Identity_Type_STATUS_None, Identity_Type_STATUS_SystemAssigned, Identity_Type_STATUS_UserAssigned)) +} + +// AddRelatedPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.MapOf( + gen.AlphaString(), + UserIdentityProperties_STATUSGenerator()) +} + +func Test_RuleResolveConfiguration_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RuleResolveConfiguration to RuleResolveConfiguration via AssignProperties_To_RuleResolveConfiguration & AssignProperties_From_RuleResolveConfiguration returns original", + prop.ForAll(RunPropertyAssignmentTestForRuleResolveConfiguration, RuleResolveConfigurationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRuleResolveConfiguration tests if a specific instance of RuleResolveConfiguration can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForRuleResolveConfiguration(subject RuleResolveConfiguration) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.RuleResolveConfiguration + err := copied.AssignProperties_To_RuleResolveConfiguration(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RuleResolveConfiguration + err = actual.AssignProperties_From_RuleResolveConfiguration(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RuleResolveConfiguration_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration, RuleResolveConfigurationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration runs a test to see if a specific instance of RuleResolveConfiguration round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration(subject RuleResolveConfiguration) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration instances for property testing - lazily instantiated by +// RuleResolveConfigurationGenerator() +var ruleResolveConfigurationGenerator gopter.Gen + +// RuleResolveConfigurationGenerator returns a generator of RuleResolveConfiguration instances for property testing. +func RuleResolveConfigurationGenerator() gopter.Gen { + if ruleResolveConfigurationGenerator != nil { + return ruleResolveConfigurationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration(generators) + ruleResolveConfigurationGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration{}), generators) + + return ruleResolveConfigurationGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_RuleResolveConfiguration_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RuleResolveConfiguration_STATUS to RuleResolveConfiguration_STATUS via AssignProperties_To_RuleResolveConfiguration_STATUS & AssignProperties_From_RuleResolveConfiguration_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForRuleResolveConfiguration_STATUS, RuleResolveConfiguration_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRuleResolveConfiguration_STATUS tests if a specific instance of RuleResolveConfiguration_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForRuleResolveConfiguration_STATUS(subject RuleResolveConfiguration_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.RuleResolveConfiguration_STATUS + err := copied.AssignProperties_To_RuleResolveConfiguration_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RuleResolveConfiguration_STATUS + err = actual.AssignProperties_From_RuleResolveConfiguration_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RuleResolveConfiguration_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration_STATUS, RuleResolveConfiguration_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration_STATUS runs a test to see if a specific instance of RuleResolveConfiguration_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration_STATUS(subject RuleResolveConfiguration_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration_STATUS instances for property testing - lazily instantiated by +// RuleResolveConfiguration_STATUSGenerator() +var ruleResolveConfiguration_STATUSGenerator gopter.Gen + +// RuleResolveConfiguration_STATUSGenerator returns a generator of RuleResolveConfiguration_STATUS instances for property testing. +func RuleResolveConfiguration_STATUSGenerator() gopter.Gen { + if ruleResolveConfiguration_STATUSGenerator != nil { + return ruleResolveConfiguration_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(generators) + ruleResolveConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration_STATUS{}), generators) + + return ruleResolveConfiguration_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ScheduledQueryRule_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + parameters.MinSuccessfulTests = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule to hub returns original", + prop.ForAll(RunResourceConversionTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForScheduledQueryRule tests if a specific instance of ScheduledQueryRule round trips to the hub storage version and back losslessly +func RunResourceConversionTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub storage.ScheduledQueryRule + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual ScheduledQueryRule + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRule_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule to ScheduledQueryRule via AssignProperties_To_ScheduledQueryRule & AssignProperties_From_ScheduledQueryRule returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule tests if a specific instance of ScheduledQueryRule can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRule + err := copied.AssignProperties_To_ScheduledQueryRule(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule + err = actual.AssignProperties_From_ScheduledQueryRule(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRule_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 20 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule runs a test to see if a specific instance of ScheduledQueryRule round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule instances for property testing - lazily instantiated by ScheduledQueryRuleGenerator() +var scheduledQueryRuleGenerator gopter.Gen + +// ScheduledQueryRuleGenerator returns a generator of ScheduledQueryRule instances for property testing. +func ScheduledQueryRuleGenerator() gopter.Gen { + if scheduledQueryRuleGenerator != nil { + return scheduledQueryRuleGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRule(generators) + scheduledQueryRuleGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule{}), generators) + + return scheduledQueryRuleGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule(gens map[string]gopter.Gen) { + gens["Spec"] = ScheduledQueryRule_SpecGenerator() + gens["Status"] = ScheduledQueryRule_STATUSGenerator() +} + +func Test_ScheduledQueryRuleCriteria_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleCriteria to ScheduledQueryRuleCriteria via AssignProperties_To_ScheduledQueryRuleCriteria & AssignProperties_From_ScheduledQueryRuleCriteria returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleCriteria, ScheduledQueryRuleCriteriaGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleCriteria tests if a specific instance of ScheduledQueryRuleCriteria can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleCriteria(subject ScheduledQueryRuleCriteria) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRuleCriteria + err := copied.AssignProperties_To_ScheduledQueryRuleCriteria(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleCriteria + err = actual.AssignProperties_From_ScheduledQueryRuleCriteria(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRuleCriteria_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria, ScheduledQueryRuleCriteriaGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria runs a test to see if a specific instance of ScheduledQueryRuleCriteria round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria(subject ScheduledQueryRuleCriteria) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteriaGenerator() +var scheduledQueryRuleCriteriaGenerator gopter.Gen + +// ScheduledQueryRuleCriteriaGenerator returns a generator of ScheduledQueryRuleCriteria instances for property testing. +func ScheduledQueryRuleCriteriaGenerator() gopter.Gen { + if scheduledQueryRuleCriteriaGenerator != nil { + return scheduledQueryRuleCriteriaGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(generators) + scheduledQueryRuleCriteriaGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria{}), generators) + + return scheduledQueryRuleCriteriaGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(ConditionGenerator()) +} + +func Test_ScheduledQueryRuleCriteria_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleCriteria_STATUS to ScheduledQueryRuleCriteria_STATUS via AssignProperties_To_ScheduledQueryRuleCriteria_STATUS & AssignProperties_From_ScheduledQueryRuleCriteria_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS, ScheduledQueryRuleCriteria_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS tests if a specific instance of ScheduledQueryRuleCriteria_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleCriteria_STATUS(subject ScheduledQueryRuleCriteria_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRuleCriteria_STATUS + err := copied.AssignProperties_To_ScheduledQueryRuleCriteria_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleCriteria_STATUS + err = actual.AssignProperties_From_ScheduledQueryRuleCriteria_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRuleCriteria_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS, ScheduledQueryRuleCriteria_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS runs a test to see if a specific instance of ScheduledQueryRuleCriteria_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS(subject ScheduledQueryRuleCriteria_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteria_STATUSGenerator() +var scheduledQueryRuleCriteria_STATUSGenerator gopter.Gen + +// ScheduledQueryRuleCriteria_STATUSGenerator returns a generator of ScheduledQueryRuleCriteria_STATUS instances for property testing. +func ScheduledQueryRuleCriteria_STATUSGenerator() gopter.Gen { + if scheduledQueryRuleCriteria_STATUSGenerator != nil { + return scheduledQueryRuleCriteria_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(generators) + scheduledQueryRuleCriteria_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria_STATUS{}), generators) + + return scheduledQueryRuleCriteria_STATUSGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(Condition_STATUSGenerator()) +} + +func Test_ScheduledQueryRuleOperatorSpec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRuleOperatorSpec to ScheduledQueryRuleOperatorSpec via AssignProperties_To_ScheduledQueryRuleOperatorSpec & AssignProperties_From_ScheduledQueryRuleOperatorSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec, ScheduledQueryRuleOperatorSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec tests if a specific instance of ScheduledQueryRuleOperatorSpec can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRuleOperatorSpec(subject ScheduledQueryRuleOperatorSpec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRuleOperatorSpec + err := copied.AssignProperties_To_ScheduledQueryRuleOperatorSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRuleOperatorSpec + err = actual.AssignProperties_From_ScheduledQueryRuleOperatorSpec(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRuleOperatorSpec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleOperatorSpec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleOperatorSpec, ScheduledQueryRuleOperatorSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleOperatorSpec runs a test to see if a specific instance of ScheduledQueryRuleOperatorSpec round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleOperatorSpec(subject ScheduledQueryRuleOperatorSpec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleOperatorSpec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleOperatorSpec instances for property testing - lazily instantiated by +// ScheduledQueryRuleOperatorSpecGenerator() +var scheduledQueryRuleOperatorSpecGenerator gopter.Gen + +// ScheduledQueryRuleOperatorSpecGenerator returns a generator of ScheduledQueryRuleOperatorSpec instances for property testing. +func ScheduledQueryRuleOperatorSpecGenerator() gopter.Gen { + if scheduledQueryRuleOperatorSpecGenerator != nil { + return scheduledQueryRuleOperatorSpecGenerator + } + + generators := make(map[string]gopter.Gen) + scheduledQueryRuleOperatorSpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleOperatorSpec{}), generators) + + return scheduledQueryRuleOperatorSpecGenerator +} + +func Test_ScheduledQueryRule_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule_STATUS to ScheduledQueryRule_STATUS via AssignProperties_To_ScheduledQueryRule_STATUS & AssignProperties_From_ScheduledQueryRule_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule_STATUS, ScheduledQueryRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule_STATUS tests if a specific instance of ScheduledQueryRule_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule_STATUS(subject ScheduledQueryRule_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRule_STATUS + err := copied.AssignProperties_To_ScheduledQueryRule_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule_STATUS + err = actual.AssignProperties_From_ScheduledQueryRule_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRule_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_STATUS, ScheduledQueryRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_STATUS runs a test to see if a specific instance of ScheduledQueryRule_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_STATUS(subject ScheduledQueryRule_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRule_STATUSGenerator() +var scheduledQueryRule_STATUSGenerator gopter.Gen + +// ScheduledQueryRule_STATUSGenerator returns a generator of ScheduledQueryRule_STATUS instances for property testing. +// We first initialize scheduledQueryRule_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_STATUSGenerator() gopter.Gen { + if scheduledQueryRule_STATUSGenerator != nil { + return scheduledQueryRule_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + return scheduledQueryRule_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["CreatedWithApiVersion"] = gen.PtrOf(gen.AlphaString()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["IsLegacyLogAnalyticsRule"] = gen.PtrOf(gen.Bool()) + gens["IsWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["Kind"] = gen.PtrOf(gen.OneConstOf(ScheduledQueryRule_Kind_STATUS_LogAlert, ScheduledQueryRule_Kind_STATUS_LogToMetric)) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.OneConstOf( + ScheduledQueryRuleProperties_Severity_STATUS_0, + ScheduledQueryRuleProperties_Severity_STATUS_1, + ScheduledQueryRuleProperties_Severity_STATUS_2, + ScheduledQueryRuleProperties_Severity_STATUS_3, + ScheduledQueryRuleProperties_Severity_STATUS_4)) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(Actions_STATUSGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteria_STATUSGenerator()) + gens["Identity"] = gen.PtrOf(Identity_STATUSGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfiguration_STATUSGenerator()) + gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) +} + +func Test_ScheduledQueryRule_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ScheduledQueryRule_Spec to ScheduledQueryRule_Spec via AssignProperties_To_ScheduledQueryRule_Spec & AssignProperties_From_ScheduledQueryRule_Spec returns original", + prop.ForAll(RunPropertyAssignmentTestForScheduledQueryRule_Spec, ScheduledQueryRule_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForScheduledQueryRule_Spec tests if a specific instance of ScheduledQueryRule_Spec can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForScheduledQueryRule_Spec(subject ScheduledQueryRule_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.ScheduledQueryRule_Spec + err := copied.AssignProperties_To_ScheduledQueryRule_Spec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ScheduledQueryRule_Spec + err = actual.AssignProperties_From_ScheduledQueryRule_Spec(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ScheduledQueryRule_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_Spec, ScheduledQueryRule_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_Spec runs a test to see if a specific instance of ScheduledQueryRule_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_Spec(subject ScheduledQueryRule_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_Spec instances for property testing - lazily instantiated by +// ScheduledQueryRule_SpecGenerator() +var scheduledQueryRule_SpecGenerator gopter.Gen + +// ScheduledQueryRule_SpecGenerator returns a generator of ScheduledQueryRule_Spec instances for property testing. +// We first initialize scheduledQueryRule_SpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_SpecGenerator() gopter.Gen { + if scheduledQueryRule_SpecGenerator != nil { + return scheduledQueryRule_SpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + return scheduledQueryRule_SpecGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["AzureName"] = gen.AlphaString() + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["Kind"] = gen.PtrOf(gen.OneConstOf(ScheduledQueryRule_Kind_Spec_LogAlert, ScheduledQueryRule_Kind_Spec_LogToMetric)) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.OneConstOf( + ScheduledQueryRuleProperties_Severity_0, + ScheduledQueryRuleProperties_Severity_1, + ScheduledQueryRuleProperties_Severity_2, + ScheduledQueryRuleProperties_Severity_3, + ScheduledQueryRuleProperties_Severity_4)) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(ActionsGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteriaGenerator()) + gens["Identity"] = gen.PtrOf(IdentityGenerator()) + gens["OperatorSpec"] = gen.PtrOf(ScheduledQueryRuleOperatorSpecGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfigurationGenerator()) +} + +func Test_SystemData_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SystemData_STATUS to SystemData_STATUS via AssignProperties_To_SystemData_STATUS & AssignProperties_From_SystemData_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForSystemData_STATUS, SystemData_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSystemData_STATUS tests if a specific instance of SystemData_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForSystemData_STATUS(subject SystemData_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.SystemData_STATUS + err := copied.AssignProperties_To_SystemData_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SystemData_STATUS + err = actual.AssignProperties_From_SystemData_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_SystemData_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SystemData_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSystemData_STATUS, SystemData_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSystemData_STATUS runs a test to see if a specific instance of SystemData_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForSystemData_STATUS(subject SystemData_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SystemData_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SystemData_STATUS instances for property testing - lazily instantiated by SystemData_STATUSGenerator() +var systemData_STATUSGenerator gopter.Gen + +// SystemData_STATUSGenerator returns a generator of SystemData_STATUS instances for property testing. +func SystemData_STATUSGenerator() gopter.Gen { + if systemData_STATUSGenerator != nil { + return systemData_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSystemData_STATUS(generators) + systemData_STATUSGenerator = gen.Struct(reflect.TypeOf(SystemData_STATUS{}), generators) + + return systemData_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) { + gens["CreatedAt"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedBy"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedByType"] = gen.PtrOf(gen.OneConstOf( + SystemData_CreatedByType_STATUS_Application, + SystemData_CreatedByType_STATUS_Key, + SystemData_CreatedByType_STATUS_ManagedIdentity, + SystemData_CreatedByType_STATUS_User)) + gens["LastModifiedAt"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedByType"] = gen.PtrOf(gen.OneConstOf( + SystemData_LastModifiedByType_STATUS_Application, + SystemData_LastModifiedByType_STATUS_Key, + SystemData_LastModifiedByType_STATUS_ManagedIdentity, + SystemData_LastModifiedByType_STATUS_User)) +} + +func Test_UserAssignedIdentityDetails_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from UserAssignedIdentityDetails to UserAssignedIdentityDetails via AssignProperties_To_UserAssignedIdentityDetails & AssignProperties_From_UserAssignedIdentityDetails returns original", + prop.ForAll(RunPropertyAssignmentTestForUserAssignedIdentityDetails, UserAssignedIdentityDetailsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForUserAssignedIdentityDetails tests if a specific instance of UserAssignedIdentityDetails can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForUserAssignedIdentityDetails(subject UserAssignedIdentityDetails) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.UserAssignedIdentityDetails + err := copied.AssignProperties_To_UserAssignedIdentityDetails(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual UserAssignedIdentityDetails + err = actual.AssignProperties_From_UserAssignedIdentityDetails(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_UserAssignedIdentityDetails_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserAssignedIdentityDetails via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserAssignedIdentityDetails, UserAssignedIdentityDetailsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserAssignedIdentityDetails runs a test to see if a specific instance of UserAssignedIdentityDetails round trips to JSON and back losslessly +func RunJSONSerializationTestForUserAssignedIdentityDetails(subject UserAssignedIdentityDetails) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserAssignedIdentityDetails + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserAssignedIdentityDetails instances for property testing - lazily instantiated by +// UserAssignedIdentityDetailsGenerator() +var userAssignedIdentityDetailsGenerator gopter.Gen + +// UserAssignedIdentityDetailsGenerator returns a generator of UserAssignedIdentityDetails instances for property testing. +func UserAssignedIdentityDetailsGenerator() gopter.Gen { + if userAssignedIdentityDetailsGenerator != nil { + return userAssignedIdentityDetailsGenerator + } + + generators := make(map[string]gopter.Gen) + userAssignedIdentityDetailsGenerator = gen.Struct(reflect.TypeOf(UserAssignedIdentityDetails{}), generators) + + return userAssignedIdentityDetailsGenerator +} + +func Test_UserIdentityProperties_STATUS_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from UserIdentityProperties_STATUS to UserIdentityProperties_STATUS via AssignProperties_To_UserIdentityProperties_STATUS & AssignProperties_From_UserIdentityProperties_STATUS returns original", + prop.ForAll(RunPropertyAssignmentTestForUserIdentityProperties_STATUS, UserIdentityProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForUserIdentityProperties_STATUS tests if a specific instance of UserIdentityProperties_STATUS can be assigned to storage and back losslessly +func RunPropertyAssignmentTestForUserIdentityProperties_STATUS(subject UserIdentityProperties_STATUS) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other storage.UserIdentityProperties_STATUS + err := copied.AssignProperties_To_UserIdentityProperties_STATUS(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual UserIdentityProperties_STATUS + err = actual.AssignProperties_From_UserIdentityProperties_STATUS(&other) + if err != nil { + return err.Error() + } + + // Check for a match + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_UserIdentityProperties_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserIdentityProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserIdentityProperties_STATUS, UserIdentityProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserIdentityProperties_STATUS runs a test to see if a specific instance of UserIdentityProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForUserIdentityProperties_STATUS(subject UserIdentityProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserIdentityProperties_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserIdentityProperties_STATUS instances for property testing - lazily instantiated by +// UserIdentityProperties_STATUSGenerator() +var userIdentityProperties_STATUSGenerator gopter.Gen + +// UserIdentityProperties_STATUSGenerator returns a generator of UserIdentityProperties_STATUS instances for property testing. +func UserIdentityProperties_STATUSGenerator() gopter.Gen { + if userIdentityProperties_STATUSGenerator != nil { + return userIdentityProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(generators) + userIdentityProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(UserIdentityProperties_STATUS{}), generators) + + return userIdentityProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(gens map[string]gopter.Gen) { + gens["ClientId"] = gen.PtrOf(gen.AlphaString()) + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/insights/v1api20231201/storage/groupversion_info_gen.go b/v2/api/insights/v1api20231201/storage/groupversion_info_gen.go new file mode 100644 index 00000000000..305c92a1045 --- /dev/null +++ b/v2/api/insights/v1api20231201/storage/groupversion_info_gen.go @@ -0,0 +1,32 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by azure-service-operator-codegen. DO NOT EDIT. + +// Package storage contains API Schema definitions for the insights storage API group +// +kubebuilder:object:generate=true +// All object properties are optional by default, this will be overridden when needed: +// +kubebuilder:validation:Optional +// +groupName=insights.azure.com +// +versionName=v1api20231201storage +package storage + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "insights.azure.com", Version: "v1api20231201storage"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder +) diff --git a/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen.go b/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen.go new file mode 100644 index 00000000000..e132655954a --- /dev/null +++ b/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen.go @@ -0,0 +1,453 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/core" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets" + "github.com/rotisserie/eris" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +kubebuilder:rbac:groups=insights.azure.com,resources=scheduledqueryrules,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=insights.azure.com,resources={scheduledqueryrules/status,scheduledqueryrules/finalizers},verbs=get;update;patch + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +// Storage version of v1api20231201.ScheduledQueryRule +// Generator information: +// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2023-12-01/scheduledQueryRule_API.json +// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} +type ScheduledQueryRule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ScheduledQueryRule_Spec `json:"spec,omitempty"` + Status ScheduledQueryRule_STATUS `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &ScheduledQueryRule{} + +// GetConditions returns the conditions of the resource +func (rule *ScheduledQueryRule) GetConditions() conditions.Conditions { + return rule.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (rule *ScheduledQueryRule) SetConditions(conditions conditions.Conditions) { + rule.Status.Conditions = conditions +} + +var _ configmaps.Exporter = &ScheduledQueryRule{} + +// ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property +func (rule *ScheduledQueryRule) ConfigMapDestinationExpressions() []*core.DestinationExpression { + if rule.Spec.OperatorSpec == nil { + return nil + } + return rule.Spec.OperatorSpec.ConfigMapExpressions +} + +var _ secrets.Exporter = &ScheduledQueryRule{} + +// SecretDestinationExpressions returns the Spec.OperatorSpec.SecretExpressions property +func (rule *ScheduledQueryRule) SecretDestinationExpressions() []*core.DestinationExpression { + if rule.Spec.OperatorSpec == nil { + return nil + } + return rule.Spec.OperatorSpec.SecretExpressions +} + +var _ genruntime.KubernetesResource = &ScheduledQueryRule{} + +// AzureName returns the Azure name of the resource +func (rule *ScheduledQueryRule) AzureName() string { + return rule.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2023-12-01" +func (rule ScheduledQueryRule) GetAPIVersion() string { + return "2023-12-01" +} + +// GetResourceScope returns the scope of the resource +func (rule *ScheduledQueryRule) GetResourceScope() genruntime.ResourceScope { + return genruntime.ResourceScopeResourceGroup +} + +// GetSpec returns the specification of this resource +func (rule *ScheduledQueryRule) GetSpec() genruntime.ConvertibleSpec { + return &rule.Spec +} + +// GetStatus returns the status of this resource +func (rule *ScheduledQueryRule) GetStatus() genruntime.ConvertibleStatus { + return &rule.Status +} + +// GetSupportedOperations returns the operations supported by the resource +func (rule *ScheduledQueryRule) GetSupportedOperations() []genruntime.ResourceOperation { + return []genruntime.ResourceOperation{ + genruntime.ResourceOperationDelete, + genruntime.ResourceOperationGet, + genruntime.ResourceOperationPut, + } +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/scheduledQueryRules" +func (rule *ScheduledQueryRule) GetType() string { + return "Microsoft.Insights/scheduledQueryRules" +} + +// NewEmptyStatus returns a new empty (blank) status +func (rule *ScheduledQueryRule) NewEmptyStatus() genruntime.ConvertibleStatus { + return &ScheduledQueryRule_STATUS{} +} + +// Owner returns the ResourceReference of the owner +func (rule *ScheduledQueryRule) Owner() *genruntime.ResourceReference { + if rule.Spec.Owner == nil { + return nil + } + + group, kind := genruntime.LookupOwnerGroupKind(rule.Spec) + return rule.Spec.Owner.AsResourceReference(group, kind) +} + +// SetStatus sets the status of this resource +func (rule *ScheduledQueryRule) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*ScheduledQueryRule_STATUS); ok { + rule.Status = *st + return nil + } + + // Convert status to required version + var st ScheduledQueryRule_STATUS + err := status.ConvertStatusTo(&st) + if err != nil { + return eris.Wrap(err, "failed to convert status") + } + + rule.Status = st + return nil +} + +// Hub marks that this ScheduledQueryRule is the hub type for conversion +func (rule *ScheduledQueryRule) Hub() {} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (rule *ScheduledQueryRule) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: rule.Spec.OriginalVersion, + Kind: "ScheduledQueryRule", + } +} + +// +kubebuilder:object:root=true +// Storage version of v1api20231201.ScheduledQueryRule +// Generator information: +// - Generated from: /monitor/resource-manager/Microsoft.Insights/stable/2023-12-01/scheduledQueryRule_API.json +// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} +type ScheduledQueryRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ScheduledQueryRule `json:"items"` +} + +// Storage version of v1api20231201.APIVersion +// +kubebuilder:validation:Enum={"2023-12-01"} +type APIVersion string + +const APIVersion_Value = APIVersion("2023-12-01") + +// Storage version of v1api20231201.ScheduledQueryRule_Spec +type ScheduledQueryRule_Spec struct { + Actions *Actions `json:"actions,omitempty"` + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it + // doesn't have to be. + AzureName string `json:"azureName,omitempty"` + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + Criteria *ScheduledQueryRuleCriteria `json:"criteria,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + Identity *Identity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + OperatorSpec *ScheduledQueryRuleOperatorSpec `json:"operatorSpec,omitempty"` + OriginalVersion string `json:"originalVersion,omitempty"` + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // +kubebuilder:validation:Required + // Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a resources.azure.com/ResourceGroup resource + Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ResolveConfiguration *RuleResolveConfiguration `json:"resolveConfiguration,omitempty"` + ScopesReferences []genruntime.ResourceReference `armReference:"Scopes" json:"scopesReferences,omitempty"` + Severity *int `json:"severity,omitempty"` + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &ScheduledQueryRule_Spec{} + +// ConvertSpecFrom populates our ScheduledQueryRule_Spec from the provided source +func (rule *ScheduledQueryRule_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == rule { + return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(rule) +} + +// ConvertSpecTo populates the provided destination from our ScheduledQueryRule_Spec +func (rule *ScheduledQueryRule_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == rule { + return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(rule) +} + +// Storage version of v1api20231201.ScheduledQueryRule_STATUS +type ScheduledQueryRule_STATUS struct { + Actions *Actions_STATUS `json:"actions,omitempty"` + AutoMitigate *bool `json:"autoMitigate,omitempty"` + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + Conditions []conditions.Condition `json:"conditions,omitempty"` + CreatedWithApiVersion *string `json:"createdWithApiVersion,omitempty"` + Criteria *ScheduledQueryRuleCriteria_STATUS `json:"criteria,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Etag *string `json:"etag,omitempty"` + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + Id *string `json:"id,omitempty"` + Identity *Identity_STATUS `json:"identity,omitempty"` + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + Name *string `json:"name,omitempty"` + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ResolveConfiguration *RuleResolveConfiguration_STATUS `json:"resolveConfiguration,omitempty"` + Scopes []string `json:"scopes,omitempty"` + Severity *int `json:"severity,omitempty"` + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + SystemData *SystemData_STATUS `json:"systemData,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + TargetResourceTypes []string `json:"targetResourceTypes,omitempty"` + Type *string `json:"type,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &ScheduledQueryRule_STATUS{} + +// ConvertStatusFrom populates our ScheduledQueryRule_STATUS from the provided source +func (rule *ScheduledQueryRule_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == rule { + return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(rule) +} + +// ConvertStatusTo populates the provided destination from our ScheduledQueryRule_STATUS +func (rule *ScheduledQueryRule_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == rule { + return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(rule) +} + +// Storage version of v1api20231201.Actions +// Actions to invoke when the alert fires. +type Actions struct { + ActionGroupsReferences []genruntime.ResourceReference `armReference:"ActionGroups" json:"actionGroupsReferences,omitempty"` + ActionProperties map[string]string `json:"actionProperties,omitempty"` + CustomProperties map[string]string `json:"customProperties,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Actions_STATUS +// Actions to invoke when the alert fires. +type Actions_STATUS struct { + ActionGroups []string `json:"actionGroups,omitempty"` + ActionProperties map[string]string `json:"actionProperties,omitempty"` + CustomProperties map[string]string `json:"customProperties,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Identity +// Identity for the resource. +type Identity struct { + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Type *string `json:"type,omitempty"` + UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"` +} + +// Storage version of v1api20231201.Identity_STATUS +// Identity for the resource. +type Identity_STATUS struct { + PrincipalId *string `json:"principalId,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` + UserAssignedIdentities map[string]UserIdentityProperties_STATUS `json:"userAssignedIdentities,omitempty"` +} + +// Storage version of v1api20231201.RuleResolveConfiguration +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + AutoResolved *bool `json:"autoResolved,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +// Storage version of v1api20231201.RuleResolveConfiguration_STATUS +// TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration_STATUS struct { + AutoResolved *bool `json:"autoResolved,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + +// Storage version of v1api20231201.ScheduledQueryRuleCriteria +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + AllOf []Condition `json:"allOf,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.ScheduledQueryRuleCriteria_STATUS +// The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria_STATUS struct { + AllOf []Condition_STATUS `json:"allOf,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.ScheduledQueryRuleOperatorSpec +// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure +type ScheduledQueryRuleOperatorSpec struct { + ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"` +} + +// Storage version of v1api20231201.SystemData_STATUS +// Metadata pertaining to creation and last modification of the resource. +type SystemData_STATUS struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Condition +// A condition of the scheduled query rule. +type Condition struct { + Dimensions []Dimension `json:"dimensions,omitempty"` + FailingPeriods *Condition_FailingPeriods `json:"failingPeriods,omitempty"` + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + MetricName *string `json:"metricName,omitempty"` + Operator *string `json:"operator,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Query *string `json:"query,omitempty"` + + // ResourceIdColumnReference: The column containing the resource id. The content of the column must be a uri formatted as + // resource id. Relevant only for rules of the kind LogAlert. + ResourceIdColumnReference *genruntime.ResourceReference `armReference:"ResourceIdColumn" json:"resourceIdColumnReference,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + TimeAggregation *string `json:"timeAggregation,omitempty"` +} + +// Storage version of v1api20231201.Condition_STATUS +// A condition of the scheduled query rule. +type Condition_STATUS struct { + Dimensions []Dimension_STATUS `json:"dimensions,omitempty"` + FailingPeriods *Condition_FailingPeriods_STATUS `json:"failingPeriods,omitempty"` + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + MetricName *string `json:"metricName,omitempty"` + Operator *string `json:"operator,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Query *string `json:"query,omitempty"` + ResourceIdColumn *string `json:"resourceIdColumn,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + TimeAggregation *string `json:"timeAggregation,omitempty"` +} + +// Storage version of v1api20231201.UserAssignedIdentityDetails +// Information about the user assigned identity for the resource +type UserAssignedIdentityDetails struct { + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Reference genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"` +} + +// Storage version of v1api20231201.UserIdentityProperties_STATUS +// User assigned identity properties. +type UserIdentityProperties_STATUS struct { + ClientId *string `json:"clientId,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Condition_FailingPeriods +type Condition_FailingPeriods struct { + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Condition_FailingPeriods_STATUS +type Condition_FailingPeriods_STATUS struct { + MinFailingPeriodsToAlert *int `json:"minFailingPeriodsToAlert,omitempty"` + NumberOfEvaluationPeriods *int `json:"numberOfEvaluationPeriods,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +// Storage version of v1api20231201.Dimension +// Dimension splitting and filtering definition +type Dimension struct { + Name *string `json:"name,omitempty"` + Operator *string `json:"operator,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Values []string `json:"values,omitempty"` +} + +// Storage version of v1api20231201.Dimension_STATUS +// Dimension splitting and filtering definition +type Dimension_STATUS struct { + Name *string `json:"name,omitempty"` + Operator *string `json:"operator,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Values []string `json:"values,omitempty"` +} + +func init() { + SchemeBuilder.Register(&ScheduledQueryRule{}, &ScheduledQueryRuleList{}) +} diff --git a/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen_test.go b/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen_test.go new file mode 100644 index 00000000000..866a3c917ae --- /dev/null +++ b/v2/api/insights/v1api20231201/storage/scheduled_query_rule_types_gen_test.go @@ -0,0 +1,1454 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package storage + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Actions_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions, ActionsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions runs a test to see if a specific instance of Actions round trips to JSON and back losslessly +func RunJSONSerializationTestForActions(subject Actions) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions instances for property testing - lazily instantiated by ActionsGenerator() +var actionsGenerator gopter.Gen + +// ActionsGenerator returns a generator of Actions instances for property testing. +func ActionsGenerator() gopter.Gen { + if actionsGenerator != nil { + return actionsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions(generators) + actionsGenerator = gen.Struct(reflect.TypeOf(Actions{}), generators) + + return actionsGenerator +} + +// AddIndependentPropertyGeneratorsForActions is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions(gens map[string]gopter.Gen) { + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Actions_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Actions_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForActions_STATUS, Actions_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForActions_STATUS runs a test to see if a specific instance of Actions_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForActions_STATUS(subject Actions_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Actions_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Actions_STATUS instances for property testing - lazily instantiated by Actions_STATUSGenerator() +var actions_STATUSGenerator gopter.Gen + +// Actions_STATUSGenerator returns a generator of Actions_STATUS instances for property testing. +func Actions_STATUSGenerator() gopter.Gen { + if actions_STATUSGenerator != nil { + return actions_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForActions_STATUS(generators) + actions_STATUSGenerator = gen.Struct(reflect.TypeOf(Actions_STATUS{}), generators) + + return actions_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForActions_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForActions_STATUS(gens map[string]gopter.Gen) { + gens["ActionGroups"] = gen.SliceOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["CustomProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_Condition_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition, ConditionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition runs a test to see if a specific instance of Condition round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition(subject Condition) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition instances for property testing - lazily instantiated by ConditionGenerator() +var conditionGenerator gopter.Gen + +// ConditionGenerator returns a generator of Condition instances for property testing. +// We first initialize conditionGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ConditionGenerator() gopter.Gen { + if conditionGenerator != nil { + return conditionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition(generators) + AddRelatedPropertyGeneratorsForCondition(generators) + conditionGenerator = gen.Struct(reflect.TypeOf(Condition{}), generators) + + return conditionGenerator +} + +// AddIndependentPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.AlphaString()) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForCondition is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(DimensionGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriodsGenerator()) +} + +func Test_Condition_FailingPeriods_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods, Condition_FailingPeriodsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods runs a test to see if a specific instance of Condition_FailingPeriods round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods(subject Condition_FailingPeriods) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods instances for property testing - lazily instantiated by +// Condition_FailingPeriodsGenerator() +var condition_FailingPeriodsGenerator gopter.Gen + +// Condition_FailingPeriodsGenerator returns a generator of Condition_FailingPeriods instances for property testing. +func Condition_FailingPeriodsGenerator() gopter.Gen { + if condition_FailingPeriodsGenerator != nil { + return condition_FailingPeriodsGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods(generators) + condition_FailingPeriodsGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods{}), generators) + + return condition_FailingPeriodsGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Condition_FailingPeriods_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_FailingPeriods_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_FailingPeriods_STATUS, Condition_FailingPeriods_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_FailingPeriods_STATUS runs a test to see if a specific instance of Condition_FailingPeriods_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_FailingPeriods_STATUS(subject Condition_FailingPeriods_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_FailingPeriods_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_FailingPeriods_STATUS instances for property testing - lazily instantiated by +// Condition_FailingPeriods_STATUSGenerator() +var condition_FailingPeriods_STATUSGenerator gopter.Gen + +// Condition_FailingPeriods_STATUSGenerator returns a generator of Condition_FailingPeriods_STATUS instances for property testing. +func Condition_FailingPeriods_STATUSGenerator() gopter.Gen { + if condition_FailingPeriods_STATUSGenerator != nil { + return condition_FailingPeriods_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(generators) + condition_FailingPeriods_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_FailingPeriods_STATUS{}), generators) + + return condition_FailingPeriods_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_FailingPeriods_STATUS(gens map[string]gopter.Gen) { + gens["MinFailingPeriodsToAlert"] = gen.PtrOf(gen.Int()) + gens["NumberOfEvaluationPeriods"] = gen.PtrOf(gen.Int()) +} + +func Test_Condition_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Condition_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForCondition_STATUS, Condition_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForCondition_STATUS runs a test to see if a specific instance of Condition_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForCondition_STATUS(subject Condition_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Condition_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Condition_STATUS instances for property testing - lazily instantiated by Condition_STATUSGenerator() +var condition_STATUSGenerator gopter.Gen + +// Condition_STATUSGenerator returns a generator of Condition_STATUS instances for property testing. +// We first initialize condition_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Condition_STATUSGenerator() gopter.Gen { + if condition_STATUSGenerator != nil { + return condition_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForCondition_STATUS(generators) + AddRelatedPropertyGeneratorsForCondition_STATUS(generators) + condition_STATUSGenerator = gen.Struct(reflect.TypeOf(Condition_STATUS{}), generators) + + return condition_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["MetricMeasureColumn"] = gen.PtrOf(gen.AlphaString()) + gens["MetricName"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.AlphaString()) + gens["Query"] = gen.PtrOf(gen.AlphaString()) + gens["ResourceIdColumn"] = gen.PtrOf(gen.AlphaString()) + gens["Threshold"] = gen.PtrOf(gen.Float64()) + gens["TimeAggregation"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForCondition_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForCondition_STATUS(gens map[string]gopter.Gen) { + gens["Dimensions"] = gen.SliceOf(Dimension_STATUSGenerator()) + gens["FailingPeriods"] = gen.PtrOf(Condition_FailingPeriods_STATUSGenerator()) +} + +func Test_Dimension_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension, DimensionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension runs a test to see if a specific instance of Dimension round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension(subject Dimension) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension instances for property testing - lazily instantiated by DimensionGenerator() +var dimensionGenerator gopter.Gen + +// DimensionGenerator returns a generator of Dimension instances for property testing. +func DimensionGenerator() gopter.Gen { + if dimensionGenerator != nil { + return dimensionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension(generators) + dimensionGenerator = gen.Struct(reflect.TypeOf(Dimension{}), generators) + + return dimensionGenerator +} + +// AddIndependentPropertyGeneratorsForDimension is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.AlphaString()) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Dimension_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Dimension_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDimension_STATUS, Dimension_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDimension_STATUS runs a test to see if a specific instance of Dimension_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForDimension_STATUS(subject Dimension_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Dimension_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Dimension_STATUS instances for property testing - lazily instantiated by Dimension_STATUSGenerator() +var dimension_STATUSGenerator gopter.Gen + +// Dimension_STATUSGenerator returns a generator of Dimension_STATUS instances for property testing. +func Dimension_STATUSGenerator() gopter.Gen { + if dimension_STATUSGenerator != nil { + return dimension_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDimension_STATUS(generators) + dimension_STATUSGenerator = gen.Struct(reflect.TypeOf(Dimension_STATUS{}), generators) + + return dimension_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForDimension_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDimension_STATUS(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Operator"] = gen.PtrOf(gen.AlphaString()) + gens["Values"] = gen.SliceOf(gen.AlphaString()) +} + +func Test_Identity_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity, IdentityGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity runs a test to see if a specific instance of Identity round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity(subject Identity) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity instances for property testing - lazily instantiated by IdentityGenerator() +var identityGenerator gopter.Gen + +// IdentityGenerator returns a generator of Identity instances for property testing. +// We first initialize identityGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func IdentityGenerator() gopter.Gen { + if identityGenerator != nil { + return identityGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity(generators) + AddRelatedPropertyGeneratorsForIdentity(generators) + identityGenerator = gen.Struct(reflect.TypeOf(Identity{}), generators) + + return identityGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForIdentity is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.SliceOf(UserAssignedIdentityDetailsGenerator()) +} + +func Test_Identity_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Identity_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIdentity_STATUS, Identity_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIdentity_STATUS runs a test to see if a specific instance of Identity_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForIdentity_STATUS(subject Identity_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Identity_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Identity_STATUS instances for property testing - lazily instantiated by Identity_STATUSGenerator() +var identity_STATUSGenerator gopter.Gen + +// Identity_STATUSGenerator returns a generator of Identity_STATUS instances for property testing. +// We first initialize identity_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func Identity_STATUSGenerator() gopter.Gen { + if identity_STATUSGenerator != nil { + return identity_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIdentity_STATUS(generators) + AddRelatedPropertyGeneratorsForIdentity_STATUS(generators) + identity_STATUSGenerator = gen.Struct(reflect.TypeOf(Identity_STATUS{}), generators) + + return identity_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) + gens["TenantId"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForIdentity_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForIdentity_STATUS(gens map[string]gopter.Gen) { + gens["UserAssignedIdentities"] = gen.MapOf( + gen.AlphaString(), + UserIdentityProperties_STATUSGenerator()) +} + +func Test_RuleResolveConfiguration_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration, RuleResolveConfigurationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration runs a test to see if a specific instance of RuleResolveConfiguration round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration(subject RuleResolveConfiguration) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration instances for property testing - lazily instantiated by +// RuleResolveConfigurationGenerator() +var ruleResolveConfigurationGenerator gopter.Gen + +// RuleResolveConfigurationGenerator returns a generator of RuleResolveConfiguration instances for property testing. +func RuleResolveConfigurationGenerator() gopter.Gen { + if ruleResolveConfigurationGenerator != nil { + return ruleResolveConfigurationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration(generators) + ruleResolveConfigurationGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration{}), generators) + + return ruleResolveConfigurationGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_RuleResolveConfiguration_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RuleResolveConfiguration_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRuleResolveConfiguration_STATUS, RuleResolveConfiguration_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRuleResolveConfiguration_STATUS runs a test to see if a specific instance of RuleResolveConfiguration_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForRuleResolveConfiguration_STATUS(subject RuleResolveConfiguration_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RuleResolveConfiguration_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of RuleResolveConfiguration_STATUS instances for property testing - lazily instantiated by +// RuleResolveConfiguration_STATUSGenerator() +var ruleResolveConfiguration_STATUSGenerator gopter.Gen + +// RuleResolveConfiguration_STATUSGenerator returns a generator of RuleResolveConfiguration_STATUS instances for property testing. +func RuleResolveConfiguration_STATUSGenerator() gopter.Gen { + if ruleResolveConfiguration_STATUSGenerator != nil { + return ruleResolveConfiguration_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(generators) + ruleResolveConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(RuleResolveConfiguration_STATUS{}), generators) + + return ruleResolveConfiguration_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRuleResolveConfiguration_STATUS(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ScheduledQueryRule_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 20 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule, ScheduledQueryRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule runs a test to see if a specific instance of ScheduledQueryRule round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule(subject ScheduledQueryRule) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule instances for property testing - lazily instantiated by ScheduledQueryRuleGenerator() +var scheduledQueryRuleGenerator gopter.Gen + +// ScheduledQueryRuleGenerator returns a generator of ScheduledQueryRule instances for property testing. +func ScheduledQueryRuleGenerator() gopter.Gen { + if scheduledQueryRuleGenerator != nil { + return scheduledQueryRuleGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRule(generators) + scheduledQueryRuleGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule{}), generators) + + return scheduledQueryRuleGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule(gens map[string]gopter.Gen) { + gens["Spec"] = ScheduledQueryRule_SpecGenerator() + gens["Status"] = ScheduledQueryRule_STATUSGenerator() +} + +func Test_ScheduledQueryRuleCriteria_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria, ScheduledQueryRuleCriteriaGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria runs a test to see if a specific instance of ScheduledQueryRuleCriteria round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria(subject ScheduledQueryRuleCriteria) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteriaGenerator() +var scheduledQueryRuleCriteriaGenerator gopter.Gen + +// ScheduledQueryRuleCriteriaGenerator returns a generator of ScheduledQueryRuleCriteria instances for property testing. +func ScheduledQueryRuleCriteriaGenerator() gopter.Gen { + if scheduledQueryRuleCriteriaGenerator != nil { + return scheduledQueryRuleCriteriaGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(generators) + scheduledQueryRuleCriteriaGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria{}), generators) + + return scheduledQueryRuleCriteriaGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(ConditionGenerator()) +} + +func Test_ScheduledQueryRuleCriteria_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleCriteria_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS, ScheduledQueryRuleCriteria_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS runs a test to see if a specific instance of ScheduledQueryRuleCriteria_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleCriteria_STATUS(subject ScheduledQueryRuleCriteria_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleCriteria_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleCriteria_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRuleCriteria_STATUSGenerator() +var scheduledQueryRuleCriteria_STATUSGenerator gopter.Gen + +// ScheduledQueryRuleCriteria_STATUSGenerator returns a generator of ScheduledQueryRuleCriteria_STATUS instances for property testing. +func ScheduledQueryRuleCriteria_STATUSGenerator() gopter.Gen { + if scheduledQueryRuleCriteria_STATUSGenerator != nil { + return scheduledQueryRuleCriteria_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(generators) + scheduledQueryRuleCriteria_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleCriteria_STATUS{}), generators) + + return scheduledQueryRuleCriteria_STATUSGenerator +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRuleCriteria_STATUS(gens map[string]gopter.Gen) { + gens["AllOf"] = gen.SliceOf(Condition_STATUSGenerator()) +} + +func Test_ScheduledQueryRuleOperatorSpec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRuleOperatorSpec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRuleOperatorSpec, ScheduledQueryRuleOperatorSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRuleOperatorSpec runs a test to see if a specific instance of ScheduledQueryRuleOperatorSpec round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRuleOperatorSpec(subject ScheduledQueryRuleOperatorSpec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRuleOperatorSpec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRuleOperatorSpec instances for property testing - lazily instantiated by +// ScheduledQueryRuleOperatorSpecGenerator() +var scheduledQueryRuleOperatorSpecGenerator gopter.Gen + +// ScheduledQueryRuleOperatorSpecGenerator returns a generator of ScheduledQueryRuleOperatorSpec instances for property testing. +func ScheduledQueryRuleOperatorSpecGenerator() gopter.Gen { + if scheduledQueryRuleOperatorSpecGenerator != nil { + return scheduledQueryRuleOperatorSpecGenerator + } + + generators := make(map[string]gopter.Gen) + scheduledQueryRuleOperatorSpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRuleOperatorSpec{}), generators) + + return scheduledQueryRuleOperatorSpecGenerator +} + +func Test_ScheduledQueryRule_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_STATUS, ScheduledQueryRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_STATUS runs a test to see if a specific instance of ScheduledQueryRule_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_STATUS(subject ScheduledQueryRule_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_STATUS instances for property testing - lazily instantiated by +// ScheduledQueryRule_STATUSGenerator() +var scheduledQueryRule_STATUSGenerator gopter.Gen + +// ScheduledQueryRule_STATUSGenerator returns a generator of ScheduledQueryRule_STATUS instances for property testing. +// We first initialize scheduledQueryRule_STATUSGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_STATUSGenerator() gopter.Gen { + if scheduledQueryRule_STATUSGenerator != nil { + return scheduledQueryRule_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(generators) + scheduledQueryRule_STATUSGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_STATUS{}), generators) + + return scheduledQueryRule_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["CreatedWithApiVersion"] = gen.PtrOf(gen.AlphaString()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["IsLegacyLogAnalyticsRule"] = gen.PtrOf(gen.Bool()) + gens["IsWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["Kind"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.Int()) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_STATUS(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(Actions_STATUSGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteria_STATUSGenerator()) + gens["Identity"] = gen.PtrOf(Identity_STATUSGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfiguration_STATUSGenerator()) + gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) +} + +func Test_ScheduledQueryRule_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ScheduledQueryRule_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForScheduledQueryRule_Spec, ScheduledQueryRule_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForScheduledQueryRule_Spec runs a test to see if a specific instance of ScheduledQueryRule_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForScheduledQueryRule_Spec(subject ScheduledQueryRule_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ScheduledQueryRule_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ScheduledQueryRule_Spec instances for property testing - lazily instantiated by +// ScheduledQueryRule_SpecGenerator() +var scheduledQueryRule_SpecGenerator gopter.Gen + +// ScheduledQueryRule_SpecGenerator returns a generator of ScheduledQueryRule_Spec instances for property testing. +// We first initialize scheduledQueryRule_SpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ScheduledQueryRule_SpecGenerator() gopter.Gen { + if scheduledQueryRule_SpecGenerator != nil { + return scheduledQueryRule_SpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(generators) + AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(generators) + scheduledQueryRule_SpecGenerator = gen.Struct(reflect.TypeOf(ScheduledQueryRule_Spec{}), generators) + + return scheduledQueryRule_SpecGenerator +} + +// AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["AutoMitigate"] = gen.PtrOf(gen.Bool()) + gens["AzureName"] = gen.AlphaString() + gens["CheckWorkspaceAlertsStorageConfigured"] = gen.PtrOf(gen.Bool()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["DisplayName"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["EvaluationFrequency"] = gen.PtrOf(gen.AlphaString()) + gens["Kind"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["MuteActionsDuration"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = gen.AlphaString() + gens["OverrideQueryTimeRange"] = gen.PtrOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.Int()) + gens["SkipQueryValidation"] = gen.PtrOf(gen.Bool()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["TargetResourceTypes"] = gen.SliceOf(gen.AlphaString()) + gens["WindowSize"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForScheduledQueryRule_Spec(gens map[string]gopter.Gen) { + gens["Actions"] = gen.PtrOf(ActionsGenerator()) + gens["Criteria"] = gen.PtrOf(ScheduledQueryRuleCriteriaGenerator()) + gens["Identity"] = gen.PtrOf(IdentityGenerator()) + gens["OperatorSpec"] = gen.PtrOf(ScheduledQueryRuleOperatorSpecGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(RuleResolveConfigurationGenerator()) +} + +func Test_SystemData_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SystemData_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSystemData_STATUS, SystemData_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSystemData_STATUS runs a test to see if a specific instance of SystemData_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForSystemData_STATUS(subject SystemData_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SystemData_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SystemData_STATUS instances for property testing - lazily instantiated by SystemData_STATUSGenerator() +var systemData_STATUSGenerator gopter.Gen + +// SystemData_STATUSGenerator returns a generator of SystemData_STATUS instances for property testing. +func SystemData_STATUSGenerator() gopter.Gen { + if systemData_STATUSGenerator != nil { + return systemData_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSystemData_STATUS(generators) + systemData_STATUSGenerator = gen.Struct(reflect.TypeOf(SystemData_STATUS{}), generators) + + return systemData_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) { + gens["CreatedAt"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedBy"] = gen.PtrOf(gen.AlphaString()) + gens["CreatedByType"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedAt"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedByType"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_UserAssignedIdentityDetails_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 100 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserAssignedIdentityDetails via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserAssignedIdentityDetails, UserAssignedIdentityDetailsGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserAssignedIdentityDetails runs a test to see if a specific instance of UserAssignedIdentityDetails round trips to JSON and back losslessly +func RunJSONSerializationTestForUserAssignedIdentityDetails(subject UserAssignedIdentityDetails) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserAssignedIdentityDetails + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserAssignedIdentityDetails instances for property testing - lazily instantiated by +// UserAssignedIdentityDetailsGenerator() +var userAssignedIdentityDetailsGenerator gopter.Gen + +// UserAssignedIdentityDetailsGenerator returns a generator of UserAssignedIdentityDetails instances for property testing. +func UserAssignedIdentityDetailsGenerator() gopter.Gen { + if userAssignedIdentityDetailsGenerator != nil { + return userAssignedIdentityDetailsGenerator + } + + generators := make(map[string]gopter.Gen) + userAssignedIdentityDetailsGenerator = gen.Struct(reflect.TypeOf(UserAssignedIdentityDetails{}), generators) + + return userAssignedIdentityDetailsGenerator +} + +func Test_UserIdentityProperties_STATUS_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MinSuccessfulTests = 80 + parameters.MaxSize = 3 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of UserIdentityProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForUserIdentityProperties_STATUS, UserIdentityProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForUserIdentityProperties_STATUS runs a test to see if a specific instance of UserIdentityProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForUserIdentityProperties_STATUS(subject UserIdentityProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual UserIdentityProperties_STATUS + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of UserIdentityProperties_STATUS instances for property testing - lazily instantiated by +// UserIdentityProperties_STATUSGenerator() +var userIdentityProperties_STATUSGenerator gopter.Gen + +// UserIdentityProperties_STATUSGenerator returns a generator of UserIdentityProperties_STATUS instances for property testing. +func UserIdentityProperties_STATUSGenerator() gopter.Gen { + if userIdentityProperties_STATUSGenerator != nil { + return userIdentityProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(generators) + userIdentityProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(UserIdentityProperties_STATUS{}), generators) + + return userIdentityProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForUserIdentityProperties_STATUS(gens map[string]gopter.Gen) { + gens["ClientId"] = gen.PtrOf(gen.AlphaString()) + gens["PrincipalId"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/insights/v1api20231201/storage/structure.txt b/v2/api/insights/v1api20231201/storage/structure.txt new file mode 100644 index 00000000000..7123980b61b --- /dev/null +++ b/v2/api/insights/v1api20231201/storage/structure.txt @@ -0,0 +1,139 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage +----------------------------------------------------------------------------- +APIVersion: Enum (1 value) +└── "2023-12-01" +ScheduledQueryRule: Resource +├── Owner: resources/v1apiv20191001.ResourceGroup +├── Spec: Object (25 properties) +│ ├── Actions: *Object (4 properties) +│ │ ├── ActionGroupsReferences: genruntime.ResourceReference[] +│ │ ├── ActionProperties: map[string]string +│ │ ├── CustomProperties: map[string]string +│ │ └── PropertyBag: genruntime.PropertyBag +│ ├── AutoMitigate: *bool +│ ├── AzureName: string +│ ├── CheckWorkspaceAlertsStorageConfigured: *bool +│ ├── Criteria: *Object (2 properties) +│ │ ├── AllOf: Object (10 properties)[] +│ │ │ ├── Dimensions: Object (4 properties)[] +│ │ │ │ ├── Name: *string +│ │ │ │ ├── Operator: *string +│ │ │ │ ├── PropertyBag: genruntime.PropertyBag +│ │ │ │ └── Values: string[] +│ │ │ ├── FailingPeriods: *Object (3 properties) +│ │ │ │ ├── MinFailingPeriodsToAlert: *int +│ │ │ │ ├── NumberOfEvaluationPeriods: *int +│ │ │ │ └── PropertyBag: genruntime.PropertyBag +│ │ │ ├── MetricMeasureColumn: *string +│ │ │ ├── MetricName: *string +│ │ │ ├── Operator: *string +│ │ │ ├── PropertyBag: genruntime.PropertyBag +│ │ │ ├── Query: *string +│ │ │ ├── ResourceIdColumnReference: *genruntime.ResourceReference +│ │ │ ├── Threshold: *float64 +│ │ │ └── TimeAggregation: *string +│ │ └── PropertyBag: genruntime.PropertyBag +│ ├── Description: *string +│ ├── DisplayName: *string +│ ├── Enabled: *bool +│ ├── EvaluationFrequency: *string +│ ├── Identity: *Object (3 properties) +│ │ ├── PropertyBag: genruntime.PropertyBag +│ │ ├── Type: *string +│ │ └── UserAssignedIdentities: Object (2 properties)[] +│ │ ├── PropertyBag: genruntime.PropertyBag +│ │ └── Reference: genruntime.ResourceReference +│ ├── Kind: *string +│ ├── Location: *string +│ ├── MuteActionsDuration: *string +│ ├── OperatorSpec: *Object (3 properties) +│ │ ├── ConfigMapExpressions: *core.DestinationExpression[] +│ │ ├── PropertyBag: genruntime.PropertyBag +│ │ └── SecretExpressions: *core.DestinationExpression[] +│ ├── OriginalVersion: string +│ ├── OverrideQueryTimeRange: *string +│ ├── Owner: *genruntime.KnownResourceReference +│ ├── PropertyBag: genruntime.PropertyBag +│ ├── ResolveConfiguration: *Object (3 properties) +│ │ ├── AutoResolved: *bool +│ │ ├── PropertyBag: genruntime.PropertyBag +│ │ └── TimeToResolve: *string +│ ├── ScopesReferences: genruntime.ResourceReference[] +│ ├── Severity: *int +│ ├── SkipQueryValidation: *bool +│ ├── Tags: map[string]string +│ ├── TargetResourceTypes: string[] +│ └── WindowSize: *string +└── Status: Object (30 properties) + ├── Actions: *Object (4 properties) + │ ├── ActionGroups: string[] + │ ├── ActionProperties: map[string]string + │ ├── CustomProperties: map[string]string + │ └── PropertyBag: genruntime.PropertyBag + ├── AutoMitigate: *bool + ├── CheckWorkspaceAlertsStorageConfigured: *bool + ├── Conditions: conditions.Condition[] + ├── CreatedWithApiVersion: *string + ├── Criteria: *Object (2 properties) + │ ├── AllOf: Object (10 properties)[] + │ │ ├── Dimensions: Object (4 properties)[] + │ │ │ ├── Name: *string + │ │ │ ├── Operator: *string + │ │ │ ├── PropertyBag: genruntime.PropertyBag + │ │ │ └── Values: string[] + │ │ ├── FailingPeriods: *Object (3 properties) + │ │ │ ├── MinFailingPeriodsToAlert: *int + │ │ │ ├── NumberOfEvaluationPeriods: *int + │ │ │ └── PropertyBag: genruntime.PropertyBag + │ │ ├── MetricMeasureColumn: *string + │ │ ├── MetricName: *string + │ │ ├── Operator: *string + │ │ ├── PropertyBag: genruntime.PropertyBag + │ │ ├── Query: *string + │ │ ├── ResourceIdColumn: *string + │ │ ├── Threshold: *float64 + │ │ └── TimeAggregation: *string + │ └── PropertyBag: genruntime.PropertyBag + ├── Description: *string + ├── DisplayName: *string + ├── Enabled: *bool + ├── Etag: *string + ├── EvaluationFrequency: *string + ├── Id: *string + ├── Identity: *Object (5 properties) + │ ├── PrincipalId: *string + │ ├── PropertyBag: genruntime.PropertyBag + │ ├── TenantId: *string + │ ├── Type: *string + │ └── UserAssignedIdentities: map[string]Object (3 properties) + │ ├── ClientId: *string + │ ├── PrincipalId: *string + │ └── PropertyBag: genruntime.PropertyBag + ├── IsLegacyLogAnalyticsRule: *bool + ├── IsWorkspaceAlertsStorageConfigured: *bool + ├── Kind: *string + ├── Location: *string + ├── MuteActionsDuration: *string + ├── Name: *string + ├── OverrideQueryTimeRange: *string + ├── PropertyBag: genruntime.PropertyBag + ├── ResolveConfiguration: *Object (3 properties) + │ ├── AutoResolved: *bool + │ ├── PropertyBag: genruntime.PropertyBag + │ └── TimeToResolve: *string + ├── Scopes: string[] + ├── Severity: *int + ├── SkipQueryValidation: *bool + ├── SystemData: *Object (7 properties) + │ ├── CreatedAt: *string + │ ├── CreatedBy: *string + │ ├── CreatedByType: *string + │ ├── LastModifiedAt: *string + │ ├── LastModifiedBy: *string + │ ├── LastModifiedByType: *string + │ └── PropertyBag: genruntime.PropertyBag + ├── Tags: map[string]string + ├── TargetResourceTypes: string[] + ├── Type: *string + └── WindowSize: *string diff --git a/v2/api/insights/v1api20231201/storage/zz_generated.deepcopy.go b/v2/api/insights/v1api20231201/storage/zz_generated.deepcopy.go new file mode 100644 index 00000000000..195b538e18d --- /dev/null +++ b/v2/api/insights/v1api20231201/storage/zz_generated.deepcopy.go @@ -0,0 +1,1090 @@ +//go:build !ignore_autogenerated + +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/core" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Actions) DeepCopyInto(out *Actions) { + *out = *in + if in.ActionGroupsReferences != nil { + in, out := &in.ActionGroupsReferences, &out.ActionGroupsReferences + *out = make([]genruntime.ResourceReference, len(*in)) + copy(*out, *in) + } + if in.ActionProperties != nil { + in, out := &in.ActionProperties, &out.ActionProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Actions. +func (in *Actions) DeepCopy() *Actions { + if in == nil { + return nil + } + out := new(Actions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Actions_STATUS) DeepCopyInto(out *Actions_STATUS) { + *out = *in + if in.ActionGroups != nil { + in, out := &in.ActionGroups, &out.ActionGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ActionProperties != nil { + in, out := &in.ActionProperties, &out.ActionProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Actions_STATUS. +func (in *Actions_STATUS) DeepCopy() *Actions_STATUS { + if in == nil { + return nil + } + out := new(Actions_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + if in.Dimensions != nil { + in, out := &in.Dimensions, &out.Dimensions + *out = make([]Dimension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailingPeriods != nil { + in, out := &in.FailingPeriods, &out.FailingPeriods + *out = new(Condition_FailingPeriods) + (*in).DeepCopyInto(*out) + } + if in.MetricMeasureColumn != nil { + in, out := &in.MetricMeasureColumn, &out.MetricMeasureColumn + *out = new(string) + **out = **in + } + if in.MetricName != nil { + in, out := &in.MetricName, &out.MetricName + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Query != nil { + in, out := &in.Query, &out.Query + *out = new(string) + **out = **in + } + if in.ResourceIdColumnReference != nil { + in, out := &in.ResourceIdColumnReference, &out.ResourceIdColumnReference + *out = new(genruntime.ResourceReference) + **out = **in + } + if in.Threshold != nil { + in, out := &in.Threshold, &out.Threshold + *out = new(float64) + **out = **in + } + if in.TimeAggregation != nil { + in, out := &in.TimeAggregation, &out.TimeAggregation + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_FailingPeriods) DeepCopyInto(out *Condition_FailingPeriods) { + *out = *in + if in.MinFailingPeriodsToAlert != nil { + in, out := &in.MinFailingPeriodsToAlert, &out.MinFailingPeriodsToAlert + *out = new(int) + **out = **in + } + if in.NumberOfEvaluationPeriods != nil { + in, out := &in.NumberOfEvaluationPeriods, &out.NumberOfEvaluationPeriods + *out = new(int) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_FailingPeriods. +func (in *Condition_FailingPeriods) DeepCopy() *Condition_FailingPeriods { + if in == nil { + return nil + } + out := new(Condition_FailingPeriods) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_FailingPeriods_STATUS) DeepCopyInto(out *Condition_FailingPeriods_STATUS) { + *out = *in + if in.MinFailingPeriodsToAlert != nil { + in, out := &in.MinFailingPeriodsToAlert, &out.MinFailingPeriodsToAlert + *out = new(int) + **out = **in + } + if in.NumberOfEvaluationPeriods != nil { + in, out := &in.NumberOfEvaluationPeriods, &out.NumberOfEvaluationPeriods + *out = new(int) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_FailingPeriods_STATUS. +func (in *Condition_FailingPeriods_STATUS) DeepCopy() *Condition_FailingPeriods_STATUS { + if in == nil { + return nil + } + out := new(Condition_FailingPeriods_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_STATUS) DeepCopyInto(out *Condition_STATUS) { + *out = *in + if in.Dimensions != nil { + in, out := &in.Dimensions, &out.Dimensions + *out = make([]Dimension_STATUS, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailingPeriods != nil { + in, out := &in.FailingPeriods, &out.FailingPeriods + *out = new(Condition_FailingPeriods_STATUS) + (*in).DeepCopyInto(*out) + } + if in.MetricMeasureColumn != nil { + in, out := &in.MetricMeasureColumn, &out.MetricMeasureColumn + *out = new(string) + **out = **in + } + if in.MetricName != nil { + in, out := &in.MetricName, &out.MetricName + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Query != nil { + in, out := &in.Query, &out.Query + *out = new(string) + **out = **in + } + if in.ResourceIdColumn != nil { + in, out := &in.ResourceIdColumn, &out.ResourceIdColumn + *out = new(string) + **out = **in + } + if in.Threshold != nil { + in, out := &in.Threshold, &out.Threshold + *out = new(float64) + **out = **in + } + if in.TimeAggregation != nil { + in, out := &in.TimeAggregation, &out.TimeAggregation + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_STATUS. +func (in *Condition_STATUS) DeepCopy() *Condition_STATUS { + if in == nil { + return nil + } + out := new(Condition_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dimension) DeepCopyInto(out *Dimension) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dimension. +func (in *Dimension) DeepCopy() *Dimension { + if in == nil { + return nil + } + out := new(Dimension) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dimension_STATUS) DeepCopyInto(out *Dimension_STATUS) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dimension_STATUS. +func (in *Dimension_STATUS) DeepCopy() *Dimension_STATUS { + if in == nil { + return nil + } + out := new(Dimension_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Identity) DeepCopyInto(out *Identity) { + *out = *in + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.UserAssignedIdentities != nil { + in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities + *out = make([]UserAssignedIdentityDetails, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity. +func (in *Identity) DeepCopy() *Identity { + if in == nil { + return nil + } + out := new(Identity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Identity_STATUS) DeepCopyInto(out *Identity_STATUS) { + *out = *in + if in.PrincipalId != nil { + in, out := &in.PrincipalId, &out.PrincipalId + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TenantId != nil { + in, out := &in.TenantId, &out.TenantId + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.UserAssignedIdentities != nil { + in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities + *out = make(map[string]UserIdentityProperties_STATUS, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity_STATUS. +func (in *Identity_STATUS) DeepCopy() *Identity_STATUS { + if in == nil { + return nil + } + out := new(Identity_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleResolveConfiguration) DeepCopyInto(out *RuleResolveConfiguration) { + *out = *in + if in.AutoResolved != nil { + in, out := &in.AutoResolved, &out.AutoResolved + *out = new(bool) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TimeToResolve != nil { + in, out := &in.TimeToResolve, &out.TimeToResolve + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleResolveConfiguration. +func (in *RuleResolveConfiguration) DeepCopy() *RuleResolveConfiguration { + if in == nil { + return nil + } + out := new(RuleResolveConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleResolveConfiguration_STATUS) DeepCopyInto(out *RuleResolveConfiguration_STATUS) { + *out = *in + if in.AutoResolved != nil { + in, out := &in.AutoResolved, &out.AutoResolved + *out = new(bool) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TimeToResolve != nil { + in, out := &in.TimeToResolve, &out.TimeToResolve + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleResolveConfiguration_STATUS. +func (in *RuleResolveConfiguration_STATUS) DeepCopy() *RuleResolveConfiguration_STATUS { + if in == nil { + return nil + } + out := new(RuleResolveConfiguration_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule) DeepCopyInto(out *ScheduledQueryRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule. +func (in *ScheduledQueryRule) DeepCopy() *ScheduledQueryRule { + if in == nil { + return nil + } + out := new(ScheduledQueryRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduledQueryRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleCriteria) DeepCopyInto(out *ScheduledQueryRuleCriteria) { + *out = *in + if in.AllOf != nil { + in, out := &in.AllOf, &out.AllOf + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleCriteria. +func (in *ScheduledQueryRuleCriteria) DeepCopy() *ScheduledQueryRuleCriteria { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleCriteria) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleCriteria_STATUS) DeepCopyInto(out *ScheduledQueryRuleCriteria_STATUS) { + *out = *in + if in.AllOf != nil { + in, out := &in.AllOf, &out.AllOf + *out = make([]Condition_STATUS, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleCriteria_STATUS. +func (in *ScheduledQueryRuleCriteria_STATUS) DeepCopy() *ScheduledQueryRuleCriteria_STATUS { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleCriteria_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleList) DeepCopyInto(out *ScheduledQueryRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ScheduledQueryRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleList. +func (in *ScheduledQueryRuleList) DeepCopy() *ScheduledQueryRuleList { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduledQueryRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleOperatorSpec) DeepCopyInto(out *ScheduledQueryRuleOperatorSpec) { + *out = *in + if in.ConfigMapExpressions != nil { + in, out := &in.ConfigMapExpressions, &out.ConfigMapExpressions + *out = make([]*core.DestinationExpression, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(core.DestinationExpression) + **out = **in + } + } + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.SecretExpressions != nil { + in, out := &in.SecretExpressions, &out.SecretExpressions + *out = make([]*core.DestinationExpression, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(core.DestinationExpression) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleOperatorSpec. +func (in *ScheduledQueryRuleOperatorSpec) DeepCopy() *ScheduledQueryRuleOperatorSpec { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleOperatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule_STATUS) DeepCopyInto(out *ScheduledQueryRule_STATUS) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = new(Actions_STATUS) + (*in).DeepCopyInto(*out) + } + if in.AutoMitigate != nil { + in, out := &in.AutoMitigate, &out.AutoMitigate + *out = new(bool) + **out = **in + } + if in.CheckWorkspaceAlertsStorageConfigured != nil { + in, out := &in.CheckWorkspaceAlertsStorageConfigured, &out.CheckWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CreatedWithApiVersion != nil { + in, out := &in.CreatedWithApiVersion, &out.CreatedWithApiVersion + *out = new(string) + **out = **in + } + if in.Criteria != nil { + in, out := &in.Criteria, &out.Criteria + *out = new(ScheduledQueryRuleCriteria_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.EvaluationFrequency != nil { + in, out := &in.EvaluationFrequency, &out.EvaluationFrequency + *out = new(string) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Identity != nil { + in, out := &in.Identity, &out.Identity + *out = new(Identity_STATUS) + (*in).DeepCopyInto(*out) + } + if in.IsLegacyLogAnalyticsRule != nil { + in, out := &in.IsLegacyLogAnalyticsRule, &out.IsLegacyLogAnalyticsRule + *out = new(bool) + **out = **in + } + if in.IsWorkspaceAlertsStorageConfigured != nil { + in, out := &in.IsWorkspaceAlertsStorageConfigured, &out.IsWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.MuteActionsDuration != nil { + in, out := &in.MuteActionsDuration, &out.MuteActionsDuration + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.OverrideQueryTimeRange != nil { + in, out := &in.OverrideQueryTimeRange, &out.OverrideQueryTimeRange + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ResolveConfiguration != nil { + in, out := &in.ResolveConfiguration, &out.ResolveConfiguration + *out = new(RuleResolveConfiguration_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Scopes != nil { + in, out := &in.Scopes, &out.Scopes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Severity != nil { + in, out := &in.Severity, &out.Severity + *out = new(int) + **out = **in + } + if in.SkipQueryValidation != nil { + in, out := &in.SkipQueryValidation, &out.SkipQueryValidation + *out = new(bool) + **out = **in + } + if in.SystemData != nil { + in, out := &in.SystemData, &out.SystemData + *out = new(SystemData_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TargetResourceTypes != nil { + in, out := &in.TargetResourceTypes, &out.TargetResourceTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.WindowSize != nil { + in, out := &in.WindowSize, &out.WindowSize + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule_STATUS. +func (in *ScheduledQueryRule_STATUS) DeepCopy() *ScheduledQueryRule_STATUS { + if in == nil { + return nil + } + out := new(ScheduledQueryRule_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule_Spec) DeepCopyInto(out *ScheduledQueryRule_Spec) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = new(Actions) + (*in).DeepCopyInto(*out) + } + if in.AutoMitigate != nil { + in, out := &in.AutoMitigate, &out.AutoMitigate + *out = new(bool) + **out = **in + } + if in.CheckWorkspaceAlertsStorageConfigured != nil { + in, out := &in.CheckWorkspaceAlertsStorageConfigured, &out.CheckWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Criteria != nil { + in, out := &in.Criteria, &out.Criteria + *out = new(ScheduledQueryRuleCriteria) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.EvaluationFrequency != nil { + in, out := &in.EvaluationFrequency, &out.EvaluationFrequency + *out = new(string) + **out = **in + } + if in.Identity != nil { + in, out := &in.Identity, &out.Identity + *out = new(Identity) + (*in).DeepCopyInto(*out) + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.MuteActionsDuration != nil { + in, out := &in.MuteActionsDuration, &out.MuteActionsDuration + *out = new(string) + **out = **in + } + if in.OperatorSpec != nil { + in, out := &in.OperatorSpec, &out.OperatorSpec + *out = new(ScheduledQueryRuleOperatorSpec) + (*in).DeepCopyInto(*out) + } + if in.OverrideQueryTimeRange != nil { + in, out := &in.OverrideQueryTimeRange, &out.OverrideQueryTimeRange + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ResolveConfiguration != nil { + in, out := &in.ResolveConfiguration, &out.ResolveConfiguration + *out = new(RuleResolveConfiguration) + (*in).DeepCopyInto(*out) + } + if in.ScopesReferences != nil { + in, out := &in.ScopesReferences, &out.ScopesReferences + *out = make([]genruntime.ResourceReference, len(*in)) + copy(*out, *in) + } + if in.Severity != nil { + in, out := &in.Severity, &out.Severity + *out = new(int) + **out = **in + } + if in.SkipQueryValidation != nil { + in, out := &in.SkipQueryValidation, &out.SkipQueryValidation + *out = new(bool) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TargetResourceTypes != nil { + in, out := &in.TargetResourceTypes, &out.TargetResourceTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.WindowSize != nil { + in, out := &in.WindowSize, &out.WindowSize + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule_Spec. +func (in *ScheduledQueryRule_Spec) DeepCopy() *ScheduledQueryRule_Spec { + if in == nil { + return nil + } + out := new(ScheduledQueryRule_Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemData_STATUS) DeepCopyInto(out *SystemData_STATUS) { + *out = *in + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.CreatedBy != nil { + in, out := &in.CreatedBy, &out.CreatedBy + *out = new(string) + **out = **in + } + if in.CreatedByType != nil { + in, out := &in.CreatedByType, &out.CreatedByType + *out = new(string) + **out = **in + } + if in.LastModifiedAt != nil { + in, out := &in.LastModifiedAt, &out.LastModifiedAt + *out = new(string) + **out = **in + } + if in.LastModifiedBy != nil { + in, out := &in.LastModifiedBy, &out.LastModifiedBy + *out = new(string) + **out = **in + } + if in.LastModifiedByType != nil { + in, out := &in.LastModifiedByType, &out.LastModifiedByType + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemData_STATUS. +func (in *SystemData_STATUS) DeepCopy() *SystemData_STATUS { + if in == nil { + return nil + } + out := new(SystemData_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserAssignedIdentityDetails) DeepCopyInto(out *UserAssignedIdentityDetails) { + *out = *in + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + out.Reference = in.Reference +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAssignedIdentityDetails. +func (in *UserAssignedIdentityDetails) DeepCopy() *UserAssignedIdentityDetails { + if in == nil { + return nil + } + out := new(UserAssignedIdentityDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserIdentityProperties_STATUS) DeepCopyInto(out *UserIdentityProperties_STATUS) { + *out = *in + if in.ClientId != nil { + in, out := &in.ClientId, &out.ClientId + *out = new(string) + **out = **in + } + if in.PrincipalId != nil { + in, out := &in.PrincipalId, &out.PrincipalId + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserIdentityProperties_STATUS. +func (in *UserIdentityProperties_STATUS) DeepCopy() *UserIdentityProperties_STATUS { + if in == nil { + return nil + } + out := new(UserIdentityProperties_STATUS) + in.DeepCopyInto(out) + return out +} diff --git a/v2/api/insights/v1api20231201/structure.txt b/v2/api/insights/v1api20231201/structure.txt new file mode 100644 index 00000000000..aabf23af074 --- /dev/null +++ b/v2/api/insights/v1api20231201/structure.txt @@ -0,0 +1,171 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201 +--------------------------------------------------------------------- +APIVersion: Enum (1 value) +└── "2023-12-01" +ScheduledQueryRule: Resource +├── Owner: resources/v1apiv20191001.ResourceGroup +├── Spec: Object (23 properties) +│ ├── Actions: *Object (3 properties) +│ │ ├── ActionGroupsReferences: genruntime.ResourceReference[] +│ │ ├── ActionProperties: map[string]string +│ │ └── CustomProperties: map[string]string +│ ├── AutoMitigate: *bool +│ ├── AzureName: Validated (1 rule) +│ │ └── Rule 0: Pattern: "^[^#<>%&:\\?/{}*]{1,260}$" +│ ├── CheckWorkspaceAlertsStorageConfigured: *bool +│ ├── Criteria: *Object (1 property) +│ │ └── AllOf: Object (9 properties)[] +│ │ ├── Dimensions: Object (3 properties)[] +│ │ │ ├── Name: *string +│ │ │ ├── Operator: *Enum (2 values) +│ │ │ │ ├── "Exclude" +│ │ │ │ └── "Include" +│ │ │ └── Values: string[] +│ │ ├── FailingPeriods: *Object (2 properties) +│ │ │ ├── MinFailingPeriodsToAlert: *int +│ │ │ └── NumberOfEvaluationPeriods: *int +│ │ ├── MetricMeasureColumn: *string +│ │ ├── MetricName: *string +│ │ ├── Operator: *Enum (5 values) +│ │ │ ├── "Equals" +│ │ │ ├── "GreaterThan" +│ │ │ ├── "GreaterThanOrEqual" +│ │ │ ├── "LessThan" +│ │ │ └── "LessThanOrEqual" +│ │ ├── Query: *string +│ │ ├── ResourceIdColumnReference: *genruntime.ResourceReference +│ │ ├── Threshold: *float64 +│ │ └── TimeAggregation: *Enum (5 values) +│ │ ├── "Average" +│ │ ├── "Count" +│ │ ├── "Maximum" +│ │ ├── "Minimum" +│ │ └── "Total" +│ ├── Description: *string +│ ├── DisplayName: *string +│ ├── Enabled: *bool +│ ├── EvaluationFrequency: *string +│ ├── Identity: *Object (2 properties) +│ │ ├── Type: *Enum (3 values) +│ │ │ ├── "None" +│ │ │ ├── "SystemAssigned" +│ │ │ └── "UserAssigned" +│ │ └── UserAssignedIdentities: Object (1 property)[] +│ │ └── Reference: genruntime.ResourceReference +│ ├── Kind: *Enum (2 values) +│ │ ├── "LogAlert" +│ │ └── "LogToMetric" +│ ├── Location: *string +│ ├── MuteActionsDuration: *string +│ ├── OperatorSpec: *Object (2 properties) +│ │ ├── ConfigMapExpressions: *core.DestinationExpression[] +│ │ └── SecretExpressions: *core.DestinationExpression[] +│ ├── OverrideQueryTimeRange: *string +│ ├── Owner: *genruntime.KnownResourceReference +│ ├── ResolveConfiguration: *Object (2 properties) +│ │ ├── AutoResolved: *bool +│ │ └── TimeToResolve: *string +│ ├── ScopesReferences: genruntime.ResourceReference[] +│ ├── Severity: *Enum (5 values) +│ │ ├── 0 +│ │ ├── 1 +│ │ ├── 2 +│ │ ├── 3 +│ │ └── 4 +│ ├── SkipQueryValidation: *bool +│ ├── Tags: map[string]string +│ ├── TargetResourceTypes: string[] +│ └── WindowSize: *string +└── Status: Object (29 properties) + ├── Actions: *Object (3 properties) + │ ├── ActionGroups: string[] + │ ├── ActionProperties: map[string]string + │ └── CustomProperties: map[string]string + ├── AutoMitigate: *bool + ├── CheckWorkspaceAlertsStorageConfigured: *bool + ├── Conditions: conditions.Condition[] + ├── CreatedWithApiVersion: *string + ├── Criteria: *Object (1 property) + │ └── AllOf: Object (9 properties)[] + │ ├── Dimensions: Object (3 properties)[] + │ │ ├── Name: *string + │ │ ├── Operator: *Enum (2 values) + │ │ │ ├── "Exclude" + │ │ │ └── "Include" + │ │ └── Values: string[] + │ ├── FailingPeriods: *Object (2 properties) + │ │ ├── MinFailingPeriodsToAlert: *int + │ │ └── NumberOfEvaluationPeriods: *int + │ ├── MetricMeasureColumn: *string + │ ├── MetricName: *string + │ ├── Operator: *Enum (5 values) + │ │ ├── "Equals" + │ │ ├── "GreaterThan" + │ │ ├── "GreaterThanOrEqual" + │ │ ├── "LessThan" + │ │ └── "LessThanOrEqual" + │ ├── Query: *string + │ ├── ResourceIdColumn: *string + │ ├── Threshold: *float64 + │ └── TimeAggregation: *Enum (5 values) + │ ├── "Average" + │ ├── "Count" + │ ├── "Maximum" + │ ├── "Minimum" + │ └── "Total" + ├── Description: *string + ├── DisplayName: *string + ├── Enabled: *bool + ├── Etag: *string + ├── EvaluationFrequency: *string + ├── Id: *string + ├── Identity: *Object (4 properties) + │ ├── PrincipalId: *string + │ ├── TenantId: *string + │ ├── Type: *Enum (3 values) + │ │ ├── "None" + │ │ ├── "SystemAssigned" + │ │ └── "UserAssigned" + │ └── UserAssignedIdentities: map[string]Object (2 properties) + │ ├── ClientId: *string + │ └── PrincipalId: *string + ├── IsLegacyLogAnalyticsRule: *bool + ├── IsWorkspaceAlertsStorageConfigured: *bool + ├── Kind: *Enum (2 values) + │ ├── "LogAlert" + │ └── "LogToMetric" + ├── Location: *string + ├── MuteActionsDuration: *string + ├── Name: *string + ├── OverrideQueryTimeRange: *string + ├── ResolveConfiguration: *Object (2 properties) + │ ├── AutoResolved: *bool + │ └── TimeToResolve: *string + ├── Scopes: string[] + ├── Severity: *Enum (5 values) + │ ├── 0 + │ ├── 1 + │ ├── 2 + │ ├── 3 + │ └── 4 + ├── SkipQueryValidation: *bool + ├── SystemData: *Object (6 properties) + │ ├── CreatedAt: *string + │ ├── CreatedBy: *string + │ ├── CreatedByType: *Enum (4 values) + │ │ ├── "Application" + │ │ ├── "Key" + │ │ ├── "ManagedIdentity" + │ │ └── "User" + │ ├── LastModifiedAt: *string + │ ├── LastModifiedBy: *string + │ └── LastModifiedByType: *Enum (4 values) + │ ├── "Application" + │ ├── "Key" + │ ├── "ManagedIdentity" + │ └── "User" + ├── Tags: map[string]string + ├── TargetResourceTypes: string[] + ├── Type: *string + └── WindowSize: *string diff --git a/v2/api/insights/v1api20231201/zz_generated.deepcopy.go b/v2/api/insights/v1api20231201/zz_generated.deepcopy.go new file mode 100644 index 00000000000..98448976125 --- /dev/null +++ b/v2/api/insights/v1api20231201/zz_generated.deepcopy.go @@ -0,0 +1,948 @@ +//go:build !ignore_autogenerated + +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1api20231201 + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/core" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Actions) DeepCopyInto(out *Actions) { + *out = *in + if in.ActionGroupsReferences != nil { + in, out := &in.ActionGroupsReferences, &out.ActionGroupsReferences + *out = make([]genruntime.ResourceReference, len(*in)) + copy(*out, *in) + } + if in.ActionProperties != nil { + in, out := &in.ActionProperties, &out.ActionProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Actions. +func (in *Actions) DeepCopy() *Actions { + if in == nil { + return nil + } + out := new(Actions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Actions_STATUS) DeepCopyInto(out *Actions_STATUS) { + *out = *in + if in.ActionGroups != nil { + in, out := &in.ActionGroups, &out.ActionGroups + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ActionProperties != nil { + in, out := &in.ActionProperties, &out.ActionProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Actions_STATUS. +func (in *Actions_STATUS) DeepCopy() *Actions_STATUS { + if in == nil { + return nil + } + out := new(Actions_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + if in.Dimensions != nil { + in, out := &in.Dimensions, &out.Dimensions + *out = make([]Dimension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailingPeriods != nil { + in, out := &in.FailingPeriods, &out.FailingPeriods + *out = new(Condition_FailingPeriods) + (*in).DeepCopyInto(*out) + } + if in.MetricMeasureColumn != nil { + in, out := &in.MetricMeasureColumn, &out.MetricMeasureColumn + *out = new(string) + **out = **in + } + if in.MetricName != nil { + in, out := &in.MetricName, &out.MetricName + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(Condition_Operator) + **out = **in + } + if in.Query != nil { + in, out := &in.Query, &out.Query + *out = new(string) + **out = **in + } + if in.ResourceIdColumnReference != nil { + in, out := &in.ResourceIdColumnReference, &out.ResourceIdColumnReference + *out = new(genruntime.ResourceReference) + **out = **in + } + if in.Threshold != nil { + in, out := &in.Threshold, &out.Threshold + *out = new(float64) + **out = **in + } + if in.TimeAggregation != nil { + in, out := &in.TimeAggregation, &out.TimeAggregation + *out = new(Condition_TimeAggregation) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_FailingPeriods) DeepCopyInto(out *Condition_FailingPeriods) { + *out = *in + if in.MinFailingPeriodsToAlert != nil { + in, out := &in.MinFailingPeriodsToAlert, &out.MinFailingPeriodsToAlert + *out = new(int) + **out = **in + } + if in.NumberOfEvaluationPeriods != nil { + in, out := &in.NumberOfEvaluationPeriods, &out.NumberOfEvaluationPeriods + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_FailingPeriods. +func (in *Condition_FailingPeriods) DeepCopy() *Condition_FailingPeriods { + if in == nil { + return nil + } + out := new(Condition_FailingPeriods) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_FailingPeriods_STATUS) DeepCopyInto(out *Condition_FailingPeriods_STATUS) { + *out = *in + if in.MinFailingPeriodsToAlert != nil { + in, out := &in.MinFailingPeriodsToAlert, &out.MinFailingPeriodsToAlert + *out = new(int) + **out = **in + } + if in.NumberOfEvaluationPeriods != nil { + in, out := &in.NumberOfEvaluationPeriods, &out.NumberOfEvaluationPeriods + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_FailingPeriods_STATUS. +func (in *Condition_FailingPeriods_STATUS) DeepCopy() *Condition_FailingPeriods_STATUS { + if in == nil { + return nil + } + out := new(Condition_FailingPeriods_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition_STATUS) DeepCopyInto(out *Condition_STATUS) { + *out = *in + if in.Dimensions != nil { + in, out := &in.Dimensions, &out.Dimensions + *out = make([]Dimension_STATUS, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailingPeriods != nil { + in, out := &in.FailingPeriods, &out.FailingPeriods + *out = new(Condition_FailingPeriods_STATUS) + (*in).DeepCopyInto(*out) + } + if in.MetricMeasureColumn != nil { + in, out := &in.MetricMeasureColumn, &out.MetricMeasureColumn + *out = new(string) + **out = **in + } + if in.MetricName != nil { + in, out := &in.MetricName, &out.MetricName + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(Condition_Operator_STATUS) + **out = **in + } + if in.Query != nil { + in, out := &in.Query, &out.Query + *out = new(string) + **out = **in + } + if in.ResourceIdColumn != nil { + in, out := &in.ResourceIdColumn, &out.ResourceIdColumn + *out = new(string) + **out = **in + } + if in.Threshold != nil { + in, out := &in.Threshold, &out.Threshold + *out = new(float64) + **out = **in + } + if in.TimeAggregation != nil { + in, out := &in.TimeAggregation, &out.TimeAggregation + *out = new(Condition_TimeAggregation_STATUS) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition_STATUS. +func (in *Condition_STATUS) DeepCopy() *Condition_STATUS { + if in == nil { + return nil + } + out := new(Condition_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dimension) DeepCopyInto(out *Dimension) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(Dimension_Operator) + **out = **in + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dimension. +func (in *Dimension) DeepCopy() *Dimension { + if in == nil { + return nil + } + out := new(Dimension) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dimension_STATUS) DeepCopyInto(out *Dimension_STATUS) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(Dimension_Operator_STATUS) + **out = **in + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dimension_STATUS. +func (in *Dimension_STATUS) DeepCopy() *Dimension_STATUS { + if in == nil { + return nil + } + out := new(Dimension_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Identity) DeepCopyInto(out *Identity) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(Identity_Type) + **out = **in + } + if in.UserAssignedIdentities != nil { + in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities + *out = make([]UserAssignedIdentityDetails, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity. +func (in *Identity) DeepCopy() *Identity { + if in == nil { + return nil + } + out := new(Identity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Identity_STATUS) DeepCopyInto(out *Identity_STATUS) { + *out = *in + if in.PrincipalId != nil { + in, out := &in.PrincipalId, &out.PrincipalId + *out = new(string) + **out = **in + } + if in.TenantId != nil { + in, out := &in.TenantId, &out.TenantId + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(Identity_Type_STATUS) + **out = **in + } + if in.UserAssignedIdentities != nil { + in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities + *out = make(map[string]UserIdentityProperties_STATUS, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity_STATUS. +func (in *Identity_STATUS) DeepCopy() *Identity_STATUS { + if in == nil { + return nil + } + out := new(Identity_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleResolveConfiguration) DeepCopyInto(out *RuleResolveConfiguration) { + *out = *in + if in.AutoResolved != nil { + in, out := &in.AutoResolved, &out.AutoResolved + *out = new(bool) + **out = **in + } + if in.TimeToResolve != nil { + in, out := &in.TimeToResolve, &out.TimeToResolve + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleResolveConfiguration. +func (in *RuleResolveConfiguration) DeepCopy() *RuleResolveConfiguration { + if in == nil { + return nil + } + out := new(RuleResolveConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleResolveConfiguration_STATUS) DeepCopyInto(out *RuleResolveConfiguration_STATUS) { + *out = *in + if in.AutoResolved != nil { + in, out := &in.AutoResolved, &out.AutoResolved + *out = new(bool) + **out = **in + } + if in.TimeToResolve != nil { + in, out := &in.TimeToResolve, &out.TimeToResolve + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleResolveConfiguration_STATUS. +func (in *RuleResolveConfiguration_STATUS) DeepCopy() *RuleResolveConfiguration_STATUS { + if in == nil { + return nil + } + out := new(RuleResolveConfiguration_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule) DeepCopyInto(out *ScheduledQueryRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule. +func (in *ScheduledQueryRule) DeepCopy() *ScheduledQueryRule { + if in == nil { + return nil + } + out := new(ScheduledQueryRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduledQueryRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleCriteria) DeepCopyInto(out *ScheduledQueryRuleCriteria) { + *out = *in + if in.AllOf != nil { + in, out := &in.AllOf, &out.AllOf + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleCriteria. +func (in *ScheduledQueryRuleCriteria) DeepCopy() *ScheduledQueryRuleCriteria { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleCriteria) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleCriteria_STATUS) DeepCopyInto(out *ScheduledQueryRuleCriteria_STATUS) { + *out = *in + if in.AllOf != nil { + in, out := &in.AllOf, &out.AllOf + *out = make([]Condition_STATUS, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleCriteria_STATUS. +func (in *ScheduledQueryRuleCriteria_STATUS) DeepCopy() *ScheduledQueryRuleCriteria_STATUS { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleCriteria_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleList) DeepCopyInto(out *ScheduledQueryRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ScheduledQueryRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleList. +func (in *ScheduledQueryRuleList) DeepCopy() *ScheduledQueryRuleList { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduledQueryRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRuleOperatorSpec) DeepCopyInto(out *ScheduledQueryRuleOperatorSpec) { + *out = *in + if in.ConfigMapExpressions != nil { + in, out := &in.ConfigMapExpressions, &out.ConfigMapExpressions + *out = make([]*core.DestinationExpression, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(core.DestinationExpression) + **out = **in + } + } + } + if in.SecretExpressions != nil { + in, out := &in.SecretExpressions, &out.SecretExpressions + *out = make([]*core.DestinationExpression, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(core.DestinationExpression) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRuleOperatorSpec. +func (in *ScheduledQueryRuleOperatorSpec) DeepCopy() *ScheduledQueryRuleOperatorSpec { + if in == nil { + return nil + } + out := new(ScheduledQueryRuleOperatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule_STATUS) DeepCopyInto(out *ScheduledQueryRule_STATUS) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = new(Actions_STATUS) + (*in).DeepCopyInto(*out) + } + if in.AutoMitigate != nil { + in, out := &in.AutoMitigate, &out.AutoMitigate + *out = new(bool) + **out = **in + } + if in.CheckWorkspaceAlertsStorageConfigured != nil { + in, out := &in.CheckWorkspaceAlertsStorageConfigured, &out.CheckWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CreatedWithApiVersion != nil { + in, out := &in.CreatedWithApiVersion, &out.CreatedWithApiVersion + *out = new(string) + **out = **in + } + if in.Criteria != nil { + in, out := &in.Criteria, &out.Criteria + *out = new(ScheduledQueryRuleCriteria_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.EvaluationFrequency != nil { + in, out := &in.EvaluationFrequency, &out.EvaluationFrequency + *out = new(string) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Identity != nil { + in, out := &in.Identity, &out.Identity + *out = new(Identity_STATUS) + (*in).DeepCopyInto(*out) + } + if in.IsLegacyLogAnalyticsRule != nil { + in, out := &in.IsLegacyLogAnalyticsRule, &out.IsLegacyLogAnalyticsRule + *out = new(bool) + **out = **in + } + if in.IsWorkspaceAlertsStorageConfigured != nil { + in, out := &in.IsWorkspaceAlertsStorageConfigured, &out.IsWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(ScheduledQueryRule_Kind_STATUS) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.MuteActionsDuration != nil { + in, out := &in.MuteActionsDuration, &out.MuteActionsDuration + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.OverrideQueryTimeRange != nil { + in, out := &in.OverrideQueryTimeRange, &out.OverrideQueryTimeRange + *out = new(string) + **out = **in + } + if in.ResolveConfiguration != nil { + in, out := &in.ResolveConfiguration, &out.ResolveConfiguration + *out = new(RuleResolveConfiguration_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Scopes != nil { + in, out := &in.Scopes, &out.Scopes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Severity != nil { + in, out := &in.Severity, &out.Severity + *out = new(ScheduledQueryRuleProperties_Severity_STATUS) + **out = **in + } + if in.SkipQueryValidation != nil { + in, out := &in.SkipQueryValidation, &out.SkipQueryValidation + *out = new(bool) + **out = **in + } + if in.SystemData != nil { + in, out := &in.SystemData, &out.SystemData + *out = new(SystemData_STATUS) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TargetResourceTypes != nil { + in, out := &in.TargetResourceTypes, &out.TargetResourceTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.WindowSize != nil { + in, out := &in.WindowSize, &out.WindowSize + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule_STATUS. +func (in *ScheduledQueryRule_STATUS) DeepCopy() *ScheduledQueryRule_STATUS { + if in == nil { + return nil + } + out := new(ScheduledQueryRule_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduledQueryRule_Spec) DeepCopyInto(out *ScheduledQueryRule_Spec) { + *out = *in + if in.Actions != nil { + in, out := &in.Actions, &out.Actions + *out = new(Actions) + (*in).DeepCopyInto(*out) + } + if in.AutoMitigate != nil { + in, out := &in.AutoMitigate, &out.AutoMitigate + *out = new(bool) + **out = **in + } + if in.CheckWorkspaceAlertsStorageConfigured != nil { + in, out := &in.CheckWorkspaceAlertsStorageConfigured, &out.CheckWorkspaceAlertsStorageConfigured + *out = new(bool) + **out = **in + } + if in.Criteria != nil { + in, out := &in.Criteria, &out.Criteria + *out = new(ScheduledQueryRuleCriteria) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.EvaluationFrequency != nil { + in, out := &in.EvaluationFrequency, &out.EvaluationFrequency + *out = new(string) + **out = **in + } + if in.Identity != nil { + in, out := &in.Identity, &out.Identity + *out = new(Identity) + (*in).DeepCopyInto(*out) + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(ScheduledQueryRule_Kind_Spec) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.MuteActionsDuration != nil { + in, out := &in.MuteActionsDuration, &out.MuteActionsDuration + *out = new(string) + **out = **in + } + if in.OperatorSpec != nil { + in, out := &in.OperatorSpec, &out.OperatorSpec + *out = new(ScheduledQueryRuleOperatorSpec) + (*in).DeepCopyInto(*out) + } + if in.OverrideQueryTimeRange != nil { + in, out := &in.OverrideQueryTimeRange, &out.OverrideQueryTimeRange + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } + if in.ResolveConfiguration != nil { + in, out := &in.ResolveConfiguration, &out.ResolveConfiguration + *out = new(RuleResolveConfiguration) + (*in).DeepCopyInto(*out) + } + if in.ScopesReferences != nil { + in, out := &in.ScopesReferences, &out.ScopesReferences + *out = make([]genruntime.ResourceReference, len(*in)) + copy(*out, *in) + } + if in.Severity != nil { + in, out := &in.Severity, &out.Severity + *out = new(ScheduledQueryRuleProperties_Severity) + **out = **in + } + if in.SkipQueryValidation != nil { + in, out := &in.SkipQueryValidation, &out.SkipQueryValidation + *out = new(bool) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TargetResourceTypes != nil { + in, out := &in.TargetResourceTypes, &out.TargetResourceTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.WindowSize != nil { + in, out := &in.WindowSize, &out.WindowSize + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduledQueryRule_Spec. +func (in *ScheduledQueryRule_Spec) DeepCopy() *ScheduledQueryRule_Spec { + if in == nil { + return nil + } + out := new(ScheduledQueryRule_Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemData_STATUS) DeepCopyInto(out *SystemData_STATUS) { + *out = *in + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.CreatedBy != nil { + in, out := &in.CreatedBy, &out.CreatedBy + *out = new(string) + **out = **in + } + if in.CreatedByType != nil { + in, out := &in.CreatedByType, &out.CreatedByType + *out = new(SystemData_CreatedByType_STATUS) + **out = **in + } + if in.LastModifiedAt != nil { + in, out := &in.LastModifiedAt, &out.LastModifiedAt + *out = new(string) + **out = **in + } + if in.LastModifiedBy != nil { + in, out := &in.LastModifiedBy, &out.LastModifiedBy + *out = new(string) + **out = **in + } + if in.LastModifiedByType != nil { + in, out := &in.LastModifiedByType, &out.LastModifiedByType + *out = new(SystemData_LastModifiedByType_STATUS) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemData_STATUS. +func (in *SystemData_STATUS) DeepCopy() *SystemData_STATUS { + if in == nil { + return nil + } + out := new(SystemData_STATUS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserAssignedIdentityDetails) DeepCopyInto(out *UserAssignedIdentityDetails) { + *out = *in + out.Reference = in.Reference +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAssignedIdentityDetails. +func (in *UserAssignedIdentityDetails) DeepCopy() *UserAssignedIdentityDetails { + if in == nil { + return nil + } + out := new(UserAssignedIdentityDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserIdentityProperties_STATUS) DeepCopyInto(out *UserIdentityProperties_STATUS) { + *out = *in + if in.ClientId != nil { + in, out := &in.ClientId, &out.ClientId + *out = new(string) + **out = **in + } + if in.PrincipalId != nil { + in, out := &in.PrincipalId, &out.PrincipalId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserIdentityProperties_STATUS. +func (in *UserIdentityProperties_STATUS) DeepCopy() *UserIdentityProperties_STATUS { + if in == nil { + return nil + } + out := new(UserIdentityProperties_STATUS) + in.DeepCopyInto(out) + return out +} diff --git a/v2/api/insights/versions_matrix.md b/v2/api/insights/versions_matrix.md index 98021820033..7ff01756a00 100644 --- a/v2/api/insights/versions_matrix.md +++ b/v2/api/insights/versions_matrix.md @@ -1,199 +1,207 @@ -| Type Definitions in package "insights" | v1api20180301 | v1api20180501preview | v1api20200202 | v1api20210501preview | v1api20220615 | v1api20221001 | v1api20230101 | -|--------------------------------------------------------------------|---------------|----------------------|---------------|----------------------|---------------|---------------|---------------| -| APIVersion | v1api20180301 | v1api20180501preview | v1api20200202 | v1api20210501preview | v1api20220615 | v1api20221001 | v1api20230101 | -| ActionGroup | | | | | | | v1api20230101 | -| ActionGroupResource_STATUS | | | | | | | v1api20230101 | -| ActionGroupSpec | | | | | | | v1api20230101 | -| ActionGroup_STATUS | | | | | | | v1api20230101 | -| ActionGroup_Spec | | | | | | | v1api20230101 | -| Actions | | | | | v1api20220615 | | | -| Actions_STATUS | | | | | v1api20220615 | | | -| ApplicationInsightsComponentProperties | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Application_Type | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Application_Type_STATUS | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Flow_Type | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Flow_Type_STATUS | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_IngestionMode | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_IngestionMode_STATUS | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Request_Source | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_Request_Source_STATUS | | | v1api20200202 | | | | | -| ApplicationInsightsComponentProperties_STATUS | | | v1api20200202 | | | | | -| ArmRoleReceiver | | | | | | | v1api20230101 | -| ArmRoleReceiver_STATUS | | | | | | | v1api20230101 | -| AutomationRunbookReceiver | | | | | | | v1api20230101 | -| AutomationRunbookReceiver_STATUS | | | | | | | v1api20230101 | -| AutoscaleNotification | | | | | | v1api20221001 | | -| AutoscaleNotification_Operation | | | | | | v1api20221001 | | -| AutoscaleNotification_Operation_STATUS | | | | | | v1api20221001 | | -| AutoscaleNotification_STATUS | | | | | | v1api20221001 | | -| AutoscaleProfile | | | | | | v1api20221001 | | -| AutoscaleProfile_STATUS | | | | | | v1api20221001 | | -| AutoscaleSetting | | | | | | v1api20221001 | | -| AutoscaleSettingProperties | | | | | | v1api20221001 | | -| AutoscaleSetting_STATUS | | | | | | v1api20221001 | | -| AutoscaleSetting_Spec | | | | | | v1api20221001 | | -| Autoscalesetting_STATUS | | | | | | v1api20221001 | | -| AzureAppPushReceiver | | | | | | | v1api20230101 | -| AzureAppPushReceiver_STATUS | | | | | | | v1api20230101 | -| AzureFunctionReceiver | | | | | | | v1api20230101 | -| AzureFunctionReceiver_STATUS | | | | | | | v1api20230101 | -| Component | | | v1api20200202 | | | | | -| Component_STATUS | | | v1api20200202 | | | | | -| Component_Spec | | | v1api20200202 | | | | | -| Condition | | | | | v1api20220615 | | | -| Condition_FailingPeriods | | | | | v1api20220615 | | | -| Condition_FailingPeriods_STATUS | | | | | v1api20220615 | | | -| Condition_Operator | | | | | v1api20220615 | | | -| Condition_Operator_STATUS | | | | | v1api20220615 | | | -| Condition_STATUS | | | | | v1api20220615 | | | -| Condition_TimeAggregation | | | | | v1api20220615 | | | -| Condition_TimeAggregation_STATUS | | | | | v1api20220615 | | | -| DiagnosticSetting | | | | v1api20210501preview | | | | -| DiagnosticSetting_STATUS | | | | v1api20210501preview | | | | -| DiagnosticSetting_Spec | | | | v1api20210501preview | | | | -| DiagnosticSettings | | | | v1api20210501preview | | | | -| DiagnosticSettings_STATUS | | | | v1api20210501preview | | | | -| Dimension | | | | | v1api20220615 | | | -| Dimension_Operator | | | | | v1api20220615 | | | -| Dimension_Operator_STATUS | | | | | v1api20220615 | | | -| Dimension_STATUS | | | | | v1api20220615 | | | -| DynamicMetricCriteria | v1api20180301 | | | | | | | -| DynamicMetricCriteria_AlertSensitivity | v1api20180301 | | | | | | | -| DynamicMetricCriteria_AlertSensitivity_STATUS | v1api20180301 | | | | | | | -| DynamicMetricCriteria_CriterionType | v1api20180301 | | | | | | | -| DynamicMetricCriteria_CriterionType_STATUS | v1api20180301 | | | | | | | -| DynamicMetricCriteria_Operator | v1api20180301 | | | | | | | -| DynamicMetricCriteria_Operator_STATUS | v1api20180301 | | | | | | | -| DynamicMetricCriteria_STATUS | v1api20180301 | | | | | | | -| DynamicMetricCriteria_TimeAggregation | v1api20180301 | | | | | | | -| DynamicMetricCriteria_TimeAggregation_STATUS | v1api20180301 | | | | | | | -| DynamicThresholdFailingPeriods | v1api20180301 | | | | | | | -| DynamicThresholdFailingPeriods_STATUS | v1api20180301 | | | | | | | -| EmailNotification | | | | | | v1api20221001 | | -| EmailNotification_STATUS | | | | | | v1api20221001 | | -| EmailReceiver | | | | | | | v1api20230101 | -| EmailReceiver_STATUS | | | | | | | v1api20230101 | -| EventHubReceiver | | | | | | | v1api20230101 | -| EventHubReceiver_STATUS | | | | | | | v1api20230101 | -| HeaderField | | v1api20180501preview | | | v1api20220615 | | | -| HeaderField_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| ItsmReceiver | | | | | | | v1api20230101 | -| ItsmReceiver_STATUS | | | | | | | v1api20230101 | -| LogSettings | | | | v1api20210501preview | | | | -| LogSettings_STATUS | | | | v1api20210501preview | | | | -| LogicAppReceiver | | | | | | | v1api20230101 | -| LogicAppReceiver_STATUS | | | | | | | v1api20230101 | -| MetricAlert | v1api20180301 | | | | | | | -| MetricAlertAction | v1api20180301 | | | | | | | -| MetricAlertAction_STATUS | v1api20180301 | | | | | | | -| MetricAlertCriteria | v1api20180301 | | | | | | | -| MetricAlertCriteria_STATUS | v1api20180301 | | | | | | | -| MetricAlertMultipleResourceMultipleMetricCriteria | v1api20180301 | | | | | | | -| MetricAlertMultipleResourceMultipleMetricCriteria_OdataType | v1api20180301 | | | | | | | -| MetricAlertMultipleResourceMultipleMetricCriteria_OdataType_STATUS | v1api20180301 | | | | | | | -| MetricAlertMultipleResourceMultipleMetricCriteria_STATUS | v1api20180301 | | | | | | | -| MetricAlertProperties | v1api20180301 | | | | | | | -| MetricAlertProperties_STATUS | v1api20180301 | | | | | | | -| MetricAlertSingleResourceMultipleMetricCriteria | v1api20180301 | | | | | | | -| MetricAlertSingleResourceMultipleMetricCriteria_OdataType | v1api20180301 | | | | | | | -| MetricAlertSingleResourceMultipleMetricCriteria_OdataType_STATUS | v1api20180301 | | | | | | | -| MetricAlertSingleResourceMultipleMetricCriteria_STATUS | v1api20180301 | | | | | | | -| MetricAlert_STATUS | v1api20180301 | | | | | | | -| MetricAlert_Spec | v1api20180301 | | | | | | | -| MetricCriteria | v1api20180301 | | | | | | | -| MetricCriteria_CriterionType | v1api20180301 | | | | | | | -| MetricCriteria_CriterionType_STATUS | v1api20180301 | | | | | | | -| MetricCriteria_Operator | v1api20180301 | | | | | | | -| MetricCriteria_Operator_STATUS | v1api20180301 | | | | | | | -| MetricCriteria_STATUS | v1api20180301 | | | | | | | -| MetricCriteria_TimeAggregation | v1api20180301 | | | | | | | -| MetricCriteria_TimeAggregation_STATUS | v1api20180301 | | | | | | | -| MetricDimension | v1api20180301 | | | | | | | -| MetricDimension_STATUS | v1api20180301 | | | | | | | -| MetricSettings | | | | v1api20210501preview | | | | -| MetricSettings_STATUS | | | | v1api20210501preview | | | | -| MetricTrigger | | | | | | v1api20221001 | | -| MetricTrigger_Operator | | | | | | v1api20221001 | | -| MetricTrigger_Operator_STATUS | | | | | | v1api20221001 | | -| MetricTrigger_STATUS | | | | | | v1api20221001 | | -| MetricTrigger_Statistic | | | | | | v1api20221001 | | -| MetricTrigger_Statistic_STATUS | | | | | | v1api20221001 | | -| MetricTrigger_TimeAggregation | | | | | | v1api20221001 | | -| MetricTrigger_TimeAggregation_STATUS | | | | | | v1api20221001 | | -| MultiMetricCriteria | v1api20180301 | | | | | | | -| MultiMetricCriteria_STATUS | v1api20180301 | | | | | | | -| PredictiveAutoscalePolicy | | | | | | v1api20221001 | | -| PredictiveAutoscalePolicy_STATUS | | | | | | v1api20221001 | | -| PredictiveAutoscalePolicy_ScaleMode | | | | | | v1api20221001 | | -| PredictiveAutoscalePolicy_ScaleMode_STATUS | | | | | | v1api20221001 | | -| PrivateLinkScopedResource_STATUS | | | v1api20200202 | | | | | -| PublicNetworkAccessType | | | v1api20200202 | | | | | -| PublicNetworkAccessType_STATUS | | | v1api20200202 | | | | | -| ReceiverStatus_STATUS | | | | | | | v1api20230101 | -| Recurrence | | | | | | v1api20221001 | | -| Recurrence_Frequency | | | | | | v1api20221001 | | -| Recurrence_Frequency_STATUS | | | | | | v1api20221001 | | -| Recurrence_STATUS | | | | | | v1api20221001 | | -| RecurrentSchedule | | | | | | v1api20221001 | | -| RecurrentSchedule_STATUS | | | | | | v1api20221001 | | -| RetentionPolicy | | | | v1api20210501preview | | | | -| RetentionPolicy_STATUS | | | | v1api20210501preview | | | | -| ScaleAction | | | | | | v1api20221001 | | -| ScaleAction_Direction | | | | | | v1api20221001 | | -| ScaleAction_Direction_STATUS | | | | | | v1api20221001 | | -| ScaleAction_STATUS | | | | | | v1api20221001 | | -| ScaleAction_Type | | | | | | v1api20221001 | | -| ScaleAction_Type_STATUS | | | | | | v1api20221001 | | -| ScaleCapacity | | | | | | v1api20221001 | | -| ScaleCapacity_STATUS | | | | | | v1api20221001 | | -| ScaleRule | | | | | | v1api20221001 | | -| ScaleRuleMetricDimension | | | | | | v1api20221001 | | -| ScaleRuleMetricDimension_Operator | | | | | | v1api20221001 | | -| ScaleRuleMetricDimension_Operator_STATUS | | | | | | v1api20221001 | | -| ScaleRuleMetricDimension_STATUS | | | | | | v1api20221001 | | -| ScaleRule_STATUS | | | | | | v1api20221001 | | -| ScheduledQueryRule | | | | | v1api20220615 | | | -| ScheduledQueryRuleCriteria | | | | | v1api20220615 | | | -| ScheduledQueryRuleCriteria_STATUS | | | | | v1api20220615 | | | -| ScheduledQueryRuleProperties | | | | | v1api20220615 | | | -| ScheduledQueryRuleProperties_STATUS | | | | | v1api20220615 | | | -| ScheduledQueryRuleProperties_Severity | | | | | v1api20220615 | | | -| ScheduledQueryRuleProperties_Severity_STATUS | | | | | v1api20220615 | | | -| ScheduledQueryRule_Kind_STATUS | | | | | v1api20220615 | | | -| ScheduledQueryRule_Kind_Spec | | | | | v1api20220615 | | | -| ScheduledQueryRule_STATUS | | | | | v1api20220615 | | | -| ScheduledQueryRule_Spec | | | | | v1api20220615 | | | -| SmsReceiver | | | | | | | v1api20230101 | -| SmsReceiver_STATUS | | | | | | | v1api20230101 | -| SystemData_CreatedByType_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | -| SystemData_LastModifiedByType_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | -| SystemData_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | -| TimeWindow | | | | | | v1api20221001 | | -| TimeWindow_STATUS | | | | | | v1api20221001 | | -| VoiceReceiver | | | | | | | v1api20230101 | -| VoiceReceiver_STATUS | | | | | | | v1api20230101 | -| WebTestGeolocation | | v1api20180501preview | | | v1api20220615 | | | -| WebTestGeolocation_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Configuration | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Configuration_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Kind | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Kind_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Request | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_Request_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_ValidationRules | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_ValidationRules_ContentValidation | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_ValidationRules_ContentValidation_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebTestProperties_ValidationRules_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| WebhookNotification | | | | | | v1api20221001 | | -| WebhookNotification_STATUS | | | | | | v1api20221001 | | -| WebhookReceiver | | | | | | | v1api20230101 | -| WebhookReceiver_STATUS | | | | | | | v1api20230101 | -| Webtest | | v1api20180501preview | | | v1api20220615 | | | -| WebtestLocationAvailabilityCriteria | v1api20180301 | | | | | | | -| WebtestLocationAvailabilityCriteria_OdataType | v1api20180301 | | | | | | | -| WebtestLocationAvailabilityCriteria_OdataType_STATUS | v1api20180301 | | | | | | | -| WebtestLocationAvailabilityCriteria_STATUS | v1api20180301 | | | | | | | -| Webtest_STATUS | | v1api20180501preview | | | v1api20220615 | | | -| Webtest_Spec | | v1api20180501preview | | | v1api20220615 | | | +| Type Definitions in package "insights" | v1api20180301 | v1api20180501preview | v1api20200202 | v1api20210501preview | v1api20220615 | v1api20221001 | v1api20230101 | v1api20231201 | +|--------------------------------------------------------------------|---------------|----------------------|---------------|----------------------|---------------|---------------|---------------|---------------| +| APIVersion | v1api20180301 | v1api20180501preview | v1api20200202 | v1api20210501preview | v1api20220615 | v1api20221001 | v1api20230101 | v1api20231201 | +| ActionGroup | | | | | | | v1api20230101 | | +| ActionGroupResource_STATUS | | | | | | | v1api20230101 | | +| ActionGroupSpec | | | | | | | v1api20230101 | | +| ActionGroup_STATUS | | | | | | | v1api20230101 | | +| ActionGroup_Spec | | | | | | | v1api20230101 | | +| Actions | | | | | v1api20220615 | | | v1api20231201 | +| Actions_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ApplicationInsightsComponentProperties | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Application_Type | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Application_Type_STATUS | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Flow_Type | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Flow_Type_STATUS | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_IngestionMode | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_IngestionMode_STATUS | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Request_Source | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_Request_Source_STATUS | | | v1api20200202 | | | | | | +| ApplicationInsightsComponentProperties_STATUS | | | v1api20200202 | | | | | | +| ArmRoleReceiver | | | | | | | v1api20230101 | | +| ArmRoleReceiver_STATUS | | | | | | | v1api20230101 | | +| AutomationRunbookReceiver | | | | | | | v1api20230101 | | +| AutomationRunbookReceiver_STATUS | | | | | | | v1api20230101 | | +| AutoscaleNotification | | | | | | v1api20221001 | | | +| AutoscaleNotification_Operation | | | | | | v1api20221001 | | | +| AutoscaleNotification_Operation_STATUS | | | | | | v1api20221001 | | | +| AutoscaleNotification_STATUS | | | | | | v1api20221001 | | | +| AutoscaleProfile | | | | | | v1api20221001 | | | +| AutoscaleProfile_STATUS | | | | | | v1api20221001 | | | +| AutoscaleSetting | | | | | | v1api20221001 | | | +| AutoscaleSettingProperties | | | | | | v1api20221001 | | | +| AutoscaleSetting_STATUS | | | | | | v1api20221001 | | | +| AutoscaleSetting_Spec | | | | | | v1api20221001 | | | +| Autoscalesetting_STATUS | | | | | | v1api20221001 | | | +| AzureAppPushReceiver | | | | | | | v1api20230101 | | +| AzureAppPushReceiver_STATUS | | | | | | | v1api20230101 | | +| AzureFunctionReceiver | | | | | | | v1api20230101 | | +| AzureFunctionReceiver_STATUS | | | | | | | v1api20230101 | | +| Component | | | v1api20200202 | | | | | | +| Component_STATUS | | | v1api20200202 | | | | | | +| Component_Spec | | | v1api20200202 | | | | | | +| Condition | | | | | v1api20220615 | | | v1api20231201 | +| Condition_FailingPeriods | | | | | v1api20220615 | | | v1api20231201 | +| Condition_FailingPeriods_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| Condition_Operator | | | | | v1api20220615 | | | v1api20231201 | +| Condition_Operator_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| Condition_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| Condition_TimeAggregation | | | | | v1api20220615 | | | v1api20231201 | +| Condition_TimeAggregation_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| DiagnosticSetting | | | | v1api20210501preview | | | | | +| DiagnosticSetting_STATUS | | | | v1api20210501preview | | | | | +| DiagnosticSetting_Spec | | | | v1api20210501preview | | | | | +| DiagnosticSettings | | | | v1api20210501preview | | | | | +| DiagnosticSettings_STATUS | | | | v1api20210501preview | | | | | +| Dimension | | | | | v1api20220615 | | | v1api20231201 | +| Dimension_Operator | | | | | v1api20220615 | | | v1api20231201 | +| Dimension_Operator_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| Dimension_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| DynamicMetricCriteria | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_AlertSensitivity | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_AlertSensitivity_STATUS | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_CriterionType | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_CriterionType_STATUS | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_Operator | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_Operator_STATUS | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_STATUS | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_TimeAggregation | v1api20180301 | | | | | | | | +| DynamicMetricCriteria_TimeAggregation_STATUS | v1api20180301 | | | | | | | | +| DynamicThresholdFailingPeriods | v1api20180301 | | | | | | | | +| DynamicThresholdFailingPeriods_STATUS | v1api20180301 | | | | | | | | +| EmailNotification | | | | | | v1api20221001 | | | +| EmailNotification_STATUS | | | | | | v1api20221001 | | | +| EmailReceiver | | | | | | | v1api20230101 | | +| EmailReceiver_STATUS | | | | | | | v1api20230101 | | +| EventHubReceiver | | | | | | | v1api20230101 | | +| EventHubReceiver_STATUS | | | | | | | v1api20230101 | | +| HeaderField | | v1api20180501preview | | | v1api20220615 | | | | +| HeaderField_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| Identity | | | | | | | | v1api20231201 | +| Identity_STATUS | | | | | | | | v1api20231201 | +| Identity_Type | | | | | | | | v1api20231201 | +| Identity_Type_STATUS | | | | | | | | v1api20231201 | +| ItsmReceiver | | | | | | | v1api20230101 | | +| ItsmReceiver_STATUS | | | | | | | v1api20230101 | | +| LogSettings | | | | v1api20210501preview | | | | | +| LogSettings_STATUS | | | | v1api20210501preview | | | | | +| LogicAppReceiver | | | | | | | v1api20230101 | | +| LogicAppReceiver_STATUS | | | | | | | v1api20230101 | | +| MetricAlert | v1api20180301 | | | | | | | | +| MetricAlertAction | v1api20180301 | | | | | | | | +| MetricAlertAction_STATUS | v1api20180301 | | | | | | | | +| MetricAlertCriteria | v1api20180301 | | | | | | | | +| MetricAlertCriteria_STATUS | v1api20180301 | | | | | | | | +| MetricAlertMultipleResourceMultipleMetricCriteria | v1api20180301 | | | | | | | | +| MetricAlertMultipleResourceMultipleMetricCriteria_OdataType | v1api20180301 | | | | | | | | +| MetricAlertMultipleResourceMultipleMetricCriteria_OdataType_STATUS | v1api20180301 | | | | | | | | +| MetricAlertMultipleResourceMultipleMetricCriteria_STATUS | v1api20180301 | | | | | | | | +| MetricAlertProperties | v1api20180301 | | | | | | | | +| MetricAlertProperties_STATUS | v1api20180301 | | | | | | | | +| MetricAlertSingleResourceMultipleMetricCriteria | v1api20180301 | | | | | | | | +| MetricAlertSingleResourceMultipleMetricCriteria_OdataType | v1api20180301 | | | | | | | | +| MetricAlertSingleResourceMultipleMetricCriteria_OdataType_STATUS | v1api20180301 | | | | | | | | +| MetricAlertSingleResourceMultipleMetricCriteria_STATUS | v1api20180301 | | | | | | | | +| MetricAlert_STATUS | v1api20180301 | | | | | | | | +| MetricAlert_Spec | v1api20180301 | | | | | | | | +| MetricCriteria | v1api20180301 | | | | | | | | +| MetricCriteria_CriterionType | v1api20180301 | | | | | | | | +| MetricCriteria_CriterionType_STATUS | v1api20180301 | | | | | | | | +| MetricCriteria_Operator | v1api20180301 | | | | | | | | +| MetricCriteria_Operator_STATUS | v1api20180301 | | | | | | | | +| MetricCriteria_STATUS | v1api20180301 | | | | | | | | +| MetricCriteria_TimeAggregation | v1api20180301 | | | | | | | | +| MetricCriteria_TimeAggregation_STATUS | v1api20180301 | | | | | | | | +| MetricDimension | v1api20180301 | | | | | | | | +| MetricDimension_STATUS | v1api20180301 | | | | | | | | +| MetricSettings | | | | v1api20210501preview | | | | | +| MetricSettings_STATUS | | | | v1api20210501preview | | | | | +| MetricTrigger | | | | | | v1api20221001 | | | +| MetricTrigger_Operator | | | | | | v1api20221001 | | | +| MetricTrigger_Operator_STATUS | | | | | | v1api20221001 | | | +| MetricTrigger_STATUS | | | | | | v1api20221001 | | | +| MetricTrigger_Statistic | | | | | | v1api20221001 | | | +| MetricTrigger_Statistic_STATUS | | | | | | v1api20221001 | | | +| MetricTrigger_TimeAggregation | | | | | | v1api20221001 | | | +| MetricTrigger_TimeAggregation_STATUS | | | | | | v1api20221001 | | | +| MultiMetricCriteria | v1api20180301 | | | | | | | | +| MultiMetricCriteria_STATUS | v1api20180301 | | | | | | | | +| PredictiveAutoscalePolicy | | | | | | v1api20221001 | | | +| PredictiveAutoscalePolicy_STATUS | | | | | | v1api20221001 | | | +| PredictiveAutoscalePolicy_ScaleMode | | | | | | v1api20221001 | | | +| PredictiveAutoscalePolicy_ScaleMode_STATUS | | | | | | v1api20221001 | | | +| PrivateLinkScopedResource_STATUS | | | v1api20200202 | | | | | | +| PublicNetworkAccessType | | | v1api20200202 | | | | | | +| PublicNetworkAccessType_STATUS | | | v1api20200202 | | | | | | +| ReceiverStatus_STATUS | | | | | | | v1api20230101 | | +| Recurrence | | | | | | v1api20221001 | | | +| Recurrence_Frequency | | | | | | v1api20221001 | | | +| Recurrence_Frequency_STATUS | | | | | | v1api20221001 | | | +| Recurrence_STATUS | | | | | | v1api20221001 | | | +| RecurrentSchedule | | | | | | v1api20221001 | | | +| RecurrentSchedule_STATUS | | | | | | v1api20221001 | | | +| RetentionPolicy | | | | v1api20210501preview | | | | | +| RetentionPolicy_STATUS | | | | v1api20210501preview | | | | | +| RuleResolveConfiguration | | | | | | | | v1api20231201 | +| RuleResolveConfiguration_STATUS | | | | | | | | v1api20231201 | +| ScaleAction | | | | | | v1api20221001 | | | +| ScaleAction_Direction | | | | | | v1api20221001 | | | +| ScaleAction_Direction_STATUS | | | | | | v1api20221001 | | | +| ScaleAction_STATUS | | | | | | v1api20221001 | | | +| ScaleAction_Type | | | | | | v1api20221001 | | | +| ScaleAction_Type_STATUS | | | | | | v1api20221001 | | | +| ScaleCapacity | | | | | | v1api20221001 | | | +| ScaleCapacity_STATUS | | | | | | v1api20221001 | | | +| ScaleRule | | | | | | v1api20221001 | | | +| ScaleRuleMetricDimension | | | | | | v1api20221001 | | | +| ScaleRuleMetricDimension_Operator | | | | | | v1api20221001 | | | +| ScaleRuleMetricDimension_Operator_STATUS | | | | | | v1api20221001 | | | +| ScaleRuleMetricDimension_STATUS | | | | | | v1api20221001 | | | +| ScaleRule_STATUS | | | | | | v1api20221001 | | | +| ScheduledQueryRule | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleCriteria | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleCriteria_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleProperties | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleProperties_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleProperties_Severity | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRuleProperties_Severity_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRule_Kind_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRule_Kind_Spec | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRule_STATUS | | | | | v1api20220615 | | | v1api20231201 | +| ScheduledQueryRule_Spec | | | | | v1api20220615 | | | v1api20231201 | +| SmsReceiver | | | | | | | v1api20230101 | | +| SmsReceiver_STATUS | | | | | | | v1api20230101 | | +| SystemData_CreatedByType_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | v1api20231201 | +| SystemData_LastModifiedByType_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | v1api20231201 | +| SystemData_STATUS | | | | v1api20210501preview | v1api20220615 | v1api20221001 | | v1api20231201 | +| TimeWindow | | | | | | v1api20221001 | | | +| TimeWindow_STATUS | | | | | | v1api20221001 | | | +| UserAssignedIdentityDetails | | | | | | | | v1api20231201 | +| UserIdentityProperties_STATUS | | | | | | | | v1api20231201 | +| VoiceReceiver | | | | | | | v1api20230101 | | +| VoiceReceiver_STATUS | | | | | | | v1api20230101 | | +| WebTestGeolocation | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestGeolocation_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Configuration | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Configuration_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Kind | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Kind_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Request | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_Request_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_ValidationRules | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_ValidationRules_ContentValidation | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_ValidationRules_ContentValidation_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebTestProperties_ValidationRules_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| WebhookNotification | | | | | | v1api20221001 | | | +| WebhookNotification_STATUS | | | | | | v1api20221001 | | | +| WebhookReceiver | | | | | | | v1api20230101 | | +| WebhookReceiver_STATUS | | | | | | | v1api20230101 | | +| Webtest | | v1api20180501preview | | | v1api20220615 | | | | +| WebtestLocationAvailabilityCriteria | v1api20180301 | | | | | | | | +| WebtestLocationAvailabilityCriteria_OdataType | v1api20180301 | | | | | | | | +| WebtestLocationAvailabilityCriteria_OdataType_STATUS | v1api20180301 | | | | | | | | +| WebtestLocationAvailabilityCriteria_STATUS | v1api20180301 | | | | | | | | +| Webtest_STATUS | | v1api20180501preview | | | v1api20220615 | | | | +| Webtest_Spec | | v1api20180501preview | | | v1api20220615 | | | | diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 4f5e6baeb02..353237da232 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -2570,6 +2570,19 @@ objectModelConfiguration: $armReference: true StorageAccountId: $armReference: true + 2023-12-01: + ScheduledQueryRule: + $export: true + $supportedFrom: v2.12.0 + Actions: + ActionGroups: + $armReference: true + Condition: + ResourceIdColumn: + $armReference: true + ScheduledQueryRuleProperties: + Scopes: + $armReference: true keyvault: 2021-04-01-preview: diff --git a/v2/internal/controllers/controller_resources_gen.go b/v2/internal/controllers/controller_resources_gen.go index 2bbfcc794a7..a3d51d63800 100644 --- a/v2/internal/controllers/controller_resources_gen.go +++ b/v2/internal/controllers/controller_resources_gen.go @@ -131,6 +131,8 @@ import ( insights_v20221001s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20221001/storage" insights_v20230101 "github.com/Azure/azure-service-operator/v2/api/insights/v1api20230101" insights_v20230101s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20230101/storage" + insights_v20231201 "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201" + insights_v20231201s "github.com/Azure/azure-service-operator/v2/api/insights/v1api20231201/storage" keyvault_customizations "github.com/Azure/azure-service-operator/v2/api/keyvault/customizations" keyvault_v20210401p "github.com/Azure/azure-service-operator/v2/api/keyvault/v1api20210401preview" keyvault_v20210401ps "github.com/Azure/azure-service-operator/v2/api/keyvault/v1api20210401preview/storage" @@ -737,10 +739,10 @@ func getKnownStorageTypes() []*registration.StorageType { result = append(result, ®istration.StorageType{Obj: new(insights_v20180301s.MetricAlert)}) result = append(result, ®istration.StorageType{Obj: new(insights_v20200202s.Component)}) result = append(result, ®istration.StorageType{Obj: new(insights_v20210501ps.DiagnosticSetting)}) - result = append(result, ®istration.StorageType{Obj: new(insights_v20220615s.ScheduledQueryRule)}) result = append(result, ®istration.StorageType{Obj: new(insights_v20220615s.Webtest)}) result = append(result, ®istration.StorageType{Obj: new(insights_v20221001s.AutoscaleSetting)}) result = append(result, ®istration.StorageType{Obj: new(insights_v20230101s.ActionGroup)}) + result = append(result, ®istration.StorageType{Obj: new(insights_v20231201s.ScheduledQueryRule)}) result = append(result, ®istration.StorageType{ Obj: new(keyvault_v20230701s.Vault), Indexes: []registration.Index{ @@ -1896,6 +1898,8 @@ func getKnownTypes() []client.Object { result = append(result, new(insights_v20221001s.AutoscaleSetting)) result = append(result, new(insights_v20230101.ActionGroup)) result = append(result, new(insights_v20230101s.ActionGroup)) + result = append(result, new(insights_v20231201.ScheduledQueryRule)) + result = append(result, new(insights_v20231201s.ScheduledQueryRule)) result = append(result, new(keyvault_v20210401p.Vault)) result = append(result, new(keyvault_v20210401ps.Vault)) result = append(result, new(keyvault_v20230701.Vault)) @@ -2433,6 +2437,8 @@ func createScheme() *runtime.Scheme { _ = insights_v20221001s.AddToScheme(scheme) _ = insights_v20230101.AddToScheme(scheme) _ = insights_v20230101s.AddToScheme(scheme) + _ = insights_v20231201.AddToScheme(scheme) + _ = insights_v20231201s.AddToScheme(scheme) _ = keyvault_v20210401p.AddToScheme(scheme) _ = keyvault_v20210401ps.AddToScheme(scheme) _ = keyvault_v20230701.AddToScheme(scheme)