diff --git a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen.go b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen.go similarity index 79% rename from v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen.go rename to v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen.go index fc68e323375..88ed4192a31 100644 --- a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen.go +++ b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen.go @@ -1,41 +1,41 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20230301 +package arm import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" -type PrometheusRuleGroup_Spec_ARM struct { +type PrometheusRuleGroup_Spec struct { // Location: The geo-location where the resource lives Location *string `json:"location,omitempty"` Name string `json:"name,omitempty"` // Properties: The Prometheus rule group properties of the resource. - Properties *PrometheusRuleGroupProperties_ARM `json:"properties,omitempty"` + Properties *PrometheusRuleGroupProperties `json:"properties,omitempty"` // Tags: Resource tags. Tags map[string]string `json:"tags,omitempty"` } -var _ genruntime.ARMResourceSpec = &PrometheusRuleGroup_Spec_ARM{} +var _ genruntime.ARMResourceSpec = &PrometheusRuleGroup_Spec{} // GetAPIVersion returns the ARM API version of the resource. This is always "2023-03-01" -func (group PrometheusRuleGroup_Spec_ARM) GetAPIVersion() string { +func (group PrometheusRuleGroup_Spec) GetAPIVersion() string { return string(APIVersion_Value) } // GetName returns the Name of the resource -func (group *PrometheusRuleGroup_Spec_ARM) GetName() string { +func (group *PrometheusRuleGroup_Spec) GetName() string { return group.Name } // GetType returns the ARM Type of the resource. This is always "Microsoft.AlertsManagement/prometheusRuleGroups" -func (group *PrometheusRuleGroup_Spec_ARM) GetType() string { +func (group *PrometheusRuleGroup_Spec) GetType() string { return "Microsoft.AlertsManagement/prometheusRuleGroups" } // An Azure Prometheus rule group. -type PrometheusRuleGroupProperties_ARM struct { +type PrometheusRuleGroupProperties struct { // ClusterName: Apply rule to data from a specific cluster. ClusterName *string `json:"clusterName,omitempty"` @@ -50,14 +50,14 @@ type PrometheusRuleGroupProperties_ARM struct { Interval *string `json:"interval,omitempty"` // Rules: Defines the rules in the Prometheus rule group. - Rules []PrometheusRule_ARM `json:"rules,omitempty"` - Scopes []string `json:"scopes,omitempty"` + Rules []PrometheusRule `json:"rules,omitempty"` + Scopes []string `json:"scopes,omitempty"` } // An Azure Prometheus alerting or recording rule. -type PrometheusRule_ARM struct { +type PrometheusRule struct { // Actions: Actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []PrometheusRuleGroupAction_ARM `json:"actions,omitempty"` + Actions []PrometheusRuleGroupAction `json:"actions,omitempty"` // Alert: Alert rule name. Alert *string `json:"alert,omitempty"` @@ -84,14 +84,14 @@ type PrometheusRule_ARM struct { Record *string `json:"record,omitempty"` // ResolveConfiguration: Defines the configuration for resolving fired alerts. Only relevant for alerts. - ResolveConfiguration *PrometheusRuleResolveConfiguration_ARM `json:"resolveConfiguration,omitempty"` + ResolveConfiguration *PrometheusRuleResolveConfiguration `json:"resolveConfiguration,omitempty"` // Severity: The severity of the alerts fired by the rule. Must be between 0 and 4. Severity *int `json:"severity,omitempty"` } // An alert action. Only relevant for alerts. -type PrometheusRuleGroupAction_ARM struct { +type PrometheusRuleGroupAction struct { ActionGroupId *string `json:"actionGroupId,omitempty"` // ActionProperties: The properties of an action group object. @@ -99,7 +99,7 @@ type PrometheusRuleGroupAction_ARM struct { } // Specifies the Prometheus alert rule configuration. -type PrometheusRuleResolveConfiguration_ARM struct { +type PrometheusRuleResolveConfiguration struct { // AutoResolved: Enable alert auto-resolution. AutoResolved *bool `json:"autoResolved,omitempty"` diff --git a/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen_test.go b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen_test.go new file mode 100644 index 00000000000..07a2cf43b92 --- /dev/null +++ b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_spec_types_gen_test.go @@ -0,0 +1,388 @@ +// 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_PrometheusRule_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 PrometheusRule via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRule, PrometheusRuleGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRule runs a test to see if a specific instance of PrometheusRule round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRule(subject PrometheusRule) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRule + 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 PrometheusRule instances for property testing - lazily instantiated by PrometheusRuleGenerator() +var prometheusRuleGenerator gopter.Gen + +// PrometheusRuleGenerator returns a generator of PrometheusRule instances for property testing. +// We first initialize prometheusRuleGenerator 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 PrometheusRuleGenerator() gopter.Gen { + if prometheusRuleGenerator != nil { + return prometheusRuleGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRule(generators) + prometheusRuleGenerator = gen.Struct(reflect.TypeOf(PrometheusRule{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRule(generators) + AddRelatedPropertyGeneratorsForPrometheusRule(generators) + prometheusRuleGenerator = gen.Struct(reflect.TypeOf(PrometheusRule{}), generators) + + return prometheusRuleGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRule is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRule(gens map[string]gopter.Gen) { + gens["Alert"] = gen.PtrOf(gen.AlphaString()) + gens["Annotations"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Expression"] = gen.PtrOf(gen.AlphaString()) + gens["For"] = gen.PtrOf(gen.AlphaString()) + gens["Labels"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Record"] = gen.PtrOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.Int()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRule is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRule(gens map[string]gopter.Gen) { + gens["Actions"] = gen.SliceOf(PrometheusRuleGroupActionGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(PrometheusRuleResolveConfigurationGenerator()) +} + +func Test_PrometheusRuleGroupAction_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 PrometheusRuleGroupAction via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupAction, PrometheusRuleGroupActionGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroupAction runs a test to see if a specific instance of PrometheusRuleGroupAction round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroupAction(subject PrometheusRuleGroupAction) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroupAction + 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 PrometheusRuleGroupAction instances for property testing - lazily instantiated by +// PrometheusRuleGroupActionGenerator() +var prometheusRuleGroupActionGenerator gopter.Gen + +// PrometheusRuleGroupActionGenerator returns a generator of PrometheusRuleGroupAction instances for property testing. +func PrometheusRuleGroupActionGenerator() gopter.Gen { + if prometheusRuleGroupActionGenerator != nil { + return prometheusRuleGroupActionGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction(generators) + prometheusRuleGroupActionGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupAction{}), generators) + + return prometheusRuleGroupActionGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction(gens map[string]gopter.Gen) { + gens["ActionGroupId"] = gen.PtrOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_PrometheusRuleGroupProperties_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 PrometheusRuleGroupProperties via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupProperties, PrometheusRuleGroupPropertiesGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroupProperties runs a test to see if a specific instance of PrometheusRuleGroupProperties round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroupProperties(subject PrometheusRuleGroupProperties) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroupProperties + 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 PrometheusRuleGroupProperties instances for property testing - lazily instantiated by +// PrometheusRuleGroupPropertiesGenerator() +var prometheusRuleGroupPropertiesGenerator gopter.Gen + +// PrometheusRuleGroupPropertiesGenerator returns a generator of PrometheusRuleGroupProperties instances for property testing. +// We first initialize prometheusRuleGroupPropertiesGenerator 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 PrometheusRuleGroupPropertiesGenerator() gopter.Gen { + if prometheusRuleGroupPropertiesGenerator != nil { + return prometheusRuleGroupPropertiesGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties(generators) + prometheusRuleGroupPropertiesGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties(generators) + AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties(generators) + prometheusRuleGroupPropertiesGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties{}), generators) + + return prometheusRuleGroupPropertiesGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties(gens map[string]gopter.Gen) { + gens["ClusterName"] = gen.PtrOf(gen.AlphaString()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Interval"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties(gens map[string]gopter.Gen) { + gens["Rules"] = gen.SliceOf(PrometheusRuleGenerator()) +} + +func Test_PrometheusRuleGroup_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 PrometheusRuleGroup_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroup_Spec, PrometheusRuleGroup_SpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroup_Spec runs a test to see if a specific instance of PrometheusRuleGroup_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroup_Spec(subject PrometheusRuleGroup_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroup_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 PrometheusRuleGroup_Spec instances for property testing - lazily instantiated by +// PrometheusRuleGroup_SpecGenerator() +var prometheusRuleGroup_SpecGenerator gopter.Gen + +// PrometheusRuleGroup_SpecGenerator returns a generator of PrometheusRuleGroup_Spec instances for property testing. +// We first initialize prometheusRuleGroup_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 PrometheusRuleGroup_SpecGenerator() gopter.Gen { + if prometheusRuleGroup_SpecGenerator != nil { + return prometheusRuleGroup_SpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec(generators) + prometheusRuleGroup_SpecGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec(generators) + AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec(generators) + prometheusRuleGroup_SpecGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_Spec{}), generators) + + return prometheusRuleGroup_SpecGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec(gens map[string]gopter.Gen) { + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(PrometheusRuleGroupPropertiesGenerator()) +} + +func Test_PrometheusRuleResolveConfiguration_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 PrometheusRuleResolveConfiguration via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleResolveConfiguration, PrometheusRuleResolveConfigurationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleResolveConfiguration runs a test to see if a specific instance of PrometheusRuleResolveConfiguration round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleResolveConfiguration(subject PrometheusRuleResolveConfiguration) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleResolveConfiguration + 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 PrometheusRuleResolveConfiguration instances for property testing - lazily instantiated by +// PrometheusRuleResolveConfigurationGenerator() +var prometheusRuleResolveConfigurationGenerator gopter.Gen + +// PrometheusRuleResolveConfigurationGenerator returns a generator of PrometheusRuleResolveConfiguration instances for property testing. +func PrometheusRuleResolveConfigurationGenerator() gopter.Gen { + if prometheusRuleResolveConfigurationGenerator != nil { + return prometheusRuleResolveConfigurationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration(generators) + prometheusRuleResolveConfigurationGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleResolveConfiguration{}), generators) + + return prometheusRuleResolveConfigurationGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen.go b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen.go similarity index 63% rename from v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen.go rename to v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen.go index 7a2d0cd65e0..caeea68a2c1 100644 --- a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen.go +++ b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen.go @@ -1,9 +1,11 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20230301 +package arm -type PrometheusRuleGroup_STATUS_ARM struct { +import v20230301 "github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301" + +type PrometheusRuleGroup_STATUS struct { // Id: Fully qualified resource ID for the resource. Ex - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} Id *string `json:"id,omitempty"` @@ -15,10 +17,10 @@ type PrometheusRuleGroup_STATUS_ARM struct { Name *string `json:"name,omitempty"` // Properties: The Prometheus rule group properties of the resource. - Properties *PrometheusRuleGroupProperties_STATUS_ARM `json:"properties,omitempty"` + Properties *PrometheusRuleGroupProperties_STATUS `json:"properties,omitempty"` // SystemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData_STATUS_ARM `json:"systemData,omitempty"` + SystemData *SystemData_STATUS `json:"systemData,omitempty"` // Tags: Resource tags. Tags map[string]string `json:"tags,omitempty"` @@ -28,7 +30,7 @@ type PrometheusRuleGroup_STATUS_ARM struct { } // An Azure Prometheus rule group. -type PrometheusRuleGroupProperties_STATUS_ARM struct { +type PrometheusRuleGroupProperties_STATUS struct { // ClusterName: Apply rule to data from a specific cluster. ClusterName *string `json:"clusterName,omitempty"` @@ -43,7 +45,7 @@ type PrometheusRuleGroupProperties_STATUS_ARM struct { Interval *string `json:"interval,omitempty"` // Rules: Defines the rules in the Prometheus rule group. - Rules []PrometheusRule_STATUS_ARM `json:"rules,omitempty"` + Rules []PrometheusRule_STATUS `json:"rules,omitempty"` // Scopes: Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. // This may change in future. @@ -51,7 +53,7 @@ type PrometheusRuleGroupProperties_STATUS_ARM struct { } // Metadata pertaining to creation and last modification of the resource. -type SystemData_STATUS_ARM struct { +type SystemData_STATUS struct { // CreatedAt: The timestamp of resource creation (UTC). CreatedAt *string `json:"createdAt,omitempty"` @@ -59,7 +61,7 @@ type SystemData_STATUS_ARM struct { CreatedBy *string `json:"createdBy,omitempty"` // CreatedByType: The type of identity that created the resource. - CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` + CreatedByType *v20230301.SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` // LastModifiedAt: The timestamp of resource last modification (UTC) LastModifiedAt *string `json:"lastModifiedAt,omitempty"` @@ -68,13 +70,13 @@ type SystemData_STATUS_ARM struct { LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // LastModifiedByType: The type of identity that last modified the resource. - LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` + LastModifiedByType *v20230301.SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` } // An Azure Prometheus alerting or recording rule. -type PrometheusRule_STATUS_ARM struct { +type PrometheusRule_STATUS struct { // Actions: Actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []PrometheusRuleGroupAction_STATUS_ARM `json:"actions,omitempty"` + Actions []PrometheusRuleGroupAction_STATUS `json:"actions,omitempty"` // Alert: Alert rule name. Alert *string `json:"alert,omitempty"` @@ -101,48 +103,14 @@ type PrometheusRule_STATUS_ARM struct { Record *string `json:"record,omitempty"` // ResolveConfiguration: Defines the configuration for resolving fired alerts. Only relevant for alerts. - ResolveConfiguration *PrometheusRuleResolveConfiguration_STATUS_ARM `json:"resolveConfiguration,omitempty"` + ResolveConfiguration *PrometheusRuleResolveConfiguration_STATUS `json:"resolveConfiguration,omitempty"` // Severity: The severity of the alerts fired by the rule. Must be between 0 and 4. Severity *int `json:"severity,omitempty"` } -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, -} - // An alert action. Only relevant for alerts. -type PrometheusRuleGroupAction_STATUS_ARM struct { +type PrometheusRuleGroupAction_STATUS struct { // ActionGroupId: The resource id of the action group to use. ActionGroupId *string `json:"actionGroupId,omitempty"` @@ -151,7 +119,7 @@ type PrometheusRuleGroupAction_STATUS_ARM struct { } // Specifies the Prometheus alert rule configuration. -type PrometheusRuleResolveConfiguration_STATUS_ARM struct { +type PrometheusRuleResolveConfiguration_STATUS struct { // AutoResolved: Enable alert auto-resolution. AutoResolved *bool `json:"autoResolved,omitempty"` diff --git a/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen_test.go b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen_test.go new file mode 100644 index 00000000000..f3ba86841e4 --- /dev/null +++ b/v2/api/alertsmanagement/v1api20230301/arm/prometheus_rule_group_status_types_gen_test.go @@ -0,0 +1,471 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +import ( + "encoding/json" + v20230301 "github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301" + "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_PrometheusRuleGroupAction_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 PrometheusRuleGroupAction_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS, PrometheusRuleGroupAction_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS runs a test to see if a specific instance of PrometheusRuleGroupAction_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS(subject PrometheusRuleGroupAction_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroupAction_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 PrometheusRuleGroupAction_STATUS instances for property testing - lazily instantiated by +// PrometheusRuleGroupAction_STATUSGenerator() +var prometheusRuleGroupAction_STATUSGenerator gopter.Gen + +// PrometheusRuleGroupAction_STATUSGenerator returns a generator of PrometheusRuleGroupAction_STATUS instances for property testing. +func PrometheusRuleGroupAction_STATUSGenerator() gopter.Gen { + if prometheusRuleGroupAction_STATUSGenerator != nil { + return prometheusRuleGroupAction_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS(generators) + prometheusRuleGroupAction_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupAction_STATUS{}), generators) + + return prometheusRuleGroupAction_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS(gens map[string]gopter.Gen) { + gens["ActionGroupId"] = gen.PtrOf(gen.AlphaString()) + gens["ActionProperties"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) +} + +func Test_PrometheusRuleGroupProperties_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 PrometheusRuleGroupProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS, PrometheusRuleGroupProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS runs a test to see if a specific instance of PrometheusRuleGroupProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS(subject PrometheusRuleGroupProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroupProperties_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 PrometheusRuleGroupProperties_STATUS instances for property testing - lazily instantiated by +// PrometheusRuleGroupProperties_STATUSGenerator() +var prometheusRuleGroupProperties_STATUSGenerator gopter.Gen + +// PrometheusRuleGroupProperties_STATUSGenerator returns a generator of PrometheusRuleGroupProperties_STATUS instances for property testing. +// We first initialize prometheusRuleGroupProperties_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 PrometheusRuleGroupProperties_STATUSGenerator() gopter.Gen { + if prometheusRuleGroupProperties_STATUSGenerator != nil { + return prometheusRuleGroupProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS(generators) + prometheusRuleGroupProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS(generators) + AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS(generators) + prometheusRuleGroupProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_STATUS{}), generators) + + return prometheusRuleGroupProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS(gens map[string]gopter.Gen) { + gens["ClusterName"] = gen.PtrOf(gen.AlphaString()) + gens["Description"] = gen.PtrOf(gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Interval"] = gen.PtrOf(gen.AlphaString()) + gens["Scopes"] = gen.SliceOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS(gens map[string]gopter.Gen) { + gens["Rules"] = gen.SliceOf(PrometheusRule_STATUSGenerator()) +} + +func Test_PrometheusRuleGroup_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 PrometheusRuleGroup_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroup_STATUS, PrometheusRuleGroup_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleGroup_STATUS runs a test to see if a specific instance of PrometheusRuleGroup_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleGroup_STATUS(subject PrometheusRuleGroup_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleGroup_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 PrometheusRuleGroup_STATUS instances for property testing - lazily instantiated by +// PrometheusRuleGroup_STATUSGenerator() +var prometheusRuleGroup_STATUSGenerator gopter.Gen + +// PrometheusRuleGroup_STATUSGenerator returns a generator of PrometheusRuleGroup_STATUS instances for property testing. +// We first initialize prometheusRuleGroup_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 PrometheusRuleGroup_STATUSGenerator() gopter.Gen { + if prometheusRuleGroup_STATUSGenerator != nil { + return prometheusRuleGroup_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS(generators) + prometheusRuleGroup_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS(generators) + AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS(generators) + prometheusRuleGroup_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_STATUS{}), generators) + + return prometheusRuleGroup_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) + 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()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(PrometheusRuleGroupProperties_STATUSGenerator()) + gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) +} + +func Test_PrometheusRuleResolveConfiguration_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 PrometheusRuleResolveConfiguration_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS, PrometheusRuleResolveConfiguration_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS runs a test to see if a specific instance of PrometheusRuleResolveConfiguration_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS(subject PrometheusRuleResolveConfiguration_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRuleResolveConfiguration_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 PrometheusRuleResolveConfiguration_STATUS instances for property testing - lazily instantiated by +// PrometheusRuleResolveConfiguration_STATUSGenerator() +var prometheusRuleResolveConfiguration_STATUSGenerator gopter.Gen + +// PrometheusRuleResolveConfiguration_STATUSGenerator returns a generator of PrometheusRuleResolveConfiguration_STATUS instances for property testing. +func PrometheusRuleResolveConfiguration_STATUSGenerator() gopter.Gen { + if prometheusRuleResolveConfiguration_STATUSGenerator != nil { + return prometheusRuleResolveConfiguration_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS(generators) + prometheusRuleResolveConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleResolveConfiguration_STATUS{}), generators) + + return prometheusRuleResolveConfiguration_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS(gens map[string]gopter.Gen) { + gens["AutoResolved"] = gen.PtrOf(gen.Bool()) + gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_PrometheusRule_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 PrometheusRule_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrometheusRule_STATUS, PrometheusRule_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrometheusRule_STATUS runs a test to see if a specific instance of PrometheusRule_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrometheusRule_STATUS(subject PrometheusRule_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrometheusRule_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 PrometheusRule_STATUS instances for property testing - lazily instantiated by +// PrometheusRule_STATUSGenerator() +var prometheusRule_STATUSGenerator gopter.Gen + +// PrometheusRule_STATUSGenerator returns a generator of PrometheusRule_STATUS instances for property testing. +// We first initialize prometheusRule_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 PrometheusRule_STATUSGenerator() gopter.Gen { + if prometheusRule_STATUSGenerator != nil { + return prometheusRule_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRule_STATUS(generators) + prometheusRule_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrometheusRule_STATUS(generators) + AddRelatedPropertyGeneratorsForPrometheusRule_STATUS(generators) + prometheusRule_STATUSGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_STATUS{}), generators) + + return prometheusRule_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrometheusRule_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrometheusRule_STATUS(gens map[string]gopter.Gen) { + gens["Alert"] = gen.PtrOf(gen.AlphaString()) + gens["Annotations"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Enabled"] = gen.PtrOf(gen.Bool()) + gens["Expression"] = gen.PtrOf(gen.AlphaString()) + gens["For"] = gen.PtrOf(gen.AlphaString()) + gens["Labels"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Record"] = gen.PtrOf(gen.AlphaString()) + gens["Severity"] = gen.PtrOf(gen.Int()) +} + +// AddRelatedPropertyGeneratorsForPrometheusRule_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForPrometheusRule_STATUS(gens map[string]gopter.Gen) { + gens["Actions"] = gen.SliceOf(PrometheusRuleGroupAction_STATUSGenerator()) + gens["ResolveConfiguration"] = gen.PtrOf(PrometheusRuleResolveConfiguration_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. +// We first initialize systemData_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 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) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSystemData_STATUS(generators) + AddRelatedPropertyGeneratorsForSystemData_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["LastModifiedAt"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) { + gens["CreatedByType"] = gen.PtrOf(v20230301.SystemData_CreatedByType_STATUSGenerator()) + gens["LastModifiedByType"] = gen.PtrOf(v20230301.SystemData_LastModifiedByType_STATUSGenerator()) +} diff --git a/v2/api/alertsmanagement/v1api20230301/arm/structure.txt b/v2/api/alertsmanagement/v1api20230301/arm/structure.txt new file mode 100644 index 00000000000..973e36e1dde --- /dev/null +++ b/v2/api/alertsmanagement/v1api20230301/arm/structure.txt @@ -0,0 +1,61 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301/arm +├── PrometheusRuleGroup_STATUS: Object (7 properties) +│ ├── Id: *string +│ ├── Location: *string +│ ├── Name: *string +│ ├── Properties: *Object (6 properties) +│ │ ├── ClusterName: *string +│ │ ├── Description: *string +│ │ ├── Enabled: *bool +│ │ ├── Interval: *string +│ │ ├── Rules: Object (10 properties)[] +│ │ │ ├── Actions: Object (2 properties)[] +│ │ │ │ ├── ActionGroupId: *string +│ │ │ │ └── ActionProperties: map[string]string +│ │ │ ├── Alert: *string +│ │ │ ├── Annotations: map[string]string +│ │ │ ├── Enabled: *bool +│ │ │ ├── Expression: *string +│ │ │ ├── For: *string +│ │ │ ├── Labels: map[string]string +│ │ │ ├── Record: *string +│ │ │ ├── ResolveConfiguration: *Object (2 properties) +│ │ │ │ ├── AutoResolved: *bool +│ │ │ │ └── TimeToResolve: *string +│ │ │ └── Severity: *int +│ │ └── Scopes: string[] +│ ├── SystemData: *Object (6 properties) +│ │ ├── CreatedAt: *string +│ │ ├── CreatedBy: *string +│ │ ├── CreatedByType: *alertsmanagement/v1api20230301.SystemData_CreatedByType_STATUS +│ │ ├── LastModifiedAt: *string +│ │ ├── LastModifiedBy: *string +│ │ └── LastModifiedByType: *alertsmanagement/v1api20230301.SystemData_LastModifiedByType_STATUS +│ ├── Tags: map[string]string +│ └── Type: *string +└── PrometheusRuleGroup_Spec: Object (4 properties) + ├── Location: *string + ├── Name: string + ├── Properties: *Object (6 properties) + │ ├── ClusterName: *string + │ ├── Description: *string + │ ├── Enabled: *bool + │ ├── Interval: *string + │ ├── Rules: Object (10 properties)[] + │ │ ├── Actions: Object (2 properties)[] + │ │ │ ├── ActionGroupId: *string + │ │ │ └── ActionProperties: map[string]string + │ │ ├── Alert: *string + │ │ ├── Annotations: map[string]string + │ │ ├── Enabled: *bool + │ │ ├── Expression: *string + │ │ ├── For: *string + │ │ ├── Labels: map[string]string + │ │ ├── Record: *string + │ │ ├── ResolveConfiguration: *Object (2 properties) + │ │ │ ├── AutoResolved: *bool + │ │ │ └── TimeToResolve: *string + │ │ └── Severity: *int + │ └── Scopes: string[] + └── Tags: map[string]string diff --git a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen_test.go b/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen_test.go deleted file mode 100644 index ef97fc9184c..00000000000 --- a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_spec_arm_types_gen_test.go +++ /dev/null @@ -1,388 +0,0 @@ -// Code generated by azure-service-operator-codegen. DO NOT EDIT. -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -package v1api20230301 - -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_PrometheusRuleGroupAction_ARM_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 PrometheusRuleGroupAction_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupAction_ARM, PrometheusRuleGroupAction_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroupAction_ARM runs a test to see if a specific instance of PrometheusRuleGroupAction_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroupAction_ARM(subject PrometheusRuleGroupAction_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroupAction_ARM - 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 PrometheusRuleGroupAction_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroupAction_ARMGenerator() -var prometheusRuleGroupAction_ARMGenerator gopter.Gen - -// PrometheusRuleGroupAction_ARMGenerator returns a generator of PrometheusRuleGroupAction_ARM instances for property testing. -func PrometheusRuleGroupAction_ARMGenerator() gopter.Gen { - if prometheusRuleGroupAction_ARMGenerator != nil { - return prometheusRuleGroupAction_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_ARM(generators) - prometheusRuleGroupAction_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupAction_ARM{}), generators) - - return prometheusRuleGroupAction_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_ARM(gens map[string]gopter.Gen) { - gens["ActionGroupId"] = gen.PtrOf(gen.AlphaString()) - gens["ActionProperties"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) -} - -func Test_PrometheusRuleGroupProperties_ARM_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 PrometheusRuleGroupProperties_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupProperties_ARM, PrometheusRuleGroupProperties_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroupProperties_ARM runs a test to see if a specific instance of PrometheusRuleGroupProperties_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroupProperties_ARM(subject PrometheusRuleGroupProperties_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroupProperties_ARM - 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 PrometheusRuleGroupProperties_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroupProperties_ARMGenerator() -var prometheusRuleGroupProperties_ARMGenerator gopter.Gen - -// PrometheusRuleGroupProperties_ARMGenerator returns a generator of PrometheusRuleGroupProperties_ARM instances for property testing. -// We first initialize prometheusRuleGroupProperties_ARMGenerator 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 PrometheusRuleGroupProperties_ARMGenerator() gopter.Gen { - if prometheusRuleGroupProperties_ARMGenerator != nil { - return prometheusRuleGroupProperties_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_ARM(generators) - prometheusRuleGroupProperties_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_ARM(generators) - prometheusRuleGroupProperties_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_ARM{}), generators) - - return prometheusRuleGroupProperties_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_ARM(gens map[string]gopter.Gen) { - gens["ClusterName"] = gen.PtrOf(gen.AlphaString()) - gens["Description"] = gen.PtrOf(gen.AlphaString()) - gens["Enabled"] = gen.PtrOf(gen.Bool()) - gens["Interval"] = gen.PtrOf(gen.AlphaString()) - gens["Scopes"] = gen.SliceOf(gen.AlphaString()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_ARM(gens map[string]gopter.Gen) { - gens["Rules"] = gen.SliceOf(PrometheusRule_ARMGenerator()) -} - -func Test_PrometheusRuleGroup_Spec_ARM_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 PrometheusRuleGroup_Spec_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroup_Spec_ARM, PrometheusRuleGroup_Spec_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroup_Spec_ARM runs a test to see if a specific instance of PrometheusRuleGroup_Spec_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroup_Spec_ARM(subject PrometheusRuleGroup_Spec_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroup_Spec_ARM - 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 PrometheusRuleGroup_Spec_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroup_Spec_ARMGenerator() -var prometheusRuleGroup_Spec_ARMGenerator gopter.Gen - -// PrometheusRuleGroup_Spec_ARMGenerator returns a generator of PrometheusRuleGroup_Spec_ARM instances for property testing. -// We first initialize prometheusRuleGroup_Spec_ARMGenerator 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 PrometheusRuleGroup_Spec_ARMGenerator() gopter.Gen { - if prometheusRuleGroup_Spec_ARMGenerator != nil { - return prometheusRuleGroup_Spec_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM(generators) - prometheusRuleGroup_Spec_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_Spec_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM(generators) - prometheusRuleGroup_Spec_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_Spec_ARM{}), generators) - - return prometheusRuleGroup_Spec_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM(gens map[string]gopter.Gen) { - gens["Location"] = gen.PtrOf(gen.AlphaString()) - gens["Name"] = gen.AlphaString() - gens["Tags"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRuleGroup_Spec_ARM(gens map[string]gopter.Gen) { - gens["Properties"] = gen.PtrOf(PrometheusRuleGroupProperties_ARMGenerator()) -} - -func Test_PrometheusRuleResolveConfiguration_ARM_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 PrometheusRuleResolveConfiguration_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleResolveConfiguration_ARM, PrometheusRuleResolveConfiguration_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleResolveConfiguration_ARM runs a test to see if a specific instance of PrometheusRuleResolveConfiguration_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleResolveConfiguration_ARM(subject PrometheusRuleResolveConfiguration_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleResolveConfiguration_ARM - 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 PrometheusRuleResolveConfiguration_ARM instances for property testing - lazily instantiated by -// PrometheusRuleResolveConfiguration_ARMGenerator() -var prometheusRuleResolveConfiguration_ARMGenerator gopter.Gen - -// PrometheusRuleResolveConfiguration_ARMGenerator returns a generator of PrometheusRuleResolveConfiguration_ARM instances for property testing. -func PrometheusRuleResolveConfiguration_ARMGenerator() gopter.Gen { - if prometheusRuleResolveConfiguration_ARMGenerator != nil { - return prometheusRuleResolveConfiguration_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_ARM(generators) - prometheusRuleResolveConfiguration_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleResolveConfiguration_ARM{}), generators) - - return prometheusRuleResolveConfiguration_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_ARM(gens map[string]gopter.Gen) { - gens["AutoResolved"] = gen.PtrOf(gen.Bool()) - gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_PrometheusRule_ARM_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 PrometheusRule_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRule_ARM, PrometheusRule_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRule_ARM runs a test to see if a specific instance of PrometheusRule_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRule_ARM(subject PrometheusRule_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRule_ARM - 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 PrometheusRule_ARM instances for property testing - lazily instantiated by PrometheusRule_ARMGenerator() -var prometheusRule_ARMGenerator gopter.Gen - -// PrometheusRule_ARMGenerator returns a generator of PrometheusRule_ARM instances for property testing. -// We first initialize prometheusRule_ARMGenerator 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 PrometheusRule_ARMGenerator() gopter.Gen { - if prometheusRule_ARMGenerator != nil { - return prometheusRule_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRule_ARM(generators) - prometheusRule_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRule_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRule_ARM(generators) - prometheusRule_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_ARM{}), generators) - - return prometheusRule_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRule_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRule_ARM(gens map[string]gopter.Gen) { - gens["Alert"] = gen.PtrOf(gen.AlphaString()) - gens["Annotations"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) - gens["Enabled"] = gen.PtrOf(gen.Bool()) - gens["Expression"] = gen.PtrOf(gen.AlphaString()) - gens["For"] = gen.PtrOf(gen.AlphaString()) - gens["Labels"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) - gens["Record"] = gen.PtrOf(gen.AlphaString()) - gens["Severity"] = gen.PtrOf(gen.Int()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRule_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRule_ARM(gens map[string]gopter.Gen) { - gens["Actions"] = gen.SliceOf(PrometheusRuleGroupAction_ARMGenerator()) - gens["ResolveConfiguration"] = gen.PtrOf(PrometheusRuleResolveConfiguration_ARMGenerator()) -} diff --git a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen_test.go b/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen_test.go deleted file mode 100644 index ec54b6cd3c6..00000000000 --- a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_status_arm_types_gen_test.go +++ /dev/null @@ -1,466 +0,0 @@ -// Code generated by azure-service-operator-codegen. DO NOT EDIT. -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -package v1api20230301 - -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_PrometheusRuleGroupAction_STATUS_ARM_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 PrometheusRuleGroupAction_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS_ARM, PrometheusRuleGroupAction_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS_ARM runs a test to see if a specific instance of PrometheusRuleGroupAction_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroupAction_STATUS_ARM(subject PrometheusRuleGroupAction_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroupAction_STATUS_ARM - 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 PrometheusRuleGroupAction_STATUS_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroupAction_STATUS_ARMGenerator() -var prometheusRuleGroupAction_STATUS_ARMGenerator gopter.Gen - -// PrometheusRuleGroupAction_STATUS_ARMGenerator returns a generator of PrometheusRuleGroupAction_STATUS_ARM instances for property testing. -func PrometheusRuleGroupAction_STATUS_ARMGenerator() gopter.Gen { - if prometheusRuleGroupAction_STATUS_ARMGenerator != nil { - return prometheusRuleGroupAction_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS_ARM(generators) - prometheusRuleGroupAction_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupAction_STATUS_ARM{}), generators) - - return prometheusRuleGroupAction_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroupAction_STATUS_ARM(gens map[string]gopter.Gen) { - gens["ActionGroupId"] = gen.PtrOf(gen.AlphaString()) - gens["ActionProperties"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) -} - -func Test_PrometheusRuleGroupProperties_STATUS_ARM_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 PrometheusRuleGroupProperties_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS_ARM, PrometheusRuleGroupProperties_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS_ARM runs a test to see if a specific instance of PrometheusRuleGroupProperties_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroupProperties_STATUS_ARM(subject PrometheusRuleGroupProperties_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroupProperties_STATUS_ARM - 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 PrometheusRuleGroupProperties_STATUS_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroupProperties_STATUS_ARMGenerator() -var prometheusRuleGroupProperties_STATUS_ARMGenerator gopter.Gen - -// PrometheusRuleGroupProperties_STATUS_ARMGenerator returns a generator of PrometheusRuleGroupProperties_STATUS_ARM instances for property testing. -// We first initialize prometheusRuleGroupProperties_STATUS_ARMGenerator 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 PrometheusRuleGroupProperties_STATUS_ARMGenerator() gopter.Gen { - if prometheusRuleGroupProperties_STATUS_ARMGenerator != nil { - return prometheusRuleGroupProperties_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM(generators) - prometheusRuleGroupProperties_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM(generators) - prometheusRuleGroupProperties_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroupProperties_STATUS_ARM{}), generators) - - return prometheusRuleGroupProperties_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM(gens map[string]gopter.Gen) { - gens["ClusterName"] = gen.PtrOf(gen.AlphaString()) - gens["Description"] = gen.PtrOf(gen.AlphaString()) - gens["Enabled"] = gen.PtrOf(gen.Bool()) - gens["Interval"] = gen.PtrOf(gen.AlphaString()) - gens["Scopes"] = gen.SliceOf(gen.AlphaString()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRuleGroupProperties_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Rules"] = gen.SliceOf(PrometheusRule_STATUS_ARMGenerator()) -} - -func Test_PrometheusRuleGroup_STATUS_ARM_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 PrometheusRuleGroup_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleGroup_STATUS_ARM, PrometheusRuleGroup_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleGroup_STATUS_ARM runs a test to see if a specific instance of PrometheusRuleGroup_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleGroup_STATUS_ARM(subject PrometheusRuleGroup_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleGroup_STATUS_ARM - 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 PrometheusRuleGroup_STATUS_ARM instances for property testing - lazily instantiated by -// PrometheusRuleGroup_STATUS_ARMGenerator() -var prometheusRuleGroup_STATUS_ARMGenerator gopter.Gen - -// PrometheusRuleGroup_STATUS_ARMGenerator returns a generator of PrometheusRuleGroup_STATUS_ARM instances for property testing. -// We first initialize prometheusRuleGroup_STATUS_ARMGenerator 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 PrometheusRuleGroup_STATUS_ARMGenerator() gopter.Gen { - if prometheusRuleGroup_STATUS_ARMGenerator != nil { - return prometheusRuleGroup_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM(generators) - prometheusRuleGroup_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM(generators) - prometheusRuleGroup_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleGroup_STATUS_ARM{}), generators) - - return prometheusRuleGroup_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Id"] = gen.PtrOf(gen.AlphaString()) - 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()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRuleGroup_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Properties"] = gen.PtrOf(PrometheusRuleGroupProperties_STATUS_ARMGenerator()) - gens["SystemData"] = gen.PtrOf(SystemData_STATUS_ARMGenerator()) -} - -func Test_PrometheusRuleResolveConfiguration_STATUS_ARM_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 PrometheusRuleResolveConfiguration_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS_ARM, PrometheusRuleResolveConfiguration_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS_ARM runs a test to see if a specific instance of PrometheusRuleResolveConfiguration_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRuleResolveConfiguration_STATUS_ARM(subject PrometheusRuleResolveConfiguration_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRuleResolveConfiguration_STATUS_ARM - 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 PrometheusRuleResolveConfiguration_STATUS_ARM instances for property testing - lazily instantiated by -// PrometheusRuleResolveConfiguration_STATUS_ARMGenerator() -var prometheusRuleResolveConfiguration_STATUS_ARMGenerator gopter.Gen - -// PrometheusRuleResolveConfiguration_STATUS_ARMGenerator returns a generator of PrometheusRuleResolveConfiguration_STATUS_ARM instances for property testing. -func PrometheusRuleResolveConfiguration_STATUS_ARMGenerator() gopter.Gen { - if prometheusRuleResolveConfiguration_STATUS_ARMGenerator != nil { - return prometheusRuleResolveConfiguration_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS_ARM(generators) - prometheusRuleResolveConfiguration_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRuleResolveConfiguration_STATUS_ARM{}), generators) - - return prometheusRuleResolveConfiguration_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRuleResolveConfiguration_STATUS_ARM(gens map[string]gopter.Gen) { - gens["AutoResolved"] = gen.PtrOf(gen.Bool()) - gens["TimeToResolve"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_PrometheusRule_STATUS_ARM_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 PrometheusRule_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrometheusRule_STATUS_ARM, PrometheusRule_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrometheusRule_STATUS_ARM runs a test to see if a specific instance of PrometheusRule_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrometheusRule_STATUS_ARM(subject PrometheusRule_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrometheusRule_STATUS_ARM - 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 PrometheusRule_STATUS_ARM instances for property testing - lazily instantiated by -// PrometheusRule_STATUS_ARMGenerator() -var prometheusRule_STATUS_ARMGenerator gopter.Gen - -// PrometheusRule_STATUS_ARMGenerator returns a generator of PrometheusRule_STATUS_ARM instances for property testing. -// We first initialize prometheusRule_STATUS_ARMGenerator 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 PrometheusRule_STATUS_ARMGenerator() gopter.Gen { - if prometheusRule_STATUS_ARMGenerator != nil { - return prometheusRule_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRule_STATUS_ARM(generators) - prometheusRule_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrometheusRule_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForPrometheusRule_STATUS_ARM(generators) - prometheusRule_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrometheusRule_STATUS_ARM{}), generators) - - return prometheusRule_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrometheusRule_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrometheusRule_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Alert"] = gen.PtrOf(gen.AlphaString()) - gens["Annotations"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) - gens["Enabled"] = gen.PtrOf(gen.Bool()) - gens["Expression"] = gen.PtrOf(gen.AlphaString()) - gens["For"] = gen.PtrOf(gen.AlphaString()) - gens["Labels"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) - gens["Record"] = gen.PtrOf(gen.AlphaString()) - gens["Severity"] = gen.PtrOf(gen.Int()) -} - -// AddRelatedPropertyGeneratorsForPrometheusRule_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForPrometheusRule_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Actions"] = gen.SliceOf(PrometheusRuleGroupAction_STATUS_ARMGenerator()) - gens["ResolveConfiguration"] = gen.PtrOf(PrometheusRuleResolveConfiguration_STATUS_ARMGenerator()) -} - -func Test_SystemData_STATUS_ARM_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_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForSystemData_STATUS_ARM, SystemData_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForSystemData_STATUS_ARM runs a test to see if a specific instance of SystemData_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForSystemData_STATUS_ARM(subject SystemData_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual SystemData_STATUS_ARM - 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_ARM instances for property testing - lazily instantiated by -// SystemData_STATUS_ARMGenerator() -var systemData_STATUS_ARMGenerator gopter.Gen - -// SystemData_STATUS_ARMGenerator returns a generator of SystemData_STATUS_ARM instances for property testing. -func SystemData_STATUS_ARMGenerator() gopter.Gen { - if systemData_STATUS_ARMGenerator != nil { - return systemData_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM(generators) - systemData_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(SystemData_STATUS_ARM{}), generators) - - return systemData_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM(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)) -} diff --git a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_types_gen.go b/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_types_gen.go index be90c9a9009..bcca15e8a58 100644 --- a/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_types_gen.go +++ b/v2/api/alertsmanagement/v1api20230301/prometheus_rule_group_types_gen.go @@ -5,6 +5,7 @@ package v1api20230301 import ( "fmt" + arm "github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301/arm" storage "github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301/storage" "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" @@ -378,7 +379,7 @@ func (group *PrometheusRuleGroup_Spec) ConvertToARM(resolved genruntime.ConvertT if group == nil { return nil, nil } - result := &PrometheusRuleGroup_Spec_ARM{} + result := &arm.PrometheusRuleGroup_Spec{} // Set property "Location": if group.Location != nil { @@ -396,7 +397,7 @@ func (group *PrometheusRuleGroup_Spec) ConvertToARM(resolved genruntime.ConvertT group.Interval != nil || group.Rules != nil || group.ScopesReferences != nil { - result.Properties = &PrometheusRuleGroupProperties_ARM{} + result.Properties = &arm.PrometheusRuleGroupProperties{} } if group.ClusterName != nil { clusterName := *group.ClusterName @@ -419,7 +420,7 @@ func (group *PrometheusRuleGroup_Spec) ConvertToARM(resolved genruntime.ConvertT if err != nil { return nil, err } - result.Properties.Rules = append(result.Properties.Rules, *item_ARM.(*PrometheusRule_ARM)) + result.Properties.Rules = append(result.Properties.Rules, *item_ARM.(*arm.PrometheusRule)) } for _, item := range group.ScopesReferences { itemARMID, err := resolved.ResolvedReferences.Lookup(item) @@ -441,14 +442,14 @@ func (group *PrometheusRuleGroup_Spec) ConvertToARM(resolved genruntime.ConvertT // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (group *PrometheusRuleGroup_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleGroup_Spec_ARM{} + return &arm.PrometheusRuleGroup_Spec{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (group *PrometheusRuleGroup_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleGroup_Spec_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleGroup_Spec) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleGroup_Spec_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleGroup_Spec, got %T", armInput) } // Set property "AzureName": @@ -889,14 +890,14 @@ var _ genruntime.FromARMConverter = &PrometheusRuleGroup_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (group *PrometheusRuleGroup_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleGroup_STATUS_ARM{} + return &arm.PrometheusRuleGroup_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (group *PrometheusRuleGroup_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleGroup_STATUS_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleGroup_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleGroup_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleGroup_STATUS, got %T", armInput) } // Set property "ClusterName": @@ -1208,7 +1209,7 @@ func (rule *PrometheusRule) ConvertToARM(resolved genruntime.ConvertToARMResolve if rule == nil { return nil, nil } - result := &PrometheusRule_ARM{} + result := &arm.PrometheusRule{} // Set property "Actions": for _, item := range rule.Actions { @@ -1216,7 +1217,7 @@ func (rule *PrometheusRule) ConvertToARM(resolved genruntime.ConvertToARMResolve if err != nil { return nil, err } - result.Actions = append(result.Actions, *item_ARM.(*PrometheusRuleGroupAction_ARM)) + result.Actions = append(result.Actions, *item_ARM.(*arm.PrometheusRuleGroupAction)) } // Set property "Alert": @@ -1271,7 +1272,7 @@ func (rule *PrometheusRule) ConvertToARM(resolved genruntime.ConvertToARMResolve if err != nil { return nil, err } - resolveConfiguration := *resolveConfiguration_ARM.(*PrometheusRuleResolveConfiguration_ARM) + resolveConfiguration := *resolveConfiguration_ARM.(*arm.PrometheusRuleResolveConfiguration) result.ResolveConfiguration = &resolveConfiguration } @@ -1285,14 +1286,14 @@ func (rule *PrometheusRule) ConvertToARM(resolved genruntime.ConvertToARMResolve // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (rule *PrometheusRule) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRule_ARM{} + return &arm.PrometheusRule{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (rule *PrometheusRule) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRule_ARM) + typedInput, ok := armInput.(arm.PrometheusRule) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRule_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRule, got %T", armInput) } // Set property "Actions": @@ -1619,14 +1620,14 @@ var _ genruntime.FromARMConverter = &PrometheusRule_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (rule *PrometheusRule_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRule_STATUS_ARM{} + return &arm.PrometheusRule_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (rule *PrometheusRule_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRule_STATUS_ARM) + typedInput, ok := armInput.(arm.PrometheusRule_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRule_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRule_STATUS, got %T", armInput) } // Set property "Actions": @@ -1872,14 +1873,14 @@ var _ genruntime.FromARMConverter = &SystemData_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &SystemData_STATUS_ARM{} + 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.(SystemData_STATUS_ARM) + typedInput, ok := armInput.(arm.SystemData_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SystemData_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.SystemData_STATUS, got %T", armInput) } // Set property "CreatedAt": @@ -2019,7 +2020,7 @@ func (action *PrometheusRuleGroupAction) ConvertToARM(resolved genruntime.Conver if action == nil { return nil, nil } - result := &PrometheusRuleGroupAction_ARM{} + result := &arm.PrometheusRuleGroupAction{} // Set property "ActionGroupId": if action.ActionGroupReference != nil { @@ -2043,14 +2044,14 @@ func (action *PrometheusRuleGroupAction) ConvertToARM(resolved genruntime.Conver // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (action *PrometheusRuleGroupAction) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleGroupAction_ARM{} + return &arm.PrometheusRuleGroupAction{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (action *PrometheusRuleGroupAction) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleGroupAction_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleGroupAction) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleGroupAction_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleGroupAction, got %T", armInput) } // no assignment for property "ActionGroupReference" @@ -2143,14 +2144,14 @@ var _ genruntime.FromARMConverter = &PrometheusRuleGroupAction_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (action *PrometheusRuleGroupAction_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleGroupAction_STATUS_ARM{} + return &arm.PrometheusRuleGroupAction_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (action *PrometheusRuleGroupAction_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleGroupAction_STATUS_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleGroupAction_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleGroupAction_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleGroupAction_STATUS, got %T", armInput) } // Set property "ActionGroupId": @@ -2222,7 +2223,7 @@ func (configuration *PrometheusRuleResolveConfiguration) ConvertToARM(resolved g if configuration == nil { return nil, nil } - result := &PrometheusRuleResolveConfiguration_ARM{} + result := &arm.PrometheusRuleResolveConfiguration{} // Set property "AutoResolved": if configuration.AutoResolved != nil { @@ -2240,14 +2241,14 @@ func (configuration *PrometheusRuleResolveConfiguration) ConvertToARM(resolved g // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (configuration *PrometheusRuleResolveConfiguration) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleResolveConfiguration_ARM{} + return &arm.PrometheusRuleResolveConfiguration{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (configuration *PrometheusRuleResolveConfiguration) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleResolveConfiguration_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleResolveConfiguration) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleResolveConfiguration_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleResolveConfiguration, got %T", armInput) } // Set property "AutoResolved": @@ -2342,14 +2343,14 @@ var _ genruntime.FromARMConverter = &PrometheusRuleResolveConfiguration_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (configuration *PrometheusRuleResolveConfiguration_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrometheusRuleResolveConfiguration_STATUS_ARM{} + return &arm.PrometheusRuleResolveConfiguration_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (configuration *PrometheusRuleResolveConfiguration_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrometheusRuleResolveConfiguration_STATUS_ARM) + typedInput, ok := armInput.(arm.PrometheusRuleResolveConfiguration_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrometheusRuleResolveConfiguration_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrometheusRuleResolveConfiguration_STATUS, got %T", armInput) } // Set property "AutoResolved": @@ -2413,6 +2414,40 @@ func (configuration *PrometheusRuleResolveConfiguration_STATUS) AssignProperties return nil } +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, +} + func init() { SchemeBuilder.Register(&PrometheusRuleGroup{}, &PrometheusRuleGroupList{}) } diff --git a/v2/api/alertsmanagement/v1api20230301/structure.txt b/v2/api/alertsmanagement/v1api20230301/structure.txt index 42bee562226..91bb30977e2 100644 --- a/v2/api/alertsmanagement/v1api20230301/structure.txt +++ b/v2/api/alertsmanagement/v1api20230301/structure.txt @@ -2,129 +2,20 @@ github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301 ├── APIVersion: Enum (1 value) │ └── "2023-03-01" -├── PrometheusRuleGroup: Resource -│ ├── Owner: resources/v1apiv20191001.ResourceGroup -│ ├── Spec: Object (10 properties) -│ │ ├── AzureName: Validated (1 rule) -│ │ │ └── Rule 0: Pattern: "^[^:@/#{}%&+*<>?]+$" -│ │ ├── ClusterName: *string -│ │ ├── Description: *string -│ │ ├── Enabled: *bool -│ │ ├── Interval: *string -│ │ ├── Location: *string -│ │ ├── Owner: *genruntime.KnownResourceReference -│ │ ├── Rules: Object (10 properties)[] -│ │ │ ├── Actions: Object (2 properties)[] -│ │ │ │ ├── ActionGroupReference: *genruntime.ResourceReference -│ │ │ │ └── ActionProperties: map[string]string -│ │ │ ├── Alert: *string -│ │ │ ├── Annotations: map[string]string -│ │ │ ├── Enabled: *bool -│ │ │ ├── Expression: *string -│ │ │ ├── For: *string -│ │ │ ├── Labels: map[string]string -│ │ │ ├── Record: *string -│ │ │ ├── ResolveConfiguration: *Object (2 properties) -│ │ │ │ ├── AutoResolved: *bool -│ │ │ │ └── TimeToResolve: *string -│ │ │ └── Severity: *int -│ │ ├── ScopesReferences: genruntime.ResourceReference[] -│ │ └── Tags: map[string]string -│ └── Status: Object (13 properties) -│ ├── ClusterName: *string -│ ├── Conditions: conditions.Condition[] -│ ├── Description: *string -│ ├── Enabled: *bool -│ ├── Id: *string -│ ├── Interval: *string -│ ├── Location: *string -│ ├── Name: *string -│ ├── Rules: Object (10 properties)[] -│ │ ├── Actions: Object (2 properties)[] -│ │ │ ├── ActionGroupId: *string -│ │ │ └── ActionProperties: map[string]string -│ │ ├── Alert: *string -│ │ ├── Annotations: map[string]string -│ │ ├── Enabled: *bool -│ │ ├── Expression: *string -│ │ ├── For: *string -│ │ ├── Labels: map[string]string -│ │ ├── Record: *string -│ │ ├── ResolveConfiguration: *Object (2 properties) -│ │ │ ├── AutoResolved: *bool -│ │ │ └── TimeToResolve: *string -│ │ └── Severity: *int -│ ├── Scopes: 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 -├── PrometheusRuleGroup_STATUS_ARM: Object (7 properties) -│ ├── Id: *string -│ ├── Location: *string -│ ├── Name: *string -│ ├── Properties: *Object (6 properties) -│ │ ├── ClusterName: *string -│ │ ├── Description: *string -│ │ ├── Enabled: *bool -│ │ ├── Interval: *string -│ │ ├── Rules: Object (10 properties)[] -│ │ │ ├── Actions: Object (2 properties)[] -│ │ │ │ ├── ActionGroupId: *string -│ │ │ │ └── ActionProperties: map[string]string -│ │ │ ├── Alert: *string -│ │ │ ├── Annotations: map[string]string -│ │ │ ├── Enabled: *bool -│ │ │ ├── Expression: *string -│ │ │ ├── For: *string -│ │ │ ├── Labels: map[string]string -│ │ │ ├── Record: *string -│ │ │ ├── ResolveConfiguration: *Object (2 properties) -│ │ │ │ ├── AutoResolved: *bool -│ │ │ │ └── TimeToResolve: *string -│ │ │ └── Severity: *int -│ │ └── Scopes: 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 -└── PrometheusRuleGroup_Spec_ARM: Object (4 properties) - ├── Location: *string - ├── Name: string - ├── Properties: *Object (6 properties) +└── PrometheusRuleGroup: Resource + ├── Owner: resources/v1apiv20191001.ResourceGroup + ├── Spec: Object (10 properties) + │ ├── AzureName: Validated (1 rule) + │ │ └── Rule 0: Pattern: "^[^:@/#{}%&+*<>?]+$" │ ├── ClusterName: *string │ ├── Description: *string │ ├── Enabled: *bool │ ├── Interval: *string + │ ├── Location: *string + │ ├── Owner: *genruntime.KnownResourceReference │ ├── Rules: Object (10 properties)[] │ │ ├── Actions: Object (2 properties)[] - │ │ │ ├── ActionGroupId: *string + │ │ │ ├── ActionGroupReference: *genruntime.ResourceReference │ │ │ └── ActionProperties: map[string]string │ │ ├── Alert: *string │ │ ├── Annotations: map[string]string @@ -137,5 +28,47 @@ github.com/Azure/azure-service-operator/v2/api/alertsmanagement/v1api20230301 │ │ │ ├── AutoResolved: *bool │ │ │ └── TimeToResolve: *string │ │ └── Severity: *int - │ └── Scopes: string[] - └── Tags: map[string]string + │ ├── ScopesReferences: genruntime.ResourceReference[] + │ └── Tags: map[string]string + └── Status: Object (13 properties) + ├── ClusterName: *string + ├── Conditions: conditions.Condition[] + ├── Description: *string + ├── Enabled: *bool + ├── Id: *string + ├── Interval: *string + ├── Location: *string + ├── Name: *string + ├── Rules: Object (10 properties)[] + │ ├── Actions: Object (2 properties)[] + │ │ ├── ActionGroupId: *string + │ │ └── ActionProperties: map[string]string + │ ├── Alert: *string + │ ├── Annotations: map[string]string + │ ├── Enabled: *bool + │ ├── Expression: *string + │ ├── For: *string + │ ├── Labels: map[string]string + │ ├── Record: *string + │ ├── ResolveConfiguration: *Object (2 properties) + │ │ ├── AutoResolved: *bool + │ │ └── TimeToResolve: *string + │ └── Severity: *int + ├── Scopes: 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 diff --git a/v2/api/monitor/v1api20230403/account_status_arm_types_gen_test.go b/v2/api/monitor/v1api20230403/account_status_arm_types_gen_test.go deleted file mode 100644 index c463fa905a5..00000000000 --- a/v2/api/monitor/v1api20230403/account_status_arm_types_gen_test.go +++ /dev/null @@ -1,442 +0,0 @@ -// Code generated by azure-service-operator-codegen. DO NOT EDIT. -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -package v1api20230403 - -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_Account_STATUS_ARM_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 Account_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForAccount_STATUS_ARM, Account_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForAccount_STATUS_ARM runs a test to see if a specific instance of Account_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForAccount_STATUS_ARM(subject Account_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual Account_STATUS_ARM - 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 Account_STATUS_ARM instances for property testing - lazily instantiated by Account_STATUS_ARMGenerator() -var account_STATUS_ARMGenerator gopter.Gen - -// Account_STATUS_ARMGenerator returns a generator of Account_STATUS_ARM instances for property testing. -// We first initialize account_STATUS_ARMGenerator 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 Account_STATUS_ARMGenerator() gopter.Gen { - if account_STATUS_ARMGenerator != nil { - return account_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForAccount_STATUS_ARM(generators) - account_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(Account_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForAccount_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForAccount_STATUS_ARM(generators) - account_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(Account_STATUS_ARM{}), generators) - - return account_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForAccount_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForAccount_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Etag"] = gen.PtrOf(gen.AlphaString()) - gens["Id"] = gen.PtrOf(gen.AlphaString()) - 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()) -} - -// AddRelatedPropertyGeneratorsForAccount_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForAccount_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Properties"] = gen.PtrOf(AzureMonitorWorkspace_STATUS_ARMGenerator()) - gens["SystemData"] = gen.PtrOf(SystemData_STATUS_ARMGenerator()) -} - -func Test_AzureMonitorWorkspace_STATUS_ARM_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 AzureMonitorWorkspace_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForAzureMonitorWorkspace_STATUS_ARM, AzureMonitorWorkspace_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForAzureMonitorWorkspace_STATUS_ARM runs a test to see if a specific instance of AzureMonitorWorkspace_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForAzureMonitorWorkspace_STATUS_ARM(subject AzureMonitorWorkspace_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual AzureMonitorWorkspace_STATUS_ARM - 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 AzureMonitorWorkspace_STATUS_ARM instances for property testing - lazily instantiated by -// AzureMonitorWorkspace_STATUS_ARMGenerator() -var azureMonitorWorkspace_STATUS_ARMGenerator gopter.Gen - -// AzureMonitorWorkspace_STATUS_ARMGenerator returns a generator of AzureMonitorWorkspace_STATUS_ARM instances for property testing. -// We first initialize azureMonitorWorkspace_STATUS_ARMGenerator 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 AzureMonitorWorkspace_STATUS_ARMGenerator() gopter.Gen { - if azureMonitorWorkspace_STATUS_ARMGenerator != nil { - return azureMonitorWorkspace_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM(generators) - azureMonitorWorkspace_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(AzureMonitorWorkspace_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM(generators) - azureMonitorWorkspace_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(AzureMonitorWorkspace_STATUS_ARM{}), generators) - - return azureMonitorWorkspace_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM(gens map[string]gopter.Gen) { - gens["AccountId"] = gen.PtrOf(gen.AlphaString()) - gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf( - AzureMonitorWorkspace_ProvisioningState_STATUS_Canceled, - AzureMonitorWorkspace_ProvisioningState_STATUS_Creating, - AzureMonitorWorkspace_ProvisioningState_STATUS_Deleting, - AzureMonitorWorkspace_ProvisioningState_STATUS_Failed, - AzureMonitorWorkspace_ProvisioningState_STATUS_Succeeded)) - gens["PublicNetworkAccess"] = gen.PtrOf(gen.OneConstOf(AzureMonitorWorkspace_PublicNetworkAccess_STATUS_Disabled, AzureMonitorWorkspace_PublicNetworkAccess_STATUS_Enabled)) -} - -// AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS_ARM(gens map[string]gopter.Gen) { - gens["DefaultIngestionSettings"] = gen.PtrOf(IngestionSettings_STATUS_ARMGenerator()) - gens["Metrics"] = gen.PtrOf(Metrics_STATUS_ARMGenerator()) - gens["PrivateEndpointConnections"] = gen.SliceOf(PrivateEndpointConnection_STATUS_ARMGenerator()) -} - -func Test_IngestionSettings_STATUS_ARM_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 IngestionSettings_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForIngestionSettings_STATUS_ARM, IngestionSettings_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForIngestionSettings_STATUS_ARM runs a test to see if a specific instance of IngestionSettings_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForIngestionSettings_STATUS_ARM(subject IngestionSettings_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual IngestionSettings_STATUS_ARM - 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 IngestionSettings_STATUS_ARM instances for property testing - lazily instantiated by -// IngestionSettings_STATUS_ARMGenerator() -var ingestionSettings_STATUS_ARMGenerator gopter.Gen - -// IngestionSettings_STATUS_ARMGenerator returns a generator of IngestionSettings_STATUS_ARM instances for property testing. -func IngestionSettings_STATUS_ARMGenerator() gopter.Gen { - if ingestionSettings_STATUS_ARMGenerator != nil { - return ingestionSettings_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForIngestionSettings_STATUS_ARM(generators) - ingestionSettings_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(IngestionSettings_STATUS_ARM{}), generators) - - return ingestionSettings_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForIngestionSettings_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForIngestionSettings_STATUS_ARM(gens map[string]gopter.Gen) { - gens["DataCollectionEndpointResourceId"] = gen.PtrOf(gen.AlphaString()) - gens["DataCollectionRuleResourceId"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_Metrics_STATUS_ARM_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 Metrics_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForMetrics_STATUS_ARM, Metrics_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForMetrics_STATUS_ARM runs a test to see if a specific instance of Metrics_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForMetrics_STATUS_ARM(subject Metrics_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual Metrics_STATUS_ARM - 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 Metrics_STATUS_ARM instances for property testing - lazily instantiated by Metrics_STATUS_ARMGenerator() -var metrics_STATUS_ARMGenerator gopter.Gen - -// Metrics_STATUS_ARMGenerator returns a generator of Metrics_STATUS_ARM instances for property testing. -func Metrics_STATUS_ARMGenerator() gopter.Gen { - if metrics_STATUS_ARMGenerator != nil { - return metrics_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForMetrics_STATUS_ARM(generators) - metrics_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(Metrics_STATUS_ARM{}), generators) - - return metrics_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForMetrics_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForMetrics_STATUS_ARM(gens map[string]gopter.Gen) { - gens["InternalId"] = gen.PtrOf(gen.AlphaString()) - gens["PrometheusQueryEndpoint"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_PrivateEndpointConnection_STATUS_ARM_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 PrivateEndpointConnection_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForPrivateEndpointConnection_STATUS_ARM, PrivateEndpointConnection_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForPrivateEndpointConnection_STATUS_ARM runs a test to see if a specific instance of PrivateEndpointConnection_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForPrivateEndpointConnection_STATUS_ARM(subject PrivateEndpointConnection_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual PrivateEndpointConnection_STATUS_ARM - 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 PrivateEndpointConnection_STATUS_ARM instances for property testing - lazily instantiated by -// PrivateEndpointConnection_STATUS_ARMGenerator() -var privateEndpointConnection_STATUS_ARMGenerator gopter.Gen - -// PrivateEndpointConnection_STATUS_ARMGenerator returns a generator of PrivateEndpointConnection_STATUS_ARM instances for property testing. -func PrivateEndpointConnection_STATUS_ARMGenerator() gopter.Gen { - if privateEndpointConnection_STATUS_ARMGenerator != nil { - return privateEndpointConnection_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS_ARM(generators) - privateEndpointConnection_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(PrivateEndpointConnection_STATUS_ARM{}), generators) - - return privateEndpointConnection_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Id"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_SystemData_STATUS_ARM_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_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForSystemData_STATUS_ARM, SystemData_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForSystemData_STATUS_ARM runs a test to see if a specific instance of SystemData_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForSystemData_STATUS_ARM(subject SystemData_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual SystemData_STATUS_ARM - 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_ARM instances for property testing - lazily instantiated by -// SystemData_STATUS_ARMGenerator() -var systemData_STATUS_ARMGenerator gopter.Gen - -// SystemData_STATUS_ARMGenerator returns a generator of SystemData_STATUS_ARM instances for property testing. -func SystemData_STATUS_ARMGenerator() gopter.Gen { - if systemData_STATUS_ARMGenerator != nil { - return systemData_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM(generators) - systemData_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(SystemData_STATUS_ARM{}), generators) - - return systemData_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForSystemData_STATUS_ARM(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)) -} diff --git a/v2/api/monitor/v1api20230403/account_types_gen.go b/v2/api/monitor/v1api20230403/account_types_gen.go index 7051d277847..f13428775f3 100644 --- a/v2/api/monitor/v1api20230403/account_types_gen.go +++ b/v2/api/monitor/v1api20230403/account_types_gen.go @@ -5,6 +5,7 @@ package v1api20230403 import ( "fmt" + arm "github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403/arm" storage "github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403/storage" "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" @@ -350,7 +351,7 @@ func (account *Account_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolv if account == nil { return nil, nil } - result := &Account_Spec_ARM{} + result := &arm.Account_Spec{} // Set property "Location": if account.Location != nil { @@ -373,14 +374,14 @@ func (account *Account_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolv // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (account *Account_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &Account_Spec_ARM{} + return &arm.Account_Spec{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (account *Account_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(Account_Spec_ARM) + typedInput, ok := armInput.(arm.Account_Spec) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Account_Spec_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Account_Spec, got %T", armInput) } // Set property "AzureName": @@ -640,14 +641,14 @@ var _ genruntime.FromARMConverter = &Account_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (account *Account_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &Account_STATUS_ARM{} + return &arm.Account_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (account *Account_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(Account_STATUS_ARM) + typedInput, ok := armInput.(arm.Account_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Account_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Account_STATUS, got %T", armInput) } // Set property "AccountId": @@ -1037,14 +1038,14 @@ var _ genruntime.FromARMConverter = &IngestionSettings_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (settings *IngestionSettings_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &IngestionSettings_STATUS_ARM{} + return &arm.IngestionSettings_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (settings *IngestionSettings_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(IngestionSettings_STATUS_ARM) + typedInput, ok := armInput.(arm.IngestionSettings_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected IngestionSettings_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.IngestionSettings_STATUS, got %T", armInput) } // Set property "DataCollectionEndpointResourceId": @@ -1111,14 +1112,14 @@ var _ genruntime.FromARMConverter = &Metrics_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (metrics *Metrics_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &Metrics_STATUS_ARM{} + return &arm.Metrics_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (metrics *Metrics_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(Metrics_STATUS_ARM) + typedInput, ok := armInput.(arm.Metrics_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Metrics_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Metrics_STATUS, got %T", armInput) } // Set property "InternalId": @@ -1183,14 +1184,14 @@ var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (connection *PrivateEndpointConnection_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &PrivateEndpointConnection_STATUS_ARM{} + return &arm.PrivateEndpointConnection_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (connection *PrivateEndpointConnection_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(PrivateEndpointConnection_STATUS_ARM) + typedInput, ok := armInput.(arm.PrivateEndpointConnection_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected PrivateEndpointConnection_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.PrivateEndpointConnection_STATUS, got %T", armInput) } // Set property "Id": @@ -1257,14 +1258,14 @@ var _ genruntime.FromARMConverter = &SystemData_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &SystemData_STATUS_ARM{} + 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.(SystemData_STATUS_ARM) + typedInput, ok := armInput.(arm.SystemData_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SystemData_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.SystemData_STATUS, got %T", armInput) } // Set property "CreatedAt": @@ -1388,6 +1389,40 @@ func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination return nil } +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, +} + func init() { SchemeBuilder.Register(&Account{}, &AccountList{}) } diff --git a/v2/api/monitor/v1api20230403/account_spec_arm_types_gen.go b/v2/api/monitor/v1api20230403/arm/account_spec_types_gen.go similarity index 73% rename from v2/api/monitor/v1api20230403/account_spec_arm_types_gen.go rename to v2/api/monitor/v1api20230403/arm/account_spec_types_gen.go index 8dd77d7bc64..11b3e0b3722 100644 --- a/v2/api/monitor/v1api20230403/account_spec_arm_types_gen.go +++ b/v2/api/monitor/v1api20230403/arm/account_spec_types_gen.go @@ -1,11 +1,11 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20230403 +package arm import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" -type Account_Spec_ARM struct { +type Account_Spec struct { // Location: The geo-location where the resource lives Location *string `json:"location,omitempty"` Name string `json:"name,omitempty"` @@ -14,19 +14,19 @@ type Account_Spec_ARM struct { Tags map[string]string `json:"tags,omitempty"` } -var _ genruntime.ARMResourceSpec = &Account_Spec_ARM{} +var _ genruntime.ARMResourceSpec = &Account_Spec{} // GetAPIVersion returns the ARM API version of the resource. This is always "2023-04-03" -func (account Account_Spec_ARM) GetAPIVersion() string { +func (account Account_Spec) GetAPIVersion() string { return string(APIVersion_Value) } // GetName returns the Name of the resource -func (account *Account_Spec_ARM) GetName() string { +func (account *Account_Spec) GetName() string { return account.Name } // GetType returns the ARM Type of the resource. This is always "Microsoft.Monitor/accounts" -func (account *Account_Spec_ARM) GetType() string { +func (account *Account_Spec) GetType() string { return "Microsoft.Monitor/accounts" } diff --git a/v2/api/monitor/v1api20230403/account_spec_arm_types_gen_test.go b/v2/api/monitor/v1api20230403/arm/account_spec_types_gen_test.go similarity index 51% rename from v2/api/monitor/v1api20230403/account_spec_arm_types_gen_test.go rename to v2/api/monitor/v1api20230403/arm/account_spec_types_gen_test.go index cb0d6d9aa76..dc4c6fb53ff 100644 --- a/v2/api/monitor/v1api20230403/account_spec_arm_types_gen_test.go +++ b/v2/api/monitor/v1api20230403/arm/account_spec_types_gen_test.go @@ -1,7 +1,7 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20230403 +package arm import ( "encoding/json" @@ -17,20 +17,20 @@ import ( "testing" ) -func Test_Account_Spec_ARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_Account_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 Account_Spec_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForAccount_Spec_ARM, Account_Spec_ARMGenerator())) + "Round trip of Account_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForAccount_Spec, Account_SpecGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForAccount_Spec_ARM runs a test to see if a specific instance of Account_Spec_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForAccount_Spec_ARM(subject Account_Spec_ARM) string { +// RunJSONSerializationTestForAccount_Spec runs a test to see if a specific instance of Account_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForAccount_Spec(subject Account_Spec) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -38,7 +38,7 @@ func RunJSONSerializationTestForAccount_Spec_ARM(subject Account_Spec_ARM) strin } // Deserialize back into memory - var actual Account_Spec_ARM + var actual Account_Spec err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -56,24 +56,24 @@ func RunJSONSerializationTestForAccount_Spec_ARM(subject Account_Spec_ARM) strin return "" } -// Generator of Account_Spec_ARM instances for property testing - lazily instantiated by Account_Spec_ARMGenerator() -var account_Spec_ARMGenerator gopter.Gen +// Generator of Account_Spec instances for property testing - lazily instantiated by Account_SpecGenerator() +var account_SpecGenerator gopter.Gen -// Account_Spec_ARMGenerator returns a generator of Account_Spec_ARM instances for property testing. -func Account_Spec_ARMGenerator() gopter.Gen { - if account_Spec_ARMGenerator != nil { - return account_Spec_ARMGenerator +// Account_SpecGenerator returns a generator of Account_Spec instances for property testing. +func Account_SpecGenerator() gopter.Gen { + if account_SpecGenerator != nil { + return account_SpecGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForAccount_Spec_ARM(generators) - account_Spec_ARMGenerator = gen.Struct(reflect.TypeOf(Account_Spec_ARM{}), generators) + AddIndependentPropertyGeneratorsForAccount_Spec(generators) + account_SpecGenerator = gen.Struct(reflect.TypeOf(Account_Spec{}), generators) - return account_Spec_ARMGenerator + return account_SpecGenerator } -// AddIndependentPropertyGeneratorsForAccount_Spec_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForAccount_Spec_ARM(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForAccount_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForAccount_Spec(gens map[string]gopter.Gen) { gens["Location"] = gen.PtrOf(gen.AlphaString()) gens["Name"] = gen.AlphaString() gens["Tags"] = gen.MapOf( diff --git a/v2/api/monitor/v1api20230403/account_status_arm_types_gen.go b/v2/api/monitor/v1api20230403/arm/account_status_types_gen.go similarity index 55% rename from v2/api/monitor/v1api20230403/account_status_arm_types_gen.go rename to v2/api/monitor/v1api20230403/arm/account_status_types_gen.go index 5612f1f497e..228bcc08dfb 100644 --- a/v2/api/monitor/v1api20230403/account_status_arm_types_gen.go +++ b/v2/api/monitor/v1api20230403/arm/account_status_types_gen.go @@ -1,9 +1,11 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20230403 +package arm -type Account_STATUS_ARM struct { +import v20230403 "github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403" + +type Account_STATUS struct { // Etag: Resource entity tag (ETag) Etag *string `json:"etag,omitempty"` @@ -18,10 +20,10 @@ type Account_STATUS_ARM struct { Name *string `json:"name,omitempty"` // Properties: Resource properties - Properties *AzureMonitorWorkspace_STATUS_ARM `json:"properties,omitempty"` + Properties *AzureMonitorWorkspace_STATUS `json:"properties,omitempty"` // SystemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData_STATUS_ARM `json:"systemData,omitempty"` + SystemData *SystemData_STATUS `json:"systemData,omitempty"` // Tags: Resource tags. Tags map[string]string `json:"tags,omitempty"` @@ -31,28 +33,28 @@ type Account_STATUS_ARM struct { } // Properties of an Azure Monitor Workspace -type AzureMonitorWorkspace_STATUS_ARM struct { +type AzureMonitorWorkspace_STATUS struct { // AccountId: The immutable Id of the Azure Monitor Workspace. This property is read-only. AccountId *string `json:"accountId,omitempty"` // DefaultIngestionSettings: The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *IngestionSettings_STATUS_ARM `json:"defaultIngestionSettings,omitempty"` + DefaultIngestionSettings *IngestionSettings_STATUS `json:"defaultIngestionSettings,omitempty"` // Metrics: Properties related to the metrics container in the Azure Monitor Workspace - Metrics *Metrics_STATUS_ARM `json:"metrics,omitempty"` + Metrics *Metrics_STATUS `json:"metrics,omitempty"` // PrivateEndpointConnections: List of private endpoint connections - PrivateEndpointConnections []PrivateEndpointConnection_STATUS_ARM `json:"privateEndpointConnections,omitempty"` + PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"` // ProvisioningState: The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. - ProvisioningState *AzureMonitorWorkspace_ProvisioningState_STATUS `json:"provisioningState,omitempty"` + ProvisioningState *v20230403.AzureMonitorWorkspace_ProvisioningState_STATUS `json:"provisioningState,omitempty"` // PublicNetworkAccess: Gets or sets allow or disallow public network access to Azure Monitor Workspace - PublicNetworkAccess *AzureMonitorWorkspace_PublicNetworkAccess_STATUS `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *v20230403.AzureMonitorWorkspace_PublicNetworkAccess_STATUS `json:"publicNetworkAccess,omitempty"` } // Metadata pertaining to creation and last modification of the resource. -type SystemData_STATUS_ARM struct { +type SystemData_STATUS struct { // CreatedAt: The timestamp of resource creation (UTC). CreatedAt *string `json:"createdAt,omitempty"` @@ -60,7 +62,7 @@ type SystemData_STATUS_ARM struct { CreatedBy *string `json:"createdBy,omitempty"` // CreatedByType: The type of identity that created the resource. - CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` + CreatedByType *v20230403.SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"` // LastModifiedAt: The timestamp of resource last modification (UTC) LastModifiedAt *string `json:"lastModifiedAt,omitempty"` @@ -69,11 +71,11 @@ type SystemData_STATUS_ARM struct { LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // LastModifiedByType: The type of identity that last modified the resource. - LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` + LastModifiedByType *v20230403.SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"` } // Settings for data ingestion -type IngestionSettings_STATUS_ARM struct { +type IngestionSettings_STATUS struct { // DataCollectionEndpointResourceId: The Azure resource Id of the default data collection endpoint for this Azure Monitor // Workspace. DataCollectionEndpointResourceId *string `json:"dataCollectionEndpointResourceId,omitempty"` @@ -83,7 +85,7 @@ type IngestionSettings_STATUS_ARM struct { } // Properties related to the metrics container in the Azure Monitor Workspace -type Metrics_STATUS_ARM struct { +type Metrics_STATUS struct { // InternalId: An internal identifier for the metrics container. Only to be used by the system InternalId *string `json:"internalId,omitempty"` @@ -92,42 +94,8 @@ type Metrics_STATUS_ARM struct { } // The private endpoint connection resource. -type PrivateEndpointConnection_STATUS_ARM struct { +type PrivateEndpointConnection_STATUS struct { // Id: Fully qualified resource ID for the resource. E.g. // "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" Id *string `json:"id,omitempty"` } - -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, -} diff --git a/v2/api/monitor/v1api20230403/arm/account_status_types_gen_test.go b/v2/api/monitor/v1api20230403/arm/account_status_types_gen_test.go new file mode 100644 index 00000000000..88ecf4874f9 --- /dev/null +++ b/v2/api/monitor/v1api20230403/arm/account_status_types_gen_test.go @@ -0,0 +1,442 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package arm + +import ( + "encoding/json" + v20230403 "github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403" + "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_Account_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 Account_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForAccount_STATUS, Account_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForAccount_STATUS runs a test to see if a specific instance of Account_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForAccount_STATUS(subject Account_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Account_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 Account_STATUS instances for property testing - lazily instantiated by Account_STATUSGenerator() +var account_STATUSGenerator gopter.Gen + +// Account_STATUSGenerator returns a generator of Account_STATUS instances for property testing. +// We first initialize account_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 Account_STATUSGenerator() gopter.Gen { + if account_STATUSGenerator != nil { + return account_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForAccount_STATUS(generators) + account_STATUSGenerator = gen.Struct(reflect.TypeOf(Account_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForAccount_STATUS(generators) + AddRelatedPropertyGeneratorsForAccount_STATUS(generators) + account_STATUSGenerator = gen.Struct(reflect.TypeOf(Account_STATUS{}), generators) + + return account_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForAccount_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForAccount_STATUS(gens map[string]gopter.Gen) { + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + 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()) +} + +// AddRelatedPropertyGeneratorsForAccount_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForAccount_STATUS(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(AzureMonitorWorkspace_STATUSGenerator()) + gens["SystemData"] = gen.PtrOf(SystemData_STATUSGenerator()) +} + +func Test_AzureMonitorWorkspace_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 AzureMonitorWorkspace_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForAzureMonitorWorkspace_STATUS, AzureMonitorWorkspace_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForAzureMonitorWorkspace_STATUS runs a test to see if a specific instance of AzureMonitorWorkspace_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForAzureMonitorWorkspace_STATUS(subject AzureMonitorWorkspace_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual AzureMonitorWorkspace_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 AzureMonitorWorkspace_STATUS instances for property testing - lazily instantiated by +// AzureMonitorWorkspace_STATUSGenerator() +var azureMonitorWorkspace_STATUSGenerator gopter.Gen + +// AzureMonitorWorkspace_STATUSGenerator returns a generator of AzureMonitorWorkspace_STATUS instances for property testing. +// We first initialize azureMonitorWorkspace_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 AzureMonitorWorkspace_STATUSGenerator() gopter.Gen { + if azureMonitorWorkspace_STATUSGenerator != nil { + return azureMonitorWorkspace_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS(generators) + azureMonitorWorkspace_STATUSGenerator = gen.Struct(reflect.TypeOf(AzureMonitorWorkspace_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS(generators) + AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS(generators) + azureMonitorWorkspace_STATUSGenerator = gen.Struct(reflect.TypeOf(AzureMonitorWorkspace_STATUS{}), generators) + + return azureMonitorWorkspace_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForAzureMonitorWorkspace_STATUS(gens map[string]gopter.Gen) { + gens["AccountId"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForAzureMonitorWorkspace_STATUS(gens map[string]gopter.Gen) { + gens["DefaultIngestionSettings"] = gen.PtrOf(IngestionSettings_STATUSGenerator()) + gens["Metrics"] = gen.PtrOf(Metrics_STATUSGenerator()) + gens["PrivateEndpointConnections"] = gen.SliceOf(PrivateEndpointConnection_STATUSGenerator()) + gens["ProvisioningState"] = gen.PtrOf(v20230403.AzureMonitorWorkspace_ProvisioningState_STATUSGenerator()) + gens["PublicNetworkAccess"] = gen.PtrOf(v20230403.AzureMonitorWorkspace_PublicNetworkAccess_STATUSGenerator()) +} + +func Test_IngestionSettings_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 IngestionSettings_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForIngestionSettings_STATUS, IngestionSettings_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForIngestionSettings_STATUS runs a test to see if a specific instance of IngestionSettings_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForIngestionSettings_STATUS(subject IngestionSettings_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual IngestionSettings_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 IngestionSettings_STATUS instances for property testing - lazily instantiated by +// IngestionSettings_STATUSGenerator() +var ingestionSettings_STATUSGenerator gopter.Gen + +// IngestionSettings_STATUSGenerator returns a generator of IngestionSettings_STATUS instances for property testing. +func IngestionSettings_STATUSGenerator() gopter.Gen { + if ingestionSettings_STATUSGenerator != nil { + return ingestionSettings_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForIngestionSettings_STATUS(generators) + ingestionSettings_STATUSGenerator = gen.Struct(reflect.TypeOf(IngestionSettings_STATUS{}), generators) + + return ingestionSettings_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForIngestionSettings_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForIngestionSettings_STATUS(gens map[string]gopter.Gen) { + gens["DataCollectionEndpointResourceId"] = gen.PtrOf(gen.AlphaString()) + gens["DataCollectionRuleResourceId"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_Metrics_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 Metrics_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForMetrics_STATUS, Metrics_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForMetrics_STATUS runs a test to see if a specific instance of Metrics_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForMetrics_STATUS(subject Metrics_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Metrics_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 Metrics_STATUS instances for property testing - lazily instantiated by Metrics_STATUSGenerator() +var metrics_STATUSGenerator gopter.Gen + +// Metrics_STATUSGenerator returns a generator of Metrics_STATUS instances for property testing. +func Metrics_STATUSGenerator() gopter.Gen { + if metrics_STATUSGenerator != nil { + return metrics_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForMetrics_STATUS(generators) + metrics_STATUSGenerator = gen.Struct(reflect.TypeOf(Metrics_STATUS{}), generators) + + return metrics_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForMetrics_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForMetrics_STATUS(gens map[string]gopter.Gen) { + gens["InternalId"] = gen.PtrOf(gen.AlphaString()) + gens["PrometheusQueryEndpoint"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_PrivateEndpointConnection_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 PrivateEndpointConnection_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForPrivateEndpointConnection_STATUS, PrivateEndpointConnection_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForPrivateEndpointConnection_STATUS runs a test to see if a specific instance of PrivateEndpointConnection_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForPrivateEndpointConnection_STATUS(subject PrivateEndpointConnection_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual PrivateEndpointConnection_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 PrivateEndpointConnection_STATUS instances for property testing - lazily instantiated by +// PrivateEndpointConnection_STATUSGenerator() +var privateEndpointConnection_STATUSGenerator gopter.Gen + +// PrivateEndpointConnection_STATUSGenerator returns a generator of PrivateEndpointConnection_STATUS instances for property testing. +func PrivateEndpointConnection_STATUSGenerator() gopter.Gen { + if privateEndpointConnection_STATUSGenerator != nil { + return privateEndpointConnection_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS(generators) + privateEndpointConnection_STATUSGenerator = gen.Struct(reflect.TypeOf(PrivateEndpointConnection_STATUS{}), generators) + + return privateEndpointConnection_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForPrivateEndpointConnection_STATUS(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +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. +// We first initialize systemData_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 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) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSystemData_STATUS(generators) + AddRelatedPropertyGeneratorsForSystemData_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["LastModifiedAt"] = gen.PtrOf(gen.AlphaString()) + gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) { + gens["CreatedByType"] = gen.PtrOf(v20230403.SystemData_CreatedByType_STATUSGenerator()) + gens["LastModifiedByType"] = gen.PtrOf(v20230403.SystemData_LastModifiedByType_STATUSGenerator()) +} diff --git a/v2/api/monitor/v1api20230403/arm/structure.txt b/v2/api/monitor/v1api20230403/arm/structure.txt new file mode 100644 index 00000000000..a1ad413bd32 --- /dev/null +++ b/v2/api/monitor/v1api20230403/arm/structure.txt @@ -0,0 +1,32 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403/arm +├── Account_STATUS: Object (8 properties) +│ ├── Etag: *string +│ ├── Id: *string +│ ├── Location: *string +│ ├── Name: *string +│ ├── Properties: *Object (6 properties) +│ │ ├── AccountId: *string +│ │ ├── DefaultIngestionSettings: *Object (2 properties) +│ │ │ ├── DataCollectionEndpointResourceId: *string +│ │ │ └── DataCollectionRuleResourceId: *string +│ │ ├── Metrics: *Object (2 properties) +│ │ │ ├── InternalId: *string +│ │ │ └── PrometheusQueryEndpoint: *string +│ │ ├── PrivateEndpointConnections: Object (1 property)[] +│ │ │ └── Id: *string +│ │ ├── ProvisioningState: *monitor/v1api20230403.AzureMonitorWorkspace_ProvisioningState_STATUS +│ │ └── PublicNetworkAccess: *monitor/v1api20230403.AzureMonitorWorkspace_PublicNetworkAccess_STATUS +│ ├── SystemData: *Object (6 properties) +│ │ ├── CreatedAt: *string +│ │ ├── CreatedBy: *string +│ │ ├── CreatedByType: *monitor/v1api20230403.SystemData_CreatedByType_STATUS +│ │ ├── LastModifiedAt: *string +│ │ ├── LastModifiedBy: *string +│ │ └── LastModifiedByType: *monitor/v1api20230403.SystemData_LastModifiedByType_STATUS +│ ├── Tags: map[string]string +│ └── Type: *string +└── Account_Spec: Object (3 properties) + ├── Location: *string + ├── Name: string + └── Tags: map[string]string diff --git a/v2/api/monitor/v1api20230403/structure.txt b/v2/api/monitor/v1api20230403/structure.txt index 16b4dfa9335..a612d5bbe69 100644 --- a/v2/api/monitor/v1api20230403/structure.txt +++ b/v2/api/monitor/v1api20230403/structure.txt @@ -2,96 +2,51 @@ github.com/Azure/azure-service-operator/v2/api/monitor/v1api20230403 ├── APIVersion: Enum (1 value) │ └── "2023-04-03" -├── Account: Resource -│ ├── Owner: resources/v1apiv20191001.ResourceGroup -│ ├── Spec: Object (4 properties) -│ │ ├── AzureName: string -│ │ ├── Location: *string -│ │ ├── Owner: *genruntime.KnownResourceReference -│ │ └── Tags: map[string]string -│ └── Status: Object (14 properties) -│ ├── AccountId: *string -│ ├── Conditions: conditions.Condition[] -│ ├── DefaultIngestionSettings: *Object (2 properties) -│ │ ├── DataCollectionEndpointResourceId: *string -│ │ └── DataCollectionRuleResourceId: *string -│ ├── Etag: *string -│ ├── Id: *string -│ ├── Location: *string -│ ├── Metrics: *Object (2 properties) -│ │ ├── InternalId: *string -│ │ └── PrometheusQueryEndpoint: *string -│ ├── Name: *string -│ ├── PrivateEndpointConnections: Object (1 property)[] -│ │ └── Id: *string -│ ├── ProvisioningState: *Enum (5 values) -│ │ ├── "Canceled" -│ │ ├── "Creating" -│ │ ├── "Deleting" -│ │ ├── "Failed" -│ │ └── "Succeeded" -│ ├── PublicNetworkAccess: *Enum (2 values) -│ │ ├── "Disabled" -│ │ └── "Enabled" -│ ├── 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 -├── Account_STATUS_ARM: Object (8 properties) -│ ├── Etag: *string -│ ├── Id: *string -│ ├── Location: *string -│ ├── Name: *string -│ ├── Properties: *Object (6 properties) -│ │ ├── AccountId: *string -│ │ ├── DefaultIngestionSettings: *Object (2 properties) -│ │ │ ├── DataCollectionEndpointResourceId: *string -│ │ │ └── DataCollectionRuleResourceId: *string -│ │ ├── Metrics: *Object (2 properties) -│ │ │ ├── InternalId: *string -│ │ │ └── PrometheusQueryEndpoint: *string -│ │ ├── PrivateEndpointConnections: Object (1 property)[] -│ │ │ └── Id: *string -│ │ ├── ProvisioningState: *Enum (5 values) -│ │ │ ├── "Canceled" -│ │ │ ├── "Creating" -│ │ │ ├── "Deleting" -│ │ │ ├── "Failed" -│ │ │ └── "Succeeded" -│ │ └── PublicNetworkAccess: *Enum (2 values) -│ │ ├── "Disabled" -│ │ └── "Enabled" -│ ├── 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 -└── Account_Spec_ARM: Object (3 properties) - ├── Location: *string - ├── Name: string - └── Tags: map[string]string +└── Account: Resource + ├── Owner: resources/v1apiv20191001.ResourceGroup + ├── Spec: Object (4 properties) + │ ├── AzureName: string + │ ├── Location: *string + │ ├── Owner: *genruntime.KnownResourceReference + │ └── Tags: map[string]string + └── Status: Object (14 properties) + ├── AccountId: *string + ├── Conditions: conditions.Condition[] + ├── DefaultIngestionSettings: *Object (2 properties) + │ ├── DataCollectionEndpointResourceId: *string + │ └── DataCollectionRuleResourceId: *string + ├── Etag: *string + ├── Id: *string + ├── Location: *string + ├── Metrics: *Object (2 properties) + │ ├── InternalId: *string + │ └── PrometheusQueryEndpoint: *string + ├── Name: *string + ├── PrivateEndpointConnections: Object (1 property)[] + │ └── Id: *string + ├── ProvisioningState: *Enum (5 values) + │ ├── "Canceled" + │ ├── "Creating" + │ ├── "Deleting" + │ ├── "Failed" + │ └── "Succeeded" + ├── PublicNetworkAccess: *Enum (2 values) + │ ├── "Disabled" + │ └── "Enabled" + ├── 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