diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen.go new file mode 100644 index 00000000000..d7a272384fb --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen.go @@ -0,0 +1,43 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +//Generated from: +type Route_StatusARM struct { + //Etag: A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + + //Id: Resource ID. + Id *string `json:"id,omitempty"` + + //Name: The name of the resource that is unique within a resource group. This name + //can be used to access the resource. + Name *string `json:"name,omitempty"` + + //Properties: Properties of the route. + Properties *RoutePropertiesFormat_StatusARM `json:"properties,omitempty"` + + //Type: The type of the resource. + Type *string `json:"type,omitempty"` +} + +//Generated from: +type RoutePropertiesFormat_StatusARM struct { + //AddressPrefix: The destination CIDR to which the route applies. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + //HasBgpOverride: A value indicating whether this route overrides overlapping BGP + //routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + + //NextHopIpAddress: The IP address packets should be forwarded to. Next hop values + //are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + + //NextHopType: The type of Azure hop the packet should be sent to. + NextHopType RouteNextHopType_Status `json:"nextHopType"` + + //ProvisioningState: The provisioning state of the route resource. + ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen_test.go new file mode 100644 index 00000000000..55e364d18f4 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route__status_arm_types_gen_test.go @@ -0,0 +1,158 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +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_Route_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatusARM, RouteStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatusARM runs a test to see if a specific instance of Route_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatusARM(subject Route_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_StatusARM + 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 Route_StatusARM instances for property testing - lazily instantiated by RouteStatusARMGenerator() +var routeStatusARMGenerator gopter.Gen + +// RouteStatusARMGenerator returns a generator of Route_StatusARM instances for property testing. +// We first initialize routeStatusARMGenerator 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 RouteStatusARMGenerator() gopter.Gen { + if routeStatusARMGenerator != nil { + return routeStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatusARM(generators) + routeStatusARMGenerator = gen.Struct(reflect.TypeOf(Route_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatusARM(generators) + AddRelatedPropertyGeneratorsForRouteStatusARM(generators) + routeStatusARMGenerator = gen.Struct(reflect.TypeOf(Route_StatusARM{}), generators) + + return routeStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatusARM(gens map[string]gopter.Gen) { + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteStatusARM(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(RoutePropertiesFormatStatusARMGenerator()) +} + +func Test_RoutePropertiesFormat_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RoutePropertiesFormat_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRoutePropertiesFormatStatusARM, RoutePropertiesFormatStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRoutePropertiesFormatStatusARM runs a test to see if a specific instance of RoutePropertiesFormat_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRoutePropertiesFormatStatusARM(subject RoutePropertiesFormat_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RoutePropertiesFormat_StatusARM + 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 RoutePropertiesFormat_StatusARM instances for property testing - lazily instantiated by +//RoutePropertiesFormatStatusARMGenerator() +var routePropertiesFormatStatusARMGenerator gopter.Gen + +// RoutePropertiesFormatStatusARMGenerator returns a generator of RoutePropertiesFormat_StatusARM instances for property testing. +func RoutePropertiesFormatStatusARMGenerator() gopter.Gen { + if routePropertiesFormatStatusARMGenerator != nil { + return routePropertiesFormatStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRoutePropertiesFormatStatusARM(generators) + routePropertiesFormatStatusARMGenerator = gen.Struct(reflect.TypeOf(RoutePropertiesFormat_StatusARM{}), generators) + + return routePropertiesFormatStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForRoutePropertiesFormatStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRoutePropertiesFormatStatusARM(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.PtrOf(gen.AlphaString()) + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.OneConstOf(RouteNextHopType_StatusInternet, RouteNextHopType_StatusNone, RouteNextHopType_StatusVirtualAppliance, RouteNextHopType_StatusVirtualNetworkGateway, RouteNextHopType_StatusVnetLocal) + gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(ProvisioningState_StatusDeleting, ProvisioningState_StatusFailed, ProvisioningState_StatusSucceeded, ProvisioningState_StatusUpdating)) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen.go new file mode 100644 index 00000000000..1a2b23bf5d3 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen.go @@ -0,0 +1,59 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +//Generated from: +type RouteTable_Status_RouteTable_SubResourceEmbeddedARM struct { + //Etag: A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + + //Id: Resource ID. + Id *string `json:"id,omitempty"` + + //Location: Resource location. + Location *string `json:"location,omitempty"` + + //Name: Resource name. + Name *string `json:"name,omitempty"` + + //Properties: Properties of the route table. + Properties *RouteTablePropertiesFormat_StatusARM `json:"properties,omitempty"` + + //Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + //Type: Resource type. + Type *string `json:"type,omitempty"` +} + +//Generated from: +type RouteTablePropertiesFormat_StatusARM struct { + //DisableBgpRoutePropagation: Whether to disable the routes learned by BGP on that + //route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + + //ProvisioningState: The provisioning state of the route table resource. + ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` + + //ResourceGuid: The resource GUID property of the route table. + ResourceGuid *string `json:"resourceGuid,omitempty"` + + //Routes: Collection of routes contained within a route table. + Routes []Route_Status_SubResourceEmbeddedARM `json:"routes,omitempty"` + + //Subnets: A collection of references to subnets. + Subnets []Subnet_Status_RouteTable_SubResourceEmbeddedARM `json:"subnets,omitempty"` +} + +//Generated from: +type Route_Status_SubResourceEmbeddedARM struct { + //Id: Resource ID. + Id *string `json:"id,omitempty"` +} + +//Generated from: +type Subnet_Status_RouteTable_SubResourceEmbeddedARM struct { + //Id: Resource ID. + Id *string `json:"id,omitempty"` +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen_test.go new file mode 100644 index 00000000000..f7379f1940d --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_table__status__route_table__sub_resource_embedded_arm_types_gen_test.go @@ -0,0 +1,294 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +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_RouteTable_Status_RouteTable_SubResourceEmbeddedARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_Status_RouteTable_SubResourceEmbeddedARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbeddedARM, RouteTableStatusRouteTableSubResourceEmbeddedARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbeddedARM runs a test to see if a specific instance of RouteTable_Status_RouteTable_SubResourceEmbeddedARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbeddedARM(subject RouteTable_Status_RouteTable_SubResourceEmbeddedARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_Status_RouteTable_SubResourceEmbeddedARM + 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 RouteTable_Status_RouteTable_SubResourceEmbeddedARM instances for property testing - lazily instantiated +//by RouteTableStatusRouteTableSubResourceEmbeddedARMGenerator() +var routeTableStatusRouteTableSubResourceEmbeddedARMGenerator gopter.Gen + +// RouteTableStatusRouteTableSubResourceEmbeddedARMGenerator returns a generator of RouteTable_Status_RouteTable_SubResourceEmbeddedARM instances for property testing. +// We first initialize routeTableStatusRouteTableSubResourceEmbeddedARMGenerator 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 RouteTableStatusRouteTableSubResourceEmbeddedARMGenerator() gopter.Gen { + if routeTableStatusRouteTableSubResourceEmbeddedARMGenerator != nil { + return routeTableStatusRouteTableSubResourceEmbeddedARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM(generators) + routeTableStatusRouteTableSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbeddedARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM(generators) + AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM(generators) + routeTableStatusRouteTableSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbeddedARM{}), generators) + + return routeTableStatusRouteTableSubResourceEmbeddedARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM(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()) +} + +// AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbeddedARM(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(RouteTablePropertiesFormatStatusARMGenerator()) +} + +func Test_RouteTablePropertiesFormat_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablePropertiesFormat_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablePropertiesFormatStatusARM, RouteTablePropertiesFormatStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablePropertiesFormatStatusARM runs a test to see if a specific instance of RouteTablePropertiesFormat_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablePropertiesFormatStatusARM(subject RouteTablePropertiesFormat_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablePropertiesFormat_StatusARM + 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 RouteTablePropertiesFormat_StatusARM instances for property testing - lazily instantiated by +//RouteTablePropertiesFormatStatusARMGenerator() +var routeTablePropertiesFormatStatusARMGenerator gopter.Gen + +// RouteTablePropertiesFormatStatusARMGenerator returns a generator of RouteTablePropertiesFormat_StatusARM instances for property testing. +// We first initialize routeTablePropertiesFormatStatusARMGenerator 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 RouteTablePropertiesFormatStatusARMGenerator() gopter.Gen { + if routeTablePropertiesFormatStatusARMGenerator != nil { + return routeTablePropertiesFormatStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablePropertiesFormatStatusARM(generators) + routeTablePropertiesFormatStatusARMGenerator = gen.Struct(reflect.TypeOf(RouteTablePropertiesFormat_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablePropertiesFormatStatusARM(generators) + AddRelatedPropertyGeneratorsForRouteTablePropertiesFormatStatusARM(generators) + routeTablePropertiesFormatStatusARMGenerator = gen.Struct(reflect.TypeOf(RouteTablePropertiesFormat_StatusARM{}), generators) + + return routeTablePropertiesFormatStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablePropertiesFormatStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablePropertiesFormatStatusARM(gens map[string]gopter.Gen) { + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) + gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(ProvisioningState_StatusDeleting, ProvisioningState_StatusFailed, ProvisioningState_StatusSucceeded, ProvisioningState_StatusUpdating)) + gens["ResourceGuid"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTablePropertiesFormatStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablePropertiesFormatStatusARM(gens map[string]gopter.Gen) { + gens["Routes"] = gen.SliceOf(RouteStatusSubResourceEmbeddedARMGenerator()) + gens["Subnets"] = gen.SliceOf(SubnetStatusRouteTableSubResourceEmbeddedARMGenerator()) +} + +func Test_Route_Status_SubResourceEmbeddedARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_Status_SubResourceEmbeddedARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatusSubResourceEmbeddedARM, RouteStatusSubResourceEmbeddedARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatusSubResourceEmbeddedARM runs a test to see if a specific instance of Route_Status_SubResourceEmbeddedARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatusSubResourceEmbeddedARM(subject Route_Status_SubResourceEmbeddedARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_Status_SubResourceEmbeddedARM + 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 Route_Status_SubResourceEmbeddedARM instances for property testing - lazily instantiated by +//RouteStatusSubResourceEmbeddedARMGenerator() +var routeStatusSubResourceEmbeddedARMGenerator gopter.Gen + +// RouteStatusSubResourceEmbeddedARMGenerator returns a generator of Route_Status_SubResourceEmbeddedARM instances for property testing. +func RouteStatusSubResourceEmbeddedARMGenerator() gopter.Gen { + if routeStatusSubResourceEmbeddedARMGenerator != nil { + return routeStatusSubResourceEmbeddedARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbeddedARM(generators) + routeStatusSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(Route_Status_SubResourceEmbeddedARM{}), generators) + + return routeStatusSubResourceEmbeddedARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbeddedARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_Subnet_Status_RouteTable_SubResourceEmbeddedARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Subnet_Status_RouteTable_SubResourceEmbeddedARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbeddedARM, SubnetStatusRouteTableSubResourceEmbeddedARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbeddedARM runs a test to see if a specific instance of Subnet_Status_RouteTable_SubResourceEmbeddedARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbeddedARM(subject Subnet_Status_RouteTable_SubResourceEmbeddedARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Subnet_Status_RouteTable_SubResourceEmbeddedARM + 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 Subnet_Status_RouteTable_SubResourceEmbeddedARM instances for property testing - lazily instantiated by +//SubnetStatusRouteTableSubResourceEmbeddedARMGenerator() +var subnetStatusRouteTableSubResourceEmbeddedARMGenerator gopter.Gen + +// SubnetStatusRouteTableSubResourceEmbeddedARMGenerator returns a generator of Subnet_Status_RouteTable_SubResourceEmbeddedARM instances for property testing. +func SubnetStatusRouteTableSubResourceEmbeddedARMGenerator() gopter.Gen { + if subnetStatusRouteTableSubResourceEmbeddedARMGenerator != nil { + return subnetStatusRouteTableSubResourceEmbeddedARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbeddedARM(generators) + subnetStatusRouteTableSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(Subnet_Status_RouteTable_SubResourceEmbeddedARM{}), generators) + + return subnetStatusRouteTableSubResourceEmbeddedARMGenerator +} + +// AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbeddedARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen.go new file mode 100644 index 00000000000..3a67ebe9ed7 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen.go @@ -0,0 +1,1001 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import ( + "fmt" + "github.com/Azure/azure-service-operator/v2/api/microsoft.network/v1alpha1api20201101storage" + "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +kubebuilder:rbac:groups=microsoft.network.azure.com,resources=routetables,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=microsoft.network.azure.com,resources={routetables/status,routetables/finalizers},verbs=get;update;patch + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables +type RouteTable struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec RouteTables_Spec `json:"spec,omitempty"` + Status RouteTable_Status_RouteTable_SubResourceEmbedded `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTable{} + +// GetConditions returns the conditions of the resource +func (routeTable *RouteTable) GetConditions() conditions.Conditions { + return routeTable.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (routeTable *RouteTable) SetConditions(conditions conditions.Conditions) { + routeTable.Status.Conditions = conditions +} + +// +kubebuilder:webhook:path=/mutate-microsoft-network-azure-com-v1alpha1api20201101-routetable,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=microsoft.network.azure.com,resources=routetables,verbs=create;update,versions=v1alpha1api20201101,name=default.v1alpha1api20201101.routetables.microsoft.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &RouteTable{} + +// Default applies defaults to the RouteTable resource +func (routeTable *RouteTable) Default() { + routeTable.defaultImpl() + var temp interface{} = routeTable + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (routeTable *RouteTable) defaultAzureName() { + if routeTable.Spec.AzureName == "" { + routeTable.Spec.AzureName = routeTable.Name + } +} + +// defaultImpl applies the code generated defaults to the RouteTable resource +func (routeTable *RouteTable) defaultImpl() { routeTable.defaultAzureName() } + +var _ genruntime.KubernetesResource = &RouteTable{} + +// AzureName returns the Azure name of the resource +func (routeTable *RouteTable) AzureName() string { + return routeTable.Spec.AzureName +} + +// GetResourceKind returns the kind of the resource +func (routeTable *RouteTable) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (routeTable *RouteTable) GetSpec() genruntime.ConvertibleSpec { + return &routeTable.Spec +} + +// GetStatus returns the status of this resource +func (routeTable *RouteTable) GetStatus() genruntime.ConvertibleStatus { + return &routeTable.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (routeTable *RouteTable) GetType() string { + return "Microsoft.Network/routeTables" +} + +// NewEmptyStatus returns a new empty (blank) status +func (routeTable *RouteTable) NewEmptyStatus() genruntime.ConvertibleStatus { + return &RouteTable_Status_RouteTable_SubResourceEmbedded{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (routeTable *RouteTable) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(routeTable.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Namespace: routeTable.Namespace, + Name: routeTable.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (routeTable *RouteTable) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*RouteTable_Status_RouteTable_SubResourceEmbedded); ok { + routeTable.Status = *st + return nil + } + + // Convert status to required version + var st RouteTable_Status_RouteTable_SubResourceEmbedded + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + routeTable.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-microsoft-network-azure-com-v1alpha1api20201101-routetable,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=microsoft.network.azure.com,resources=routetables,verbs=create;update,versions=v1alpha1api20201101,name=validate.v1alpha1api20201101.routetables.microsoft.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &RouteTable{} + +// ValidateCreate validates the creation of the resource +func (routeTable *RouteTable) ValidateCreate() error { + validations := routeTable.createValidations() + var temp interface{} = routeTable + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.CreateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateDelete validates the deletion of the resource +func (routeTable *RouteTable) ValidateDelete() error { + validations := routeTable.deleteValidations() + var temp interface{} = routeTable + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.DeleteValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateUpdate validates an update of the resource +func (routeTable *RouteTable) ValidateUpdate(old runtime.Object) error { + validations := routeTable.updateValidations() + var temp interface{} = routeTable + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.UpdateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation(old) + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// createValidations validates the creation of the resource +func (routeTable *RouteTable) createValidations() []func() error { + return []func() error{routeTable.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (routeTable *RouteTable) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (routeTable *RouteTable) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return routeTable.validateResourceReferences() + }, + } +} + +// validateResourceReferences validates all resource references +func (routeTable *RouteTable) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&routeTable.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// AssignPropertiesFromRouteTable populates our RouteTable from the provided source RouteTable +func (routeTable *RouteTable) AssignPropertiesFromRouteTable(source *v1alpha1api20201101storage.RouteTable) error { + + // Spec + var spec RouteTables_Spec + err := spec.AssignPropertiesFromRouteTablesSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "populating Spec from Spec, calling AssignPropertiesFromRouteTablesSpec()") + } + routeTable.Spec = spec + + // Status + var status RouteTable_Status_RouteTable_SubResourceEmbedded + err = status.AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded(&source.Status) + if err != nil { + return errors.Wrap(err, "populating Status from Status, calling AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded()") + } + routeTable.Status = status + + // No error + return nil +} + +// AssignPropertiesToRouteTable populates the provided destination RouteTable from our RouteTable +func (routeTable *RouteTable) AssignPropertiesToRouteTable(destination *v1alpha1api20201101storage.RouteTable) error { + + // Spec + var spec v1alpha1api20201101storage.RouteTables_Spec + err := routeTable.Spec.AssignPropertiesToRouteTablesSpec(&spec) + if err != nil { + return errors.Wrap(err, "populating Spec from Spec, calling AssignPropertiesToRouteTablesSpec()") + } + destination.Spec = spec + + // Status + var status v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded + err = routeTable.Status.AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded(&status) + if err != nil { + return errors.Wrap(err, "populating Status from Status, calling AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded()") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (routeTable *RouteTable) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: routeTable.Spec.OriginalVersion(), + Kind: "RouteTable", + } +} + +// +kubebuilder:object:root=true +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables +type RouteTableList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RouteTable `json:"items"` +} + +//Generated from: +type RouteTable_Status_RouteTable_SubResourceEmbedded struct { + //Conditions: The observed state of the resource + Conditions []conditions.Condition `json:"conditions,omitempty"` + + //DisableBgpRoutePropagation: Whether to disable the routes learned by BGP on that + //route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + + //Etag: A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + + //Id: Resource ID. + Id *string `json:"id,omitempty"` + + //Location: Resource location. + Location *string `json:"location,omitempty"` + + //Name: Resource name. + Name *string `json:"name,omitempty"` + + //ProvisioningState: The provisioning state of the route table resource. + ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` + + //ResourceGuid: The resource GUID property of the route table. + ResourceGuid *string `json:"resourceGuid,omitempty"` + + //Routes: Collection of routes contained within a route table. + Routes []Route_Status_SubResourceEmbedded `json:"routes,omitempty"` + + //Subnets: A collection of references to subnets. + Subnets []Subnet_Status_RouteTable_SubResourceEmbedded `json:"subnets,omitempty"` + + //Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + //Type: Resource type. + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &RouteTable_Status_RouteTable_SubResourceEmbedded{} + +// ConvertStatusFrom populates our RouteTable_Status_RouteTable_SubResourceEmbedded from the provided source +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded) + if ok { + // Populate our instance from source + return routeTableStatusRouteTableSubResourceEmbedded.AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded{} + err := src.ConvertStatusFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = routeTableStatusRouteTableSubResourceEmbedded.AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our RouteTable_Status_RouteTable_SubResourceEmbedded +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded) + if ok { + // Populate destination from our instance + return routeTableStatusRouteTableSubResourceEmbedded.AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded{} + err := routeTableStatusRouteTableSubResourceEmbedded.AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +var _ genruntime.FromARMConverter = &RouteTable_Status_RouteTable_SubResourceEmbedded{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTable_Status_RouteTable_SubResourceEmbeddedARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTable_Status_RouteTable_SubResourceEmbeddedARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_Status_RouteTable_SubResourceEmbeddedARM, got %T", armInput) + } + + // no assignment for property ‘Conditions’ + + // Set property ‘DisableBgpRoutePropagation’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *typedInput.Properties.DisableBgpRoutePropagation + routeTableStatusRouteTableSubResourceEmbedded.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + } + + // Set property ‘Etag’: + if typedInput.Etag != nil { + etag := *typedInput.Etag + routeTableStatusRouteTableSubResourceEmbedded.Etag = &etag + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + routeTableStatusRouteTableSubResourceEmbedded.Id = &id + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + routeTableStatusRouteTableSubResourceEmbedded.Location = &location + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + routeTableStatusRouteTableSubResourceEmbedded.Name = &name + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + routeTableStatusRouteTableSubResourceEmbedded.ProvisioningState = &provisioningState + } + } + + // Set property ‘ResourceGuid’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ResourceGuid != nil { + resourceGuid := *typedInput.Properties.ResourceGuid + routeTableStatusRouteTableSubResourceEmbedded.ResourceGuid = &resourceGuid + } + } + + // Set property ‘Routes’: + // copying flattened property: + if typedInput.Properties != nil { + for _, item := range typedInput.Properties.Routes { + var item1 Route_Status_SubResourceEmbedded + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + routeTableStatusRouteTableSubResourceEmbedded.Routes = append(routeTableStatusRouteTableSubResourceEmbedded.Routes, item1) + } + } + + // Set property ‘Subnets’: + // copying flattened property: + if typedInput.Properties != nil { + for _, item := range typedInput.Properties.Subnets { + var item1 Subnet_Status_RouteTable_SubResourceEmbedded + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + routeTableStatusRouteTableSubResourceEmbedded.Subnets = append(routeTableStatusRouteTableSubResourceEmbedded.Subnets, item1) + } + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + routeTableStatusRouteTableSubResourceEmbedded.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + routeTableStatusRouteTableSubResourceEmbedded.Tags[key] = value + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + routeTableStatusRouteTableSubResourceEmbedded.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded populates our RouteTable_Status_RouteTable_SubResourceEmbedded from the provided source RouteTable_Status_RouteTable_SubResourceEmbedded +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded(source *v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded) error { + + // Conditions + routeTableStatusRouteTableSubResourceEmbedded.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // DisableBgpRoutePropagation + if source.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *source.DisableBgpRoutePropagation + routeTableStatusRouteTableSubResourceEmbedded.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + routeTableStatusRouteTableSubResourceEmbedded.DisableBgpRoutePropagation = nil + } + + // Etag + routeTableStatusRouteTableSubResourceEmbedded.Etag = genruntime.ClonePointerToString(source.Etag) + + // Id + routeTableStatusRouteTableSubResourceEmbedded.Id = genruntime.ClonePointerToString(source.Id) + + // Location + routeTableStatusRouteTableSubResourceEmbedded.Location = genruntime.ClonePointerToString(source.Location) + + // Name + routeTableStatusRouteTableSubResourceEmbedded.Name = genruntime.ClonePointerToString(source.Name) + + // ProvisioningState + if source.ProvisioningState != nil { + provisioningState := ProvisioningState_Status(*source.ProvisioningState) + routeTableStatusRouteTableSubResourceEmbedded.ProvisioningState = &provisioningState + } else { + routeTableStatusRouteTableSubResourceEmbedded.ProvisioningState = nil + } + + // ResourceGuid + routeTableStatusRouteTableSubResourceEmbedded.ResourceGuid = genruntime.ClonePointerToString(source.ResourceGuid) + + // Routes + if source.Routes != nil { + routeList := make([]Route_Status_SubResourceEmbedded, len(source.Routes)) + for routeIndex, routeItem := range source.Routes { + // Shadow the loop variable to avoid aliasing + routeItem := routeItem + var route Route_Status_SubResourceEmbedded + err := route.AssignPropertiesFromRouteStatusSubResourceEmbedded(&routeItem) + if err != nil { + return errors.Wrap(err, "populating Routes from Routes, calling AssignPropertiesFromRouteStatusSubResourceEmbedded()") + } + routeList[routeIndex] = route + } + routeTableStatusRouteTableSubResourceEmbedded.Routes = routeList + } else { + routeTableStatusRouteTableSubResourceEmbedded.Routes = nil + } + + // Subnets + if source.Subnets != nil { + subnetList := make([]Subnet_Status_RouteTable_SubResourceEmbedded, len(source.Subnets)) + for subnetIndex, subnetItem := range source.Subnets { + // Shadow the loop variable to avoid aliasing + subnetItem := subnetItem + var subnet Subnet_Status_RouteTable_SubResourceEmbedded + err := subnet.AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded(&subnetItem) + if err != nil { + return errors.Wrap(err, "populating Subnets from Subnets, calling AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded()") + } + subnetList[subnetIndex] = subnet + } + routeTableStatusRouteTableSubResourceEmbedded.Subnets = subnetList + } else { + routeTableStatusRouteTableSubResourceEmbedded.Subnets = nil + } + + // Tags + routeTableStatusRouteTableSubResourceEmbedded.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // Type + routeTableStatusRouteTableSubResourceEmbedded.Type = genruntime.ClonePointerToString(source.Type) + + // No error + return nil +} + +// AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded populates the provided destination RouteTable_Status_RouteTable_SubResourceEmbedded from our RouteTable_Status_RouteTable_SubResourceEmbedded +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded(destination *v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(routeTableStatusRouteTableSubResourceEmbedded.Conditions) + + // DisableBgpRoutePropagation + if routeTableStatusRouteTableSubResourceEmbedded.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *routeTableStatusRouteTableSubResourceEmbedded.DisableBgpRoutePropagation + destination.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + destination.DisableBgpRoutePropagation = nil + } + + // Etag + destination.Etag = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.Etag) + + // Id + destination.Id = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.Id) + + // Location + destination.Location = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.Location) + + // Name + destination.Name = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.Name) + + // ProvisioningState + if routeTableStatusRouteTableSubResourceEmbedded.ProvisioningState != nil { + provisioningState := string(*routeTableStatusRouteTableSubResourceEmbedded.ProvisioningState) + destination.ProvisioningState = &provisioningState + } else { + destination.ProvisioningState = nil + } + + // ResourceGuid + destination.ResourceGuid = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.ResourceGuid) + + // Routes + if routeTableStatusRouteTableSubResourceEmbedded.Routes != nil { + routeList := make([]v1alpha1api20201101storage.Route_Status_SubResourceEmbedded, len(routeTableStatusRouteTableSubResourceEmbedded.Routes)) + for routeIndex, routeItem := range routeTableStatusRouteTableSubResourceEmbedded.Routes { + // Shadow the loop variable to avoid aliasing + routeItem := routeItem + var route v1alpha1api20201101storage.Route_Status_SubResourceEmbedded + err := routeItem.AssignPropertiesToRouteStatusSubResourceEmbedded(&route) + if err != nil { + return errors.Wrap(err, "populating Routes from Routes, calling AssignPropertiesToRouteStatusSubResourceEmbedded()") + } + routeList[routeIndex] = route + } + destination.Routes = routeList + } else { + destination.Routes = nil + } + + // Subnets + if routeTableStatusRouteTableSubResourceEmbedded.Subnets != nil { + subnetList := make([]v1alpha1api20201101storage.Subnet_Status_RouteTable_SubResourceEmbedded, len(routeTableStatusRouteTableSubResourceEmbedded.Subnets)) + for subnetIndex, subnetItem := range routeTableStatusRouteTableSubResourceEmbedded.Subnets { + // Shadow the loop variable to avoid aliasing + subnetItem := subnetItem + var subnet v1alpha1api20201101storage.Subnet_Status_RouteTable_SubResourceEmbedded + err := subnetItem.AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded(&subnet) + if err != nil { + return errors.Wrap(err, "populating Subnets from Subnets, calling AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded()") + } + subnetList[subnetIndex] = subnet + } + destination.Subnets = subnetList + } else { + destination.Subnets = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(routeTableStatusRouteTableSubResourceEmbedded.Tags) + + // Type + destination.Type = genruntime.ClonePointerToString(routeTableStatusRouteTableSubResourceEmbedded.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"2020-11-01"} +type RouteTablesSpecAPIVersion string + +const RouteTablesSpecAPIVersion20201101 = RouteTablesSpecAPIVersion("2020-11-01") + +type RouteTables_Spec struct { + //AzureName: The name of the resource in Azure. This is often the same as the name + //of the resource in Kubernetes but it doesn't have to be. + AzureName string `json:"azureName"` + + //DisableBgpRoutePropagation: Whether to disable the routes learned by BGP on that + //route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"microsoft.resources.azure.com" json:"owner" kind:"ResourceGroup"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMTransformer = &RouteTables_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (routeTablesSpec *RouteTables_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if routeTablesSpec == nil { + return nil, nil + } + var result RouteTables_SpecARM + + // Set property ‘Location’: + result.Location = routeTablesSpec.Location + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + if routeTablesSpec.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *routeTablesSpec.DisableBgpRoutePropagation + result.Properties.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + + // Set property ‘Tags’: + if routeTablesSpec.Tags != nil { + result.Tags = make(map[string]string) + for key, value := range routeTablesSpec.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routeTablesSpec *RouteTables_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTables_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routeTablesSpec *RouteTables_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTables_SpecARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTables_SpecARM, got %T", armInput) + } + + // Set property ‘AzureName’: + routeTablesSpec.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘DisableBgpRoutePropagation’: + // copying flattened property: + if typedInput.Properties.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *typedInput.Properties.DisableBgpRoutePropagation + routeTablesSpec.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + + // Set property ‘Location’: + routeTablesSpec.Location = typedInput.Location + + // Set property ‘Owner’: + routeTablesSpec.Owner = genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + routeTablesSpec.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + routeTablesSpec.Tags[key] = value + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &RouteTables_Spec{} + +// ConvertSpecFrom populates our RouteTables_Spec from the provided source +func (routeTablesSpec *RouteTables_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v1alpha1api20201101storage.RouteTables_Spec) + if ok { + // Populate our instance from source + return routeTablesSpec.AssignPropertiesFromRouteTablesSpec(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20201101storage.RouteTables_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()") + } + + // Update our instance from src + err = routeTablesSpec.AssignPropertiesFromRouteTablesSpec(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil +} + +// ConvertSpecTo populates the provided destination from our RouteTables_Spec +func (routeTablesSpec *RouteTables_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v1alpha1api20201101storage.RouteTables_Spec) + if ok { + // Populate destination from our instance + return routeTablesSpec.AssignPropertiesToRouteTablesSpec(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20201101storage.RouteTables_Spec{} + err := routeTablesSpec.AssignPropertiesToRouteTablesSpec(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()") + } + + // Update dst from our instance + err = dst.ConvertSpecTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecTo()") + } + + return nil +} + +// AssignPropertiesFromRouteTablesSpec populates our RouteTables_Spec from the provided source RouteTables_Spec +func (routeTablesSpec *RouteTables_Spec) AssignPropertiesFromRouteTablesSpec(source *v1alpha1api20201101storage.RouteTables_Spec) error { + + // AzureName + routeTablesSpec.AzureName = source.AzureName + + // DisableBgpRoutePropagation + if source.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *source.DisableBgpRoutePropagation + routeTablesSpec.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + routeTablesSpec.DisableBgpRoutePropagation = nil + } + + // Location + routeTablesSpec.Location = genruntime.GetOptionalStringValue(source.Location) + + // Owner + routeTablesSpec.Owner = source.Owner.Copy() + + // Tags + routeTablesSpec.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // No error + return nil +} + +// AssignPropertiesToRouteTablesSpec populates the provided destination RouteTables_Spec from our RouteTables_Spec +func (routeTablesSpec *RouteTables_Spec) AssignPropertiesToRouteTablesSpec(destination *v1alpha1api20201101storage.RouteTables_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AzureName + destination.AzureName = routeTablesSpec.AzureName + + // DisableBgpRoutePropagation + if routeTablesSpec.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *routeTablesSpec.DisableBgpRoutePropagation + destination.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + destination.DisableBgpRoutePropagation = nil + } + + // Location + location := routeTablesSpec.Location + destination.Location = &location + + // OriginalVersion + destination.OriginalVersion = routeTablesSpec.OriginalVersion() + + // Owner + destination.Owner = routeTablesSpec.Owner.Copy() + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(routeTablesSpec.Tags) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// OriginalVersion returns the original API version used to create the resource. +func (routeTablesSpec *RouteTables_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (routeTablesSpec *RouteTables_Spec) SetAzureName(azureName string) { + routeTablesSpec.AzureName = azureName +} + +//Generated from: +type Route_Status_SubResourceEmbedded struct { + //Id: Resource ID. + Id *string `json:"id,omitempty"` +} + +var _ genruntime.FromARMConverter = &Route_Status_SubResourceEmbedded{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routeStatusSubResourceEmbedded *Route_Status_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Route_Status_SubResourceEmbeddedARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routeStatusSubResourceEmbedded *Route_Status_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Route_Status_SubResourceEmbeddedARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Route_Status_SubResourceEmbeddedARM, got %T", armInput) + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + routeStatusSubResourceEmbedded.Id = &id + } + + // No error + return nil +} + +// AssignPropertiesFromRouteStatusSubResourceEmbedded populates our Route_Status_SubResourceEmbedded from the provided source Route_Status_SubResourceEmbedded +func (routeStatusSubResourceEmbedded *Route_Status_SubResourceEmbedded) AssignPropertiesFromRouteStatusSubResourceEmbedded(source *v1alpha1api20201101storage.Route_Status_SubResourceEmbedded) error { + + // Id + routeStatusSubResourceEmbedded.Id = genruntime.ClonePointerToString(source.Id) + + // No error + return nil +} + +// AssignPropertiesToRouteStatusSubResourceEmbedded populates the provided destination Route_Status_SubResourceEmbedded from our Route_Status_SubResourceEmbedded +func (routeStatusSubResourceEmbedded *Route_Status_SubResourceEmbedded) AssignPropertiesToRouteStatusSubResourceEmbedded(destination *v1alpha1api20201101storage.Route_Status_SubResourceEmbedded) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Id + destination.Id = genruntime.ClonePointerToString(routeStatusSubResourceEmbedded.Id) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: +type Subnet_Status_RouteTable_SubResourceEmbedded struct { + //Id: Resource ID. + Id *string `json:"id,omitempty"` +} + +var _ genruntime.FromARMConverter = &Subnet_Status_RouteTable_SubResourceEmbedded{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (subnetStatusRouteTableSubResourceEmbedded *Subnet_Status_RouteTable_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Subnet_Status_RouteTable_SubResourceEmbeddedARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (subnetStatusRouteTableSubResourceEmbedded *Subnet_Status_RouteTable_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Subnet_Status_RouteTable_SubResourceEmbeddedARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Subnet_Status_RouteTable_SubResourceEmbeddedARM, got %T", armInput) + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + subnetStatusRouteTableSubResourceEmbedded.Id = &id + } + + // No error + return nil +} + +// AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded populates our Subnet_Status_RouteTable_SubResourceEmbedded from the provided source Subnet_Status_RouteTable_SubResourceEmbedded +func (subnetStatusRouteTableSubResourceEmbedded *Subnet_Status_RouteTable_SubResourceEmbedded) AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded(source *v1alpha1api20201101storage.Subnet_Status_RouteTable_SubResourceEmbedded) error { + + // Id + subnetStatusRouteTableSubResourceEmbedded.Id = genruntime.ClonePointerToString(source.Id) + + // No error + return nil +} + +// AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded populates the provided destination Subnet_Status_RouteTable_SubResourceEmbedded from our Subnet_Status_RouteTable_SubResourceEmbedded +func (subnetStatusRouteTableSubResourceEmbedded *Subnet_Status_RouteTable_SubResourceEmbedded) AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded(destination *v1alpha1api20201101storage.Subnet_Status_RouteTable_SubResourceEmbedded) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Id + destination.Id = genruntime.ClonePointerToString(subnetStatusRouteTableSubResourceEmbedded.Id) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +func init() { + SchemeBuilder.Register(&RouteTable{}, &RouteTableList{}) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen_test.go new file mode 100644 index 00000000000..a5f32fc7163 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_table_types_gen_test.go @@ -0,0 +1,539 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import ( + "encoding/json" + "github.com/Azure/azure-service-operator/v2/api/microsoft.network/v1alpha1api20201101storage" + "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_RouteTable_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTable to RouteTable via AssignPropertiesToRouteTable & AssignPropertiesFromRouteTable returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTable, RouteTableGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTable tests if a specific instance of RouteTable can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTable(subject RouteTable) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.RouteTable + err := subject.AssignPropertiesToRouteTable(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTable + err = actual.AssignPropertiesFromRouteTable(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RouteTable_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTable, RouteTableGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTable runs a test to see if a specific instance of RouteTable round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTable(subject RouteTable) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable + 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 RouteTable instances for property testing - lazily instantiated by RouteTableGenerator() +var routeTableGenerator gopter.Gen + +// RouteTableGenerator returns a generator of RouteTable instances for property testing. +func RouteTableGenerator() gopter.Gen { + if routeTableGenerator != nil { + return routeTableGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForRouteTable(generators) + routeTableGenerator = gen.Struct(reflect.TypeOf(RouteTable{}), generators) + + return routeTableGenerator +} + +// AddRelatedPropertyGeneratorsForRouteTable is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTable(gens map[string]gopter.Gen) { + gens["Spec"] = RouteTablesSpecGenerator() + gens["Status"] = RouteTableStatusRouteTableSubResourceEmbeddedGenerator() +} + +func Test_RouteTable_Status_RouteTable_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTable_Status_RouteTable_SubResourceEmbedded to RouteTable_Status_RouteTable_SubResourceEmbedded via AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded & AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusRouteTableSubResourceEmbedded, RouteTableStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTableStatusRouteTableSubResourceEmbedded tests if a specific instance of RouteTable_Status_RouteTable_SubResourceEmbedded can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTableStatusRouteTableSubResourceEmbedded(subject RouteTable_Status_RouteTable_SubResourceEmbedded) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.RouteTable_Status_RouteTable_SubResourceEmbedded + err := subject.AssignPropertiesToRouteTableStatusRouteTableSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTable_Status_RouteTable_SubResourceEmbedded + err = actual.AssignPropertiesFromRouteTableStatusRouteTableSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RouteTable_Status_RouteTable_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_Status_RouteTable_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded, RouteTableStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_RouteTable_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded(subject RouteTable_Status_RouteTable_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_Status_RouteTable_SubResourceEmbedded + 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 RouteTable_Status_RouteTable_SubResourceEmbedded instances for property testing - lazily instantiated by +//RouteTableStatusRouteTableSubResourceEmbeddedGenerator() +var routeTableStatusRouteTableSubResourceEmbeddedGenerator gopter.Gen + +// RouteTableStatusRouteTableSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_RouteTable_SubResourceEmbedded instances for property testing. +// We first initialize routeTableStatusRouteTableSubResourceEmbeddedGenerator 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 RouteTableStatusRouteTableSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusRouteTableSubResourceEmbeddedGenerator != nil { + return routeTableStatusRouteTableSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + routeTableStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbedded{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + routeTableStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbedded{}), generators) + + return routeTableStatusRouteTableSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) + 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["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(ProvisioningState_StatusDeleting, ProvisioningState_StatusFailed, ProvisioningState_StatusSucceeded, ProvisioningState_StatusUpdating)) + gens["ResourceGuid"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Routes"] = gen.SliceOf(RouteStatusSubResourceEmbeddedGenerator()) + gens["Subnets"] = gen.SliceOf(SubnetStatusRouteTableSubResourceEmbeddedGenerator()) +} + +func Test_RouteTables_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTables_Spec to RouteTables_Spec via AssignPropertiesToRouteTablesSpec & AssignPropertiesFromRouteTablesSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTablesSpec, RouteTablesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTablesSpec tests if a specific instance of RouteTables_Spec can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesSpec(subject RouteTables_Spec) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.RouteTables_Spec + err := subject.AssignPropertiesToRouteTablesSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTables_Spec + err = actual.AssignPropertiesFromRouteTablesSpec(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RouteTables_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTables_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesSpec, RouteTablesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesSpec runs a test to see if a specific instance of RouteTables_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesSpec(subject RouteTables_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTables_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 RouteTables_Spec instances for property testing - lazily instantiated by RouteTablesSpecGenerator() +var routeTablesSpecGenerator gopter.Gen + +// RouteTablesSpecGenerator returns a generator of RouteTables_Spec instances for property testing. +func RouteTablesSpecGenerator() gopter.Gen { + if routeTablesSpecGenerator != nil { + return routeTablesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpec(generators) + routeTablesSpecGenerator = gen.Struct(reflect.TypeOf(RouteTables_Spec{}), generators) + + return routeTablesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +func Test_Route_Status_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Route_Status_SubResourceEmbedded to Route_Status_SubResourceEmbedded via AssignPropertiesToRouteStatusSubResourceEmbedded & AssignPropertiesFromRouteStatusSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteStatusSubResourceEmbedded, RouteStatusSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteStatusSubResourceEmbedded tests if a specific instance of Route_Status_SubResourceEmbedded can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteStatusSubResourceEmbedded(subject Route_Status_SubResourceEmbedded) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.Route_Status_SubResourceEmbedded + err := subject.AssignPropertiesToRouteStatusSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Route_Status_SubResourceEmbedded + err = actual.AssignPropertiesFromRouteStatusSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Route_Status_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatusSubResourceEmbedded, RouteStatusSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatusSubResourceEmbedded runs a test to see if a specific instance of Route_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatusSubResourceEmbedded(subject Route_Status_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_Status_SubResourceEmbedded + 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 Route_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +//RouteStatusSubResourceEmbeddedGenerator() +var routeStatusSubResourceEmbeddedGenerator gopter.Gen + +// RouteStatusSubResourceEmbeddedGenerator returns a generator of Route_Status_SubResourceEmbedded instances for property testing. +func RouteStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeStatusSubResourceEmbeddedGenerator != nil { + return routeStatusSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded(generators) + routeStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(Route_Status_SubResourceEmbedded{}), generators) + + return routeStatusSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_Subnet_Status_RouteTable_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Subnet_Status_RouteTable_SubResourceEmbedded to Subnet_Status_RouteTable_SubResourceEmbedded via AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded & AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForSubnetStatusRouteTableSubResourceEmbedded, SubnetStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSubnetStatusRouteTableSubResourceEmbedded tests if a specific instance of Subnet_Status_RouteTable_SubResourceEmbedded can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForSubnetStatusRouteTableSubResourceEmbedded(subject Subnet_Status_RouteTable_SubResourceEmbedded) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.Subnet_Status_RouteTable_SubResourceEmbedded + err := subject.AssignPropertiesToSubnetStatusRouteTableSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Subnet_Status_RouteTable_SubResourceEmbedded + err = actual.AssignPropertiesFromSubnetStatusRouteTableSubResourceEmbedded(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Subnet_Status_RouteTable_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Subnet_Status_RouteTable_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded, SubnetStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded runs a test to see if a specific instance of Subnet_Status_RouteTable_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded(subject Subnet_Status_RouteTable_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Subnet_Status_RouteTable_SubResourceEmbedded + 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 Subnet_Status_RouteTable_SubResourceEmbedded instances for property testing - lazily instantiated by +//SubnetStatusRouteTableSubResourceEmbeddedGenerator() +var subnetStatusRouteTableSubResourceEmbeddedGenerator gopter.Gen + +// SubnetStatusRouteTableSubResourceEmbeddedGenerator returns a generator of Subnet_Status_RouteTable_SubResourceEmbedded instances for property testing. +func SubnetStatusRouteTableSubResourceEmbeddedGenerator() gopter.Gen { + if subnetStatusRouteTableSubResourceEmbeddedGenerator != nil { + return subnetStatusRouteTableSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded(generators) + subnetStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(Subnet_Status_RouteTable_SubResourceEmbedded{}), generators) + + return subnetStatusRouteTableSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen.go new file mode 100644 index 00000000000..fc0fe024ce7 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen.go @@ -0,0 +1,43 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type RouteTables_SpecARM struct { + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + + //Name: Name of the resource + Name string `json:"name"` + + //Properties: Properties of the route table. + Properties RouteTables_Spec_PropertiesARM `json:"properties"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &RouteTables_SpecARM{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (routeTablesSpecARM RouteTables_SpecARM) GetAPIVersion() string { + return "2020-11-01" +} + +// GetName returns the Name of the resource +func (routeTablesSpecARM RouteTables_SpecARM) GetName() string { + return routeTablesSpecARM.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (routeTablesSpecARM RouteTables_SpecARM) GetType() string { + return "Microsoft.Network/routeTables" +} + +type RouteTables_Spec_PropertiesARM struct { + //DisableBgpRoutePropagation: Whether to disable the routes learned by BGP on that + //route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..df59478db81 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables__spec_arm_types_gen_test.go @@ -0,0 +1,153 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +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_RouteTables_SpecARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTables_SpecARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesSpecARM, RouteTablesSpecARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesSpecARM runs a test to see if a specific instance of RouteTables_SpecARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesSpecARM(subject RouteTables_SpecARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTables_SpecARM + 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 RouteTables_SpecARM instances for property testing - lazily instantiated by RouteTablesSpecARMGenerator() +var routeTablesSpecARMGenerator gopter.Gen + +// RouteTablesSpecARMGenerator returns a generator of RouteTables_SpecARM instances for property testing. +// We first initialize routeTablesSpecARMGenerator 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 RouteTablesSpecARMGenerator() gopter.Gen { + if routeTablesSpecARMGenerator != nil { + return routeTablesSpecARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecARM(generators) + routeTablesSpecARMGenerator = gen.Struct(reflect.TypeOf(RouteTables_SpecARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecARM(generators) + AddRelatedPropertyGeneratorsForRouteTablesSpecARM(generators) + routeTablesSpecARMGenerator = gen.Struct(reflect.TypeOf(RouteTables_SpecARM{}), generators) + + return routeTablesSpecARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesSpecARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesSpecARM(gens map[string]gopter.Gen) { + gens["Location"] = gen.AlphaString() + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTablesSpecARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesSpecARM(gens map[string]gopter.Gen) { + gens["Properties"] = RouteTablesSpecPropertiesARMGenerator() +} + +func Test_RouteTables_Spec_PropertiesARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTables_Spec_PropertiesARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesSpecPropertiesARM, RouteTablesSpecPropertiesARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesSpecPropertiesARM runs a test to see if a specific instance of RouteTables_Spec_PropertiesARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesSpecPropertiesARM(subject RouteTables_Spec_PropertiesARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTables_Spec_PropertiesARM + 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 RouteTables_Spec_PropertiesARM instances for property testing - lazily instantiated by +//RouteTablesSpecPropertiesARMGenerator() +var routeTablesSpecPropertiesARMGenerator gopter.Gen + +// RouteTablesSpecPropertiesARMGenerator returns a generator of RouteTables_Spec_PropertiesARM instances for property testing. +func RouteTablesSpecPropertiesARMGenerator() gopter.Gen { + if routeTablesSpecPropertiesARMGenerator != nil { + return routeTablesSpecPropertiesARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesARM(generators) + routeTablesSpecPropertiesARMGenerator = gen.Struct(reflect.TypeOf(RouteTables_Spec_PropertiesARM{}), generators) + + return routeTablesSpecPropertiesARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesARM(gens map[string]gopter.Gen) { + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen.go new file mode 100644 index 00000000000..65cfff89511 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen.go @@ -0,0 +1,876 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import ( + "fmt" + "github.com/Azure/azure-service-operator/v2/api/microsoft.network/v1alpha1api20201101storage" + "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +kubebuilder:rbac:groups=microsoft.network.azure.com,resources=routetablesroutes,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=microsoft.network.azure.com,resources={routetablesroutes/status,routetablesroutes/finalizers},verbs=get;update;patch + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables_routes +type RouteTablesRoute struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec RouteTablesRoutes_Spec `json:"spec,omitempty"` + Status Route_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTablesRoute{} + +// GetConditions returns the conditions of the resource +func (routeTablesRoute *RouteTablesRoute) GetConditions() conditions.Conditions { + return routeTablesRoute.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (routeTablesRoute *RouteTablesRoute) SetConditions(conditions conditions.Conditions) { + routeTablesRoute.Status.Conditions = conditions +} + +// +kubebuilder:webhook:path=/mutate-microsoft-network-azure-com-v1alpha1api20201101-routetablesroute,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=microsoft.network.azure.com,resources=routetablesroutes,verbs=create;update,versions=v1alpha1api20201101,name=default.v1alpha1api20201101.routetablesroutes.microsoft.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &RouteTablesRoute{} + +// Default applies defaults to the RouteTablesRoute resource +func (routeTablesRoute *RouteTablesRoute) Default() { + routeTablesRoute.defaultImpl() + var temp interface{} = routeTablesRoute + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (routeTablesRoute *RouteTablesRoute) defaultAzureName() { + if routeTablesRoute.Spec.AzureName == "" { + routeTablesRoute.Spec.AzureName = routeTablesRoute.Name + } +} + +// defaultImpl applies the code generated defaults to the RouteTablesRoute resource +func (routeTablesRoute *RouteTablesRoute) defaultImpl() { routeTablesRoute.defaultAzureName() } + +var _ genruntime.KubernetesResource = &RouteTablesRoute{} + +// AzureName returns the Azure name of the resource +func (routeTablesRoute *RouteTablesRoute) AzureName() string { + return routeTablesRoute.Spec.AzureName +} + +// GetResourceKind returns the kind of the resource +func (routeTablesRoute *RouteTablesRoute) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (routeTablesRoute *RouteTablesRoute) GetSpec() genruntime.ConvertibleSpec { + return &routeTablesRoute.Spec +} + +// GetStatus returns the status of this resource +func (routeTablesRoute *RouteTablesRoute) GetStatus() genruntime.ConvertibleStatus { + return &routeTablesRoute.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (routeTablesRoute *RouteTablesRoute) GetType() string { + return "Microsoft.Network/routeTables/routes" +} + +// NewEmptyStatus returns a new empty (blank) status +func (routeTablesRoute *RouteTablesRoute) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Route_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (routeTablesRoute *RouteTablesRoute) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(routeTablesRoute.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Namespace: routeTablesRoute.Namespace, + Name: routeTablesRoute.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (routeTablesRoute *RouteTablesRoute) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Route_Status); ok { + routeTablesRoute.Status = *st + return nil + } + + // Convert status to required version + var st Route_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + routeTablesRoute.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-microsoft-network-azure-com-v1alpha1api20201101-routetablesroute,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=microsoft.network.azure.com,resources=routetablesroutes,verbs=create;update,versions=v1alpha1api20201101,name=validate.v1alpha1api20201101.routetablesroutes.microsoft.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &RouteTablesRoute{} + +// ValidateCreate validates the creation of the resource +func (routeTablesRoute *RouteTablesRoute) ValidateCreate() error { + validations := routeTablesRoute.createValidations() + var temp interface{} = routeTablesRoute + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.CreateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateDelete validates the deletion of the resource +func (routeTablesRoute *RouteTablesRoute) ValidateDelete() error { + validations := routeTablesRoute.deleteValidations() + var temp interface{} = routeTablesRoute + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.DeleteValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateUpdate validates an update of the resource +func (routeTablesRoute *RouteTablesRoute) ValidateUpdate(old runtime.Object) error { + validations := routeTablesRoute.updateValidations() + var temp interface{} = routeTablesRoute + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.UpdateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation(old) + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// createValidations validates the creation of the resource +func (routeTablesRoute *RouteTablesRoute) createValidations() []func() error { + return []func() error{routeTablesRoute.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (routeTablesRoute *RouteTablesRoute) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (routeTablesRoute *RouteTablesRoute) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return routeTablesRoute.validateResourceReferences() + }, + } +} + +// validateResourceReferences validates all resource references +func (routeTablesRoute *RouteTablesRoute) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&routeTablesRoute.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// AssignPropertiesFromRouteTablesRoute populates our RouteTablesRoute from the provided source RouteTablesRoute +func (routeTablesRoute *RouteTablesRoute) AssignPropertiesFromRouteTablesRoute(source *v1alpha1api20201101storage.RouteTablesRoute) error { + + // Spec + var spec RouteTablesRoutes_Spec + err := spec.AssignPropertiesFromRouteTablesRoutesSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "populating Spec from Spec, calling AssignPropertiesFromRouteTablesRoutesSpec()") + } + routeTablesRoute.Spec = spec + + // Status + var status Route_Status + err = status.AssignPropertiesFromRouteStatus(&source.Status) + if err != nil { + return errors.Wrap(err, "populating Status from Status, calling AssignPropertiesFromRouteStatus()") + } + routeTablesRoute.Status = status + + // No error + return nil +} + +// AssignPropertiesToRouteTablesRoute populates the provided destination RouteTablesRoute from our RouteTablesRoute +func (routeTablesRoute *RouteTablesRoute) AssignPropertiesToRouteTablesRoute(destination *v1alpha1api20201101storage.RouteTablesRoute) error { + + // Spec + var spec v1alpha1api20201101storage.RouteTablesRoutes_Spec + err := routeTablesRoute.Spec.AssignPropertiesToRouteTablesRoutesSpec(&spec) + if err != nil { + return errors.Wrap(err, "populating Spec from Spec, calling AssignPropertiesToRouteTablesRoutesSpec()") + } + destination.Spec = spec + + // Status + var status v1alpha1api20201101storage.Route_Status + err = routeTablesRoute.Status.AssignPropertiesToRouteStatus(&status) + if err != nil { + return errors.Wrap(err, "populating Status from Status, calling AssignPropertiesToRouteStatus()") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (routeTablesRoute *RouteTablesRoute) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: routeTablesRoute.Spec.OriginalVersion(), + Kind: "RouteTablesRoute", + } +} + +// +kubebuilder:object:root=true +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables_routes +type RouteTablesRouteList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RouteTablesRoute `json:"items"` +} + +// +kubebuilder:validation:Enum={"2020-11-01"} +type RouteTablesRoutesSpecAPIVersion string + +const RouteTablesRoutesSpecAPIVersion20201101 = RouteTablesRoutesSpecAPIVersion("2020-11-01") + +type RouteTablesRoutes_Spec struct { + // +kubebuilder:validation:Required + //AddressPrefix: The destination CIDR to which the route applies. + AddressPrefix string `json:"addressPrefix"` + + //AzureName: The name of the resource in Azure. This is often the same as the name + //of the resource in Kubernetes but it doesn't have to be. + AzureName string `json:"azureName"` + + //HasBgpOverride: A value indicating whether this route overrides overlapping BGP + //routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + + //Location: Location to deploy resource to + Location *string `json:"location,omitempty"` + + //NextHopIpAddress: The IP address packets should be forwarded to. Next hop values + //are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + + // +kubebuilder:validation:Required + //NextHopType: The type of Azure hop the packet should be sent to. + NextHopType RoutePropertiesFormatNextHopType `json:"nextHopType"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"microsoft.network.azure.com" json:"owner" kind:"RouteTable"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMTransformer = &RouteTablesRoutes_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if routeTablesRoutesSpec == nil { + return nil, nil + } + var result RouteTablesRoutes_SpecARM + + // Set property ‘Location’: + if routeTablesRoutesSpec.Location != nil { + location := *routeTablesRoutesSpec.Location + result.Location = &location + } + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + result.Properties.AddressPrefix = routeTablesRoutesSpec.AddressPrefix + if routeTablesRoutesSpec.HasBgpOverride != nil { + hasBgpOverride := *routeTablesRoutesSpec.HasBgpOverride + result.Properties.HasBgpOverride = &hasBgpOverride + } + if routeTablesRoutesSpec.NextHopIpAddress != nil { + nextHopIpAddress := *routeTablesRoutesSpec.NextHopIpAddress + result.Properties.NextHopIpAddress = &nextHopIpAddress + } + result.Properties.NextHopType = routeTablesRoutesSpec.NextHopType + + // Set property ‘Tags’: + if routeTablesRoutesSpec.Tags != nil { + result.Tags = make(map[string]string) + for key, value := range routeTablesRoutesSpec.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTablesRoutes_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTablesRoutes_SpecARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTablesRoutes_SpecARM, got %T", armInput) + } + + // Set property ‘AddressPrefix’: + // copying flattened property: + routeTablesRoutesSpec.AddressPrefix = typedInput.Properties.AddressPrefix + + // Set property ‘AzureName’: + routeTablesRoutesSpec.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘HasBgpOverride’: + // copying flattened property: + if typedInput.Properties.HasBgpOverride != nil { + hasBgpOverride := *typedInput.Properties.HasBgpOverride + routeTablesRoutesSpec.HasBgpOverride = &hasBgpOverride + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + routeTablesRoutesSpec.Location = &location + } + + // Set property ‘NextHopIpAddress’: + // copying flattened property: + if typedInput.Properties.NextHopIpAddress != nil { + nextHopIpAddress := *typedInput.Properties.NextHopIpAddress + routeTablesRoutesSpec.NextHopIpAddress = &nextHopIpAddress + } + + // Set property ‘NextHopType’: + // copying flattened property: + routeTablesRoutesSpec.NextHopType = typedInput.Properties.NextHopType + + // Set property ‘Owner’: + routeTablesRoutesSpec.Owner = genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + routeTablesRoutesSpec.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + routeTablesRoutesSpec.Tags[key] = value + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &RouteTablesRoutes_Spec{} + +// ConvertSpecFrom populates our RouteTablesRoutes_Spec from the provided source +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v1alpha1api20201101storage.RouteTablesRoutes_Spec) + if ok { + // Populate our instance from source + return routeTablesRoutesSpec.AssignPropertiesFromRouteTablesRoutesSpec(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20201101storage.RouteTablesRoutes_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()") + } + + // Update our instance from src + err = routeTablesRoutesSpec.AssignPropertiesFromRouteTablesRoutesSpec(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil +} + +// ConvertSpecTo populates the provided destination from our RouteTablesRoutes_Spec +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v1alpha1api20201101storage.RouteTablesRoutes_Spec) + if ok { + // Populate destination from our instance + return routeTablesRoutesSpec.AssignPropertiesToRouteTablesRoutesSpec(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20201101storage.RouteTablesRoutes_Spec{} + err := routeTablesRoutesSpec.AssignPropertiesToRouteTablesRoutesSpec(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()") + } + + // Update dst from our instance + err = dst.ConvertSpecTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecTo()") + } + + return nil +} + +// AssignPropertiesFromRouteTablesRoutesSpec populates our RouteTablesRoutes_Spec from the provided source RouteTablesRoutes_Spec +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) AssignPropertiesFromRouteTablesRoutesSpec(source *v1alpha1api20201101storage.RouteTablesRoutes_Spec) error { + + // AddressPrefix + routeTablesRoutesSpec.AddressPrefix = genruntime.GetOptionalStringValue(source.AddressPrefix) + + // AzureName + routeTablesRoutesSpec.AzureName = source.AzureName + + // HasBgpOverride + if source.HasBgpOverride != nil { + hasBgpOverride := *source.HasBgpOverride + routeTablesRoutesSpec.HasBgpOverride = &hasBgpOverride + } else { + routeTablesRoutesSpec.HasBgpOverride = nil + } + + // Location + routeTablesRoutesSpec.Location = genruntime.ClonePointerToString(source.Location) + + // NextHopIpAddress + routeTablesRoutesSpec.NextHopIpAddress = genruntime.ClonePointerToString(source.NextHopIpAddress) + + // NextHopType + if source.NextHopType != nil { + routeTablesRoutesSpec.NextHopType = RoutePropertiesFormatNextHopType(*source.NextHopType) + } else { + routeTablesRoutesSpec.NextHopType = "" + } + + // Owner + routeTablesRoutesSpec.Owner = source.Owner.Copy() + + // Tags + routeTablesRoutesSpec.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // No error + return nil +} + +// AssignPropertiesToRouteTablesRoutesSpec populates the provided destination RouteTablesRoutes_Spec from our RouteTablesRoutes_Spec +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) AssignPropertiesToRouteTablesRoutesSpec(destination *v1alpha1api20201101storage.RouteTablesRoutes_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AddressPrefix + addressPrefix := routeTablesRoutesSpec.AddressPrefix + destination.AddressPrefix = &addressPrefix + + // AzureName + destination.AzureName = routeTablesRoutesSpec.AzureName + + // HasBgpOverride + if routeTablesRoutesSpec.HasBgpOverride != nil { + hasBgpOverride := *routeTablesRoutesSpec.HasBgpOverride + destination.HasBgpOverride = &hasBgpOverride + } else { + destination.HasBgpOverride = nil + } + + // Location + destination.Location = genruntime.ClonePointerToString(routeTablesRoutesSpec.Location) + + // NextHopIpAddress + destination.NextHopIpAddress = genruntime.ClonePointerToString(routeTablesRoutesSpec.NextHopIpAddress) + + // NextHopType + nextHopType := string(routeTablesRoutesSpec.NextHopType) + destination.NextHopType = &nextHopType + + // OriginalVersion + destination.OriginalVersion = routeTablesRoutesSpec.OriginalVersion() + + // Owner + destination.Owner = routeTablesRoutesSpec.Owner.Copy() + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(routeTablesRoutesSpec.Tags) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// OriginalVersion returns the original API version used to create the resource. +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) SetAzureName(azureName string) { + routeTablesRoutesSpec.AzureName = azureName +} + +//Generated from: +type Route_Status struct { + //AddressPrefix: The destination CIDR to which the route applies. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + //Conditions: The observed state of the resource + Conditions []conditions.Condition `json:"conditions,omitempty"` + + //Etag: A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + + //HasBgpOverride: A value indicating whether this route overrides overlapping BGP + //routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + + //Id: Resource ID. + Id *string `json:"id,omitempty"` + + //Name: The name of the resource that is unique within a resource group. This name + //can be used to access the resource. + Name *string `json:"name,omitempty"` + + //NextHopIpAddress: The IP address packets should be forwarded to. Next hop values + //are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + + //NextHopType: The type of Azure hop the packet should be sent to. + NextHopType *RouteNextHopType_Status `json:"nextHopType,omitempty"` + + //ProvisioningState: The provisioning state of the route resource. + ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` + + //Type: The type of the resource. + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Route_Status{} + +// ConvertStatusFrom populates our Route_Status from the provided source +func (routeStatus *Route_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v1alpha1api20201101storage.Route_Status) + if ok { + // Populate our instance from source + return routeStatus.AssignPropertiesFromRouteStatus(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20201101storage.Route_Status{} + err := src.ConvertStatusFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = routeStatus.AssignPropertiesFromRouteStatus(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our Route_Status +func (routeStatus *Route_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v1alpha1api20201101storage.Route_Status) + if ok { + // Populate destination from our instance + return routeStatus.AssignPropertiesToRouteStatus(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20201101storage.Route_Status{} + err := routeStatus.AssignPropertiesToRouteStatus(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +var _ genruntime.FromARMConverter = &Route_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routeStatus *Route_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Route_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routeStatus *Route_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Route_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Route_StatusARM, got %T", armInput) + } + + // Set property ‘AddressPrefix’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.AddressPrefix != nil { + addressPrefix := *typedInput.Properties.AddressPrefix + routeStatus.AddressPrefix = &addressPrefix + } + } + + // no assignment for property ‘Conditions’ + + // Set property ‘Etag’: + if typedInput.Etag != nil { + etag := *typedInput.Etag + routeStatus.Etag = &etag + } + + // Set property ‘HasBgpOverride’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.HasBgpOverride != nil { + hasBgpOverride := *typedInput.Properties.HasBgpOverride + routeStatus.HasBgpOverride = &hasBgpOverride + } + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + routeStatus.Id = &id + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + routeStatus.Name = &name + } + + // Set property ‘NextHopIpAddress’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NextHopIpAddress != nil { + nextHopIpAddress := *typedInput.Properties.NextHopIpAddress + routeStatus.NextHopIpAddress = &nextHopIpAddress + } + } + + // Set property ‘NextHopType’: + // copying flattened property: + if typedInput.Properties != nil { + routeStatus.NextHopType = &typedInput.Properties.NextHopType + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + routeStatus.ProvisioningState = &provisioningState + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + routeStatus.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromRouteStatus populates our Route_Status from the provided source Route_Status +func (routeStatus *Route_Status) AssignPropertiesFromRouteStatus(source *v1alpha1api20201101storage.Route_Status) error { + + // AddressPrefix + routeStatus.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix) + + // Conditions + routeStatus.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // Etag + routeStatus.Etag = genruntime.ClonePointerToString(source.Etag) + + // HasBgpOverride + if source.HasBgpOverride != nil { + hasBgpOverride := *source.HasBgpOverride + routeStatus.HasBgpOverride = &hasBgpOverride + } else { + routeStatus.HasBgpOverride = nil + } + + // Id + routeStatus.Id = genruntime.ClonePointerToString(source.Id) + + // Name + routeStatus.Name = genruntime.ClonePointerToString(source.Name) + + // NextHopIpAddress + routeStatus.NextHopIpAddress = genruntime.ClonePointerToString(source.NextHopIpAddress) + + // NextHopType + if source.NextHopType != nil { + nextHopType := RouteNextHopType_Status(*source.NextHopType) + routeStatus.NextHopType = &nextHopType + } else { + routeStatus.NextHopType = nil + } + + // ProvisioningState + if source.ProvisioningState != nil { + provisioningState := ProvisioningState_Status(*source.ProvisioningState) + routeStatus.ProvisioningState = &provisioningState + } else { + routeStatus.ProvisioningState = nil + } + + // Type + routeStatus.Type = genruntime.ClonePointerToString(source.Type) + + // No error + return nil +} + +// AssignPropertiesToRouteStatus populates the provided destination Route_Status from our Route_Status +func (routeStatus *Route_Status) AssignPropertiesToRouteStatus(destination *v1alpha1api20201101storage.Route_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AddressPrefix + destination.AddressPrefix = genruntime.ClonePointerToString(routeStatus.AddressPrefix) + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(routeStatus.Conditions) + + // Etag + destination.Etag = genruntime.ClonePointerToString(routeStatus.Etag) + + // HasBgpOverride + if routeStatus.HasBgpOverride != nil { + hasBgpOverride := *routeStatus.HasBgpOverride + destination.HasBgpOverride = &hasBgpOverride + } else { + destination.HasBgpOverride = nil + } + + // Id + destination.Id = genruntime.ClonePointerToString(routeStatus.Id) + + // Name + destination.Name = genruntime.ClonePointerToString(routeStatus.Name) + + // NextHopIpAddress + destination.NextHopIpAddress = genruntime.ClonePointerToString(routeStatus.NextHopIpAddress) + + // NextHopType + if routeStatus.NextHopType != nil { + nextHopType := string(*routeStatus.NextHopType) + destination.NextHopType = &nextHopType + } else { + destination.NextHopType = nil + } + + // ProvisioningState + if routeStatus.ProvisioningState != nil { + provisioningState := string(*routeStatus.ProvisioningState) + destination.ProvisioningState = &provisioningState + } else { + destination.ProvisioningState = nil + } + + // Type + destination.Type = genruntime.ClonePointerToString(routeStatus.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: +type RouteNextHopType_Status string + +const ( + RouteNextHopType_StatusInternet = RouteNextHopType_Status("Internet") + RouteNextHopType_StatusNone = RouteNextHopType_Status("None") + RouteNextHopType_StatusVirtualAppliance = RouteNextHopType_Status("VirtualAppliance") + RouteNextHopType_StatusVirtualNetworkGateway = RouteNextHopType_Status("VirtualNetworkGateway") + RouteNextHopType_StatusVnetLocal = RouteNextHopType_Status("VnetLocal") +) + +// +kubebuilder:validation:Enum={"Internet","None","VirtualAppliance","VirtualNetworkGateway","VnetLocal"} +type RoutePropertiesFormatNextHopType string + +const ( + RoutePropertiesFormatNextHopTypeInternet = RoutePropertiesFormatNextHopType("Internet") + RoutePropertiesFormatNextHopTypeNone = RoutePropertiesFormatNextHopType("None") + RoutePropertiesFormatNextHopTypeVirtualAppliance = RoutePropertiesFormatNextHopType("VirtualAppliance") + RoutePropertiesFormatNextHopTypeVirtualNetworkGateway = RoutePropertiesFormatNextHopType("VirtualNetworkGateway") + RoutePropertiesFormatNextHopTypeVnetLocal = RoutePropertiesFormatNextHopType("VnetLocal") +) + +func init() { + SchemeBuilder.Register(&RouteTablesRoute{}, &RouteTablesRouteList{}) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen_test.go new file mode 100644 index 00000000000..3ca289feddb --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_route_types_gen_test.go @@ -0,0 +1,329 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import ( + "encoding/json" + "github.com/Azure/azure-service-operator/v2/api/microsoft.network/v1alpha1api20201101storage" + "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_RouteTablesRoute_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTablesRoute to RouteTablesRoute via AssignPropertiesToRouteTablesRoute & AssignPropertiesFromRouteTablesRoute returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTablesRoute, RouteTablesRouteGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTablesRoute tests if a specific instance of RouteTablesRoute can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesRoute(subject RouteTablesRoute) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.RouteTablesRoute + err := subject.AssignPropertiesToRouteTablesRoute(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTablesRoute + err = actual.AssignPropertiesFromRouteTablesRoute(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RouteTablesRoute_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablesRoute via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesRoute, RouteTablesRouteGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesRoute runs a test to see if a specific instance of RouteTablesRoute round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesRoute(subject RouteTablesRoute) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablesRoute + 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 RouteTablesRoute instances for property testing - lazily instantiated by RouteTablesRouteGenerator() +var routeTablesRouteGenerator gopter.Gen + +// RouteTablesRouteGenerator returns a generator of RouteTablesRoute instances for property testing. +func RouteTablesRouteGenerator() gopter.Gen { + if routeTablesRouteGenerator != nil { + return routeTablesRouteGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForRouteTablesRoute(generators) + routeTablesRouteGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoute{}), generators) + + return routeTablesRouteGenerator +} + +// AddRelatedPropertyGeneratorsForRouteTablesRoute is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesRoute(gens map[string]gopter.Gen) { + gens["Spec"] = RouteTablesRoutesSpecGenerator() + gens["Status"] = RouteStatusGenerator() +} + +func Test_RouteTablesRoutes_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTablesRoutes_Spec to RouteTablesRoutes_Spec via AssignPropertiesToRouteTablesRoutesSpec & AssignPropertiesFromRouteTablesRoutesSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTablesRoutesSpec, RouteTablesRoutesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTablesRoutesSpec tests if a specific instance of RouteTablesRoutes_Spec can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesRoutesSpec(subject RouteTablesRoutes_Spec) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.RouteTablesRoutes_Spec + err := subject.AssignPropertiesToRouteTablesRoutesSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTablesRoutes_Spec + err = actual.AssignPropertiesFromRouteTablesRoutesSpec(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_RouteTablesRoutes_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablesRoutes_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesRoutesSpec, RouteTablesRoutesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesRoutesSpec runs a test to see if a specific instance of RouteTablesRoutes_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesRoutesSpec(subject RouteTablesRoutes_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablesRoutes_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 RouteTablesRoutes_Spec instances for property testing - lazily instantiated by +//RouteTablesRoutesSpecGenerator() +var routeTablesRoutesSpecGenerator gopter.Gen + +// RouteTablesRoutesSpecGenerator returns a generator of RouteTablesRoutes_Spec instances for property testing. +func RouteTablesRoutesSpecGenerator() gopter.Gen { + if routeTablesRoutesSpecGenerator != nil { + return routeTablesRoutesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec(generators) + routeTablesRoutesSpecGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoutes_Spec{}), generators) + + return routeTablesRoutesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.AlphaString() + gens["AzureName"] = gen.AlphaString() + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.OneConstOf(RoutePropertiesFormatNextHopTypeInternet, RoutePropertiesFormatNextHopTypeNone, RoutePropertiesFormatNextHopTypeVirtualAppliance, RoutePropertiesFormatNextHopTypeVirtualNetworkGateway, RoutePropertiesFormatNextHopTypeVnetLocal) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +func Test_Route_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Route_Status to Route_Status via AssignPropertiesToRouteStatus & AssignPropertiesFromRouteStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteStatus, RouteStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteStatus tests if a specific instance of Route_Status can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteStatus(subject Route_Status) string { + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20201101storage.Route_Status + err := subject.AssignPropertiesToRouteStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Route_Status + err = actual.AssignPropertiesFromRouteStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Route_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatus, RouteStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatus runs a test to see if a specific instance of Route_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatus(subject Route_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_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 Route_Status instances for property testing - lazily instantiated by RouteStatusGenerator() +var routeStatusGenerator gopter.Gen + +// RouteStatusGenerator returns a generator of Route_Status instances for property testing. +func RouteStatusGenerator() gopter.Gen { + if routeStatusGenerator != nil { + return routeStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatus(generators) + routeStatusGenerator = gen.Struct(reflect.TypeOf(Route_Status{}), generators) + + return routeStatusGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatus(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.PtrOf(gen.AlphaString()) + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.OneConstOf(RouteNextHopType_StatusInternet, RouteNextHopType_StatusNone, RouteNextHopType_StatusVirtualAppliance, RouteNextHopType_StatusVirtualNetworkGateway, RouteNextHopType_StatusVnetLocal)) + gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(ProvisioningState_StatusDeleting, ProvisioningState_StatusFailed, ProvisioningState_StatusSucceeded, ProvisioningState_StatusUpdating)) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen.go new file mode 100644 index 00000000000..ddebf783baf --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen.go @@ -0,0 +1,54 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type RouteTablesRoutes_SpecARM struct { + //Location: Location to deploy resource to + Location *string `json:"location,omitempty"` + + //Name: Name of the resource + Name string `json:"name"` + + //Properties: Properties of the route. + Properties RoutePropertiesFormatARM `json:"properties"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &RouteTablesRoutes_SpecARM{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (routeTablesRoutesSpecARM RouteTablesRoutes_SpecARM) GetAPIVersion() string { + return "2020-11-01" +} + +// GetName returns the Name of the resource +func (routeTablesRoutesSpecARM RouteTablesRoutes_SpecARM) GetName() string { + return routeTablesRoutesSpecARM.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (routeTablesRoutesSpecARM RouteTablesRoutes_SpecARM) GetType() string { + return "Microsoft.Network/routeTables/routes" +} + +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/definitions/RoutePropertiesFormat +type RoutePropertiesFormatARM struct { + //AddressPrefix: The destination CIDR to which the route applies. + AddressPrefix string `json:"addressPrefix"` + + //HasBgpOverride: A value indicating whether this route overrides overlapping BGP + //routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + + //NextHopIpAddress: The IP address packets should be forwarded to. Next hop values + //are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + + //NextHopType: The type of Azure hop the packet should be sent to. + NextHopType RoutePropertiesFormatNextHopType `json:"nextHopType"` +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..33cbb7f059c --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101/route_tables_routes__spec_arm_types_gen_test.go @@ -0,0 +1,157 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101 + +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_RouteTablesRoutes_SpecARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablesRoutes_SpecARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesRoutesSpecARM, RouteTablesRoutesSpecARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesRoutesSpecARM runs a test to see if a specific instance of RouteTablesRoutes_SpecARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesRoutesSpecARM(subject RouteTablesRoutes_SpecARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablesRoutes_SpecARM + 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 RouteTablesRoutes_SpecARM instances for property testing - lazily instantiated by +//RouteTablesRoutesSpecARMGenerator() +var routeTablesRoutesSpecARMGenerator gopter.Gen + +// RouteTablesRoutesSpecARMGenerator returns a generator of RouteTablesRoutes_SpecARM instances for property testing. +// We first initialize routeTablesRoutesSpecARMGenerator 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 RouteTablesRoutesSpecARMGenerator() gopter.Gen { + if routeTablesRoutesSpecARMGenerator != nil { + return routeTablesRoutesSpecARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesRoutesSpecARM(generators) + routeTablesRoutesSpecARMGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoutes_SpecARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesRoutesSpecARM(generators) + AddRelatedPropertyGeneratorsForRouteTablesRoutesSpecARM(generators) + routeTablesRoutesSpecARMGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoutes_SpecARM{}), generators) + + return routeTablesRoutesSpecARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesRoutesSpecARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesRoutesSpecARM(gens map[string]gopter.Gen) { + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTablesRoutesSpecARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesRoutesSpecARM(gens map[string]gopter.Gen) { + gens["Properties"] = RoutePropertiesFormatARMGenerator() +} + +func Test_RoutePropertiesFormatARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RoutePropertiesFormatARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRoutePropertiesFormatARM, RoutePropertiesFormatARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRoutePropertiesFormatARM runs a test to see if a specific instance of RoutePropertiesFormatARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRoutePropertiesFormatARM(subject RoutePropertiesFormatARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RoutePropertiesFormatARM + 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 RoutePropertiesFormatARM instances for property testing - lazily instantiated by +//RoutePropertiesFormatARMGenerator() +var routePropertiesFormatARMGenerator gopter.Gen + +// RoutePropertiesFormatARMGenerator returns a generator of RoutePropertiesFormatARM instances for property testing. +func RoutePropertiesFormatARMGenerator() gopter.Gen { + if routePropertiesFormatARMGenerator != nil { + return routePropertiesFormatARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRoutePropertiesFormatARM(generators) + routePropertiesFormatARMGenerator = gen.Struct(reflect.TypeOf(RoutePropertiesFormatARM{}), generators) + + return routePropertiesFormatARMGenerator +} + +// AddIndependentPropertyGeneratorsForRoutePropertiesFormatARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRoutePropertiesFormatARM(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.AlphaString() + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.OneConstOf(RoutePropertiesFormatNextHopTypeInternet, RoutePropertiesFormatNextHopTypeNone, RoutePropertiesFormatNextHopTypeVirtualAppliance, RoutePropertiesFormatNextHopTypeVirtualNetworkGateway, RoutePropertiesFormatNextHopTypeVnetLocal) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101/zz_generated.deepcopy.go b/v2/api/microsoft.network/v1alpha1api20201101/zz_generated.deepcopy.go index 076be862ed6..6ed509941ac 100644 --- a/v2/api/microsoft.network/v1alpha1api20201101/zz_generated.deepcopy.go +++ b/v2/api/microsoft.network/v1alpha1api20201101/zz_generated.deepcopy.go @@ -5503,6 +5503,304 @@ func (in *ResourceNavigationLink_StatusARM) DeepCopy() *ResourceNavigationLink_S return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoutePropertiesFormatARM) DeepCopyInto(out *RoutePropertiesFormatARM) { + *out = *in + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoutePropertiesFormatARM. +func (in *RoutePropertiesFormatARM) DeepCopy() *RoutePropertiesFormatARM { + if in == nil { + return nil + } + out := new(RoutePropertiesFormatARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoutePropertiesFormat_StatusARM) DeepCopyInto(out *RoutePropertiesFormat_StatusARM) { + *out = *in + if in.AddressPrefix != nil { + in, out := &in.AddressPrefix, &out.AddressPrefix + *out = new(string) + **out = **in + } + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(ProvisioningState_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoutePropertiesFormat_StatusARM. +func (in *RoutePropertiesFormat_StatusARM) DeepCopy() *RoutePropertiesFormat_StatusARM { + if in == nil { + return nil + } + out := new(RoutePropertiesFormat_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable) DeepCopyInto(out *RouteTable) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable. +func (in *RouteTable) DeepCopy() *RouteTable { + if in == nil { + return nil + } + out := new(RouteTable) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTable) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTableList) DeepCopyInto(out *RouteTableList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteTable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTableList. +func (in *RouteTableList) DeepCopy() *RouteTableList { + if in == nil { + return nil + } + out := new(RouteTableList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTableList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablePropertiesFormat_StatusARM) DeepCopyInto(out *RouteTablePropertiesFormat_StatusARM) { + *out = *in + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(ProvisioningState_Status) + **out = **in + } + if in.ResourceGuid != nil { + in, out := &in.ResourceGuid, &out.ResourceGuid + *out = new(string) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route_Status_SubResourceEmbeddedARM, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Subnets != nil { + in, out := &in.Subnets, &out.Subnets + *out = make([]Subnet_Status_RouteTable_SubResourceEmbeddedARM, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTablePropertiesFormat_StatusARM. +func (in *RouteTablePropertiesFormat_StatusARM) DeepCopy() *RouteTablePropertiesFormat_StatusARM { + if in == nil { + return nil + } + out := new(RouteTablePropertiesFormat_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable_Status_RouteTable_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_RouteTable_SubResourceEmbedded) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **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.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(ProvisioningState_Status) + **out = **in + } + if in.ResourceGuid != nil { + in, out := &in.ResourceGuid, &out.ResourceGuid + *out = new(string) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route_Status_SubResourceEmbedded, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Subnets != nil { + in, out := &in.Subnets, &out.Subnets + *out = make([]Subnet_Status_RouteTable_SubResourceEmbedded, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 RouteTable_Status_RouteTable_SubResourceEmbedded. +func (in *RouteTable_Status_RouteTable_SubResourceEmbedded) DeepCopy() *RouteTable_Status_RouteTable_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(RouteTable_Status_RouteTable_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable_Status_RouteTable_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_RouteTable_SubResourceEmbeddedARM) { + *out = *in + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **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.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(RouteTablePropertiesFormat_StatusARM) + (*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 RouteTable_Status_RouteTable_SubResourceEmbeddedARM. +func (in *RouteTable_Status_RouteTable_SubResourceEmbeddedARM) DeepCopy() *RouteTable_Status_RouteTable_SubResourceEmbeddedARM { + if in == nil { + return nil + } + out := new(RouteTable_Status_RouteTable_SubResourceEmbeddedARM) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) { *out = *in @@ -5513,18 +5811,361 @@ func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyI } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded. -func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopy() *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded. +func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopy() *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM. +func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCopy() *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM { + if in == nil { + return nil + } + out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRoute) DeepCopyInto(out *RouteTablesRoute) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTablesRoute. +func (in *RouteTablesRoute) DeepCopy() *RouteTablesRoute { + if in == nil { + return nil + } + out := new(RouteTablesRoute) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTablesRoute) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRouteList) DeepCopyInto(out *RouteTablesRouteList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteTablesRoute, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTablesRouteList. +func (in *RouteTablesRouteList) DeepCopy() *RouteTablesRouteList { + if in == nil { + return nil + } + out := new(RouteTablesRouteList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTablesRouteList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRoutes_Spec) DeepCopyInto(out *RouteTablesRoutes_Spec) { + *out = *in + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } + out.Owner = in.Owner + 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 RouteTablesRoutes_Spec. +func (in *RouteTablesRoutes_Spec) DeepCopy() *RouteTablesRoutes_Spec { + if in == nil { + return nil + } + out := new(RouteTablesRoutes_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 *RouteTablesRoutes_SpecARM) DeepCopyInto(out *RouteTablesRoutes_SpecARM) { + *out = *in + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + in.Properties.DeepCopyInto(&out.Properties) + 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 RouteTablesRoutes_SpecARM. +func (in *RouteTablesRoutes_SpecARM) DeepCopy() *RouteTablesRoutes_SpecARM { + if in == nil { + return nil + } + out := new(RouteTablesRoutes_SpecARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTables_Spec) DeepCopyInto(out *RouteTables_Spec) { + *out = *in + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } + out.Owner = in.Owner + 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 RouteTables_Spec. +func (in *RouteTables_Spec) DeepCopy() *RouteTables_Spec { + if in == nil { + return nil + } + out := new(RouteTables_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 *RouteTables_SpecARM) DeepCopyInto(out *RouteTables_SpecARM) { + *out = *in + in.Properties.DeepCopyInto(&out.Properties) + 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 RouteTables_SpecARM. +func (in *RouteTables_SpecARM) DeepCopy() *RouteTables_SpecARM { + if in == nil { + return nil + } + out := new(RouteTables_SpecARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTables_Spec_PropertiesARM) DeepCopyInto(out *RouteTables_Spec_PropertiesARM) { + *out = *in + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTables_Spec_PropertiesARM. +func (in *RouteTables_Spec_PropertiesARM) DeepCopy() *RouteTables_Spec_PropertiesARM { + if in == nil { + return nil + } + out := new(RouteTables_Spec_PropertiesARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route_Status) DeepCopyInto(out *Route_Status) { + *out = *in + if in.AddressPrefix != nil { + in, out := &in.AddressPrefix, &out.AddressPrefix + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } + if in.NextHopType != nil { + in, out := &in.NextHopType, &out.NextHopType + *out = new(RouteNextHopType_Status) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(ProvisioningState_Status) + **out = **in + } + 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 Route_Status. +func (in *Route_Status) DeepCopy() *Route_Status { + if in == nil { + return nil + } + out := new(Route_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route_StatusARM) DeepCopyInto(out *Route_StatusARM) { + *out = *in + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *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(RoutePropertiesFormat_StatusARM) + (*in).DeepCopyInto(*out) + } + 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 Route_StatusARM. +func (in *Route_StatusARM) DeepCopy() *Route_StatusARM { + if in == nil { + return nil + } + out := new(Route_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route_Status_SubResourceEmbedded) DeepCopyInto(out *Route_Status_SubResourceEmbedded) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route_Status_SubResourceEmbedded. +func (in *Route_Status_SubResourceEmbedded) DeepCopy() *Route_Status_SubResourceEmbedded { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + out := new(Route_Status_SubResourceEmbedded) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) { +func (in *Route_Status_SubResourceEmbeddedARM) DeepCopyInto(out *Route_Status_SubResourceEmbeddedARM) { *out = *in if in.Id != nil { in, out := &in.Id, &out.Id @@ -5533,12 +6174,12 @@ func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCo } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM. -func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCopy() *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route_Status_SubResourceEmbeddedARM. +func (in *Route_Status_SubResourceEmbeddedARM) DeepCopy() *Route_Status_SubResourceEmbeddedARM { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + out := new(Route_Status_SubResourceEmbeddedARM) in.DeepCopyInto(out) return out } @@ -6574,6 +7215,46 @@ func (in *Subnet_Status_PublicIPAddress_SubResourceEmbeddedARM) DeepCopy() *Subn return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subnet_Status_RouteTable_SubResourceEmbedded) DeepCopyInto(out *Subnet_Status_RouteTable_SubResourceEmbedded) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet_Status_RouteTable_SubResourceEmbedded. +func (in *Subnet_Status_RouteTable_SubResourceEmbedded) DeepCopy() *Subnet_Status_RouteTable_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(Subnet_Status_RouteTable_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subnet_Status_RouteTable_SubResourceEmbeddedARM) DeepCopyInto(out *Subnet_Status_RouteTable_SubResourceEmbeddedARM) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet_Status_RouteTable_SubResourceEmbeddedARM. +func (in *Subnet_Status_RouteTable_SubResourceEmbeddedARM) DeepCopy() *Subnet_Status_RouteTable_SubResourceEmbeddedARM { + if in == nil { + return nil + } + out := new(Subnet_Status_RouteTable_SubResourceEmbeddedARM) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subnet_Status_VirtualNetwork_SubResourceEmbedded) DeepCopyInto(out *Subnet_Status_VirtualNetwork_SubResourceEmbedded) { *out = *in diff --git a/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen.go new file mode 100644 index 00000000000..0c12a39996b --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen.go @@ -0,0 +1,210 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +//Storage version of v1alpha1api20201101.RouteTable +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables +type RouteTable struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec RouteTables_Spec `json:"spec,omitempty"` + Status RouteTable_Status_RouteTable_SubResourceEmbedded `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTable{} + +// GetConditions returns the conditions of the resource +func (routeTable *RouteTable) GetConditions() conditions.Conditions { + return routeTable.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (routeTable *RouteTable) SetConditions(conditions conditions.Conditions) { + routeTable.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &RouteTable{} + +// AzureName returns the Azure name of the resource +func (routeTable *RouteTable) AzureName() string { + return routeTable.Spec.AzureName +} + +// GetResourceKind returns the kind of the resource +func (routeTable *RouteTable) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (routeTable *RouteTable) GetSpec() genruntime.ConvertibleSpec { + return &routeTable.Spec +} + +// GetStatus returns the status of this resource +func (routeTable *RouteTable) GetStatus() genruntime.ConvertibleStatus { + return &routeTable.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (routeTable *RouteTable) GetType() string { + return "Microsoft.Network/routeTables" +} + +// NewEmptyStatus returns a new empty (blank) status +func (routeTable *RouteTable) NewEmptyStatus() genruntime.ConvertibleStatus { + return &RouteTable_Status_RouteTable_SubResourceEmbedded{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (routeTable *RouteTable) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(routeTable.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Namespace: routeTable.Namespace, + Name: routeTable.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (routeTable *RouteTable) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*RouteTable_Status_RouteTable_SubResourceEmbedded); ok { + routeTable.Status = *st + return nil + } + + // Convert status to required version + var st RouteTable_Status_RouteTable_SubResourceEmbedded + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + routeTable.Status = st + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (routeTable *RouteTable) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: routeTable.Spec.OriginalVersion, + Kind: "RouteTable", + } +} + +// +kubebuilder:object:root=true +//Storage version of v1alpha1api20201101.RouteTable +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables +type RouteTableList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RouteTable `json:"items"` +} + +//Storage version of v1alpha1api20201101.RouteTable_Status_RouteTable_SubResourceEmbedded +//Generated from: +type RouteTable_Status_RouteTable_SubResourceEmbedded struct { + Conditions []conditions.Condition `json:"conditions,omitempty"` + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResourceGuid *string `json:"resourceGuid,omitempty"` + Routes []Route_Status_SubResourceEmbedded `json:"routes,omitempty"` + Subnets []Subnet_Status_RouteTable_SubResourceEmbedded `json:"subnets,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &RouteTable_Status_RouteTable_SubResourceEmbedded{} + +// ConvertStatusFrom populates our RouteTable_Status_RouteTable_SubResourceEmbedded from the provided source +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == routeTableStatusRouteTableSubResourceEmbedded { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(routeTableStatusRouteTableSubResourceEmbedded) +} + +// ConvertStatusTo populates the provided destination from our RouteTable_Status_RouteTable_SubResourceEmbedded +func (routeTableStatusRouteTableSubResourceEmbedded *RouteTable_Status_RouteTable_SubResourceEmbedded) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == routeTableStatusRouteTableSubResourceEmbedded { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(routeTableStatusRouteTableSubResourceEmbedded) +} + +//Storage version of v1alpha1api20201101.RouteTables_Spec +type RouteTables_Spec struct { + //AzureName: The name of the resource in Azure. This is often the same as the name + //of the resource in Kubernetes but it doesn't have to be. + AzureName string `json:"azureName"` + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + Location *string `json:"location,omitempty"` + OriginalVersion string `json:"originalVersion"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"microsoft.resources.azure.com" json:"owner" kind:"ResourceGroup"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &RouteTables_Spec{} + +// ConvertSpecFrom populates our RouteTables_Spec from the provided source +func (routeTablesSpec *RouteTables_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == routeTablesSpec { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(routeTablesSpec) +} + +// ConvertSpecTo populates the provided destination from our RouteTables_Spec +func (routeTablesSpec *RouteTables_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == routeTablesSpec { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(routeTablesSpec) +} + +//Storage version of v1alpha1api20201101.Route_Status_SubResourceEmbedded +//Generated from: +type Route_Status_SubResourceEmbedded struct { + Id *string `json:"id,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +//Storage version of v1alpha1api20201101.Subnet_Status_RouteTable_SubResourceEmbedded +//Generated from: +type Subnet_Status_RouteTable_SubResourceEmbedded struct { + Id *string `json:"id,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +func init() { + SchemeBuilder.Register(&RouteTable{}, &RouteTableList{}) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen_test.go new file mode 100644 index 00000000000..bfebc14ed19 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101storage/route_table_types_gen_test.go @@ -0,0 +1,344 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101storage + +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_RouteTable_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTable, RouteTableGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTable runs a test to see if a specific instance of RouteTable round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTable(subject RouteTable) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable + 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 RouteTable instances for property testing - lazily instantiated by RouteTableGenerator() +var routeTableGenerator gopter.Gen + +// RouteTableGenerator returns a generator of RouteTable instances for property testing. +func RouteTableGenerator() gopter.Gen { + if routeTableGenerator != nil { + return routeTableGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForRouteTable(generators) + routeTableGenerator = gen.Struct(reflect.TypeOf(RouteTable{}), generators) + + return routeTableGenerator +} + +// AddRelatedPropertyGeneratorsForRouteTable is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTable(gens map[string]gopter.Gen) { + gens["Spec"] = RouteTablesSpecGenerator() + gens["Status"] = RouteTableStatusRouteTableSubResourceEmbeddedGenerator() +} + +func Test_RouteTable_Status_RouteTable_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_Status_RouteTable_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded, RouteTableStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_RouteTable_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusRouteTableSubResourceEmbedded(subject RouteTable_Status_RouteTable_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_Status_RouteTable_SubResourceEmbedded + 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 RouteTable_Status_RouteTable_SubResourceEmbedded instances for property testing - lazily instantiated by +//RouteTableStatusRouteTableSubResourceEmbeddedGenerator() +var routeTableStatusRouteTableSubResourceEmbeddedGenerator gopter.Gen + +// RouteTableStatusRouteTableSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_RouteTable_SubResourceEmbedded instances for property testing. +// We first initialize routeTableStatusRouteTableSubResourceEmbeddedGenerator 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 RouteTableStatusRouteTableSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusRouteTableSubResourceEmbeddedGenerator != nil { + return routeTableStatusRouteTableSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + routeTableStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbedded{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(generators) + routeTableStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_RouteTable_SubResourceEmbedded{}), generators) + + return routeTableStatusRouteTableSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) + 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["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["ResourceGuid"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTableStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Routes"] = gen.SliceOf(RouteStatusSubResourceEmbeddedGenerator()) + gens["Subnets"] = gen.SliceOf(SubnetStatusRouteTableSubResourceEmbeddedGenerator()) +} + +func Test_RouteTables_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTables_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesSpec, RouteTablesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesSpec runs a test to see if a specific instance of RouteTables_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesSpec(subject RouteTables_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTables_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 RouteTables_Spec instances for property testing - lazily instantiated by RouteTablesSpecGenerator() +var routeTablesSpecGenerator gopter.Gen + +// RouteTablesSpecGenerator returns a generator of RouteTables_Spec instances for property testing. +func RouteTablesSpecGenerator() gopter.Gen { + if routeTablesSpecGenerator != nil { + return routeTablesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpec(generators) + routeTablesSpecGenerator = gen.Struct(reflect.TypeOf(RouteTables_Spec{}), generators) + + return routeTablesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["DisableBgpRoutePropagation"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +func Test_Route_Status_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatusSubResourceEmbedded, RouteStatusSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatusSubResourceEmbedded runs a test to see if a specific instance of Route_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatusSubResourceEmbedded(subject Route_Status_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_Status_SubResourceEmbedded + 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 Route_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +//RouteStatusSubResourceEmbeddedGenerator() +var routeStatusSubResourceEmbeddedGenerator gopter.Gen + +// RouteStatusSubResourceEmbeddedGenerator returns a generator of Route_Status_SubResourceEmbedded instances for property testing. +func RouteStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeStatusSubResourceEmbeddedGenerator != nil { + return routeStatusSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded(generators) + routeStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(Route_Status_SubResourceEmbedded{}), generators) + + return routeStatusSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatusSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_Subnet_Status_RouteTable_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Subnet_Status_RouteTable_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded, SubnetStatusRouteTableSubResourceEmbeddedGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded runs a test to see if a specific instance of Subnet_Status_RouteTable_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForSubnetStatusRouteTableSubResourceEmbedded(subject Subnet_Status_RouteTable_SubResourceEmbedded) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Subnet_Status_RouteTable_SubResourceEmbedded + 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 Subnet_Status_RouteTable_SubResourceEmbedded instances for property testing - lazily instantiated by +//SubnetStatusRouteTableSubResourceEmbeddedGenerator() +var subnetStatusRouteTableSubResourceEmbeddedGenerator gopter.Gen + +// SubnetStatusRouteTableSubResourceEmbeddedGenerator returns a generator of Subnet_Status_RouteTable_SubResourceEmbedded instances for property testing. +func SubnetStatusRouteTableSubResourceEmbeddedGenerator() gopter.Gen { + if subnetStatusRouteTableSubResourceEmbeddedGenerator != nil { + return subnetStatusRouteTableSubResourceEmbeddedGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded(generators) + subnetStatusRouteTableSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(Subnet_Status_RouteTable_SubResourceEmbedded{}), generators) + + return subnetStatusRouteTableSubResourceEmbeddedGenerator +} + +// AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubnetStatusRouteTableSubResourceEmbedded(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen.go b/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen.go new file mode 100644 index 00000000000..8001b103eeb --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen.go @@ -0,0 +1,198 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +//Storage version of v1alpha1api20201101.RouteTablesRoute +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables_routes +type RouteTablesRoute struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec RouteTablesRoutes_Spec `json:"spec,omitempty"` + Status Route_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTablesRoute{} + +// GetConditions returns the conditions of the resource +func (routeTablesRoute *RouteTablesRoute) GetConditions() conditions.Conditions { + return routeTablesRoute.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (routeTablesRoute *RouteTablesRoute) SetConditions(conditions conditions.Conditions) { + routeTablesRoute.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &RouteTablesRoute{} + +// AzureName returns the Azure name of the resource +func (routeTablesRoute *RouteTablesRoute) AzureName() string { + return routeTablesRoute.Spec.AzureName +} + +// GetResourceKind returns the kind of the resource +func (routeTablesRoute *RouteTablesRoute) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (routeTablesRoute *RouteTablesRoute) GetSpec() genruntime.ConvertibleSpec { + return &routeTablesRoute.Spec +} + +// GetStatus returns the status of this resource +func (routeTablesRoute *RouteTablesRoute) GetStatus() genruntime.ConvertibleStatus { + return &routeTablesRoute.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (routeTablesRoute *RouteTablesRoute) GetType() string { + return "Microsoft.Network/routeTables/routes" +} + +// NewEmptyStatus returns a new empty (blank) status +func (routeTablesRoute *RouteTablesRoute) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Route_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (routeTablesRoute *RouteTablesRoute) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(routeTablesRoute.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Namespace: routeTablesRoute.Namespace, + Name: routeTablesRoute.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (routeTablesRoute *RouteTablesRoute) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Route_Status); ok { + routeTablesRoute.Status = *st + return nil + } + + // Convert status to required version + var st Route_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + routeTablesRoute.Status = st + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (routeTablesRoute *RouteTablesRoute) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: routeTablesRoute.Spec.OriginalVersion, + Kind: "RouteTablesRoute", + } +} + +// +kubebuilder:object:root=true +//Storage version of v1alpha1api20201101.RouteTablesRoute +//Generated from: https://schema.management.azure.com/schemas/2020-11-01/Microsoft.Network.json#/resourceDefinitions/routeTables_routes +type RouteTablesRouteList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RouteTablesRoute `json:"items"` +} + +//Storage version of v1alpha1api20201101.RouteTablesRoutes_Spec +type RouteTablesRoutes_Spec struct { + AddressPrefix *string `json:"addressPrefix,omitempty"` + + //AzureName: The name of the resource in Azure. This is often the same as the name + //of the resource in Kubernetes but it doesn't have to be. + AzureName string `json:"azureName"` + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + Location *string `json:"location,omitempty"` + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + NextHopType *string `json:"nextHopType,omitempty"` + OriginalVersion string `json:"originalVersion"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"microsoft.network.azure.com" json:"owner" kind:"RouteTable"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &RouteTablesRoutes_Spec{} + +// ConvertSpecFrom populates our RouteTablesRoutes_Spec from the provided source +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == routeTablesRoutesSpec { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(routeTablesRoutesSpec) +} + +// ConvertSpecTo populates the provided destination from our RouteTablesRoutes_Spec +func (routeTablesRoutesSpec *RouteTablesRoutes_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == routeTablesRoutesSpec { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(routeTablesRoutesSpec) +} + +//Storage version of v1alpha1api20201101.Route_Status +//Generated from: +type Route_Status struct { + AddressPrefix *string `json:"addressPrefix,omitempty"` + Conditions []conditions.Condition `json:"conditions,omitempty"` + Etag *string `json:"etag,omitempty"` + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + NextHopType *string `json:"nextHopType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Route_Status{} + +// ConvertStatusFrom populates our Route_Status from the provided source +func (routeStatus *Route_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == routeStatus { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(routeStatus) +} + +// ConvertStatusTo populates the provided destination from our Route_Status +func (routeStatus *Route_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == routeStatus { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(routeStatus) +} + +func init() { + SchemeBuilder.Register(&RouteTablesRoute{}, &RouteTablesRouteList{}) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen_test.go b/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen_test.go new file mode 100644 index 00000000000..b08f74fa516 --- /dev/null +++ b/v2/api/microsoft.network/v1alpha1api20201101storage/route_tables_route_types_gen_test.go @@ -0,0 +1,212 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20201101storage + +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_RouteTablesRoute_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablesRoute via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesRoute, RouteTablesRouteGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesRoute runs a test to see if a specific instance of RouteTablesRoute round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesRoute(subject RouteTablesRoute) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablesRoute + 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 RouteTablesRoute instances for property testing - lazily instantiated by RouteTablesRouteGenerator() +var routeTablesRouteGenerator gopter.Gen + +// RouteTablesRouteGenerator returns a generator of RouteTablesRoute instances for property testing. +func RouteTablesRouteGenerator() gopter.Gen { + if routeTablesRouteGenerator != nil { + return routeTablesRouteGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForRouteTablesRoute(generators) + routeTablesRouteGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoute{}), generators) + + return routeTablesRouteGenerator +} + +// AddRelatedPropertyGeneratorsForRouteTablesRoute is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesRoute(gens map[string]gopter.Gen) { + gens["Spec"] = RouteTablesRoutesSpecGenerator() + gens["Status"] = RouteStatusGenerator() +} + +func Test_RouteTablesRoutes_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTablesRoutes_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesRoutesSpec, RouteTablesRoutesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesRoutesSpec runs a test to see if a specific instance of RouteTablesRoutes_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesRoutesSpec(subject RouteTablesRoutes_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTablesRoutes_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 RouteTablesRoutes_Spec instances for property testing - lazily instantiated by +//RouteTablesRoutesSpecGenerator() +var routeTablesRoutesSpecGenerator gopter.Gen + +// RouteTablesRoutesSpecGenerator returns a generator of RouteTablesRoutes_Spec instances for property testing. +func RouteTablesRoutesSpecGenerator() gopter.Gen { + if routeTablesRoutesSpecGenerator != nil { + return routeTablesRoutesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec(generators) + routeTablesRoutesSpecGenerator = gen.Struct(reflect.TypeOf(RouteTablesRoutes_Spec{}), generators) + + return routeTablesRoutesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesRoutesSpec(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.PtrOf(gen.AlphaString()) + gens["AzureName"] = gen.AlphaString() + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +func Test_Route_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Route_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteStatus, RouteStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteStatus runs a test to see if a specific instance of Route_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteStatus(subject Route_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Route_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 Route_Status instances for property testing - lazily instantiated by RouteStatusGenerator() +var routeStatusGenerator gopter.Gen + +// RouteStatusGenerator returns a generator of Route_Status instances for property testing. +func RouteStatusGenerator() gopter.Gen { + if routeStatusGenerator != nil { + return routeStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteStatus(generators) + routeStatusGenerator = gen.Struct(reflect.TypeOf(Route_Status{}), generators) + + return routeStatusGenerator +} + +// AddIndependentPropertyGeneratorsForRouteStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteStatus(gens map[string]gopter.Gen) { + gens["AddressPrefix"] = gen.PtrOf(gen.AlphaString()) + gens["Etag"] = gen.PtrOf(gen.AlphaString()) + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.AlphaString()) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/microsoft.network/v1alpha1api20201101storage/zz_generated.deepcopy.go b/v2/api/microsoft.network/v1alpha1api20201101storage/zz_generated.deepcopy.go index fd31613eebd..ed23d0e0257 100644 --- a/v2/api/microsoft.network/v1alpha1api20201101storage/zz_generated.deepcopy.go +++ b/v2/api/microsoft.network/v1alpha1api20201101storage/zz_generated.deepcopy.go @@ -3370,6 +3370,155 @@ func (in *ResourceNavigationLink_Status) DeepCopy() *ResourceNavigationLink_Stat return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable) DeepCopyInto(out *RouteTable) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable. +func (in *RouteTable) DeepCopy() *RouteTable { + if in == nil { + return nil + } + out := new(RouteTable) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTable) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTableList) DeepCopyInto(out *RouteTableList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteTable, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTableList. +func (in *RouteTableList) DeepCopy() *RouteTableList { + if in == nil { + return nil + } + out := new(RouteTableList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTableList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTable_Status_RouteTable_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_RouteTable_SubResourceEmbedded) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **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.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.ResourceGuid != nil { + in, out := &in.ResourceGuid, &out.ResourceGuid + *out = new(string) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route_Status_SubResourceEmbedded, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Subnets != nil { + in, out := &in.Subnets, &out.Subnets + *out = make([]Subnet_Status_RouteTable_SubResourceEmbedded, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 RouteTable_Status_RouteTable_SubResourceEmbedded. +func (in *RouteTable_Status_RouteTable_SubResourceEmbedded) DeepCopy() *RouteTable_Status_RouteTable_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(RouteTable_Status_RouteTable_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) { *out = *in @@ -3397,6 +3546,261 @@ func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopy( return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRoute) DeepCopyInto(out *RouteTablesRoute) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTablesRoute. +func (in *RouteTablesRoute) DeepCopy() *RouteTablesRoute { + if in == nil { + return nil + } + out := new(RouteTablesRoute) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTablesRoute) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRouteList) DeepCopyInto(out *RouteTablesRouteList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RouteTablesRoute, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTablesRouteList. +func (in *RouteTablesRouteList) DeepCopy() *RouteTablesRouteList { + if in == nil { + return nil + } + out := new(RouteTablesRouteList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RouteTablesRouteList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteTablesRoutes_Spec) DeepCopyInto(out *RouteTablesRoutes_Spec) { + *out = *in + if in.AddressPrefix != nil { + in, out := &in.AddressPrefix, &out.AddressPrefix + *out = new(string) + **out = **in + } + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } + if in.NextHopType != nil { + in, out := &in.NextHopType, &out.NextHopType + *out = new(string) + **out = **in + } + out.Owner = in.Owner + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.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 RouteTablesRoutes_Spec. +func (in *RouteTablesRoutes_Spec) DeepCopy() *RouteTablesRoutes_Spec { + if in == nil { + return nil + } + out := new(RouteTablesRoutes_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 *RouteTables_Spec) DeepCopyInto(out *RouteTables_Spec) { + *out = *in + if in.DisableBgpRoutePropagation != nil { + in, out := &in.DisableBgpRoutePropagation, &out.DisableBgpRoutePropagation + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + out.Owner = in.Owner + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.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 RouteTables_Spec. +func (in *RouteTables_Spec) DeepCopy() *RouteTables_Spec { + if in == nil { + return nil + } + out := new(RouteTables_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 *Route_Status) DeepCopyInto(out *Route_Status) { + *out = *in + if in.AddressPrefix != nil { + in, out := &in.AddressPrefix, &out.AddressPrefix + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.HasBgpOverride != nil { + in, out := &in.HasBgpOverride, &out.HasBgpOverride + *out = new(bool) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NextHopIpAddress != nil { + in, out := &in.NextHopIpAddress, &out.NextHopIpAddress + *out = new(string) + **out = **in + } + if in.NextHopType != nil { + in, out := &in.NextHopType, &out.NextHopType + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + 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 Route_Status. +func (in *Route_Status) DeepCopy() *Route_Status { + if in == nil { + return nil + } + out := new(Route_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route_Status_SubResourceEmbedded) DeepCopyInto(out *Route_Status_SubResourceEmbedded) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route_Status_SubResourceEmbedded. +func (in *Route_Status_SubResourceEmbedded) DeepCopy() *Route_Status_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(Route_Status_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecurityRule_Status_NetworkSecurityGroup_SubResourceEmbedded) DeepCopyInto(out *SecurityRule_Status_NetworkSecurityGroup_SubResourceEmbedded) { *out = *in @@ -3856,6 +4260,33 @@ func (in *Subnet_Status_PublicIPAddress_SubResourceEmbedded) DeepCopy() *Subnet_ return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subnet_Status_RouteTable_SubResourceEmbedded) DeepCopyInto(out *Subnet_Status_RouteTable_SubResourceEmbedded) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet_Status_RouteTable_SubResourceEmbedded. +func (in *Subnet_Status_RouteTable_SubResourceEmbedded) DeepCopy() *Subnet_Status_RouteTable_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(Subnet_Status_RouteTable_SubResourceEmbedded) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subnet_Status_VirtualNetwork_SubResourceEmbedded) DeepCopyInto(out *Subnet_Status_VirtualNetwork_SubResourceEmbedded) { *out = *in diff --git a/v2/api/microsoft.network/versions_matrix.md b/v2/api/microsoft.network/versions_matrix.md index f3b35812509..179667c1de3 100644 --- a/v2/api/microsoft.network/versions_matrix.md +++ b/v2/api/microsoft.network/versions_matrix.md @@ -131,7 +131,22 @@ | RadiusServer_Status | v1alpha1api20201101 | | ResourceNavigationLinkFormat_Status | v1alpha1api20201101 | | ResourceNavigationLink_Status | v1alpha1api20201101 | +| RouteNextHopType_Status | v1alpha1api20201101 | +| RoutePropertiesFormat | v1alpha1api20201101 | +| RoutePropertiesFormatNextHopType | v1alpha1api20201101 | +| RoutePropertiesFormat_Status | v1alpha1api20201101 | +| RouteTable | v1alpha1api20201101 | +| RouteTablePropertiesFormat_Status | v1alpha1api20201101 | +| RouteTable_Status_RouteTable_SubResourceEmbedded | v1alpha1api20201101 | | RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| RouteTablesRoute | v1alpha1api20201101 | +| RouteTablesRoutesSpecAPIVersion | v1alpha1api20201101 | +| RouteTablesRoutes_Spec | v1alpha1api20201101 | +| RouteTablesSpecAPIVersion | v1alpha1api20201101 | +| RouteTables_Spec | v1alpha1api20201101 | +| RouteTables_Spec_Properties | v1alpha1api20201101 | +| Route_Status | v1alpha1api20201101 | +| Route_Status_SubResourceEmbedded | v1alpha1api20201101 | | SecurityRuleAccess_Status | v1alpha1api20201101 | | SecurityRuleDirection_Status | v1alpha1api20201101 | | SecurityRulePropertiesFormat | v1alpha1api20201101 | @@ -157,6 +172,7 @@ | Subnet_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | | Subnet_Status_NetworkSecurityGroup_SubResourceEmbedded | v1alpha1api20201101 | | Subnet_Status_PublicIPAddress_SubResourceEmbedded | v1alpha1api20201101 | +| Subnet_Status_RouteTable_SubResourceEmbedded | v1alpha1api20201101 | | Subnet_Status_VirtualNetwork_SubResourceEmbedded | v1alpha1api20201101 | | Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | | TransportProtocol_Status | v1alpha1api20201101 | diff --git a/v2/api/resources.md b/v2/api/resources.md index 49de197183a..90af713493a 100644 --- a/v2/api/resources.md +++ b/v2/api/resources.md @@ -72,6 +72,8 @@ v1alpha1api20201101 - NetworkSecurityGroup - NetworkSecurityGroupsSecurityRule - PublicIPAddress +- RouteTable +- RouteTablesRoute - VirtualNetwork - VirtualNetworkGateway - VirtualNetworksSubnet diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 4e002a30a47..2e576cd29b6 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -178,6 +178,16 @@ exportFilters: version: v*api20201101 name: NetworkSecurityGroupsSecurityRule because: "including NSG rules" + - action: include-transitive + group: microsoft.network + version: v*api20201101 + name: RouteTable + because: "including route tables" + - action: include-transitive + group: microsoft.network + version: v*api20201101 + name: RouteTablesRoute + because: "including route table routes" - action: include-transitive group: microsoft.compute version: v*api20200930 diff --git a/v2/config/samples/microsoft.network/v1alpha1api20201101_routetable.yaml b/v2/config/samples/microsoft.network/v1alpha1api20201101_routetable.yaml new file mode 100644 index 00000000000..cfe5fa0ce27 --- /dev/null +++ b/v2/config/samples/microsoft.network/v1alpha1api20201101_routetable.yaml @@ -0,0 +1,10 @@ +apiVersion: microsoft.network.azure.com/v1alpha1api20201101 +kind: RouteTable +metadata: + name: sampleroutetable + namespace: default +spec: + location: westcentralus + owner: + name: aso-sample-rg + disableBgpRoutePropagation: true diff --git a/v2/config/samples/microsoft.network/v1alpha1api20201101_routetablesroute.yaml b/v2/config/samples/microsoft.network/v1alpha1api20201101_routetablesroute.yaml new file mode 100644 index 00000000000..17f85bb07f7 --- /dev/null +++ b/v2/config/samples/microsoft.network/v1alpha1api20201101_routetablesroute.yaml @@ -0,0 +1,11 @@ +apiVersion: microsoft.network.azure.com/v1alpha1api20201101 +kind: RouteTablesRoute +metadata: + name: sampleroute + namespace: default +spec: + owner: + name: sampleroutetable + addressPrefix: cab:cab::/96 + nextHopType: VirtualAppliance + nextHopIpAddress: ace:cab:deca:f00d::1 diff --git a/v2/internal/controllers/crd_networking_routetable_test.go b/v2/internal/controllers/crd_networking_routetable_test.go new file mode 100644 index 00000000000..bdbd5e11b74 --- /dev/null +++ b/v2/internal/controllers/crd_networking_routetable_test.go @@ -0,0 +1,105 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +package controllers_test + +import ( + "context" + "testing" + + "github.com/Azure/go-autorest/autorest/to" + . "github.com/onsi/gomega" + "sigs.k8s.io/controller-runtime/pkg/client" + + network "github.com/Azure/azure-service-operator/v2/api/microsoft.network/v1alpha1api20201101" + "github.com/Azure/azure-service-operator/v2/internal/testcommon" +) + +func Test_Networking_RouteTable_CRUD(t *testing.T) { + t.Parallel() + + g := NewGomegaWithT(t) + ctx := context.Background() + tc := globalTestContext.ForTest(t) + + rg := tc.CreateTestResourceGroupAndWait() + + routeTable := &network.RouteTable{ + ObjectMeta: tc.MakeObjectMeta("routetable"), + Spec: network.RouteTables_Spec{ + Location: tc.AzureRegion, + Owner: testcommon.AsOwner(rg), + }, + } + + tc.CreateResourceAndWait(routeTable) + + // It should be created in Kubernetes + g.Expect(routeTable.Status.Id).ToNot(BeNil()) + armId := *routeTable.Status.Id + + tc.RunParallelSubtests( + testcommon.Subtest{ + Name: "Routes CRUD", + Test: func(testContext *testcommon.KubePerTestContext) { + Routes_CRUD(testContext, routeTable) + }, + }, + ) + + tc.DeleteResourceAndWait(routeTable) + + // Ensure that the resource was really deleted in Azure + exists, retryAfter, err := tc.AzureClient.HeadByID(ctx, armId, string(network.RouteTablesSpecAPIVersion20201101)) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(retryAfter).To(BeZero()) + g.Expect(exists).To(BeFalse()) +} + +func Routes_CRUD(tc *testcommon.KubePerTestContext, routeTable *network.RouteTable) { + ipv6Route := &network.RouteTablesRoute{ + ObjectMeta: tc.MakeObjectMeta("ipv6route"), + Spec: network.RouteTablesRoutes_Spec{ + Owner: testcommon.AsOwner(routeTable), + AddressPrefix: "cab:cab::/96", + NextHopType: network.RoutePropertiesFormatNextHopTypeVirtualAppliance, + NextHopIpAddress: to.StringPtr("ace:cab:deca:f00d::1"), + }, + } + + ipv4Route := &network.RouteTablesRoute{ + ObjectMeta: tc.MakeObjectMeta("ipv4route"), + Spec: network.RouteTablesRoutes_Spec{ + Owner: testcommon.AsOwner(routeTable), + AddressPrefix: "Storage", + NextHopType: network.RoutePropertiesFormatNextHopTypeVirtualAppliance, + NextHopIpAddress: to.StringPtr("10.0.100.4"), + }, + } + + tc.CreateResourcesAndWait(ipv4Route, ipv6Route) + defer tc.DeleteResourcesAndWait(ipv4Route, ipv6Route) + + tc.Expect(ipv4Route.Status.Id).ToNot(BeNil()) + tc.Expect(ipv4Route.Status.AddressPrefix).ToNot(BeNil()) + tc.Expect(*ipv4Route.Status.AddressPrefix).To(Equal("Storage")) + tc.Expect(ipv6Route.Status.Id).ToNot(BeNil()) + tc.Expect(ipv6Route.Status.AddressPrefix).ToNot(BeNil()) + tc.Expect(*ipv6Route.Status.AddressPrefix).To(Equal("cab:cab::/96")) + + // Update the subnet + old := ipv4Route.DeepCopy() + ipv4Route.Spec.NextHopIpAddress = to.StringPtr("10.0.100.5") + tc.Patch(old, ipv4Route) + + objectKey := client.ObjectKeyFromObject(ipv4Route) + + // ensure state got updated in Azure + tc.Eventually(func() *string { + updated := &network.RouteTablesRoute{} + tc.GetResource(objectKey, updated) + return updated.Status.NextHopIpAddress + }).Should(Equal(to.StringPtr("10.0.100.5"))) +} diff --git a/v2/internal/controllers/recordings/Test_Networking_RouteTable_CRUD.yaml b/v2/internal/controllers/recordings/Test_Networking_RouteTable_CRUD.yaml new file mode 100644 index 00000000000..a6485c9a59b --- /dev/null +++ b/v2/internal/controllers/recordings/Test_Networking_RouteTable_CRUD.yaml @@ -0,0 +1,1341 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"asotest-rg-wuysaf","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "93" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:15 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: PUT + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:16 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"location":"westus2","name":"asotest-routetable-ttechn","properties":{}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "73" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:20 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-routetable-ttechn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn\",\r\n + \ \"etag\": \"W/\\\"e63ec009-b4d8-45ef-9dac-079db621ef50\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"cebb128b-5b17-4a5c-8506-1d7eaaef0660\",\r\n + \ \"disableBgpRoutePropagation\": false,\r\n \"routes\": []\r\n }\r\n}" + headers: + Azure-Asyncnotification: + - Enabled + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/8b2a58eb-d411-4d76-b48b-686fcce46bb1?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:20 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/8b2a58eb-d411-4d76-b48b-686fcce46bb1?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:20 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-routetable-ttechn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn\",\r\n + \ \"etag\": \"W/\\\"215a0fcc-8398-4780-a104-20a86e3b2aef\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"cebb128b-5b17-4a5c-8506-1d7eaaef0660\",\r\n + \ \"disableBgpRoutePropagation\": false,\r\n \"routes\": []\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Etag: + - W/"215a0fcc-8398-4780-a104-20a86e3b2aef" + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"name":"asotest-ipv4route-dlvvam","properties":{"addressPrefix":"Storage","nextHopIpAddress":"10.0.100.4","nextHopType":"VirtualAppliance"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "141" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ipv4route-dlvvam\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam\",\r\n + \ \"etag\": \"W/\\\"b3d069c4-9929-43ff-97a4-a8645160e09e\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"Storage\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"10.0.100.4\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/ea5c95af-6491-4907-9494-5a5bf9feed2b?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "549" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: '{"name":"asotest-ipv6route-ovwahm","properties":{"addressPrefix":"cab:cab::/96","nextHopIpAddress":"ace:cab:deca:f00d::1","nextHopType":"VirtualAppliance"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "156" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ipv6route-ovwahm\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm\",\r\n + \ \"etag\": \"W/\\\"b88ea4a2-ea78-4c94-b6ef-666d53d7bdbb\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"cab:cab::/96\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"ace:cab:deca:f00d::1\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/32a243ba-c8ae-4a45-866f-17e3453ae3a0?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "564" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/ea5c95af-6491-4907-9494-5a5bf9feed2b?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/32a243ba-c8ae-4a45-866f-17e3453ae3a0?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ipv4route-dlvvam\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam\",\r\n + \ \"etag\": \"W/\\\"b2dd7d0a-8341-488f-80da-ed14dd2110a6\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"Storage\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"10.0.100.4\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Etag: + - W/"b2dd7d0a-8341-488f-80da-ed14dd2110a6" + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:25 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ipv6route-ovwahm\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm\",\r\n + \ \"etag\": \"W/\\\"b2dd7d0a-8341-488f-80da-ed14dd2110a6\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"cab:cab::/96\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"ace:cab:deca:f00d::1\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Etag: + - W/"b2dd7d0a-8341-488f-80da-ed14dd2110a6" + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"name":"asotest-ipv4route-dlvvam","properties":{"addressPrefix":"Storage","nextHopIpAddress":"10.0.100.5","nextHopType":"VirtualAppliance"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "141" + Content-Type: + - application/json + Test-Request-Attempt: + - "1" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:30 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ipv4route-dlvvam\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam\",\r\n + \ \"etag\": \"W/\\\"21443b13-11ed-46bb-b833-8220c4cd902a\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"Storage\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"10.0.100.5\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/689f568b-d3b6-4fc6-a45f-80fb173b0772?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:30 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/689f568b-d3b6-4fc6-a45f-80fb173b0772?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"status\": \"Succeeded\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:30 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ipv4route-dlvvam\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam\",\r\n + \ \"etag\": \"W/\\\"0d9c0a7d-b359-4179-8c87-fa5b3424239a\\\"\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"Storage\",\r\n + \ \"nextHopType\": \"VirtualAppliance\",\r\n \"nextHopIpAddress\": \"10.0.100.5\",\r\n + \ \"hasBgpOverride\": false\r\n },\r\n \"type\": \"Microsoft.Network/routeTables/routes\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Etag: + - W/"0d9c0a7d-b359-4179-8c87-fa5b3424239a" + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:35 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: DELETE + response: + body: "" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/8832140a-a3a4-4af1-97ad-cc0b67c294c1?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operationResults/8832140a-a3a4-4af1-97ad-cc0b67c294c1?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:35 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm?api-version=2020-11-01 + method: DELETE + response: + body: "" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/3dab61df-6ba5-40b0-a19e-f11815d7fea0?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operationResults/3dab61df-6ba5-40b0-a19e-f11815d7fea0?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:45 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv4route-dlvvam + not found.\",\r\n \"details\": []\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "289" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:45 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn/routes/asotest-ipv6route-ovwahm + not found.\",\r\n \"details\": []\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "289" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:00:50 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn?api-version=2020-11-01 + method: DELETE + response: + body: "" + headers: + Azure-Asyncnotification: + - Enabled + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/53761d77-2268-452b-9024-4706a5ff2e77?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operationResults/53761d77-2268-452b-9024-4706a5ff2e77?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "10" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:01 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn + not found.\",\r\n \"details\": []\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "257" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:05 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf/providers/Microsoft.Network/routeTables/asotest-routetable-ttechn + not found.\",\r\n \"details\": []\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "257" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:05 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1BU09URVNUOjJEUkc6MkRXVVlTQUYtV0VTVFVTMiIsImpvYkxvY2F0aW9uIjoid2VzdHVzMiJ9?api-version=2020-06-01 + Pragma: + - no-cache + Retry-After: + - "15" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "3" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "4" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "5" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "6" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "7" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:21 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "8" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:22 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "9" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:22 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "10" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:24 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "11" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:26 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "12" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:31 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "13" + X-Ms-Date: + - Mon, 25 Oct 2021 22:01:42 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "14" + X-Ms-Date: + - Mon, 25 Oct 2021 22:02:02 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf","name":"asotest-rg-wuysaf","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "15" + X-Ms-Date: + - Mon, 25 Oct 2021 22:02:43 GMT + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-wuysaf?api-version=2020-06-01 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-wuysaf'' + could not be found."}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "109" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Failure-Cause: + - gateway + status: 404 Not Found + code: 404 + duration: ""