diff --git a/v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen.go b/v2/api/resources/v1api20200601/arm/resource_group_spec_types_gen.go similarity index 77% rename from v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen.go rename to v2/api/resources/v1api20200601/arm/resource_group_spec_types_gen.go index cdb4d3fa8c8..96fe86ce28b 100644 --- a/v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen.go +++ b/v2/api/resources/v1api20200601/arm/resource_group_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 v1api20200601 +package arm import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" -type ResourceGroup_Spec_ARM struct { +type ResourceGroup_Spec struct { // Location: The location of the resource group. It cannot be changed after the resource group has been created. It must be // one of the supported Azure locations. Location *string `json:"location,omitempty"` @@ -18,19 +18,19 @@ type ResourceGroup_Spec_ARM struct { Tags map[string]string `json:"tags,omitempty"` } -var _ genruntime.ARMResourceSpec = &ResourceGroup_Spec_ARM{} +var _ genruntime.ARMResourceSpec = &ResourceGroup_Spec{} // GetAPIVersion returns the ARM API version of the resource. This is always "2020-06-01" -func (group ResourceGroup_Spec_ARM) GetAPIVersion() string { +func (group ResourceGroup_Spec) GetAPIVersion() string { return "2020-06-01" } // GetName returns the Name of the resource -func (group *ResourceGroup_Spec_ARM) GetName() string { +func (group *ResourceGroup_Spec) GetName() string { return group.Name } // GetType returns the ARM Type of the resource. This is always "Microsoft.Resources/resourceGroups" -func (group *ResourceGroup_Spec_ARM) GetType() string { +func (group *ResourceGroup_Spec) GetType() string { return "Microsoft.Resources/resourceGroups" } diff --git a/v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen_test.go b/v2/api/resources/v1api20200601/arm/resource_group_spec_types_gen_test.go similarity index 50% rename from v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen_test.go rename to v2/api/resources/v1api20200601/arm/resource_group_spec_types_gen_test.go index ad5b194016a..54e18c3cd72 100644 --- a/v2/api/resources/v1api20200601/resource_group_spec_arm_types_gen_test.go +++ b/v2/api/resources/v1api20200601/arm/resource_group_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 v1api20200601 +package arm import ( "encoding/json" @@ -17,20 +17,20 @@ import ( "testing" ) -func Test_ResourceGroup_Spec_ARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_ResourceGroup_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 ResourceGroup_Spec_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForResourceGroup_Spec_ARM, ResourceGroup_Spec_ARMGenerator())) + "Round trip of ResourceGroup_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForResourceGroup_Spec, ResourceGroup_SpecGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForResourceGroup_Spec_ARM runs a test to see if a specific instance of ResourceGroup_Spec_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForResourceGroup_Spec_ARM(subject ResourceGroup_Spec_ARM) string { +// RunJSONSerializationTestForResourceGroup_Spec runs a test to see if a specific instance of ResourceGroup_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForResourceGroup_Spec(subject ResourceGroup_Spec) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -38,7 +38,7 @@ func RunJSONSerializationTestForResourceGroup_Spec_ARM(subject ResourceGroup_Spe } // Deserialize back into memory - var actual ResourceGroup_Spec_ARM + var actual ResourceGroup_Spec err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -56,25 +56,24 @@ func RunJSONSerializationTestForResourceGroup_Spec_ARM(subject ResourceGroup_Spe return "" } -// Generator of ResourceGroup_Spec_ARM instances for property testing - lazily instantiated by -// ResourceGroup_Spec_ARMGenerator() -var resourceGroup_Spec_ARMGenerator gopter.Gen +// Generator of ResourceGroup_Spec instances for property testing - lazily instantiated by ResourceGroup_SpecGenerator() +var resourceGroup_SpecGenerator gopter.Gen -// ResourceGroup_Spec_ARMGenerator returns a generator of ResourceGroup_Spec_ARM instances for property testing. -func ResourceGroup_Spec_ARMGenerator() gopter.Gen { - if resourceGroup_Spec_ARMGenerator != nil { - return resourceGroup_Spec_ARMGenerator +// ResourceGroup_SpecGenerator returns a generator of ResourceGroup_Spec instances for property testing. +func ResourceGroup_SpecGenerator() gopter.Gen { + if resourceGroup_SpecGenerator != nil { + return resourceGroup_SpecGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForResourceGroup_Spec_ARM(generators) - resourceGroup_Spec_ARMGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_Spec_ARM{}), generators) + AddIndependentPropertyGeneratorsForResourceGroup_Spec(generators) + resourceGroup_SpecGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_Spec{}), generators) - return resourceGroup_Spec_ARMGenerator + return resourceGroup_SpecGenerator } -// AddIndependentPropertyGeneratorsForResourceGroup_Spec_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForResourceGroup_Spec_ARM(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForResourceGroup_Spec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForResourceGroup_Spec(gens map[string]gopter.Gen) { gens["Location"] = gen.PtrOf(gen.AlphaString()) gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) gens["Name"] = gen.AlphaString() diff --git a/v2/api/resources/v1api20200601/resource_group_status_arm_types_gen.go b/v2/api/resources/v1api20200601/arm/resource_group_status_types_gen.go similarity index 84% rename from v2/api/resources/v1api20200601/resource_group_status_arm_types_gen.go rename to v2/api/resources/v1api20200601/arm/resource_group_status_types_gen.go index 25d65a81b1a..999ed8e72e8 100644 --- a/v2/api/resources/v1api20200601/resource_group_status_arm_types_gen.go +++ b/v2/api/resources/v1api20200601/arm/resource_group_status_types_gen.go @@ -1,10 +1,10 @@ // Code generated by azure-service-operator-codegen. DO NOT EDIT. // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package v1api20200601 +package arm // Resource group information. -type ResourceGroup_STATUS_ARM struct { +type ResourceGroup_STATUS struct { // Id: The ID of the resource group. Id *string `json:"id,omitempty"` @@ -19,7 +19,7 @@ type ResourceGroup_STATUS_ARM struct { Name *string `json:"name,omitempty"` // Properties: The resource group properties. - Properties *ResourceGroupProperties_STATUS_ARM `json:"properties,omitempty"` + Properties *ResourceGroupProperties_STATUS `json:"properties,omitempty"` // Tags: The tags attached to the resource group. Tags map[string]string `json:"tags,omitempty"` @@ -29,7 +29,7 @@ type ResourceGroup_STATUS_ARM struct { } // The resource group properties. -type ResourceGroupProperties_STATUS_ARM struct { +type ResourceGroupProperties_STATUS struct { // ProvisioningState: The provisioning state. ProvisioningState *string `json:"provisioningState,omitempty"` } diff --git a/v2/api/resources/v1api20200601/arm/resource_group_status_types_gen_test.go b/v2/api/resources/v1api20200601/arm/resource_group_status_types_gen_test.go new file mode 100644 index 00000000000..a4af46b1352 --- /dev/null +++ b/v2/api/resources/v1api20200601/arm/resource_group_status_types_gen_test.go @@ -0,0 +1,161 @@ +// 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_ResourceGroupProperties_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 ResourceGroupProperties_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForResourceGroupProperties_STATUS, ResourceGroupProperties_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForResourceGroupProperties_STATUS runs a test to see if a specific instance of ResourceGroupProperties_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForResourceGroupProperties_STATUS(subject ResourceGroupProperties_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ResourceGroupProperties_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 ResourceGroupProperties_STATUS instances for property testing - lazily instantiated by +// ResourceGroupProperties_STATUSGenerator() +var resourceGroupProperties_STATUSGenerator gopter.Gen + +// ResourceGroupProperties_STATUSGenerator returns a generator of ResourceGroupProperties_STATUS instances for property testing. +func ResourceGroupProperties_STATUSGenerator() gopter.Gen { + if resourceGroupProperties_STATUSGenerator != nil { + return resourceGroupProperties_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS(generators) + resourceGroupProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(ResourceGroupProperties_STATUS{}), generators) + + return resourceGroupProperties_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS(gens map[string]gopter.Gen) { + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ResourceGroup_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 ResourceGroup_STATUS via JSON returns original", + prop.ForAll(RunJSONSerializationTestForResourceGroup_STATUS, ResourceGroup_STATUSGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForResourceGroup_STATUS runs a test to see if a specific instance of ResourceGroup_STATUS round trips to JSON and back losslessly +func RunJSONSerializationTestForResourceGroup_STATUS(subject ResourceGroup_STATUS) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ResourceGroup_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 ResourceGroup_STATUS instances for property testing - lazily instantiated by +// ResourceGroup_STATUSGenerator() +var resourceGroup_STATUSGenerator gopter.Gen + +// ResourceGroup_STATUSGenerator returns a generator of ResourceGroup_STATUS instances for property testing. +// We first initialize resourceGroup_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 ResourceGroup_STATUSGenerator() gopter.Gen { + if resourceGroup_STATUSGenerator != nil { + return resourceGroup_STATUSGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForResourceGroup_STATUS(generators) + resourceGroup_STATUSGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_STATUS{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForResourceGroup_STATUS(generators) + AddRelatedPropertyGeneratorsForResourceGroup_STATUS(generators) + resourceGroup_STATUSGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_STATUS{}), generators) + + return resourceGroup_STATUSGenerator +} + +// AddIndependentPropertyGeneratorsForResourceGroup_STATUS is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForResourceGroup_STATUS(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf( + gen.AlphaString(), + gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForResourceGroup_STATUS is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForResourceGroup_STATUS(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(ResourceGroupProperties_STATUSGenerator()) +} diff --git a/v2/api/resources/v1api20200601/arm/structure.txt b/v2/api/resources/v1api20200601/arm/structure.txt new file mode 100644 index 00000000000..4065dc689e1 --- /dev/null +++ b/v2/api/resources/v1api20200601/arm/structure.txt @@ -0,0 +1,17 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601/arm +-------------------------------------------------------------------------- +ResourceGroup_STATUS: Object (7 properties) +├── Id: *string +├── Location: *string +├── ManagedBy: *string +├── Name: *string +├── Properties: *Object (1 property) +│ └── ProvisioningState: *string +├── Tags: map[string]string +└── Type: *string +ResourceGroup_Spec: Object (4 properties) +├── Location: *string +├── ManagedBy: *string +├── Name: string +└── Tags: map[string]string diff --git a/v2/api/resources/v1api20200601/resource_group_status_arm_types_gen_test.go b/v2/api/resources/v1api20200601/resource_group_status_arm_types_gen_test.go deleted file mode 100644 index e97de79e1dd..00000000000 --- a/v2/api/resources/v1api20200601/resource_group_status_arm_types_gen_test.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by azure-service-operator-codegen. DO NOT EDIT. -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -package v1api20200601 - -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_ResourceGroupProperties_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 ResourceGroupProperties_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForResourceGroupProperties_STATUS_ARM, ResourceGroupProperties_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForResourceGroupProperties_STATUS_ARM runs a test to see if a specific instance of ResourceGroupProperties_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForResourceGroupProperties_STATUS_ARM(subject ResourceGroupProperties_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual ResourceGroupProperties_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 ResourceGroupProperties_STATUS_ARM instances for property testing - lazily instantiated by -// ResourceGroupProperties_STATUS_ARMGenerator() -var resourceGroupProperties_STATUS_ARMGenerator gopter.Gen - -// ResourceGroupProperties_STATUS_ARMGenerator returns a generator of ResourceGroupProperties_STATUS_ARM instances for property testing. -func ResourceGroupProperties_STATUS_ARMGenerator() gopter.Gen { - if resourceGroupProperties_STATUS_ARMGenerator != nil { - return resourceGroupProperties_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS_ARM(generators) - resourceGroupProperties_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(ResourceGroupProperties_STATUS_ARM{}), generators) - - return resourceGroupProperties_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForResourceGroupProperties_STATUS_ARM(gens map[string]gopter.Gen) { - gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) -} - -func Test_ResourceGroup_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 ResourceGroup_STATUS_ARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForResourceGroup_STATUS_ARM, ResourceGroup_STATUS_ARMGenerator())) - properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) -} - -// RunJSONSerializationTestForResourceGroup_STATUS_ARM runs a test to see if a specific instance of ResourceGroup_STATUS_ARM round trips to JSON and back losslessly -func RunJSONSerializationTestForResourceGroup_STATUS_ARM(subject ResourceGroup_STATUS_ARM) string { - // Serialize to JSON - bin, err := json.Marshal(subject) - if err != nil { - return err.Error() - } - - // Deserialize back into memory - var actual ResourceGroup_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 ResourceGroup_STATUS_ARM instances for property testing - lazily instantiated by -// ResourceGroup_STATUS_ARMGenerator() -var resourceGroup_STATUS_ARMGenerator gopter.Gen - -// ResourceGroup_STATUS_ARMGenerator returns a generator of ResourceGroup_STATUS_ARM instances for property testing. -// We first initialize resourceGroup_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 ResourceGroup_STATUS_ARMGenerator() gopter.Gen { - if resourceGroup_STATUS_ARMGenerator != nil { - return resourceGroup_STATUS_ARMGenerator - } - - generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForResourceGroup_STATUS_ARM(generators) - resourceGroup_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_STATUS_ARM{}), generators) - - // The above call to gen.Struct() captures the map, so create a new one - generators = make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForResourceGroup_STATUS_ARM(generators) - AddRelatedPropertyGeneratorsForResourceGroup_STATUS_ARM(generators) - resourceGroup_STATUS_ARMGenerator = gen.Struct(reflect.TypeOf(ResourceGroup_STATUS_ARM{}), generators) - - return resourceGroup_STATUS_ARMGenerator -} - -// AddIndependentPropertyGeneratorsForResourceGroup_STATUS_ARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForResourceGroup_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Id"] = gen.PtrOf(gen.AlphaString()) - gens["Location"] = gen.PtrOf(gen.AlphaString()) - gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) - gens["Name"] = gen.PtrOf(gen.AlphaString()) - gens["Tags"] = gen.MapOf( - gen.AlphaString(), - gen.AlphaString()) - gens["Type"] = gen.PtrOf(gen.AlphaString()) -} - -// AddRelatedPropertyGeneratorsForResourceGroup_STATUS_ARM is a factory method for creating gopter generators -func AddRelatedPropertyGeneratorsForResourceGroup_STATUS_ARM(gens map[string]gopter.Gen) { - gens["Properties"] = gen.PtrOf(ResourceGroupProperties_STATUS_ARMGenerator()) -} diff --git a/v2/api/resources/v1api20200601/resource_group_types_gen.go b/v2/api/resources/v1api20200601/resource_group_types_gen.go index cddf98aee3b..e8bb7f1b2cc 100644 --- a/v2/api/resources/v1api20200601/resource_group_types_gen.go +++ b/v2/api/resources/v1api20200601/resource_group_types_gen.go @@ -5,6 +5,7 @@ package v1api20200601 import ( "fmt" + arm "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601/arm" storage "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601/storage" "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" @@ -406,7 +407,7 @@ func (group *ResourceGroup_Spec) ConvertToARM(resolved genruntime.ConvertToARMRe if group == nil { return nil, nil } - result := &ResourceGroup_Spec_ARM{} + result := &arm.ResourceGroup_Spec{} // Set property "Location": if group.Location != nil { @@ -435,14 +436,14 @@ func (group *ResourceGroup_Spec) ConvertToARM(resolved genruntime.ConvertToARMRe // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (group *ResourceGroup_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &ResourceGroup_Spec_ARM{} + return &arm.ResourceGroup_Spec{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (group *ResourceGroup_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(ResourceGroup_Spec_ARM) + typedInput, ok := armInput.(arm.ResourceGroup_Spec) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ResourceGroup_Spec_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ResourceGroup_Spec, got %T", armInput) } // Set property "AzureName": @@ -704,14 +705,14 @@ var _ genruntime.FromARMConverter = &ResourceGroup_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (group *ResourceGroup_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &ResourceGroup_STATUS_ARM{} + return &arm.ResourceGroup_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (group *ResourceGroup_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(ResourceGroup_STATUS_ARM) + typedInput, ok := armInput.(arm.ResourceGroup_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ResourceGroup_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ResourceGroup_STATUS, got %T", armInput) } // no assignment for property "Conditions" @@ -972,14 +973,14 @@ var _ genruntime.FromARMConverter = &ResourceGroupProperties_STATUS{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into func (properties *ResourceGroupProperties_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &ResourceGroupProperties_STATUS_ARM{} + return &arm.ResourceGroupProperties_STATUS{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object func (properties *ResourceGroupProperties_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(ResourceGroupProperties_STATUS_ARM) + typedInput, ok := armInput.(arm.ResourceGroupProperties_STATUS) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ResourceGroupProperties_STATUS_ARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.ResourceGroupProperties_STATUS, got %T", armInput) } // Set property "ProvisioningState": diff --git a/v2/api/resources/v1api20200601/structure.txt b/v2/api/resources/v1api20200601/structure.txt index 3973adef271..f6c9fdccc85 100644 --- a/v2/api/resources/v1api20200601/structure.txt +++ b/v2/api/resources/v1api20200601/structure.txt @@ -24,17 +24,3 @@ ResourceGroup: Resource │ └── ProvisioningState: *string ├── Tags: map[string]string └── Type: *string -ResourceGroup_STATUS_ARM: Object (7 properties) -├── Id: *string -├── Location: *string -├── ManagedBy: *string -├── Name: *string -├── Properties: *Object (1 property) -│ └── ProvisioningState: *string -├── Tags: map[string]string -└── Type: *string -ResourceGroup_Spec_ARM: Object (4 properties) -├── Location: *string -├── ManagedBy: *string -├── Name: string -└── Tags: map[string]string diff --git a/v2/api/resources/v1api20200601/zz_generated.deepcopy.go b/v2/api/resources/v1api20200601/zz_generated.deepcopy.go index 29ae18b98d2..ca483fb4433 100644 --- a/v2/api/resources/v1api20200601/zz_generated.deepcopy.go +++ b/v2/api/resources/v1api20200601/zz_generated.deepcopy.go @@ -131,26 +131,6 @@ func (in *ResourceGroupProperties_STATUS) DeepCopy() *ResourceGroupProperties_ST return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceGroupProperties_STATUS_ARM) DeepCopyInto(out *ResourceGroupProperties_STATUS_ARM) { - *out = *in - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceGroupProperties_STATUS_ARM. -func (in *ResourceGroupProperties_STATUS_ARM) DeepCopy() *ResourceGroupProperties_STATUS_ARM { - if in == nil { - return nil - } - out := new(ResourceGroupProperties_STATUS_ARM) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceGroup_STATUS) DeepCopyInto(out *ResourceGroup_STATUS) { *out = *in @@ -210,58 +190,6 @@ func (in *ResourceGroup_STATUS) DeepCopy() *ResourceGroup_STATUS { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceGroup_STATUS_ARM) DeepCopyInto(out *ResourceGroup_STATUS_ARM) { - *out = *in - if in.Id != nil { - in, out := &in.Id, &out.Id - *out = new(string) - **out = **in - } - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(string) - **out = **in - } - if in.ManagedBy != nil { - in, out := &in.ManagedBy, &out.ManagedBy - *out = new(string) - **out = **in - } - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Properties != nil { - in, out := &in.Properties, &out.Properties - *out = new(ResourceGroupProperties_STATUS_ARM) - (*in).DeepCopyInto(*out) - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceGroup_STATUS_ARM. -func (in *ResourceGroup_STATUS_ARM) DeepCopy() *ResourceGroup_STATUS_ARM { - if in == nil { - return nil - } - out := new(ResourceGroup_STATUS_ARM) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceGroup_Spec) DeepCopyInto(out *ResourceGroup_Spec) { *out = *in @@ -298,35 +226,3 @@ func (in *ResourceGroup_Spec) DeepCopy() *ResourceGroup_Spec { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceGroup_Spec_ARM) DeepCopyInto(out *ResourceGroup_Spec_ARM) { - *out = *in - if in.Location != nil { - in, out := &in.Location, &out.Location - *out = new(string) - **out = **in - } - if in.ManagedBy != nil { - in, out := &in.ManagedBy, &out.ManagedBy - *out = new(string) - **out = **in - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceGroup_Spec_ARM. -func (in *ResourceGroup_Spec_ARM) DeepCopy() *ResourceGroup_Spec_ARM { - if in == nil { - return nil - } - out := new(ResourceGroup_Spec_ARM) - in.DeepCopyInto(out) - return out -} diff --git a/v2/internal/genericarmclient/generic_client_test.go b/v2/internal/genericarmclient/generic_client_test.go index 8151c103dfe..64ee8a23cf8 100644 --- a/v2/internal/genericarmclient/generic_client_test.go +++ b/v2/internal/genericarmclient/generic_client_test.go @@ -12,13 +12,16 @@ import ( "net/http/httptest" "testing" + . "github.com/onsi/gomega" + + resources "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + arm "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601/arm" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - . "github.com/onsi/gomega" "github.com/pkg/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - resources "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" "github.com/Azure/azure-service-operator/v2/internal/config" "github.com/Azure/azure-service-operator/v2/internal/genericarmclient" asometrics "github.com/Azure/azure-service-operator/v2/internal/metrics" @@ -47,7 +50,7 @@ func Test_NewResourceGroup(t *testing.T) { spec, err := resourceGroup.Spec.ConvertToARM(resolved) g.Expect(err).ToNot(HaveOccurred()) - typedResourceGroupSpec := spec.(*resources.ResourceGroup_Spec_ARM) + typedResourceGroupSpec := spec.(*arm.ResourceGroup_Spec) id := genericarmclient.MakeResourceGroupID(testContext.AzureSubscription, resourceGroup.Name) @@ -109,7 +112,7 @@ func Test_NewResourceGroup_Error(t *testing.T) { spec, err := resourceGroup.Spec.ConvertToARM(resolved) g.Expect(err).ToNot(HaveOccurred()) - typedResourceGroupSpec := spec.(*resources.ResourceGroup_Spec_ARM) + typedResourceGroupSpec := spec.(*arm.ResourceGroup_Spec) id := genericarmclient.MakeResourceGroupID(testContext.AzureSubscription, resourceGroup.Name) diff --git a/v2/tools/generator/internal/astmodel/type_name.go b/v2/tools/generator/internal/astmodel/type_name.go index 9f544ce936e..4a913825397 100644 --- a/v2/tools/generator/internal/astmodel/type_name.go +++ b/v2/tools/generator/internal/astmodel/type_name.go @@ -25,8 +25,7 @@ const ( ) var armPackageDenyList = set.Make( - "kusto", - "resources") + "kusto") // CreateARMTypeName creates an ARM object type name func CreateARMTypeName(name InternalTypeName) InternalTypeName {