diff --git a/v2/api/microsoft.network/versions_matrix.md b/v2/api/microsoft.network/versions_matrix.md new file mode 100644 index 00000000000..179667c1de3 --- /dev/null +++ b/v2/api/microsoft.network/versions_matrix.md @@ -0,0 +1,240 @@ +| Types defined in microsoft.network | v1alpha1api20201101 | +|--------------------------------------------------------------------------------------------|---------------------| +| AddressSpace | v1alpha1api20201101 | +| AddressSpace_Status | v1alpha1api20201101 | +| ApplicationGatewayIPConfigurationPropertiesFormat_Status | v1alpha1api20201101 | +| ApplicationGatewayIPConfiguration_Status | v1alpha1api20201101 | +| ApplicationSecurityGroup_Status_NetworkSecurityGroupsSecurityRule_SubResourceEmbedded | v1alpha1api20201101 | +| BackendAddressPool_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | +| BgpSettings | v1alpha1api20201101 | +| BgpSettings_Status | v1alpha1api20201101 | +| DdosSettings | v1alpha1api20201101 | +| DdosSettingsProtectionCoverage | v1alpha1api20201101 | +| DdosSettingsStatusProtectionCoverage | v1alpha1api20201101 | +| DdosSettings_Status | v1alpha1api20201101 | +| Delegation_Status | v1alpha1api20201101 | +| DhGroup_Status | v1alpha1api20201101 | +| DhcpOptions | v1alpha1api20201101 | +| DhcpOptions_Status | v1alpha1api20201101 | +| ExtendedLocation | v1alpha1api20201101 | +| ExtendedLocationType | v1alpha1api20201101 | +| ExtendedLocationType_Status | v1alpha1api20201101 | +| ExtendedLocation_Status | v1alpha1api20201101 | +| FlowLog_Status_SubResourceEmbedded | v1alpha1api20201101 | +| FrontendIPConfigurationPropertiesFormat | v1alpha1api20201101 | +| FrontendIPConfigurationPropertiesFormatPrivateIPAddressVersion | v1alpha1api20201101 | +| FrontendIPConfigurationPropertiesFormatPrivateIPAllocationMethod | v1alpha1api20201101 | +| FrontendIPConfigurationPropertiesFormat_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | +| FrontendIPConfiguration_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | +| IPAllocationMethod_Status | v1alpha1api20201101 | +| IPConfigurationBgpPeeringAddress | v1alpha1api20201101 | +| IPConfigurationBgpPeeringAddress_Status | v1alpha1api20201101 | +| IPConfigurationProfilePropertiesFormat_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| IPConfigurationProfile_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| IPConfigurationPropertiesFormat_Status_PublicIPAddress_SubResourceEmbedded | v1alpha1api20201101 | +| IPConfigurationPropertiesFormat_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| IPConfiguration_Status_PublicIPAddress_SubResourceEmbedded | v1alpha1api20201101 | +| IPConfiguration_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| IPVersion_Status | v1alpha1api20201101 | +| IkeEncryption_Status | v1alpha1api20201101 | +| IkeIntegrity_Status | v1alpha1api20201101 | +| InboundNatPoolPropertiesFormat | v1alpha1api20201101 | +| InboundNatPoolPropertiesFormatProtocol | v1alpha1api20201101 | +| InboundNatPoolPropertiesFormat_Status | v1alpha1api20201101 | +| InboundNatPool_Status | v1alpha1api20201101 | +| InboundNatRule_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | +| IpTag | v1alpha1api20201101 | +| IpTag_Status | v1alpha1api20201101 | +| IpsecEncryption_Status | v1alpha1api20201101 | +| IpsecIntegrity_Status | v1alpha1api20201101 | +| IpsecPolicy | v1alpha1api20201101 | +| IpsecPolicyDhGroup | v1alpha1api20201101 | +| IpsecPolicyIkeEncryption | v1alpha1api20201101 | +| IpsecPolicyIkeIntegrity | v1alpha1api20201101 | +| IpsecPolicyIpsecEncryption | v1alpha1api20201101 | +| IpsecPolicyIpsecIntegrity | v1alpha1api20201101 | +| IpsecPolicyPfsGroup | v1alpha1api20201101 | +| IpsecPolicy_Status | v1alpha1api20201101 | +| LoadBalancer | v1alpha1api20201101 | +| LoadBalancerBackendAddressPropertiesFormat | v1alpha1api20201101 | +| LoadBalancerPropertiesFormat_Status | v1alpha1api20201101 | +| LoadBalancerSku | v1alpha1api20201101 | +| LoadBalancerSkuName | v1alpha1api20201101 | +| LoadBalancerSkuStatusName | v1alpha1api20201101 | +| LoadBalancerSkuStatusTier | v1alpha1api20201101 | +| LoadBalancerSkuTier | v1alpha1api20201101 | +| LoadBalancerSku_Status | v1alpha1api20201101 | +| LoadBalancer_Status | v1alpha1api20201101 | +| LoadBalancersSpecAPIVersion | v1alpha1api20201101 | +| LoadBalancers_Spec | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_BackendAddressPools | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_BackendAddressPools_Properties | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_BackendAddressPools_Properties_LoadBalancerBackendAddresses | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_FrontendIPConfigurations | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_InboundNatPools | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_LoadBalancingRules | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_OutboundRules | v1alpha1api20201101 | +| LoadBalancers_Spec_Properties_Probes | v1alpha1api20201101 | +| LoadBalancingRulePropertiesFormat | v1alpha1api20201101 | +| LoadBalancingRulePropertiesFormatLoadDistribution | v1alpha1api20201101 | +| LoadBalancingRulePropertiesFormatProtocol | v1alpha1api20201101 | +| LoadBalancingRulePropertiesFormatStatusLoadDistribution | v1alpha1api20201101 | +| LoadBalancingRulePropertiesFormat_Status | v1alpha1api20201101 | +| LoadBalancingRule_Status | v1alpha1api20201101 | +| NatGatewaySkuStatusName | v1alpha1api20201101 | +| NatGatewaySku_Status | v1alpha1api20201101 | +| NatGateway_Status_PublicIPAddress_SubResourceEmbedded | v1alpha1api20201101 | +| NetworkInterface_Status_NetworkSecurityGroup_SubResourceEmbedded | v1alpha1api20201101 | +| NetworkSecurityGroup | v1alpha1api20201101 | +| NetworkSecurityGroupPropertiesFormat_Status | v1alpha1api20201101 | +| NetworkSecurityGroup_Status_NetworkSecurityGroup_SubResourceEmbedded | v1alpha1api20201101 | +| NetworkSecurityGroup_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| NetworkSecurityGroupsSecurityRule | v1alpha1api20201101 | +| NetworkSecurityGroupsSecurityRulesSpecAPIVersion | v1alpha1api20201101 | +| NetworkSecurityGroupsSecurityRules_Spec | v1alpha1api20201101 | +| NetworkSecurityGroupsSpecAPIVersion | v1alpha1api20201101 | +| NetworkSecurityGroups_Spec | v1alpha1api20201101 | +| OutboundRulePropertiesFormat | v1alpha1api20201101 | +| OutboundRulePropertiesFormatProtocol | v1alpha1api20201101 | +| OutboundRulePropertiesFormatStatusProtocol | v1alpha1api20201101 | +| OutboundRulePropertiesFormat_Status | v1alpha1api20201101 | +| OutboundRule_Status | v1alpha1api20201101 | +| PfsGroup_Status | v1alpha1api20201101 | +| PrivateEndpoint_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| ProbePropertiesFormat | v1alpha1api20201101 | +| ProbePropertiesFormatProtocol | v1alpha1api20201101 | +| ProbePropertiesFormatStatusProtocol | v1alpha1api20201101 | +| ProbePropertiesFormat_Status | v1alpha1api20201101 | +| Probe_Status | v1alpha1api20201101 | +| ProvisioningState_Status | v1alpha1api20201101 | +| PublicIPAddress | v1alpha1api20201101 | +| PublicIPAddressDnsSettings | v1alpha1api20201101 | +| PublicIPAddressDnsSettings_Status | v1alpha1api20201101 | +| PublicIPAddressPropertiesFormat | v1alpha1api20201101 | +| PublicIPAddressPropertiesFormatPublicIPAddressVersion | v1alpha1api20201101 | +| PublicIPAddressPropertiesFormatPublicIPAllocationMethod | v1alpha1api20201101 | +| PublicIPAddressPropertiesFormatStatusMigrationPhase | v1alpha1api20201101 | +| PublicIPAddressPropertiesFormat_Status | v1alpha1api20201101 | +| PublicIPAddressSku | v1alpha1api20201101 | +| PublicIPAddressSkuName | v1alpha1api20201101 | +| PublicIPAddressSkuStatusName | v1alpha1api20201101 | +| PublicIPAddressSkuStatusTier | v1alpha1api20201101 | +| PublicIPAddressSkuTier | v1alpha1api20201101 | +| PublicIPAddressSku_Status | v1alpha1api20201101 | +| PublicIPAddress_Status_LoadBalancer_SubResourceEmbedded | v1alpha1api20201101 | +| PublicIPAddress_Status_PublicIPAddress_SubResourceEmbedded | v1alpha1api20201101 | +| PublicIPAddress_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| PublicIPAddressesSpecAPIVersion | v1alpha1api20201101 | +| PublicIPAddresses_Spec | v1alpha1api20201101 | +| RadiusServer | v1alpha1api20201101 | +| 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 | +| SecurityRulePropertiesFormatAccess | v1alpha1api20201101 | +| SecurityRulePropertiesFormatDirection | v1alpha1api20201101 | +| SecurityRulePropertiesFormatProtocol | v1alpha1api20201101 | +| SecurityRulePropertiesFormatStatusProtocol | v1alpha1api20201101 | +| SecurityRulePropertiesFormat_Status | v1alpha1api20201101 | +| SecurityRule_Status_NetworkSecurityGroup_SubResourceEmbedded | v1alpha1api20201101 | +| SecurityRule_Status_NetworkSecurityGroupsSecurityRule_SubResourceEmbedded | v1alpha1api20201101 | +| ServiceAssociationLinkPropertiesFormat_Status | v1alpha1api20201101 | +| ServiceAssociationLink_Status | v1alpha1api20201101 | +| ServiceDelegationPropertiesFormat | v1alpha1api20201101 | +| ServiceDelegationPropertiesFormat_Status | v1alpha1api20201101 | +| ServiceEndpointPolicy_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | +| ServiceEndpointPropertiesFormat | v1alpha1api20201101 | +| ServiceEndpointPropertiesFormat_Status | v1alpha1api20201101 | +| SubResource | v1alpha1api20201101 | +| SubResource_Status | v1alpha1api20201101 | +| SubnetPropertiesFormatStatusPrivateEndpointNetworkPolicies | v1alpha1api20201101 | +| SubnetPropertiesFormatStatusPrivateLinkServiceNetworkPolicies | v1alpha1api20201101 | +| SubnetPropertiesFormat_Status | v1alpha1api20201101 | +| 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 | +| VirtualNetwork | v1alpha1api20201101 | +| VirtualNetworkBgpCommunities | v1alpha1api20201101 | +| VirtualNetworkBgpCommunities_Status | v1alpha1api20201101 | +| VirtualNetworkGateway | v1alpha1api20201101 | +| VirtualNetworkGatewayIPConfigurationPropertiesFormat | v1alpha1api20201101 | +| VirtualNetworkGatewayIPConfigurationPropertiesFormatPrivateIPAllocationMethod | v1alpha1api20201101 | +| VirtualNetworkGatewayIPConfigurationPropertiesFormat_Status | v1alpha1api20201101 | +| VirtualNetworkGatewayIPConfiguration_Status | v1alpha1api20201101 | +| VirtualNetworkGatewayPropertiesFormatStatusGatewayType | v1alpha1api20201101 | +| VirtualNetworkGatewayPropertiesFormatStatusVpnGatewayGeneration | v1alpha1api20201101 | +| VirtualNetworkGatewayPropertiesFormatStatusVpnType | v1alpha1api20201101 | +| VirtualNetworkGatewayPropertiesFormat_Status | v1alpha1api20201101 | +| VirtualNetworkGatewaySku | v1alpha1api20201101 | +| VirtualNetworkGatewaySkuName | v1alpha1api20201101 | +| VirtualNetworkGatewaySkuStatusName | v1alpha1api20201101 | +| VirtualNetworkGatewaySkuStatusTier | v1alpha1api20201101 | +| VirtualNetworkGatewaySkuTier | v1alpha1api20201101 | +| VirtualNetworkGatewaySku_Status | v1alpha1api20201101 | +| VirtualNetworkGateway_Status | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecAPIVersion | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecPropertiesGatewayType | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecPropertiesVpnClientConfigurationVpnAuthenticationTypes | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecPropertiesVpnClientConfigurationVpnClientProtocols | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecPropertiesVpnGatewayGeneration | v1alpha1api20201101 | +| VirtualNetworkGatewaysSpecPropertiesVpnType | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec_Properties | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec_Properties_IpConfigurations | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec_Properties_VpnClientConfiguration | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec_Properties_VpnClientConfiguration_VpnClientRevokedCertificates | v1alpha1api20201101 | +| VirtualNetworkGateways_Spec_Properties_VpnClientConfiguration_VpnClientRootCertificates | v1alpha1api20201101 | +| VirtualNetworkPeeringPropertiesFormat | v1alpha1api20201101 | +| VirtualNetworkPeeringPropertiesFormatPeeringState | v1alpha1api20201101 | +| VirtualNetworkPeeringPropertiesFormatStatusPeeringState | v1alpha1api20201101 | +| VirtualNetworkPeeringPropertiesFormat_Status | v1alpha1api20201101 | +| VirtualNetworkPeering_Status | v1alpha1api20201101 | +| VirtualNetworkPeering_Status_SubResourceEmbedded | v1alpha1api20201101 | +| VirtualNetworkPropertiesFormat_Status | v1alpha1api20201101 | +| VirtualNetwork_Status | v1alpha1api20201101 | +| VirtualNetworksSpecAPIVersion | v1alpha1api20201101 | +| VirtualNetworksSubnet | v1alpha1api20201101 | +| VirtualNetworksSubnetsSpecAPIVersion | v1alpha1api20201101 | +| VirtualNetworksSubnets_Spec | v1alpha1api20201101 | +| VirtualNetworksSubnets_Spec_Properties | v1alpha1api20201101 | +| VirtualNetworksSubnets_Spec_Properties_Delegations | v1alpha1api20201101 | +| VirtualNetworksVirtualNetworkPeering | v1alpha1api20201101 | +| VirtualNetworksVirtualNetworkPeeringsSpecAPIVersion | v1alpha1api20201101 | +| VirtualNetworksVirtualNetworkPeerings_Spec | v1alpha1api20201101 | +| VirtualNetworks_Spec | v1alpha1api20201101 | +| VirtualNetworks_Spec_Properties | v1alpha1api20201101 | +| VirtualNetworks_Spec_Properties_Subnets | v1alpha1api20201101 | +| VirtualNetworks_Spec_Properties_Subnets_Properties | v1alpha1api20201101 | +| VirtualNetworks_Spec_Properties_Subnets_Properties_Delegations | v1alpha1api20201101 | +| VpnClientConfigurationStatusVpnAuthenticationTypes | v1alpha1api20201101 | +| VpnClientConfigurationStatusVpnClientProtocols | v1alpha1api20201101 | +| VpnClientConfiguration_Status | v1alpha1api20201101 | +| VpnClientRevokedCertificatePropertiesFormat | v1alpha1api20201101 | +| VpnClientRevokedCertificatePropertiesFormat_Status | v1alpha1api20201101 | +| VpnClientRevokedCertificate_Status | v1alpha1api20201101 | +| VpnClientRootCertificatePropertiesFormat | v1alpha1api20201101 | +| VpnClientRootCertificatePropertiesFormat_Status | v1alpha1api20201101 | +| VpnClientRootCertificate_Status | v1alpha1api20201101 | diff --git a/v2/api/network/customizations/route_table_extension_types_gen.go b/v2/api/network/customizations/route_table_extension_types_gen.go new file mode 100644 index 00000000000..47565f6ca8c --- /dev/null +++ b/v2/api/network/customizations/route_table_extension_types_gen.go @@ -0,0 +1,20 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package customizations + +import ( + v20201101 "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" +) + +type RouteTableExtension struct { +} + +// GetExtendedResources Returns the KubernetesResource slice for Resource versions +func (extension *RouteTableExtension) GetExtendedResources() []genruntime.KubernetesResource { + return []genruntime.KubernetesResource{ + &v20201101.RouteTable{}, + &v20201101s.RouteTable{}} +} diff --git a/v2/api/network/customizations/route_table_extensions.go b/v2/api/network/customizations/route_table_extensions.go new file mode 100644 index 00000000000..ca1c87f45bd --- /dev/null +++ b/v2/api/network/customizations/route_table_extensions.go @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package customizations + +import ( + "context" + "encoding/json" + "reflect" + + "github.com/go-logr/logr" + "github.com/pkg/errors" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/conversion" + + network "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + . "github.com/Azure/azure-service-operator/v2/internal/logging" + "github.com/Azure/azure-service-operator/v2/internal/resolver" + "github.com/Azure/azure-service-operator/v2/internal/util/kubeclient" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/extensions" +) + +// Attention: A lot of code in this file is very similar to the logic in virtual_network_extensions.go. +// The two should be kept in sync as much as possible. + +var _ extensions.ARMResourceModifier = &RouteTableExtension{} + +func (extension *RouteTableExtension) ModifyARMResource( + ctx context.Context, + armObj genruntime.ARMResource, + obj genruntime.ARMMetaObject, + kubeClient kubeclient.Client, + resolver *resolver.Resolver, + log logr.Logger) (genruntime.ARMResource, error) { + + typedObj, ok := obj.(*network.RouteTable) + if !ok { + return nil, errors.Errorf("cannot run on unknown resource type %T", obj) + } + + // Type assert that we are the hub type. This should fail to compile if + // the hub type has been changed but this extension has not been updated to match + var _ conversion.Hub = typedObj + + routeGVK := getRouteGVK(obj) + + routes := &network.RouteTablesRouteList{} + matchingFields := client.MatchingFields{".metadata.ownerReferences[0]": string(obj.GetUID())} // TODO: Need to add this index + err := kubeClient.List(ctx, routes, matchingFields) + if err != nil { + return nil, errors.Wrapf(err, "failed listing routes owned by RouteTable %s/%s", obj.GetNamespace(), obj.GetName()) + } + + var armRoutes []genruntime.ARMResourceSpec + for _, route := range routes.Items { + route := route + + var transformed genruntime.ARMResourceSpec + transformed, err = transformToARM(ctx, &route, routeGVK, kubeClient, resolver) + if err != nil { + return nil, errors.Wrapf(err, "failed to transform route %s/%s", route.GetNamespace(), route.GetName()) + } + armRoutes = append(armRoutes, transformed) + } + + log.V(Info).Info("Found routes to include on RouteTable", "count", len(armRoutes), "names", genruntime.ARMSpecNames(armRoutes)) + + err = fuzzySetRoutes(armObj.Spec(), armRoutes) + if err != nil { + return nil, errors.Wrapf(err, "failed to set routes") + } + + return armObj, nil +} + +func getRouteGVK(routeTable genruntime.ARMMetaObject) schema.GroupVersionKind { + gvk := genruntime.GetOriginalGVK(routeTable) + gvk.Kind = reflect.TypeOf(network.RouteTablesRoute{}).Name() // "RouteTableRoute" + + return gvk +} + +// TODO: When we move to Swagger as the source of truth, the type for routetable.properties.routes and routtableroutes.properties +// TODO: may be the same, so we can do away with the JSON serialization part of this assignment. +// fuzzySetRoutes assigns a collection of routes to the routes property of the route table. Since there are +// many possible ARM API versions and we don't know which one we're using, we cannot do this statically. +// To make matters even more horrible, the type used in the routetable.properties.routes is not the same +// type as used for routes.properties (although structurally they are basically the same). To overcome this +// we JSON serialize the route and deserialize it into the routetableroutes.properties.routes field. +func fuzzySetRoutes(routeTable genruntime.ARMResourceSpec, routes []genruntime.ARMResourceSpec) (err error) { + if len(routes) == 0 { + // Nothing to do + return nil + } + + defer func() { + if x := recover(); x != nil { + err = errors.Errorf("caught panic: %s", x) + } + }() + + // Here be dragons + routeTableValue := reflect.ValueOf(routeTable) + routeTableValue = reflect.Indirect(routeTableValue) + + if (routeTableValue == reflect.Value{}) { + return errors.Errorf("cannot assign to nil route table") + } + + propertiesField := routeTableValue.FieldByName("Properties") + if (propertiesField == reflect.Value{}) { + return errors.Errorf("couldn't find properties field on route table") + } + + propertiesValue := reflect.Indirect(propertiesField) + if (propertiesValue == reflect.Value{}) { + // If the properties field is nil, we must construct an entirely new properties and assign it here + temp := reflect.New(propertiesField.Type().Elem()) + propertiesField.Set(temp) + propertiesValue = reflect.Indirect(temp) + } + + routesField := propertiesValue.FieldByName("Routes") + if (routesField == reflect.Value{}) { + return errors.Errorf("couldn't find routes field on route table") + } + + if routesField.Type().Kind() != reflect.Slice { + return errors.Errorf("routes field on route table was not of kind Slice") + } + + elemType := routesField.Type().Elem() + routesSlice := reflect.MakeSlice(routesField.Type(), 0, 0) + + for _, route := range routes { + embeddedRoute := reflect.New(elemType) + err = fuzzySetRoute(route, embeddedRoute) + if err != nil { + return err + } + + routesSlice = reflect.Append(routesSlice, reflect.Indirect(embeddedRoute)) + } + + // Now do the assignment + routesField.Set(routesSlice) + + return err +} + +func fuzzySetRoute(route genruntime.ARMResourceSpec, embeddedRoute reflect.Value) error { + routeJSON, err := json.Marshal(route) + if err != nil { + return errors.Wrapf(err, "failed to marshal route json") + } + + err = json.Unmarshal(routeJSON, embeddedRoute.Interface()) + if err != nil { + return errors.Wrapf(err, "failed to unmarshal route JSON") + } + + // Safety check that these are actually the same: + // We can't use reflect.DeepEqual because the types are not the same. + embeddedRouteJSON, err := json.Marshal(embeddedRoute.Interface()) + if err != nil { + return errors.Wrap(err, "unable to check that embedded route is the same as route") + } + if string(embeddedRouteJSON) != string(routeJSON) { + return errors.Errorf("embeddedRouteJSON (%s) != routeJSON (%s)", string(embeddedRouteJSON), string(routeJSON)) + } + + return nil +} diff --git a/v2/api/network/customizations/route_tables_route_extension_types_gen.go b/v2/api/network/customizations/route_tables_route_extension_types_gen.go new file mode 100644 index 00000000000..454004d1961 --- /dev/null +++ b/v2/api/network/customizations/route_tables_route_extension_types_gen.go @@ -0,0 +1,20 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package customizations + +import ( + v20201101 "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" +) + +type RouteTablesRouteExtension struct { +} + +// GetExtendedResources Returns the KubernetesResource slice for Resource versions +func (extension *RouteTablesRouteExtension) GetExtendedResources() []genruntime.KubernetesResource { + return []genruntime.KubernetesResource{ + &v20201101.RouteTablesRoute{}, + &v20201101s.RouteTablesRoute{}} +} diff --git a/v2/api/network/customizations/virtual_network_extensions.go b/v2/api/network/customizations/virtual_network_extensions.go index a5b804ece16..91030c0e780 100644 --- a/v2/api/network/customizations/virtual_network_extensions.go +++ b/v2/api/network/customizations/virtual_network_extensions.go @@ -22,6 +22,9 @@ import ( "github.com/Azure/azure-service-operator/v2/pkg/genruntime/extensions" ) +// Attention: A lot of code in this file is very similar to the logic in route_table_extensions.go. +// The two should be kept in sync as much as possible. + var _ extensions.ARMResourceModifier = &VirtualNetworkExtension{} func (extension *VirtualNetworkExtension) ModifyARMResource( @@ -62,7 +65,7 @@ func (extension *VirtualNetworkExtension) ModifyARMResource( armSubnets = append(armSubnets, transformed) } - log.V(Info).Info("Found subnets to include on VNET", "count", len(armSubnets), "names", getSubnetNames(armSubnets)) + log.V(Info).Info("Found subnets to include on VNET", "count", len(armSubnets), "names", genruntime.ARMSpecNames(armSubnets)) err = fuzzySetSubnets(armObj.Spec(), armSubnets) if err != nil { @@ -72,15 +75,6 @@ func (extension *VirtualNetworkExtension) ModifyARMResource( return armObj, nil } -func getSubnetNames(subnets []genruntime.ARMResourceSpec) []string { - var result []string - for _, s := range subnets { - result = append(result, s.GetName()) - } - - return result -} - func getSubnetGVK(vnet genruntime.ARMMetaObject) schema.GroupVersionKind { gvk := genruntime.GetOriginalGVK(vnet) gvk.Kind = reflect.TypeOf(network.VirtualNetworksSubnet{}).Name() // "VirtualNetworksSubnet" @@ -115,12 +109,12 @@ func transformToARM( return nil, errors.Wrapf(err, "transforming resource %s to ARM", obj.GetName()) } - typedArmSpec, ok := armSpec.(genruntime.ARMResourceSpec) + typedARMSpec, ok := armSpec.(genruntime.ARMResourceSpec) if !ok { return nil, errors.Errorf("casting armSpec of type %T to genruntime.ARMResourceSpec", armSpec) } - return typedArmSpec, nil + return typedARMSpec, nil } // TODO: When we move to Swagger as the source of truth, the type for vnet.properties.subnets and subnet.properties @@ -130,7 +124,18 @@ func transformToARM( // To make matters even more horrible, the type used in the vnet.properties.subnets property is not the same // type as used for subnet.properties (although structurally they are basically the same). To overcome this // we JSON serialize the subnet and deserialize it into the vnet.properties.subnets field. -func fuzzySetSubnets(vnet genruntime.ARMResourceSpec, subnets []genruntime.ARMResourceSpec) error { +func fuzzySetSubnets(vnet genruntime.ARMResourceSpec, subnets []genruntime.ARMResourceSpec) (err error) { + if len(subnets) == 0 { + // Nothing to do + return nil + } + + defer func() { + if x := recover(); x != nil { + err = errors.Errorf("caught panic: %s", x) + } + }() + // Here be dragons vnetValue := reflect.ValueOf(vnet) vnetValue = reflect.Indirect(vnetValue) @@ -142,12 +147,16 @@ func fuzzySetSubnets(vnet genruntime.ARMResourceSpec, subnets []genruntime.ARMRe if (propertiesField == reflect.Value{}) { return errors.Errorf("couldn't find properties field on vnet") } - propertiesField = reflect.Indirect(propertiesField) - if (propertiesField == reflect.Value{}) { - return errors.Errorf("cannot assign to nil vnet properties") + + propertiesValue := reflect.Indirect(propertiesField) + if (propertiesValue == reflect.Value{}) { + // If the properties field is nil, we must construct an entirely new properties and assign it here + temp := reflect.New(propertiesField.Type().Elem()) + propertiesField.Set(temp) + propertiesValue = reflect.Indirect(temp) } - subnetsField := propertiesField.FieldByName("Subnets") + subnetsField := propertiesValue.FieldByName("Subnets") if (subnetsField == reflect.Value{}) { return errors.Errorf("couldn't find subnets field on vnet") } diff --git a/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go b/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go index a1f209d7599..619f1dd2838 100644 --- a/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go +++ b/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go @@ -29,7 +29,7 @@ type SubnetPropertiesFormat_StatusARM struct { ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` Purpose *string `json:"purpose,omitempty"` ResourceNavigationLinks []ResourceNavigationLink_StatusARM `json:"resourceNavigationLinks,omitempty"` - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbeddedARM `json:"routeTable,omitempty"` ServiceAssociationLinks []ServiceAssociationLink_StatusARM `json:"serviceAssociationLinks,omitempty"` ServiceEndpointPolicies []ServiceEndpointPolicy_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM `json:"serviceEndpointPolicies,omitempty"` ServiceEndpoints []ServiceEndpointPropertiesFormat_StatusARM `json:"serviceEndpoints,omitempty"` @@ -90,8 +90,8 @@ type ResourceNavigationLink_StatusARM struct { Type *string `json:"type,omitempty"` } -// Deprecated version of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instead -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM struct { +// Deprecated version of RouteTable_Status_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_SubResourceEmbedded instead +type RouteTable_Status_SubResourceEmbeddedARM struct { Id *string `json:"id,omitempty"` } diff --git a/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go b/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go index 4b24420bb20..63a0a955ada 100644 --- a/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go +++ b/v2/api/network/v1alpha1api20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go @@ -183,7 +183,7 @@ func AddRelatedPropertyGeneratorsForSubnetPropertiesFormatStatusARM(gens map[str gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusARMGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedARMGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusARMGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusARMGenerator()) @@ -707,19 +707,19 @@ func AddRelatedPropertyGeneratorsForResourceNavigationLinkStatusARM(gens map[str gens["Properties"] = gen.PtrOf(ResourceNavigationLinkFormatStatusARMGenerator()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbeddedARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbeddedARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM, RouteTableStatusSubResourceEmbeddedARMGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbeddedARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM(subject RouteTable_Status_SubResourceEmbeddedARM) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -727,7 +727,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM + var actual RouteTable_Status_SubResourceEmbeddedARM err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -745,25 +745,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbeddedARM instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedARMGenerator() +var routeTableStatusSubResourceEmbeddedARMGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator +// RouteTableStatusSubResourceEmbeddedARMGenerator returns a generator of RouteTable_Status_SubResourceEmbeddedARM instances for property testing. +func RouteTableStatusSubResourceEmbeddedARMGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedARMGenerator != nil { + return routeTableStatusSubResourceEmbeddedARMGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM(generators) + routeTableStatusSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbeddedARM{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator + return routeTableStatusSubResourceEmbeddedARMGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen.go b/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen.go index 18471adc913..9098225b8b2 100644 --- a/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen.go +++ b/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen.go @@ -354,7 +354,7 @@ type Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` Purpose *string `json:"purpose,omitempty"` ResourceNavigationLinks []ResourceNavigationLink_Status `json:"resourceNavigationLinks,omitempty"` - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbedded `json:"routeTable,omitempty"` ServiceAssociationLinks []ServiceAssociationLink_Status `json:"serviceAssociationLinks,omitempty"` ServiceEndpointPolicies []ServiceEndpointPolicy_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"serviceEndpointPolicies,omitempty"` ServiceEndpoints []ServiceEndpointPropertiesFormat_Status `json:"serviceEndpoints,omitempty"` @@ -621,7 +621,7 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) Populat // copying flattened property: if typedInput.Properties != nil { if typedInput.Properties.RouteTable != nil { - var routeTable1 RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var routeTable1 RouteTable_Status_SubResourceEmbedded err := routeTable1.PopulateFromARM(owner, *typedInput.Properties.RouteTable) if err != nil { return err @@ -880,10 +880,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if source.RouteTable != nil { - var routeTable RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := routeTable.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source.RouteTable) + var routeTable RouteTable_Status_SubResourceEmbedded + err := routeTable.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source.RouteTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } embedded.RouteTable = &routeTable } else { @@ -1153,10 +1153,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if embedded.RouteTable != nil { - var routeTable alpha20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := embedded.RouteTable.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&routeTable) + var routeTable alpha20201101s.RouteTable_Status_SubResourceEmbedded + err := embedded.RouteTable.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&routeTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } destination.RouteTable = &routeTable } else { @@ -2790,23 +2790,23 @@ func (link *ResourceNavigationLink_Status) AssignPropertiesToResourceNavigationL return nil } -// Deprecated version of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instead -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { +// Deprecated version of RouteTable_Status_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_SubResourceEmbedded instead +type RouteTable_Status_SubResourceEmbedded struct { Id *string `json:"id,omitempty"` } -var _ genruntime.FromARMConverter = &RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{} +var _ genruntime.FromARMConverter = &RouteTable_Status_SubResourceEmbedded{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM{} +func (embedded *RouteTable_Status_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTable_Status_SubResourceEmbeddedARM{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) +func (embedded *RouteTable_Status_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTable_Status_SubResourceEmbeddedARM) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_Status_SubResourceEmbeddedARM, got %T", armInput) } // Set property ‘Id’: @@ -2819,8 +2819,8 @@ func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) Pop return nil } -// AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from the provided source RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source *alpha20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesFromRouteTableStatusSubResourceEmbedded populates our RouteTable_Status_SubResourceEmbedded from the provided source RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source *alpha20201101s.RouteTable_Status_SubResourceEmbedded) error { // Id embedded.Id = genruntime.ClonePointerToString(source.Id) @@ -2829,8 +2829,8 @@ func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) Ass return nil } -// AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates the provided destination RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(destination *alpha20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesToRouteTableStatusSubResourceEmbedded populates the provided destination RouteTable_Status_SubResourceEmbedded from our RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesToRouteTableStatusSubResourceEmbedded(destination *alpha20201101s.RouteTable_Status_SubResourceEmbedded) error { // Create a new property bag propertyBag := genruntime.NewPropertyBag() diff --git a/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen_test.go b/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen_test.go index 259c4b230ef..f043c5ba519 100644 --- a/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen_test.go +++ b/v2/api/network/v1alpha1api20201101/virtual_networks_subnet_types_gen_test.go @@ -299,7 +299,7 @@ func AddRelatedPropertyGeneratorsForSubnetStatusVirtualNetworksSubnetSubResource gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusGenerator()) @@ -1231,32 +1231,32 @@ func AddIndependentPropertyGeneratorsForResourceNavigationLinkStatus(gens map[st gens["Type"] = gen.PtrOf(gen.AlphaString()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded to RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded via AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded & AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded returns original", - prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip from RouteTable_Status_SubResourceEmbedded to RouteTable_Status_SubResourceEmbedded via AssignPropertiesToRouteTableStatusSubResourceEmbedded & AssignPropertiesFromRouteTableStatusSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) } -// RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded tests if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded can be assigned to v1alpha1api20201101storage and back losslessly -func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded tests if a specific instance of RouteTable_Status_SubResourceEmbedded can be assigned to v1alpha1api20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Copy subject to make sure assignment doesn't modify it copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other alpha20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := copied.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var other alpha20201101s.RouteTable_Status_SubResourceEmbedded + err := copied.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } // Use AssignPropertiesFrom() to convert back to our original type - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err = actual.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var actual RouteTable_Status_SubResourceEmbedded + err = actual.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } @@ -1273,19 +1273,19 @@ func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourc return "" } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -1293,7 +1293,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var actual RouteTable_Status_SubResourceEmbedded err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -1311,25 +1311,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedGenerator() +var routeTableStatusSubResourceEmbeddedGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator +// RouteTableStatusSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_SubResourceEmbedded instances for property testing. +func RouteTableStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedGenerator != nil { + return routeTableStatusSubResourceEmbeddedGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(generators) + routeTableStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbedded{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator + return routeTableStatusSubResourceEmbeddedGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1alpha1api20201101/zz_generated.deepcopy.go b/v2/api/network/v1alpha1api20201101/zz_generated.deepcopy.go index ca52a8ce1ba..fa3fc457edd 100644 --- a/v2/api/network/v1alpha1api20201101/zz_generated.deepcopy.go +++ b/v2/api/network/v1alpha1api20201101/zz_generated.deepcopy.go @@ -7661,7 +7661,7 @@ func (in *ResourceNavigationLink_StatusARM) DeepCopy() *ResourceNavigationLink_S } // 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) { +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_SubResourceEmbedded) { *out = *in if in.Id != nil { in, out := &in.Id, &out.Id @@ -7670,18 +7670,18 @@ 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_SubResourceEmbedded. +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopy() *RouteTable_Status_SubResourceEmbedded { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + out := new(RouteTable_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 *RouteTable_Status_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_SubResourceEmbeddedARM) { *out = *in if in.Id != nil { in, out := &in.Id, &out.Id @@ -7690,12 +7690,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 RouteTable_Status_SubResourceEmbeddedARM. +func (in *RouteTable_Status_SubResourceEmbeddedARM) DeepCopy() *RouteTable_Status_SubResourceEmbeddedARM { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + out := new(RouteTable_Status_SubResourceEmbeddedARM) in.DeepCopyInto(out) return out } @@ -8623,7 +8623,7 @@ func (in *SubnetPropertiesFormat_StatusARM) DeepCopyInto(out *SubnetPropertiesFo } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + *out = new(RouteTable_Status_SubResourceEmbeddedARM) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { @@ -8935,7 +8935,7 @@ func (in *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto( } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + *out = new(RouteTable_Status_SubResourceEmbedded) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { diff --git a/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen.go b/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen.go index b82284b5c62..a6688ea3194 100644 --- a/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen.go +++ b/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen.go @@ -222,7 +222,7 @@ type Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { ProvisioningState *string `json:"provisioningState,omitempty"` Purpose *string `json:"purpose,omitempty"` ResourceNavigationLinks []ResourceNavigationLink_Status `json:"resourceNavigationLinks,omitempty"` - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbedded `json:"routeTable,omitempty"` ServiceAssociationLinks []ServiceAssociationLink_Status `json:"serviceAssociationLinks,omitempty"` ServiceEndpointPolicies []ServiceEndpointPolicy_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"serviceEndpointPolicies,omitempty"` ServiceEndpoints []ServiceEndpointPropertiesFormat_Status `json:"serviceEndpoints,omitempty"` @@ -466,10 +466,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if source.RouteTable != nil { - var routeTable RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := routeTable.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source.RouteTable) + var routeTable RouteTable_Status_SubResourceEmbedded + err := routeTable.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source.RouteTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } embedded.RouteTable = &routeTable } else { @@ -731,10 +731,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if embedded.RouteTable != nil { - var routeTable v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := embedded.RouteTable.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&routeTable) + var routeTable v20201101s.RouteTable_Status_SubResourceEmbedded + err := embedded.RouteTable.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&routeTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } destination.RouteTable = &routeTable } else { @@ -1751,15 +1751,15 @@ func (link *ResourceNavigationLink_Status) AssignPropertiesToResourceNavigationL return nil } -// Storage version of v1alpha1api20201101.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -// Deprecated version of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instead -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { +// Storage version of v1alpha1api20201101.RouteTable_Status_SubResourceEmbedded +// Deprecated version of RouteTable_Status_SubResourceEmbedded. Use v1beta20201101.RouteTable_Status_SubResourceEmbedded instead +type RouteTable_Status_SubResourceEmbedded struct { Id *string `json:"id,omitempty"` PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } -// AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from the provided source RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source *v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesFromRouteTableStatusSubResourceEmbedded populates our RouteTable_Status_SubResourceEmbedded from the provided source RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source *v20201101s.RouteTable_Status_SubResourceEmbedded) error { // Clone the existing property bag propertyBag := genruntime.NewPropertyBag(source.PropertyBag) @@ -1777,8 +1777,8 @@ func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) Ass return nil } -// AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates the provided destination RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(destination *v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesToRouteTableStatusSubResourceEmbedded populates the provided destination RouteTable_Status_SubResourceEmbedded from our RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesToRouteTableStatusSubResourceEmbedded(destination *v20201101s.RouteTable_Status_SubResourceEmbedded) error { // Clone the existing property bag propertyBag := genruntime.NewPropertyBag(embedded.PropertyBag) diff --git a/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen_test.go b/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen_test.go index 352aa60a72d..c7225ec949b 100644 --- a/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen_test.go +++ b/v2/api/network/v1alpha1api20201101storage/virtual_networks_subnet_types_gen_test.go @@ -294,7 +294,7 @@ func AddRelatedPropertyGeneratorsForSubnetStatusVirtualNetworksSubnetSubResource gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusGenerator()) @@ -1207,32 +1207,32 @@ func AddIndependentPropertyGeneratorsForResourceNavigationLinkStatus(gens map[st gens["Type"] = gen.PtrOf(gen.AlphaString()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded to RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded via AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded & AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded returns original", - prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip from RouteTable_Status_SubResourceEmbedded to RouteTable_Status_SubResourceEmbedded via AssignPropertiesToRouteTableStatusSubResourceEmbedded & AssignPropertiesFromRouteTableStatusSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) } -// RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded tests if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded can be assigned to v1beta20201101storage and back losslessly -func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded tests if a specific instance of RouteTable_Status_SubResourceEmbedded can be assigned to v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Copy subject to make sure assignment doesn't modify it copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := copied.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var other v20201101s.RouteTable_Status_SubResourceEmbedded + err := copied.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } // Use AssignPropertiesFrom() to convert back to our original type - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err = actual.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var actual RouteTable_Status_SubResourceEmbedded + err = actual.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } @@ -1249,19 +1249,19 @@ func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourc return "" } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -1269,7 +1269,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var actual RouteTable_Status_SubResourceEmbedded err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -1287,25 +1287,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedGenerator() +var routeTableStatusSubResourceEmbeddedGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator +// RouteTableStatusSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_SubResourceEmbedded instances for property testing. +func RouteTableStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedGenerator != nil { + return routeTableStatusSubResourceEmbeddedGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(generators) + routeTableStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbedded{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator + return routeTableStatusSubResourceEmbeddedGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1alpha1api20201101storage/zz_generated.deepcopy.go b/v2/api/network/v1alpha1api20201101storage/zz_generated.deepcopy.go index bbc45e5e0f4..951fb013be2 100644 --- a/v2/api/network/v1alpha1api20201101storage/zz_generated.deepcopy.go +++ b/v2/api/network/v1alpha1api20201101storage/zz_generated.deepcopy.go @@ -4324,7 +4324,7 @@ func (in *ResourceNavigationLink_Status) DeepCopy() *ResourceNavigationLink_Stat } // 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) { +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopyInto(out *RouteTable_Status_SubResourceEmbedded) { *out = *in if in.Id != nil { in, out := &in.Id, &out.Id @@ -4340,12 +4340,12 @@ 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_SubResourceEmbedded. +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopy() *RouteTable_Status_SubResourceEmbedded { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + out := new(RouteTable_Status_SubResourceEmbedded) in.DeepCopyInto(out) return out } @@ -4963,7 +4963,7 @@ func (in *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto( } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + *out = new(RouteTable_Status_SubResourceEmbedded) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { diff --git a/v2/api/network/v1beta20201101/route__status_arm_types_gen.go b/v2/api/network/v1beta20201101/route__status_arm_types_gen.go new file mode 100644 index 00000000000..cfa790208ed --- /dev/null +++ b/v2/api/network/v1beta20201101/route__status_arm_types_gen.go @@ -0,0 +1,39 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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"` +} + +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,omitempty"` + + // ProvisioningState: The provisioning state of the route resource. + ProvisioningState *ProvisioningState_Status `json:"provisioningState,omitempty"` +} diff --git a/v2/api/network/v1beta20201101/route__status_arm_types_gen_test.go b/v2/api/network/v1beta20201101/route__status_arm_types_gen_test.go new file mode 100644 index 00000000000..915262442d9 --- /dev/null +++ b/v2/api/network/v1beta20201101/route__status_arm_types_gen_test.go @@ -0,0 +1,167 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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.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)) +} diff --git a/v2/api/network/v1beta20201101/route_table__status_arm_types_gen.go b/v2/api/network/v1beta20201101/route_table__status_arm_types_gen.go new file mode 100644 index 00000000000..da84af448d1 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_table__status_arm_types_gen.go @@ -0,0 +1,38 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +type RouteTable_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"` + + // 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"` +} + +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"` +} diff --git a/v2/api/network/v1beta20201101/route_table__status_arm_types_gen_test.go b/v2/api/network/v1beta20201101/route_table__status_arm_types_gen_test.go new file mode 100644 index 00000000000..99538109410 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_table__status_arm_types_gen_test.go @@ -0,0 +1,163 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusARM, RouteTableStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatusARM runs a test to see if a specific instance of RouteTable_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusARM(subject RouteTable_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_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 RouteTable_StatusARM instances for property testing - lazily instantiated by +// RouteTableStatusARMGenerator() +var routeTableStatusARMGenerator gopter.Gen + +// RouteTableStatusARMGenerator returns a generator of RouteTable_StatusARM instances for property testing. +// We first initialize routeTableStatusARMGenerator 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 RouteTableStatusARMGenerator() gopter.Gen { + if routeTableStatusARMGenerator != nil { + return routeTableStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusARM(generators) + routeTableStatusARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatusARM(generators) + AddRelatedPropertyGeneratorsForRouteTableStatusARM(generators) + routeTableStatusARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_StatusARM{}), generators) + + return routeTableStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusARM(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()) +} + +// AddRelatedPropertyGeneratorsForRouteTableStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTableStatusARM(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. +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) + + 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()) +} diff --git a/v2/api/network/v1beta20201101/route_table_types_gen.go b/v2/api/network/v1beta20201101/route_table_types_gen.go new file mode 100644 index 00000000000..ae2d310efb0 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_table_types_gen.go @@ -0,0 +1,831 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +import ( + "fmt" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "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/conversion" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +// 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 `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTable{} + +// GetConditions returns the conditions of the resource +func (table *RouteTable) GetConditions() conditions.Conditions { + return table.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (table *RouteTable) SetConditions(conditions conditions.Conditions) { + table.Status.Conditions = conditions +} + +var _ conversion.Convertible = &RouteTable{} + +// ConvertFrom populates our RouteTable from the provided hub RouteTable +func (table *RouteTable) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*v20201101s.RouteTable) + if !ok { + return fmt.Errorf("expected network/v1beta20201101storage/RouteTable but received %T instead", hub) + } + + return table.AssignPropertiesFromRouteTable(source) +} + +// ConvertTo populates the provided hub RouteTable from our RouteTable +func (table *RouteTable) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*v20201101s.RouteTable) + if !ok { + return fmt.Errorf("expected network/v1beta20201101storage/RouteTable but received %T instead", hub) + } + + return table.AssignPropertiesToRouteTable(destination) +} + +// +kubebuilder:webhook:path=/mutate-network-azure-com-v1beta20201101-routetable,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=routetables,verbs=create;update,versions=v1beta20201101,name=default.v1beta20201101.routetables.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &RouteTable{} + +// Default applies defaults to the RouteTable resource +func (table *RouteTable) Default() { + table.defaultImpl() + var temp interface{} = table + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (table *RouteTable) defaultAzureName() { + if table.Spec.AzureName == "" { + table.Spec.AzureName = table.Name + } +} + +// defaultImpl applies the code generated defaults to the RouteTable resource +func (table *RouteTable) defaultImpl() { table.defaultAzureName() } + +var _ genruntime.KubernetesResource = &RouteTable{} + +// AzureName returns the Azure name of the resource +func (table *RouteTable) AzureName() string { + return table.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (table RouteTable) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetResourceKind returns the kind of the resource +func (table *RouteTable) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (table *RouteTable) GetSpec() genruntime.ConvertibleSpec { + return &table.Spec +} + +// GetStatus returns the status of this resource +func (table *RouteTable) GetStatus() genruntime.ConvertibleStatus { + return &table.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (table *RouteTable) GetType() string { + return "Microsoft.Network/routeTables" +} + +// NewEmptyStatus returns a new empty (blank) status +func (table *RouteTable) NewEmptyStatus() genruntime.ConvertibleStatus { + return &RouteTable_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (table *RouteTable) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(table.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: table.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (table *RouteTable) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*RouteTable_Status); ok { + table.Status = *st + return nil + } + + // Convert status to required version + var st RouteTable_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + table.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-network-azure-com-v1beta20201101-routetable,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=routetables,verbs=create;update,versions=v1beta20201101,name=validate.v1beta20201101.routetables.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &RouteTable{} + +// ValidateCreate validates the creation of the resource +func (table *RouteTable) ValidateCreate() error { + validations := table.createValidations() + var temp interface{} = table + 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 (table *RouteTable) ValidateDelete() error { + validations := table.deleteValidations() + var temp interface{} = table + 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 (table *RouteTable) ValidateUpdate(old runtime.Object) error { + validations := table.updateValidations() + var temp interface{} = table + 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 (table *RouteTable) createValidations() []func() error { + return []func() error{table.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (table *RouteTable) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (table *RouteTable) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return table.validateResourceReferences() + }, + table.validateWriteOnceProperties} +} + +// validateResourceReferences validates all resource references +func (table *RouteTable) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&table.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// validateWriteOnceProperties validates all WriteOnce properties +func (table *RouteTable) validateWriteOnceProperties(old runtime.Object) error { + oldObj, ok := old.(*RouteTable) + if !ok { + return nil + } + + return genruntime.ValidateWriteOnceProperties(oldObj, table) +} + +// AssignPropertiesFromRouteTable populates our RouteTable from the provided source RouteTable +func (table *RouteTable) AssignPropertiesFromRouteTable(source *v20201101s.RouteTable) error { + + // ObjectMeta + table.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec RouteTables_Spec + err := spec.AssignPropertiesFromRouteTablesSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromRouteTablesSpec() to populate field Spec") + } + table.Spec = spec + + // Status + var status RouteTable_Status + err = status.AssignPropertiesFromRouteTableStatus(&source.Status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatus() to populate field Status") + } + table.Status = status + + // No error + return nil +} + +// AssignPropertiesToRouteTable populates the provided destination RouteTable from our RouteTable +func (table *RouteTable) AssignPropertiesToRouteTable(destination *v20201101s.RouteTable) error { + + // ObjectMeta + destination.ObjectMeta = *table.ObjectMeta.DeepCopy() + + // Spec + var spec v20201101s.RouteTables_Spec + err := table.Spec.AssignPropertiesToRouteTablesSpec(&spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToRouteTablesSpec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status v20201101s.RouteTable_Status + err = table.Status.AssignPropertiesToRouteTableStatus(&status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatus() to populate field Status") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (table *RouteTable) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: table.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"` +} + +type RouteTable_Status 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"` + + // Tags: Resource tags. + Tags map[string]string `json:"tags,omitempty"` + + // Type: Resource type. + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &RouteTable_Status{} + +// ConvertStatusFrom populates our RouteTable_Status from the provided source +func (table *RouteTable_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v20201101s.RouteTable_Status) + if ok { + // Populate our instance from source + return table.AssignPropertiesFromRouteTableStatus(src) + } + + // Convert to an intermediate form + src = &v20201101s.RouteTable_Status{} + err := src.ConvertStatusFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = table.AssignPropertiesFromRouteTableStatus(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 +func (table *RouteTable_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v20201101s.RouteTable_Status) + if ok { + // Populate destination from our instance + return table.AssignPropertiesToRouteTableStatus(dst) + } + + // Convert to an intermediate form + dst = &v20201101s.RouteTable_Status{} + err := table.AssignPropertiesToRouteTableStatus(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{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (table *RouteTable_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTable_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (table *RouteTable_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTable_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_StatusARM, 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 + table.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + } + + // Set property ‘Etag’: + if typedInput.Etag != nil { + etag := *typedInput.Etag + table.Etag = &etag + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + table.Id = &id + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + table.Location = &location + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + table.Name = &name + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + table.ProvisioningState = &provisioningState + } + } + + // Set property ‘ResourceGuid’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ResourceGuid != nil { + resourceGuid := *typedInput.Properties.ResourceGuid + table.ResourceGuid = &resourceGuid + } + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + table.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + table.Tags[key] = value + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + table.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromRouteTableStatus populates our RouteTable_Status from the provided source RouteTable_Status +func (table *RouteTable_Status) AssignPropertiesFromRouteTableStatus(source *v20201101s.RouteTable_Status) error { + + // Conditions + table.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // DisableBgpRoutePropagation + if source.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *source.DisableBgpRoutePropagation + table.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + table.DisableBgpRoutePropagation = nil + } + + // Etag + table.Etag = genruntime.ClonePointerToString(source.Etag) + + // Id + table.Id = genruntime.ClonePointerToString(source.Id) + + // Location + table.Location = genruntime.ClonePointerToString(source.Location) + + // Name + table.Name = genruntime.ClonePointerToString(source.Name) + + // ProvisioningState + if source.ProvisioningState != nil { + provisioningState := ProvisioningState_Status(*source.ProvisioningState) + table.ProvisioningState = &provisioningState + } else { + table.ProvisioningState = nil + } + + // ResourceGuid + table.ResourceGuid = genruntime.ClonePointerToString(source.ResourceGuid) + + // Tags + table.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // Type + table.Type = genruntime.ClonePointerToString(source.Type) + + // No error + return nil +} + +// AssignPropertiesToRouteTableStatus populates the provided destination RouteTable_Status from our RouteTable_Status +func (table *RouteTable_Status) AssignPropertiesToRouteTableStatus(destination *v20201101s.RouteTable_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(table.Conditions) + + // DisableBgpRoutePropagation + if table.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *table.DisableBgpRoutePropagation + destination.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + destination.DisableBgpRoutePropagation = nil + } + + // Etag + destination.Etag = genruntime.ClonePointerToString(table.Etag) + + // Id + destination.Id = genruntime.ClonePointerToString(table.Id) + + // Location + destination.Location = genruntime.ClonePointerToString(table.Location) + + // Name + destination.Name = genruntime.ClonePointerToString(table.Name) + + // ProvisioningState + if table.ProvisioningState != nil { + provisioningState := string(*table.ProvisioningState) + destination.ProvisioningState = &provisioningState + } else { + destination.ProvisioningState = nil + } + + // ResourceGuid + destination.ResourceGuid = genruntime.ClonePointerToString(table.ResourceGuid) + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(table.Tags) + + // Type + destination.Type = genruntime.ClonePointerToString(table.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +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,omitempty"` + + // 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: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a resources.azure.com/ResourceGroup resource + Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"` + + // 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 (tables *RouteTables_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if tables == nil { + return nil, nil + } + result := &RouteTables_SpecARM{} + + // Set property ‘Location’: + if tables.Location != nil { + location := *tables.Location + result.Location = &location + } + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + if tables.DisableBgpRoutePropagation != nil { + result.Properties = &RouteTables_Spec_PropertiesARM{} + } + if tables.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *tables.DisableBgpRoutePropagation + result.Properties.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + + // Set property ‘Tags’: + if tables.Tags != nil { + result.Tags = make(map[string]string) + for key, value := range tables.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (tables *RouteTables_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTables_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (tables *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’: + tables.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘DisableBgpRoutePropagation’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *typedInput.Properties.DisableBgpRoutePropagation + tables.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + tables.Location = &location + } + + // Set property ‘Owner’: + tables.Owner = &genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + tables.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + tables.Tags[key] = value + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &RouteTables_Spec{} + +// ConvertSpecFrom populates our RouteTables_Spec from the provided source +func (tables *RouteTables_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v20201101s.RouteTables_Spec) + if ok { + // Populate our instance from source + return tables.AssignPropertiesFromRouteTablesSpec(src) + } + + // Convert to an intermediate form + src = &v20201101s.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 = tables.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 (tables *RouteTables_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v20201101s.RouteTables_Spec) + if ok { + // Populate destination from our instance + return tables.AssignPropertiesToRouteTablesSpec(dst) + } + + // Convert to an intermediate form + dst = &v20201101s.RouteTables_Spec{} + err := tables.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 (tables *RouteTables_Spec) AssignPropertiesFromRouteTablesSpec(source *v20201101s.RouteTables_Spec) error { + + // AzureName + tables.AzureName = source.AzureName + + // DisableBgpRoutePropagation + if source.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *source.DisableBgpRoutePropagation + tables.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + tables.DisableBgpRoutePropagation = nil + } + + // Location + tables.Location = genruntime.ClonePointerToString(source.Location) + + // Owner + if source.Owner != nil { + owner := source.Owner.Copy() + tables.Owner = &owner + } else { + tables.Owner = nil + } + + // Tags + tables.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // No error + return nil +} + +// AssignPropertiesToRouteTablesSpec populates the provided destination RouteTables_Spec from our RouteTables_Spec +func (tables *RouteTables_Spec) AssignPropertiesToRouteTablesSpec(destination *v20201101s.RouteTables_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AzureName + destination.AzureName = tables.AzureName + + // DisableBgpRoutePropagation + if tables.DisableBgpRoutePropagation != nil { + disableBgpRoutePropagation := *tables.DisableBgpRoutePropagation + destination.DisableBgpRoutePropagation = &disableBgpRoutePropagation + } else { + destination.DisableBgpRoutePropagation = nil + } + + // Location + destination.Location = genruntime.ClonePointerToString(tables.Location) + + // OriginalVersion + destination.OriginalVersion = tables.OriginalVersion() + + // Owner + if tables.Owner != nil { + owner := tables.Owner.Copy() + destination.Owner = &owner + } else { + destination.Owner = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(tables.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 (tables *RouteTables_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (tables *RouteTables_Spec) SetAzureName(azureName string) { tables.AzureName = azureName } + +func init() { + SchemeBuilder.Register(&RouteTable{}, &RouteTableList{}) +} diff --git a/v2/api/network/v1beta20201101/route_table_types_gen_test.go b/v2/api/network/v1beta20201101/route_table_types_gen_test.go new file mode 100644 index 00000000000..3a00955c03c --- /dev/null +++ b/v2/api/network/v1beta20201101/route_table_types_gen_test.go @@ -0,0 +1,380 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +import ( + "encoding/json" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "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_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTable to hub returns original", + prop.ForAll(RunResourceConversionTestForRouteTable, RouteTableGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForRouteTable tests if a specific instance of RouteTable round trips to the hub storage version and back losslessly +func RunResourceConversionTestForRouteTable(subject RouteTable) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub v20201101s.RouteTable + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual RouteTable + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_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 v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTable(subject RouteTable) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.RouteTable + err := copied.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"] = RouteTableStatusGenerator() +} + +func Test_RouteTable_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTable_Status to RouteTable_Status via AssignPropertiesToRouteTableStatus & AssignPropertiesFromRouteTableStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTableStatus, RouteTableStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForRouteTableStatus tests if a specific instance of RouteTable_Status can be assigned to v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTableStatus(subject RouteTable_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.RouteTable_Status + err := copied.AssignPropertiesToRouteTableStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual RouteTable_Status + err = actual.AssignPropertiesFromRouteTableStatus(&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_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatus, RouteTableStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatus runs a test to see if a specific instance of RouteTable_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatus(subject RouteTable_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_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 RouteTable_Status instances for property testing - lazily instantiated by RouteTableStatusGenerator() +var routeTableStatusGenerator gopter.Gen + +// RouteTableStatusGenerator returns a generator of RouteTable_Status instances for property testing. +func RouteTableStatusGenerator() gopter.Gen { + if routeTableStatusGenerator != nil { + return routeTableStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatus(generators) + routeTableStatusGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status{}), generators) + + return routeTableStatusGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatus(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()) +} + +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 v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesSpec(subject RouteTables_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.RouteTables_Spec + err := copied.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.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} diff --git a/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen.go b/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen.go new file mode 100644 index 00000000000..fbdc99b9c1b --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen.go @@ -0,0 +1,53 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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,omitempty"` + + // Properties: Properties of the route table. + Properties *RouteTables_Spec_PropertiesARM `json:"properties,omitempty"` + + // 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 (tables RouteTables_SpecARM) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetName returns the Name of the resource +func (tables *RouteTables_SpecARM) GetName() string { + return tables.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (tables *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"` + + // Routes: Collection of routes contained within a route table. + Routes []RouteTables_Spec_Properties_RoutesARM `json:"routes,omitempty"` +} + +type RouteTables_Spec_Properties_RoutesARM struct { + // 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 *RoutePropertiesFormatARM `json:"properties,omitempty"` +} diff --git a/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen_test.go b/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..69ae479d58a --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables__spec_arm_types_gen_test.go @@ -0,0 +1,241 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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.PtrOf(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"] = gen.PtrOf(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. +// We first initialize routeTablesSpecPropertiesARMGenerator 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 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) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesARM(generators) + AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesARM(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()) +} + +// AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesARM(gens map[string]gopter.Gen) { + gens["Routes"] = gen.SliceOf(RouteTablesSpecPropertiesRoutesARMGenerator()) +} + +func Test_RouteTables_Spec_Properties_RoutesARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTables_Spec_Properties_RoutesARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTablesSpecPropertiesRoutesARM, RouteTablesSpecPropertiesRoutesARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTablesSpecPropertiesRoutesARM runs a test to see if a specific instance of RouteTables_Spec_Properties_RoutesARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTablesSpecPropertiesRoutesARM(subject RouteTables_Spec_Properties_RoutesARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTables_Spec_Properties_RoutesARM + 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_Properties_RoutesARM instances for property testing - lazily instantiated by +// RouteTablesSpecPropertiesRoutesARMGenerator() +var routeTablesSpecPropertiesRoutesARMGenerator gopter.Gen + +// RouteTablesSpecPropertiesRoutesARMGenerator returns a generator of RouteTables_Spec_Properties_RoutesARM instances for property testing. +// We first initialize routeTablesSpecPropertiesRoutesARMGenerator 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 RouteTablesSpecPropertiesRoutesARMGenerator() gopter.Gen { + if routeTablesSpecPropertiesRoutesARMGenerator != nil { + return routeTablesSpecPropertiesRoutesARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM(generators) + routeTablesSpecPropertiesRoutesARMGenerator = gen.Struct(reflect.TypeOf(RouteTables_Spec_Properties_RoutesARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM(generators) + AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM(generators) + routeTablesSpecPropertiesRoutesARMGenerator = gen.Struct(reflect.TypeOf(RouteTables_Spec_Properties_RoutesARM{}), generators) + + return routeTablesSpecPropertiesRoutesARMGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesSpecPropertiesRoutesARM(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(RoutePropertiesFormatARMGenerator()) +} diff --git a/v2/api/network/v1beta20201101/route_tables_route_types_gen.go b/v2/api/network/v1beta20201101/route_tables_route_types_gen.go new file mode 100644 index 00000000000..5df00bafea7 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables_route_types_gen.go @@ -0,0 +1,903 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +import ( + "fmt" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "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/conversion" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" +// 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 (route *RouteTablesRoute) GetConditions() conditions.Conditions { + return route.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (route *RouteTablesRoute) SetConditions(conditions conditions.Conditions) { + route.Status.Conditions = conditions +} + +var _ conversion.Convertible = &RouteTablesRoute{} + +// ConvertFrom populates our RouteTablesRoute from the provided hub RouteTablesRoute +func (route *RouteTablesRoute) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*v20201101s.RouteTablesRoute) + if !ok { + return fmt.Errorf("expected network/v1beta20201101storage/RouteTablesRoute but received %T instead", hub) + } + + return route.AssignPropertiesFromRouteTablesRoute(source) +} + +// ConvertTo populates the provided hub RouteTablesRoute from our RouteTablesRoute +func (route *RouteTablesRoute) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*v20201101s.RouteTablesRoute) + if !ok { + return fmt.Errorf("expected network/v1beta20201101storage/RouteTablesRoute but received %T instead", hub) + } + + return route.AssignPropertiesToRouteTablesRoute(destination) +} + +// +kubebuilder:webhook:path=/mutate-network-azure-com-v1beta20201101-routetablesroute,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=routetablesroutes,verbs=create;update,versions=v1beta20201101,name=default.v1beta20201101.routetablesroutes.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &RouteTablesRoute{} + +// Default applies defaults to the RouteTablesRoute resource +func (route *RouteTablesRoute) Default() { + route.defaultImpl() + var temp interface{} = route + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (route *RouteTablesRoute) defaultAzureName() { + if route.Spec.AzureName == "" { + route.Spec.AzureName = route.Name + } +} + +// defaultImpl applies the code generated defaults to the RouteTablesRoute resource +func (route *RouteTablesRoute) defaultImpl() { route.defaultAzureName() } + +var _ genruntime.KubernetesResource = &RouteTablesRoute{} + +// AzureName returns the Azure name of the resource +func (route *RouteTablesRoute) AzureName() string { + return route.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (route RouteTablesRoute) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetResourceKind returns the kind of the resource +func (route *RouteTablesRoute) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (route *RouteTablesRoute) GetSpec() genruntime.ConvertibleSpec { + return &route.Spec +} + +// GetStatus returns the status of this resource +func (route *RouteTablesRoute) GetStatus() genruntime.ConvertibleStatus { + return &route.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (route *RouteTablesRoute) GetType() string { + return "Microsoft.Network/routeTables/routes" +} + +// NewEmptyStatus returns a new empty (blank) status +func (route *RouteTablesRoute) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Route_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (route *RouteTablesRoute) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(route.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: route.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (route *RouteTablesRoute) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Route_Status); ok { + route.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") + } + + route.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-network-azure-com-v1beta20201101-routetablesroute,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=routetablesroutes,verbs=create;update,versions=v1beta20201101,name=validate.v1beta20201101.routetablesroutes.network.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &RouteTablesRoute{} + +// ValidateCreate validates the creation of the resource +func (route *RouteTablesRoute) ValidateCreate() error { + validations := route.createValidations() + var temp interface{} = route + 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 (route *RouteTablesRoute) ValidateDelete() error { + validations := route.deleteValidations() + var temp interface{} = route + 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 (route *RouteTablesRoute) ValidateUpdate(old runtime.Object) error { + validations := route.updateValidations() + var temp interface{} = route + 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 (route *RouteTablesRoute) createValidations() []func() error { + return []func() error{route.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (route *RouteTablesRoute) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (route *RouteTablesRoute) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return route.validateResourceReferences() + }, + route.validateWriteOnceProperties} +} + +// validateResourceReferences validates all resource references +func (route *RouteTablesRoute) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&route.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// validateWriteOnceProperties validates all WriteOnce properties +func (route *RouteTablesRoute) validateWriteOnceProperties(old runtime.Object) error { + oldObj, ok := old.(*RouteTablesRoute) + if !ok { + return nil + } + + return genruntime.ValidateWriteOnceProperties(oldObj, route) +} + +// AssignPropertiesFromRouteTablesRoute populates our RouteTablesRoute from the provided source RouteTablesRoute +func (route *RouteTablesRoute) AssignPropertiesFromRouteTablesRoute(source *v20201101s.RouteTablesRoute) error { + + // ObjectMeta + route.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec RouteTablesRoutes_Spec + err := spec.AssignPropertiesFromRouteTablesRoutesSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromRouteTablesRoutesSpec() to populate field Spec") + } + route.Spec = spec + + // Status + var status Route_Status + err = status.AssignPropertiesFromRouteStatus(&source.Status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromRouteStatus() to populate field Status") + } + route.Status = status + + // No error + return nil +} + +// AssignPropertiesToRouteTablesRoute populates the provided destination RouteTablesRoute from our RouteTablesRoute +func (route *RouteTablesRoute) AssignPropertiesToRouteTablesRoute(destination *v20201101s.RouteTablesRoute) error { + + // ObjectMeta + destination.ObjectMeta = *route.ObjectMeta.DeepCopy() + + // Spec + var spec v20201101s.RouteTablesRoutes_Spec + err := route.Spec.AssignPropertiesToRouteTablesRoutesSpec(&spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToRouteTablesRoutesSpec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status v20201101s.Route_Status + err = route.Status.AssignPropertiesToRouteStatus(&status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToRouteStatus() to populate field Status") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (route *RouteTablesRoute) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: route.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"` +} + +type RouteTablesRoutes_Spec struct { + // +kubebuilder:validation:Required + // AddressPrefix: The destination CIDR to which the route applies. + 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,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"` + + // +kubebuilder:validation:Required + // NextHopType: The type of Azure hop the packet should be sent to. + NextHopType *RoutePropertiesFormatNextHopType `json:"nextHopType,omitempty"` + + // +kubebuilder:validation:Required + // Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a network.azure.com/RouteTable resource + Owner *genruntime.KnownResourceReference `group:"network.azure.com" json:"owner,omitempty" kind:"RouteTable"` +} + +var _ genruntime.ARMTransformer = &RouteTablesRoutes_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (routes *RouteTablesRoutes_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if routes == nil { + return nil, nil + } + result := &RouteTablesRoutes_SpecARM{} + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + if routes.AddressPrefix != nil || + routes.HasBgpOverride != nil || + routes.NextHopIpAddress != nil || + routes.NextHopType != nil { + result.Properties = &RoutePropertiesFormatARM{} + } + if routes.AddressPrefix != nil { + addressPrefix := *routes.AddressPrefix + result.Properties.AddressPrefix = &addressPrefix + } + if routes.HasBgpOverride != nil { + hasBgpOverride := *routes.HasBgpOverride + result.Properties.HasBgpOverride = &hasBgpOverride + } + if routes.NextHopIpAddress != nil { + nextHopIpAddress := *routes.NextHopIpAddress + result.Properties.NextHopIpAddress = &nextHopIpAddress + } + if routes.NextHopType != nil { + nextHopType := *routes.NextHopType + result.Properties.NextHopType = &nextHopType + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (routes *RouteTablesRoutes_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTablesRoutes_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (routes *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: + if typedInput.Properties != nil { + if typedInput.Properties.AddressPrefix != nil { + addressPrefix := *typedInput.Properties.AddressPrefix + routes.AddressPrefix = &addressPrefix + } + } + + // Set property ‘AzureName’: + routes.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘HasBgpOverride’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.HasBgpOverride != nil { + hasBgpOverride := *typedInput.Properties.HasBgpOverride + routes.HasBgpOverride = &hasBgpOverride + } + } + + // Set property ‘NextHopIpAddress’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NextHopIpAddress != nil { + nextHopIpAddress := *typedInput.Properties.NextHopIpAddress + routes.NextHopIpAddress = &nextHopIpAddress + } + } + + // Set property ‘NextHopType’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NextHopType != nil { + nextHopType := *typedInput.Properties.NextHopType + routes.NextHopType = &nextHopType + } + } + + // Set property ‘Owner’: + routes.Owner = &genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &RouteTablesRoutes_Spec{} + +// ConvertSpecFrom populates our RouteTablesRoutes_Spec from the provided source +func (routes *RouteTablesRoutes_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v20201101s.RouteTablesRoutes_Spec) + if ok { + // Populate our instance from source + return routes.AssignPropertiesFromRouteTablesRoutesSpec(src) + } + + // Convert to an intermediate form + src = &v20201101s.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 = routes.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 (routes *RouteTablesRoutes_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v20201101s.RouteTablesRoutes_Spec) + if ok { + // Populate destination from our instance + return routes.AssignPropertiesToRouteTablesRoutesSpec(dst) + } + + // Convert to an intermediate form + dst = &v20201101s.RouteTablesRoutes_Spec{} + err := routes.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 (routes *RouteTablesRoutes_Spec) AssignPropertiesFromRouteTablesRoutesSpec(source *v20201101s.RouteTablesRoutes_Spec) error { + + // AddressPrefix + routes.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix) + + // AzureName + routes.AzureName = source.AzureName + + // HasBgpOverride + if source.HasBgpOverride != nil { + hasBgpOverride := *source.HasBgpOverride + routes.HasBgpOverride = &hasBgpOverride + } else { + routes.HasBgpOverride = nil + } + + // NextHopIpAddress + routes.NextHopIpAddress = genruntime.ClonePointerToString(source.NextHopIpAddress) + + // NextHopType + if source.NextHopType != nil { + nextHopType := RoutePropertiesFormatNextHopType(*source.NextHopType) + routes.NextHopType = &nextHopType + } else { + routes.NextHopType = nil + } + + // Owner + if source.Owner != nil { + owner := source.Owner.Copy() + routes.Owner = &owner + } else { + routes.Owner = nil + } + + // No error + return nil +} + +// AssignPropertiesToRouteTablesRoutesSpec populates the provided destination RouteTablesRoutes_Spec from our RouteTablesRoutes_Spec +func (routes *RouteTablesRoutes_Spec) AssignPropertiesToRouteTablesRoutesSpec(destination *v20201101s.RouteTablesRoutes_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AddressPrefix + destination.AddressPrefix = genruntime.ClonePointerToString(routes.AddressPrefix) + + // AzureName + destination.AzureName = routes.AzureName + + // HasBgpOverride + if routes.HasBgpOverride != nil { + hasBgpOverride := *routes.HasBgpOverride + destination.HasBgpOverride = &hasBgpOverride + } else { + destination.HasBgpOverride = nil + } + + // NextHopIpAddress + destination.NextHopIpAddress = genruntime.ClonePointerToString(routes.NextHopIpAddress) + + // NextHopType + if routes.NextHopType != nil { + nextHopType := string(*routes.NextHopType) + destination.NextHopType = &nextHopType + } else { + destination.NextHopType = nil + } + + // OriginalVersion + destination.OriginalVersion = routes.OriginalVersion() + + // Owner + if routes.Owner != nil { + owner := routes.Owner.Copy() + destination.Owner = &owner + } else { + destination.Owner = nil + } + + // 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 (routes *RouteTablesRoutes_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (routes *RouteTablesRoutes_Spec) SetAzureName(azureName string) { routes.AzureName = azureName } + +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 (route *Route_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v20201101s.Route_Status) + if ok { + // Populate our instance from source + return route.AssignPropertiesFromRouteStatus(src) + } + + // Convert to an intermediate form + src = &v20201101s.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 = route.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 (route *Route_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v20201101s.Route_Status) + if ok { + // Populate destination from our instance + return route.AssignPropertiesToRouteStatus(dst) + } + + // Convert to an intermediate form + dst = &v20201101s.Route_Status{} + err := route.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 (route *Route_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Route_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (route *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 + route.AddressPrefix = &addressPrefix + } + } + + // no assignment for property ‘Conditions’ + + // Set property ‘Etag’: + if typedInput.Etag != nil { + etag := *typedInput.Etag + route.Etag = &etag + } + + // Set property ‘HasBgpOverride’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.HasBgpOverride != nil { + hasBgpOverride := *typedInput.Properties.HasBgpOverride + route.HasBgpOverride = &hasBgpOverride + } + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + route.Id = &id + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + route.Name = &name + } + + // Set property ‘NextHopIpAddress’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NextHopIpAddress != nil { + nextHopIpAddress := *typedInput.Properties.NextHopIpAddress + route.NextHopIpAddress = &nextHopIpAddress + } + } + + // Set property ‘NextHopType’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NextHopType != nil { + nextHopType := *typedInput.Properties.NextHopType + route.NextHopType = &nextHopType + } + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + route.ProvisioningState = &provisioningState + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + route.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromRouteStatus populates our Route_Status from the provided source Route_Status +func (route *Route_Status) AssignPropertiesFromRouteStatus(source *v20201101s.Route_Status) error { + + // AddressPrefix + route.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix) + + // Conditions + route.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // Etag + route.Etag = genruntime.ClonePointerToString(source.Etag) + + // HasBgpOverride + if source.HasBgpOverride != nil { + hasBgpOverride := *source.HasBgpOverride + route.HasBgpOverride = &hasBgpOverride + } else { + route.HasBgpOverride = nil + } + + // Id + route.Id = genruntime.ClonePointerToString(source.Id) + + // Name + route.Name = genruntime.ClonePointerToString(source.Name) + + // NextHopIpAddress + route.NextHopIpAddress = genruntime.ClonePointerToString(source.NextHopIpAddress) + + // NextHopType + if source.NextHopType != nil { + nextHopType := RouteNextHopType_Status(*source.NextHopType) + route.NextHopType = &nextHopType + } else { + route.NextHopType = nil + } + + // ProvisioningState + if source.ProvisioningState != nil { + provisioningState := ProvisioningState_Status(*source.ProvisioningState) + route.ProvisioningState = &provisioningState + } else { + route.ProvisioningState = nil + } + + // Type + route.Type = genruntime.ClonePointerToString(source.Type) + + // No error + return nil +} + +// AssignPropertiesToRouteStatus populates the provided destination Route_Status from our Route_Status +func (route *Route_Status) AssignPropertiesToRouteStatus(destination *v20201101s.Route_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AddressPrefix + destination.AddressPrefix = genruntime.ClonePointerToString(route.AddressPrefix) + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(route.Conditions) + + // Etag + destination.Etag = genruntime.ClonePointerToString(route.Etag) + + // HasBgpOverride + if route.HasBgpOverride != nil { + hasBgpOverride := *route.HasBgpOverride + destination.HasBgpOverride = &hasBgpOverride + } else { + destination.HasBgpOverride = nil + } + + // Id + destination.Id = genruntime.ClonePointerToString(route.Id) + + // Name + destination.Name = genruntime.ClonePointerToString(route.Name) + + // NextHopIpAddress + destination.NextHopIpAddress = genruntime.ClonePointerToString(route.NextHopIpAddress) + + // NextHopType + if route.NextHopType != nil { + nextHopType := string(*route.NextHopType) + destination.NextHopType = &nextHopType + } else { + destination.NextHopType = nil + } + + // ProvisioningState + if route.ProvisioningState != nil { + provisioningState := string(*route.ProvisioningState) + destination.ProvisioningState = &provisioningState + } else { + destination.ProvisioningState = nil + } + + // Type + destination.Type = genruntime.ClonePointerToString(route.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +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/network/v1beta20201101/route_tables_route_types_gen_test.go b/v2/api/network/v1beta20201101/route_tables_route_types_gen_test.go new file mode 100644 index 00000000000..22c046f06ec --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables_route_types_gen_test.go @@ -0,0 +1,392 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +import ( + "encoding/json" + v20201101s "github.com/Azure/azure-service-operator/v2/api/network/v1beta20201101storage" + "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_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from RouteTablesRoute to hub returns original", + prop.ForAll(RunResourceConversionTestForRouteTablesRoute, RouteTablesRouteGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForRouteTablesRoute tests if a specific instance of RouteTablesRoute round trips to the hub storage version and back losslessly +func RunResourceConversionTestForRouteTablesRoute(subject RouteTablesRoute) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub v20201101s.RouteTablesRoute + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual RouteTablesRoute + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_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 v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesRoute(subject RouteTablesRoute) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.RouteTablesRoute + err := copied.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 v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTablesRoutesSpec(subject RouteTablesRoutes_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.RouteTablesRoutes_Spec + err := copied.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.PtrOf(gen.AlphaString()) + gens["AzureName"] = gen.AlphaString() + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.OneConstOf( + RoutePropertiesFormatNextHopTypeInternet, + RoutePropertiesFormatNextHopTypeNone, + RoutePropertiesFormatNextHopTypeVirtualAppliance, + RoutePropertiesFormatNextHopTypeVirtualNetworkGateway, + RoutePropertiesFormatNextHopTypeVnetLocal)) +} + +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 v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteStatus(subject Route_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v20201101s.Route_Status + err := copied.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/network/v1beta20201101/route_tables_routes__spec_arm_types_gen.go b/v2/api/network/v1beta20201101/route_tables_routes__spec_arm_types_gen.go new file mode 100644 index 00000000000..724181420e8 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables_routes__spec_arm_types_gen.go @@ -0,0 +1,47 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type RouteTablesRoutes_SpecARM struct { + // Name: Name of the resource + Name string `json:"name,omitempty"` + + // Properties: Properties of the route. + Properties *RoutePropertiesFormatARM `json:"properties,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &RouteTablesRoutes_SpecARM{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (routes RouteTablesRoutes_SpecARM) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetName returns the Name of the resource +func (routes *RouteTablesRoutes_SpecARM) GetName() string { + return routes.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (routes *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,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 *RoutePropertiesFormatNextHopType `json:"nextHopType,omitempty"` +} diff --git a/v2/api/network/v1beta20201101/route_tables_routes__spec_arm_types_gen_test.go b/v2/api/network/v1beta20201101/route_tables_routes__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..02895043bc9 --- /dev/null +++ b/v2/api/network/v1beta20201101/route_tables_routes__spec_arm_types_gen_test.go @@ -0,0 +1,160 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101 + +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["Name"] = gen.AlphaString() +} + +// AddRelatedPropertyGeneratorsForRouteTablesRoutesSpecARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForRouteTablesRoutesSpecARM(gens map[string]gopter.Gen) { + gens["Properties"] = gen.PtrOf(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.PtrOf(gen.AlphaString()) + gens["HasBgpOverride"] = gen.PtrOf(gen.Bool()) + gens["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.OneConstOf( + RoutePropertiesFormatNextHopTypeInternet, + RoutePropertiesFormatNextHopTypeNone, + RoutePropertiesFormatNextHopTypeVirtualAppliance, + RoutePropertiesFormatNextHopTypeVirtualNetworkGateway, + RoutePropertiesFormatNextHopTypeVnetLocal)) +} diff --git a/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go b/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go index 46ffd4bb7a6..235d1b4cac7 100644 --- a/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go +++ b/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen.go @@ -68,7 +68,7 @@ type SubnetPropertiesFormat_StatusARM struct { ResourceNavigationLinks []ResourceNavigationLink_StatusARM `json:"resourceNavigationLinks,omitempty"` // RouteTable: The reference to the RouteTable resource. - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbeddedARM `json:"routeTable,omitempty"` // ServiceAssociationLinks: An array of references to services injecting into this subnet. ServiceAssociationLinks []ServiceAssociationLink_StatusARM `json:"serviceAssociationLinks,omitempty"` @@ -175,7 +175,7 @@ type ResourceNavigationLink_StatusARM struct { Type *string `json:"type,omitempty"` } -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM struct { +type RouteTable_Status_SubResourceEmbeddedARM struct { // Id: Resource ID. Id *string `json:"id,omitempty"` } diff --git a/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go b/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go index 7aedf2225b5..2bf1201c524 100644 --- a/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go +++ b/v2/api/network/v1beta20201101/subnet__status__virtual_networks_subnet__sub_resource_embedded_arm_types_gen_test.go @@ -183,7 +183,7 @@ func AddRelatedPropertyGeneratorsForSubnetPropertiesFormatStatusARM(gens map[str gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusARMGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedARMGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusARMGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusARMGenerator()) @@ -707,19 +707,19 @@ func AddRelatedPropertyGeneratorsForResourceNavigationLinkStatusARM(gens map[str gens["Properties"] = gen.PtrOf(ResourceNavigationLinkFormatStatusARMGenerator()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbeddedARM via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbeddedARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM, RouteTableStatusSubResourceEmbeddedARMGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbeddedARM round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbeddedARM(subject RouteTable_Status_SubResourceEmbeddedARM) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -727,7 +727,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM + var actual RouteTable_Status_SubResourceEmbeddedARM err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -745,25 +745,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbeddedARM instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedARMGenerator() +var routeTableStatusSubResourceEmbeddedARMGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator +// RouteTableStatusSubResourceEmbeddedARMGenerator returns a generator of RouteTable_Status_SubResourceEmbeddedARM instances for property testing. +func RouteTableStatusSubResourceEmbeddedARMGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedARMGenerator != nil { + return routeTableStatusSubResourceEmbeddedARMGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM(generators) + routeTableStatusSubResourceEmbeddedARMGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbeddedARM{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedARMGenerator + return routeTableStatusSubResourceEmbeddedARMGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedARM(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbeddedARM(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen.go b/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen.go index a49418e9056..473e2152e8d 100644 --- a/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen.go +++ b/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen.go @@ -377,7 +377,7 @@ type Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { ResourceNavigationLinks []ResourceNavigationLink_Status `json:"resourceNavigationLinks,omitempty"` // RouteTable: The reference to the RouteTable resource. - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbedded `json:"routeTable,omitempty"` // ServiceAssociationLinks: An array of references to services injecting into this subnet. ServiceAssociationLinks []ServiceAssociationLink_Status `json:"serviceAssociationLinks,omitempty"` @@ -652,7 +652,7 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) Populat // copying flattened property: if typedInput.Properties != nil { if typedInput.Properties.RouteTable != nil { - var routeTable1 RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var routeTable1 RouteTable_Status_SubResourceEmbedded err := routeTable1.PopulateFromARM(owner, *typedInput.Properties.RouteTable) if err != nil { return err @@ -911,10 +911,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if source.RouteTable != nil { - var routeTable RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := routeTable.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source.RouteTable) + var routeTable RouteTable_Status_SubResourceEmbedded + err := routeTable.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source.RouteTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesFromRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } embedded.RouteTable = &routeTable } else { @@ -1184,10 +1184,10 @@ func (embedded *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignP // RouteTable if embedded.RouteTable != nil { - var routeTable v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := embedded.RouteTable.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&routeTable) + var routeTable v20201101s.RouteTable_Status_SubResourceEmbedded + err := embedded.RouteTable.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&routeTable) if err != nil { - return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded() to populate field RouteTable") + return errors.Wrap(err, "calling AssignPropertiesToRouteTableStatusSubResourceEmbedded() to populate field RouteTable") } destination.RouteTable = &routeTable } else { @@ -2898,23 +2898,23 @@ func (link *ResourceNavigationLink_Status) AssignPropertiesToResourceNavigationL return nil } -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { +type RouteTable_Status_SubResourceEmbedded struct { // Id: Resource ID. Id *string `json:"id,omitempty"` } -var _ genruntime.FromARMConverter = &RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{} +var _ genruntime.FromARMConverter = &RouteTable_Status_SubResourceEmbedded{} // NewEmptyARMValue returns an empty ARM value suitable for deserializing into -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { - return &RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM{} +func (embedded *RouteTable_Status_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &RouteTable_Status_SubResourceEmbeddedARM{} } // PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { - typedInput, ok := armInput.(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) +func (embedded *RouteTable_Status_SubResourceEmbedded) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(RouteTable_Status_SubResourceEmbeddedARM) if !ok { - return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM, got %T", armInput) + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected RouteTable_Status_SubResourceEmbeddedARM, got %T", armInput) } // Set property ‘Id’: @@ -2927,8 +2927,8 @@ func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) Pop return nil } -// AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from the provided source RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(source *v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesFromRouteTableStatusSubResourceEmbedded populates our RouteTable_Status_SubResourceEmbedded from the provided source RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesFromRouteTableStatusSubResourceEmbedded(source *v20201101s.RouteTable_Status_SubResourceEmbedded) error { // Id embedded.Id = genruntime.ClonePointerToString(source.Id) @@ -2937,8 +2937,8 @@ func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) Ass return nil } -// AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded populates the provided destination RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded from our RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -func (embedded *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(destination *v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) error { +// AssignPropertiesToRouteTableStatusSubResourceEmbedded populates the provided destination RouteTable_Status_SubResourceEmbedded from our RouteTable_Status_SubResourceEmbedded +func (embedded *RouteTable_Status_SubResourceEmbedded) AssignPropertiesToRouteTableStatusSubResourceEmbedded(destination *v20201101s.RouteTable_Status_SubResourceEmbedded) error { // Create a new property bag propertyBag := genruntime.NewPropertyBag() diff --git a/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen_test.go b/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen_test.go index 0d42f26a832..f9e212b7336 100644 --- a/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen_test.go +++ b/v2/api/network/v1beta20201101/virtual_networks_subnet_types_gen_test.go @@ -298,7 +298,7 @@ func AddRelatedPropertyGeneratorsForSubnetStatusVirtualNetworksSubnetSubResource gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusGenerator()) @@ -1230,32 +1230,32 @@ func AddIndependentPropertyGeneratorsForResourceNavigationLinkStatus(gens map[st gens["Type"] = gen.PtrOf(gen.AlphaString()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded to RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded via AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded & AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded returns original", - prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip from RouteTable_Status_SubResourceEmbedded to RouteTable_Status_SubResourceEmbedded via AssignPropertiesToRouteTableStatusSubResourceEmbedded & AssignPropertiesFromRouteTableStatusSubResourceEmbedded returns original", + prop.ForAll(RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) } -// RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded tests if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded can be assigned to v1beta20201101storage and back losslessly -func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded tests if a specific instance of RouteTable_Status_SubResourceEmbedded can be assigned to v1beta20201101storage and back losslessly +func RunPropertyAssignmentTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Copy subject to make sure assignment doesn't modify it copied := subject.DeepCopy() // Use AssignPropertiesTo() for the first stage of conversion - var other v20201101s.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err := copied.AssignPropertiesToRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var other v20201101s.RouteTable_Status_SubResourceEmbedded + err := copied.AssignPropertiesToRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } // Use AssignPropertiesFrom() to convert back to our original type - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded - err = actual.AssignPropertiesFromRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(&other) + var actual RouteTable_Status_SubResourceEmbedded + err = actual.AssignPropertiesFromRouteTableStatusSubResourceEmbedded(&other) if err != nil { return err.Error() } @@ -1272,19 +1272,19 @@ func RunPropertyAssignmentTestForRouteTableStatusVirtualNetworksSubnetSubResourc return "" } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -1292,7 +1292,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var actual RouteTable_Status_SubResourceEmbedded err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -1310,25 +1310,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedGenerator() +var routeTableStatusSubResourceEmbeddedGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator +// RouteTableStatusSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_SubResourceEmbedded instances for property testing. +func RouteTableStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedGenerator != nil { + return routeTableStatusSubResourceEmbeddedGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(generators) + routeTableStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbedded{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator + return routeTableStatusSubResourceEmbeddedGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1beta20201101/zz_generated.deepcopy.go b/v2/api/network/v1beta20201101/zz_generated.deepcopy.go index fea5ebfd004..37127f6929f 100644 --- a/v2/api/network/v1beta20201101/zz_generated.deepcopy.go +++ b/v2/api/network/v1beta20201101/zz_generated.deepcopy.go @@ -7661,41 +7661,673 @@ func (in *ResourceNavigationLink_StatusARM) DeepCopy() *ResourceNavigationLink_S } // 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) { +func (in *RoutePropertiesFormatARM) DeepCopyInto(out *RoutePropertiesFormatARM) { *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.NextHopType != nil { + in, out := &in.NextHopType, &out.NextHopType + *out = new(RoutePropertiesFormatNextHopType) + **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.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 + } +} + +// 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 + } +} + +// 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) DeepCopyInto(out *RouteTable_Status) { + *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.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. +func (in *RouteTable_Status) DeepCopy() *RouteTable_Status { + if in == nil { + return nil + } + out := new(RouteTable_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 *RouteTable_StatusARM) DeepCopyInto(out *RouteTable_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.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_StatusARM. +func (in *RouteTable_StatusARM) DeepCopy() *RouteTable_StatusARM { + if in == nil { + return nil + } + out := new(RouteTable_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_SubResourceEmbedded) DeepCopyInto(out *RouteTable_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 RouteTable_Status_SubResourceEmbedded. +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopy() *RouteTable_Status_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(RouteTable_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_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_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_SubResourceEmbeddedARM. +func (in *RouteTable_Status_SubResourceEmbeddedARM) DeepCopy() *RouteTable_Status_SubResourceEmbeddedARM { + if in == nil { + return nil + } + out := new(RouteTable_Status_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.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.NextHopType != nil { + in, out := &in.NextHopType, &out.NextHopType + *out = new(RoutePropertiesFormatNextHopType) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } +} + +// 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.Properties != nil { + in, out := &in.Properties, &out.Properties + *out = new(RoutePropertiesFormatARM) + (*in).DeepCopyInto(*out) + } +} + +// 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 + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new 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 + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.Properties != nil { + in, out := &in.Properties, &out.Properties + *out = new(RouteTables_Spec_PropertiesARM) + (*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 + } + } +} + +// 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 + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]RouteTables_Spec_Properties_RoutesARM, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// 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 *RouteTables_Spec_Properties_RoutesARM) DeepCopyInto(out *RouteTables_Spec_Properties_RoutesARM) { + *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(RoutePropertiesFormatARM) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTables_Spec_Properties_RoutesARM. +func (in *RouteTables_Spec_Properties_RoutesARM) DeepCopy() *RouteTables_Spec_Properties_RoutesARM { + if in == nil { + return nil + } + out := new(RouteTables_Spec_Properties_RoutesARM) + 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 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 Route_Status. +func (in *Route_Status) DeepCopy() *Route_Status { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + 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 *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) DeepCopyInto(out *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) { +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 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_StatusARM. +func (in *Route_StatusARM) DeepCopy() *Route_StatusARM { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + out := new(Route_StatusARM) in.DeepCopyInto(out) return out } @@ -8623,7 +9255,7 @@ func (in *SubnetPropertiesFormat_StatusARM) DeepCopyInto(out *SubnetPropertiesFo } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbeddedARM) + *out = new(RouteTable_Status_SubResourceEmbeddedARM) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { @@ -8935,7 +9567,7 @@ func (in *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto( } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + *out = new(RouteTable_Status_SubResourceEmbedded) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { diff --git a/v2/api/network/v1beta20201101storage/route_table_types_gen.go b/v2/api/network/v1beta20201101storage/route_table_types_gen.go new file mode 100644 index 00000000000..3c46737ee7b --- /dev/null +++ b/v2/api/network/v1beta20201101storage/route_table_types_gen.go @@ -0,0 +1,207 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101storage + +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:rbac:groups=network.azure.com,resources=routetables,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=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" +// Storage version of v1beta20201101.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 `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &RouteTable{} + +// GetConditions returns the conditions of the resource +func (table *RouteTable) GetConditions() conditions.Conditions { + return table.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (table *RouteTable) SetConditions(conditions conditions.Conditions) { + table.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &RouteTable{} + +// AzureName returns the Azure name of the resource +func (table *RouteTable) AzureName() string { + return table.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (table RouteTable) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetResourceKind returns the kind of the resource +func (table *RouteTable) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (table *RouteTable) GetSpec() genruntime.ConvertibleSpec { + return &table.Spec +} + +// GetStatus returns the status of this resource +func (table *RouteTable) GetStatus() genruntime.ConvertibleStatus { + return &table.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables" +func (table *RouteTable) GetType() string { + return "Microsoft.Network/routeTables" +} + +// NewEmptyStatus returns a new empty (blank) status +func (table *RouteTable) NewEmptyStatus() genruntime.ConvertibleStatus { + return &RouteTable_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (table *RouteTable) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(table.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: table.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (table *RouteTable) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*RouteTable_Status); ok { + table.Status = *st + return nil + } + + // Convert status to required version + var st RouteTable_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + table.Status = st + return nil +} + +// Hub marks that this RouteTable is the hub type for conversion +func (table *RouteTable) Hub() {} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (table *RouteTable) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: table.Spec.OriginalVersion, + Kind: "RouteTable", + } +} + +// +kubebuilder:object:root=true +// Storage version of v1beta20201101.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 v1beta20201101.RouteTable_Status +type RouteTable_Status 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"` + Tags map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &RouteTable_Status{} + +// ConvertStatusFrom populates our RouteTable_Status from the provided source +func (table *RouteTable_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == table { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(table) +} + +// ConvertStatusTo populates the provided destination from our RouteTable_Status +func (table *RouteTable_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == table { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(table) +} + +// Storage version of v1beta20201101.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,omitempty"` + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + Location *string `json:"location,omitempty"` + OriginalVersion string `json:"originalVersion,omitempty"` + + // +kubebuilder:validation:Required + // Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a resources.azure.com/ResourceGroup resource + Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &RouteTables_Spec{} + +// ConvertSpecFrom populates our RouteTables_Spec from the provided source +func (tables *RouteTables_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == tables { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(tables) +} + +// ConvertSpecTo populates the provided destination from our RouteTables_Spec +func (tables *RouteTables_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == tables { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(tables) +} + +func init() { + SchemeBuilder.Register(&RouteTable{}, &RouteTableList{}) +} diff --git a/v2/api/network/v1beta20201101storage/route_table_types_gen_test.go b/v2/api/network/v1beta20201101storage/route_table_types_gen_test.go new file mode 100644 index 00000000000..10baed32866 --- /dev/null +++ b/v2/api/network/v1beta20201101storage/route_table_types_gen_test.go @@ -0,0 +1,208 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101storage + +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"] = RouteTableStatusGenerator() +} + +func Test_RouteTable_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of RouteTable_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatus, RouteTableStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForRouteTableStatus runs a test to see if a specific instance of RouteTable_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatus(subject RouteTable_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual RouteTable_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 RouteTable_Status instances for property testing - lazily instantiated by RouteTableStatusGenerator() +var routeTableStatusGenerator gopter.Gen + +// RouteTableStatusGenerator returns a generator of RouteTable_Status instances for property testing. +func RouteTableStatusGenerator() gopter.Gen { + if routeTableStatusGenerator != nil { + return routeTableStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForRouteTableStatus(generators) + routeTableStatusGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status{}), generators) + + return routeTableStatusGenerator +} + +// AddIndependentPropertyGeneratorsForRouteTableStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatus(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()) +} + +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()) +} diff --git a/v2/api/network/v1beta20201101storage/route_tables_route_types_gen.go b/v2/api/network/v1beta20201101storage/route_tables_route_types_gen.go new file mode 100644 index 00000000000..0caca8ccad6 --- /dev/null +++ b/v2/api/network/v1beta20201101storage/route_tables_route_types_gen.go @@ -0,0 +1,209 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1beta20201101storage + +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:rbac:groups=network.azure.com,resources=routetablesroutes,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=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" +// Storage version of v1beta20201101.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 (route *RouteTablesRoute) GetConditions() conditions.Conditions { + return route.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (route *RouteTablesRoute) SetConditions(conditions conditions.Conditions) { + route.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &RouteTablesRoute{} + +// AzureName returns the Azure name of the resource +func (route *RouteTablesRoute) AzureName() string { + return route.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01" +func (route RouteTablesRoute) GetAPIVersion() string { + return string(APIVersionValue) +} + +// GetResourceKind returns the kind of the resource +func (route *RouteTablesRoute) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (route *RouteTablesRoute) GetSpec() genruntime.ConvertibleSpec { + return &route.Spec +} + +// GetStatus returns the status of this resource +func (route *RouteTablesRoute) GetStatus() genruntime.ConvertibleStatus { + return &route.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/routeTables/routes" +func (route *RouteTablesRoute) GetType() string { + return "Microsoft.Network/routeTables/routes" +} + +// NewEmptyStatus returns a new empty (blank) status +func (route *RouteTablesRoute) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Route_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (route *RouteTablesRoute) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(route.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: route.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (route *RouteTablesRoute) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Route_Status); ok { + route.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") + } + + route.Status = st + return nil +} + +// Hub marks that this RouteTablesRoute is the hub type for conversion +func (route *RouteTablesRoute) Hub() {} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (route *RouteTablesRoute) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: route.Spec.OriginalVersion, + Kind: "RouteTablesRoute", + } +} + +// +kubebuilder:object:root=true +// Storage version of v1beta20201101.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 v1beta20201101.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,omitempty"` + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` + NextHopIpAddress *string `json:"nextHopIpAddress,omitempty"` + NextHopType *string `json:"nextHopType,omitempty"` + OriginalVersion string `json:"originalVersion,omitempty"` + + // +kubebuilder:validation:Required + // Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also + // controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a + // reference to a network.azure.com/RouteTable resource + Owner *genruntime.KnownResourceReference `group:"network.azure.com" json:"owner,omitempty" kind:"RouteTable"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &RouteTablesRoutes_Spec{} + +// ConvertSpecFrom populates our RouteTablesRoutes_Spec from the provided source +func (routes *RouteTablesRoutes_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == routes { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(routes) +} + +// ConvertSpecTo populates the provided destination from our RouteTablesRoutes_Spec +func (routes *RouteTablesRoutes_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == routes { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(routes) +} + +// Storage version of v1beta20201101.Route_Status +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 (route *Route_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == route { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(route) +} + +// ConvertStatusTo populates the provided destination from our Route_Status +func (route *Route_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == route { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(route) +} + +func init() { + SchemeBuilder.Register(&RouteTablesRoute{}, &RouteTablesRouteList{}) +} diff --git a/v2/api/network/v1beta20201101storage/route_tables_route_types_gen_test.go b/v2/api/network/v1beta20201101storage/route_tables_route_types_gen_test.go new file mode 100644 index 00000000000..761ca27fb24 --- /dev/null +++ b/v2/api/network/v1beta20201101storage/route_tables_route_types_gen_test.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 v1beta20201101storage + +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["NextHopIpAddress"] = gen.PtrOf(gen.AlphaString()) + gens["NextHopType"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = 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/network/v1beta20201101storage/virtual_networks_subnet_types_gen.go b/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen.go index 2a5ecd22481..0e4c984515a 100644 --- a/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen.go +++ b/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen.go @@ -151,7 +151,7 @@ type Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { ProvisioningState *string `json:"provisioningState,omitempty"` Purpose *string `json:"purpose,omitempty"` ResourceNavigationLinks []ResourceNavigationLink_Status `json:"resourceNavigationLinks,omitempty"` - RouteTable *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"routeTable,omitempty"` + RouteTable *RouteTable_Status_SubResourceEmbedded `json:"routeTable,omitempty"` ServiceAssociationLinks []ServiceAssociationLink_Status `json:"serviceAssociationLinks,omitempty"` ServiceEndpointPolicies []ServiceEndpointPolicy_Status_VirtualNetworksSubnet_SubResourceEmbedded `json:"serviceEndpointPolicies,omitempty"` ServiceEndpoints []ServiceEndpointPropertiesFormat_Status `json:"serviceEndpoints,omitempty"` @@ -295,8 +295,8 @@ type ResourceNavigationLink_Status struct { Type *string `json:"type,omitempty"` } -// Storage version of v1beta20201101.RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded -type RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded struct { +// Storage version of v1beta20201101.RouteTable_Status_SubResourceEmbedded +type RouteTable_Status_SubResourceEmbedded struct { Id *string `json:"id,omitempty"` PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } diff --git a/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen_test.go b/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen_test.go index ae54649a8dc..d016fef6426 100644 --- a/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen_test.go +++ b/v2/api/network/v1beta20201101storage/virtual_networks_subnet_types_gen_test.go @@ -167,7 +167,7 @@ func AddRelatedPropertyGeneratorsForSubnetStatusVirtualNetworksSubnetSubResource gens["NetworkSecurityGroup"] = gen.PtrOf(NetworkSecurityGroupStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["PrivateEndpoints"] = gen.SliceOf(PrivateEndpointStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ResourceNavigationLinks"] = gen.SliceOf(ResourceNavigationLinkStatusGenerator()) - gens["RouteTable"] = gen.PtrOf(RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) + gens["RouteTable"] = gen.PtrOf(RouteTableStatusSubResourceEmbeddedGenerator()) gens["ServiceAssociationLinks"] = gen.SliceOf(ServiceAssociationLinkStatusGenerator()) gens["ServiceEndpointPolicies"] = gen.SliceOf(ServiceEndpointPolicyStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator()) gens["ServiceEndpoints"] = gen.SliceOf(ServiceEndpointPropertiesFormatStatusGenerator()) @@ -744,19 +744,19 @@ func AddIndependentPropertyGeneratorsForResourceNavigationLinkStatus(gens map[st gens["Type"] = gen.PtrOf(gen.AlphaString()) } -func Test_RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { +func Test_RouteTable_Status_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_VirtualNetworksSubnet_SubResourceEmbedded via JSON returns original", - prop.ForAll(RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded, RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator())) + "Round trip of RouteTable_Status_SubResourceEmbedded via JSON returns original", + prop.ForAll(RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded, RouteTableStatusSubResourceEmbeddedGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) } -// RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded round trips to JSON and back losslessly -func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(subject RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) string { +// RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded runs a test to see if a specific instance of RouteTable_Status_SubResourceEmbedded round trips to JSON and back losslessly +func RunJSONSerializationTestForRouteTableStatusSubResourceEmbedded(subject RouteTable_Status_SubResourceEmbedded) string { // Serialize to JSON bin, err := json.Marshal(subject) if err != nil { @@ -764,7 +764,7 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource } // Deserialize back into memory - var actual RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded + var actual RouteTable_Status_SubResourceEmbedded err = json.Unmarshal(bin, &actual) if err != nil { return err.Error() @@ -782,25 +782,25 @@ func RunJSONSerializationTestForRouteTableStatusVirtualNetworksSubnetSubResource return "" } -// Generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing - lazily -// instantiated by RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() -var routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator gopter.Gen +// Generator of RouteTable_Status_SubResourceEmbedded instances for property testing - lazily instantiated by +// RouteTableStatusSubResourceEmbeddedGenerator() +var routeTableStatusSubResourceEmbeddedGenerator gopter.Gen -// RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded instances for property testing. -func RouteTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator() gopter.Gen { - if routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator != nil { - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator +// RouteTableStatusSubResourceEmbeddedGenerator returns a generator of RouteTable_Status_SubResourceEmbedded instances for property testing. +func RouteTableStatusSubResourceEmbeddedGenerator() gopter.Gen { + if routeTableStatusSubResourceEmbeddedGenerator != nil { + return routeTableStatusSubResourceEmbeddedGenerator } generators := make(map[string]gopter.Gen) - AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(generators) - routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded{}), generators) + AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(generators) + routeTableStatusSubResourceEmbeddedGenerator = gen.Struct(reflect.TypeOf(RouteTable_Status_SubResourceEmbedded{}), generators) - return routeTableStatusVirtualNetworksSubnetSubResourceEmbeddedGenerator + return routeTableStatusSubResourceEmbeddedGenerator } -// AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded is a factory method for creating gopter generators -func AddIndependentPropertyGeneratorsForRouteTableStatusVirtualNetworksSubnetSubResourceEmbedded(gens map[string]gopter.Gen) { +// AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForRouteTableStatusSubResourceEmbedded(gens map[string]gopter.Gen) { gens["Id"] = gen.PtrOf(gen.AlphaString()) } diff --git a/v2/api/network/v1beta20201101storage/zz_generated.deepcopy.go b/v2/api/network/v1beta20201101storage/zz_generated.deepcopy.go index 1d1c0e74955..496f73f8700 100644 --- a/v2/api/network/v1beta20201101storage/zz_generated.deepcopy.go +++ b/v2/api/network/v1beta20201101storage/zz_generated.deepcopy.go @@ -4324,13 +4324,99 @@ func (in *ResourceNavigationLink_Status) DeepCopy() *ResourceNavigationLink_Stat } // 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) { +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) DeepCopyInto(out *RouteTable_Status) { + *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)) @@ -4338,14 +4424,287 @@ func (in *RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyI (*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.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. +func (in *RouteTable_Status) DeepCopy() *RouteTable_Status { + if in == nil { + return nil + } + out := new(RouteTable_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 *RouteTable_Status_SubResourceEmbedded) DeepCopyInto(out *RouteTable_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 RouteTable_Status_SubResourceEmbedded. +func (in *RouteTable_Status_SubResourceEmbedded) DeepCopy() *RouteTable_Status_SubResourceEmbedded { + if in == nil { + return nil + } + out := new(RouteTable_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 *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.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.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// 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 + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(genruntime.KnownResourceReference) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.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 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 Route_Status. +func (in *Route_Status) DeepCopy() *Route_Status { if in == nil { return nil } - out := new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + out := new(Route_Status) in.DeepCopyInto(out) return out } @@ -4963,7 +5322,7 @@ func (in *Subnet_Status_VirtualNetworksSubnet_SubResourceEmbedded) DeepCopyInto( } if in.RouteTable != nil { in, out := &in.RouteTable, &out.RouteTable - *out = new(RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded) + *out = new(RouteTable_Status_SubResourceEmbedded) (*in).DeepCopyInto(*out) } if in.ServiceAssociationLinks != nil { diff --git a/v2/api/network/versions_matrix.md b/v2/api/network/versions_matrix.md index d053ad37280..fb4c58d7ee1 100644 --- a/v2/api/network/versions_matrix.md +++ b/v2/api/network/versions_matrix.md @@ -155,7 +155,20 @@ | RadiusServer_Status | v1alpha1api20201101 | v1beta20201101 | | ResourceNavigationLinkFormat_Status | v1alpha1api20201101 | v1beta20201101 | | ResourceNavigationLink_Status | v1alpha1api20201101 | v1beta20201101 | -| RouteTable_Status_VirtualNetworksSubnet_SubResourceEmbedded | v1alpha1api20201101 | v1beta20201101 | +| RouteNextHopType_Status | | v1beta20201101 | +| RoutePropertiesFormat | | v1beta20201101 | +| RoutePropertiesFormatNextHopType | | v1beta20201101 | +| RoutePropertiesFormat_Status | | v1beta20201101 | +| RouteTable | | v1beta20201101 | +| RouteTablePropertiesFormat_Status | | v1beta20201101 | +| RouteTable_Status | | v1beta20201101 | +| RouteTable_Status_SubResourceEmbedded | v1alpha1api20201101 | v1beta20201101 | +| RouteTablesRoute | | v1beta20201101 | +| RouteTablesRoutes_Spec | | v1beta20201101 | +| RouteTables_Spec | | v1beta20201101 | +| RouteTables_Spec_Properties | | v1beta20201101 | +| RouteTables_Spec_Properties_Routes | | v1beta20201101 | +| Route_Status | | v1beta20201101 | | SecurityRuleAccess_Status | v1alpha1api20201101 | v1beta20201101 | | SecurityRuleDirection_Status | v1alpha1api20201101 | v1beta20201101 | | SecurityRulePropertiesFormat | v1alpha1api20201101 | v1beta20201101 | diff --git a/v2/api/resources.md b/v2/api/resources.md index fdc927590d6..d1b138d3f24 100644 --- a/v2/api/resources.md +++ b/v2/api/resources.md @@ -184,6 +184,8 @@ These are the resources with Azure Service Operator support committed to our **m | NetworkSecurityGroupsSecurityRule | 2020-11-01 | v1alpha1api20201101 | v2.0.0-alpha.1 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1alpha1api20201101_networksecuritygroupssecurityrule.yaml) | | PublicIPAddress | 2020-11-01 | v1beta20201101 | v2.0.0-beta.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1beta20201101_publicipaddress.yaml) | | PublicIPAddress | 2020-11-01 | v1alpha1api20201101 | v2.0.0-alpha.1 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1alpha1api20201101_publicipaddress.yaml) | +| RouteTable | 2020-11-01 | v1beta20201101 | v2.0.0-beta.1 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1beta20201101_routetable.yaml) | +| RouteTablesRoute | 2020-11-01 | v1beta20201101 | v2.0.0-beta.1 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1beta20201101_routetablesroute.yaml) | | VirtualNetwork | 2020-11-01 | v1beta20201101 | v2.0.0-beta.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1beta20201101_virtualnetwork.yaml) | | VirtualNetwork | 2020-11-01 | v1alpha1api20201101 | v2.0.0-alpha.1 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1alpha1api20201101_virtualnetwork.yaml) | | VirtualNetworkGateway | 2020-11-01 | v1beta20201101 | v2.0.0-beta.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/network/v1beta20201101_virtualnetworkgateway.yaml) | diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 57caa8b3af4..76baf62ac7b 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -309,6 +309,16 @@ typeTransformers: property: VirtualNetworkPeerings remove: true because: This is an embedded resource + - group: network + name: RouteTablePropertiesFormat_Status # This type is subsequently flattened into RouteTable_Status + property: Routes + remove: true + because: This is an embedded resource + - group: network + name: RouteTablePropertiesFormat_Status # This type is subsequently flattened into RouteTable_Status + property: Subnets + remove: true + because: This is an embedded resource # Deal with resources that have tags or location included but shouldn't have (proxy resources, etc). # See https://github.com/Azure/azure-resource-manager-schemas/issues/1850 @@ -327,6 +337,16 @@ typeTransformers: property: Tags remove: true because: Child resource cannot set tags + - group: network + name: RouteTablesRoutes_Spec + property: Location + remove: true + because: Child resource cannot choose location + - group: network + name: RouteTablesRoutes_Spec + property: Tags + remove: true + because: Child resource cannot set tags # Deal with service Swaggers that are just wrong - group: insights @@ -976,6 +996,15 @@ objectModelConfiguration: PublicIPAddress: $export: true $supportedFrom: v2.0.0-alpha.1 + RouteTable: + $export: true + $supportedFrom: v2.0.0-beta.1 + RouteTables_Spec_Properties: + Routes: + $isResourceLifecycleOwnedByParent: true + RouteTablesRoute: + $export: true + $supportedFrom: v2.0.0-beta.1 SubResource: Id: $armReference: true diff --git a/v2/config/samples/network/v1beta20201101_routetable.yaml b/v2/config/samples/network/v1beta20201101_routetable.yaml new file mode 100644 index 00000000000..14170be3fe6 --- /dev/null +++ b/v2/config/samples/network/v1beta20201101_routetable.yaml @@ -0,0 +1,10 @@ +apiVersion: network.azure.com/v1beta20201101 +kind: RouteTable +metadata: + name: sampleroutetable + namespace: default +spec: + location: westcentralus + owner: + name: aso-sample-rg + disableBgpRoutePropagation: true diff --git a/v2/config/samples/network/v1beta20201101_routetablesroute.yaml b/v2/config/samples/network/v1beta20201101_routetablesroute.yaml new file mode 100644 index 00000000000..ebcbf63e715 --- /dev/null +++ b/v2/config/samples/network/v1beta20201101_routetablesroute.yaml @@ -0,0 +1,11 @@ +apiVersion: network.azure.com/v1beta20201101 +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/controller_resources.go b/v2/internal/controllers/controller_resources.go index 6746aaa7722..0122b0ce7b7 100644 --- a/v2/internal/controllers/controller_resources.go +++ b/v2/internal/controllers/controller_resources.go @@ -64,6 +64,12 @@ func GetKnownStorageTypes( Func: indexOwner, }) } + if _, ok := t.Obj.(*networkstorage.RouteTablesRoute); ok { + t.Indexes = append(t.Indexes, registration.Index{ + Key: ".metadata.ownerReferences[0]", + Func: indexOwner, + }) + } } err := resourceResolver.IndexStorageTypes(mgr.GetScheme(), knownStorageTypes) diff --git a/v2/internal/controllers/controller_resources_gen.go b/v2/internal/controllers/controller_resources_gen.go index d1ab3db8ff7..e07ba7f9d3d 100644 --- a/v2/internal/controllers/controller_resources_gen.go +++ b/v2/internal/controllers/controller_resources_gen.go @@ -435,6 +435,16 @@ func getKnownStorageTypes() []*registration.StorageType { Indexes: []registration.Index{}, Watches: []registration.Watch{}, }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20201101s.RouteTable), + Indexes: []registration.Index{}, + Watches: []registration.Watch{}, + }) + result = append(result, ®istration.StorageType{ + Obj: new(network_v20201101s.RouteTablesRoute), + Indexes: []registration.Index{}, + Watches: []registration.Watch{}, + }) result = append(result, ®istration.StorageType{ Obj: new(network_v20201101s.VirtualNetwork), Indexes: []registration.Index{}, @@ -731,6 +741,8 @@ func getKnownTypes() []client.Object { result = append(result, new(network_v20201101.NetworkSecurityGroup)) result = append(result, new(network_v20201101.NetworkSecurityGroupsSecurityRule)) result = append(result, new(network_v20201101.PublicIPAddress)) + result = append(result, new(network_v20201101.RouteTable)) + result = append(result, new(network_v20201101.RouteTablesRoute)) result = append(result, new(network_v20201101.VirtualNetwork)) result = append(result, new(network_v20201101.VirtualNetworkGateway)) result = append(result, new(network_v20201101.VirtualNetworksSubnet)) @@ -740,6 +752,8 @@ func getKnownTypes() []client.Object { result = append(result, new(network_v20201101s.NetworkSecurityGroup)) result = append(result, new(network_v20201101s.NetworkSecurityGroupsSecurityRule)) result = append(result, new(network_v20201101s.PublicIPAddress)) + result = append(result, new(network_v20201101s.RouteTable)) + result = append(result, new(network_v20201101s.RouteTablesRoute)) result = append(result, new(network_v20201101s.VirtualNetwork)) result = append(result, new(network_v20201101s.VirtualNetworkGateway)) result = append(result, new(network_v20201101s.VirtualNetworksSubnet)) @@ -943,6 +957,8 @@ func getResourceExtensions() []genruntime.ResourceExtension { result = append(result, &network_customizations.NetworkSecurityGroupExtension{}) result = append(result, &network_customizations.NetworkSecurityGroupsSecurityRuleExtension{}) result = append(result, &network_customizations.PublicIPAddressExtension{}) + result = append(result, &network_customizations.RouteTableExtension{}) + result = append(result, &network_customizations.RouteTablesRouteExtension{}) result = append(result, &network_customizations.VirtualNetworkExtension{}) result = append(result, &network_customizations.VirtualNetworkGatewayExtension{}) result = append(result, &network_customizations.VirtualNetworksSubnetExtension{}) 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..bf50c77a743 --- /dev/null +++ b/v2/internal/controllers/crd_networking_routetable_test.go @@ -0,0 +1,156 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +package controllers_test + +import ( + "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/network/v1beta20201101" + "github.com/Azure/azure-service-operator/v2/internal/testcommon" +) + +func Test_Networking_RouteTable_CRUD(t *testing.T) { + t.Parallel() + + g := NewGomegaWithT(t) + 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(tc.Ctx, armId, string(network.APIVersionValue)) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(retryAfter).To(BeZero()) + g.Expect(exists).To(BeFalse()) +} + +func Routes_CRUD(tc *testcommon.KubePerTestContext, routeTable *network.RouteTable) { + nextHopType := network.RoutePropertiesFormatNextHopTypeVirtualAppliance + ipv6Route := &network.RouteTablesRoute{ + ObjectMeta: tc.MakeObjectMeta("ipv6route"), + Spec: network.RouteTablesRoutes_Spec{ + Owner: testcommon.AsOwner(routeTable), + AddressPrefix: to.StringPtr("cab:cab::/96"), + NextHopType: &nextHopType, + NextHopIpAddress: to.StringPtr("ace:cab:deca:f00d::1"), + }, + } + + ipv4Route := &network.RouteTablesRoute{ + ObjectMeta: tc.MakeObjectMeta("ipv4route"), + Spec: network.RouteTablesRoutes_Spec{ + Owner: testcommon.AsOwner(routeTable), + AddressPrefix: to.StringPtr("Storage"), + NextHopType: &nextHopType, + NextHopIpAddress: to.StringPtr("10.0.100.4"), + }, + } + + tc.CreateResourcesAndWait(ipv4Route, ipv6Route) + + tc.Expect(ipv4Route.Status.Id).ToNot(BeNil()) + armId := *ipv4Route.Status.Id + 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"))) + + tc.DeleteResourcesAndWait(ipv4Route, ipv6Route) + + // Ensure that the resource was really deleted in Azure + exists, retryAfter, err := tc.AzureClient.HeadByID(tc.Ctx, armId, string(network.APIVersionValue)) + tc.Expect(err).ToNot(HaveOccurred()) + tc.Expect(retryAfter).To(BeZero()) + tc.Expect(exists).To(BeFalse()) +} + +func Test_Networking_Route_CreatedThenRouteTableUpdated_RouteStillExists(t *testing.T) { + t.Parallel() + 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), + }, + } + + nextHopType := network.RoutePropertiesFormatNextHopTypeVirtualAppliance + ipv4Route := &network.RouteTablesRoute{ + ObjectMeta: tc.MakeObjectMeta("ipv4route"), + Spec: network.RouteTablesRoutes_Spec{ + Owner: testcommon.AsOwner(routeTable), + AddressPrefix: to.StringPtr("Storage"), + NextHopType: &nextHopType, + NextHopIpAddress: to.StringPtr("10.0.100.4"), + }, + } + + tc.CreateResourceAndWait(routeTable) + tc.CreateResourcesAndWait(ipv4Route) + + // It should be created in Kubernetes + tc.Expect(ipv4Route.Status.Id).ToNot(BeNil()) + armId := *ipv4Route.Status.Id + + // Now update the RouteTable + old := routeTable.DeepCopy() + routeTable.Spec.Tags = map[string]string{ + "taters": "boil 'em, mash 'em, stick 'em in a stew", + } + tc.PatchResourceAndWait(old, routeTable) + + // Now ensure that the Route still exists + exists, _, err := tc.AzureClient.HeadByID(tc.Ctx, armId, string(network.APIVersionValue)) + tc.Expect(err).ToNot(HaveOccurred()) + tc.Expect(exists).To(BeTrue()) +} 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..49aa1e8d3d5 --- /dev/null +++ b/v2/internal/controllers/recordings/Test_Networking_RouteTable_CRUD.yaml @@ -0,0 +1,880 @@ +--- +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" + 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-Length: + - "276" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + 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"}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "57" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + 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/\\\"34770dd2-053e-4637-a486-be84cc580342\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"a1d41165-d957-4fdf-a4c8-ba17b5cc76a1\",\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/a6f37ddc-f024-44cf-bb59-23e1394d2a61?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "517" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/a6f37ddc-f024-44cf-bb59-23e1394d2a61?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" + 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/\\\"ba501edd-a04e-46d1-8e4e-0b98edd2011a\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a1d41165-d957-4fdf-a4c8-ba17b5cc76a1\",\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/"ba501edd-a04e-46d1-8e4e-0b98edd2011a" + 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-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" + 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/\\\"660b62cb-6dde-41d9-9f91-72a09a536c16\\\"\",\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/f2db7b9b-edf8-426a-afe2-77ad4d245773?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: + - "2" + 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-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" + 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/\\\"11c3df3e-ff0c-495c-a274-51c709a60d1a\\\"\",\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/d9b0b88f-fbd3-4f63-b2ec-c828e1441d31?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: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/f2db7b9b-edf8-426a-afe2-77ad4d245773?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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/d9b0b88f-fbd3-4f63-b2ec-c828e1441d31?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" + 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/\\\"5e51f85f-8cd0-45ee-9293-a9a7932bbb15\\\"\",\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/"5e51f85f-8cd0-45ee-9293-a9a7932bbb15" + 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" + 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/\\\"5e51f85f-8cd0-45ee-9293-a9a7932bbb15\\\"\",\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/"5e51f85f-8cd0-45ee-9293-a9a7932bbb15" + 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" + 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/\\\"75cf6b52-45e6-4494-8398-233a65d2be3f\\\"\",\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/6755c68d-7309-4219-9735-d75e781d82ef?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/6755c68d-7309-4219-9735-d75e781d82ef?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" + 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/\\\"63243835-a5f4-4b09-9332-3c5b65c01779\\\"\",\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/"63243835-a5f4-4b09-9332-3c5b65c01779" + 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" + 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/898215b9-0ff4-4f6f-8e9e-4f8ef3131f60?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/898215b9-0ff4-4f6f-8e9e-4f8ef3131f60?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "2" + 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" + 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/84035d7b-542e-44ab-bba6-beda33d68420?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/84035d7b-542e-44ab-bba6-beda33d68420?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "2" + 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" + 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" + 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: + - "3" + 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: + - "0" + 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/5f2b8f32-7473-4b31-9abf-895478ede93c?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/5f2b8f32-7473-4b31-9abf-895478ede93c?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "2" + 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" + 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: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Network/routeTables/asotest-routetable-ttechn'' + under resource group ''asotest-rg-wuysaf'' was not found. For more details please + go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "244" + 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: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + 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: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Network/routeTables/asotest-routetable-ttechn'' + under resource group ''asotest-rg-wuysaf'' was not found. For more details please + go to https://aka.ms/ARMResourceNotFoundFix"}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "244" + 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: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + 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" + 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: "" diff --git a/v2/internal/controllers/recordings/Test_Networking_Route_CreatedThenRouteTableUpdated_RouteStillExists.yaml b/v2/internal/controllers/recordings/Test_Networking_Route_CreatedThenRouteTableUpdated_RouteStillExists.yaml new file mode 100644 index 00000000000..3f14c04d447 --- /dev/null +++ b/v2/internal/controllers/recordings/Test_Networking_Route_CreatedThenRouteTableUpdated_RouteStillExists.yaml @@ -0,0 +1,770 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"asotest-rg-jnkrot","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: PUT + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "276" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","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-pwlckr"}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "57" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-routetable-pwlckr\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr\",\r\n + \ \"etag\": \"W/\\\"b39537c1-9808-46d0-aaa8-b453b5e5f9be\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"53a4ffb4-d23a-4130-b94e-6f73e6d84522\",\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/52f7d911-e017-4fc7-92a0-40f9dc5a2fa9?api-version=2020-11-01 + Cache-Control: + - no-cache + Content-Length: + - "517" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Retry-After: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/52f7d911-e017-4fc7-92a0-40f9dc5a2fa9?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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-routetable-pwlckr\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr\",\r\n + \ \"etag\": \"W/\\\"bd5c6c8a-9612-47c5-a744-6608e3948c30\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"properties\": + {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"53a4ffb4-d23a-4130-b94e-6f73e6d84522\",\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/"bd5c6c8a-9612-47c5-a744-6608e3948c30" + 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-hayhtc","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ipv4route-hayhtc\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc\",\r\n + \ \"etag\": \"W/\\\"ed66505b-a10d-458a-aea5-ba0ad9257376\\\"\",\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/1c3a929e-6581-42ae-98e3-ff3352cb366b?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: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus2/operations/1c3a929e-6581-42ae-98e3-ff3352cb366b?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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ipv4route-hayhtc\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc\",\r\n + \ \"etag\": \"W/\\\"ed786568-fc0b-4ad5-997b-b8fa60b21b38\\\"\",\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/"ed786568-fc0b-4ad5-997b-b8fa60b21b38" + 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: '{"location":"westus2","name":"asotest-routetable-pwlckr","properties":{"routes":[{"name":"asotest-ipv4route-hayhtc","properties":{"addressPrefix":"Storage","nextHopIpAddress":"10.0.100.4","nextHopType":"VirtualAppliance"}}]},"tags":{"taters":"boil + ''em, mash ''em, stick ''em in a stew"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "285" + Content-Type: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?api-version=2020-11-01 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-routetable-pwlckr\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr\",\r\n + \ \"etag\": \"W/\\\"72c808b4-5913-4d34-893e-8277227d2445\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"tags\": + {\r\n \"taters\": \"boil 'em, mash 'em, stick 'em in a stew\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"53a4ffb4-d23a-4130-b94e-6f73e6d84522\",\r\n \"disableBgpRoutePropagation\": + false,\r\n \"routes\": [\r\n {\r\n \"name\": \"asotest-ipv4route-hayhtc\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc\",\r\n + \ \"etag\": \"W/\\\"72c808b4-5913-4d34-893e-8277227d2445\\\"\",\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 }\r\n ]\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/9453018a-b95d-4c6f-817d-e1f2059a324b?api-version=2020-11-01 + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-routetable-pwlckr\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr\",\r\n + \ \"etag\": \"W/\\\"72c808b4-5913-4d34-893e-8277227d2445\\\"\",\r\n \"type\": + \"Microsoft.Network/routeTables\",\r\n \"location\": \"westus2\",\r\n \"tags\": + {\r\n \"taters\": \"boil 'em, mash 'em, stick 'em in a stew\"\r\n },\r\n + \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": + \"53a4ffb4-d23a-4130-b94e-6f73e6d84522\",\r\n \"disableBgpRoutePropagation\": + false,\r\n \"routes\": [\r\n {\r\n \"name\": \"asotest-ipv4route-hayhtc\",\r\n + \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc\",\r\n + \ \"etag\": \"W/\\\"72c808b4-5913-4d34-893e-8277227d2445\\\"\",\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 }\r\n ]\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Etag: + - W/"72c808b4-5913-4d34-893e-8277227d2445" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc?api-version=2020-11-01 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ipv4route-hayhtc\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc\",\r\n + \ \"etag\": \"W/\\\"72c808b4-5913-4d34-893e-8277227d2445\\\"\",\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/"72c808b4-5913-4d34-893e-8277227d2445" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc?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/7b4cda77-97fc-4868-a70a-eab56e7706ca?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/7b4cda77-97fc-4868-a70a-eab56e7706ca?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?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/e894a450-4f9b-4a5b-ad09-f6eec455d073?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/e894a450-4f9b-4a5b-ad09-f6eec455d073?api-version=2020-11-01 + Pragma: + - no-cache + Retry-After: + - "2" + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?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/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1BU09URVNUOjJEUkc6MkRKTktST1QtV0VTVFVTMiIsImpvYkxvY2F0aW9uIjoid2VzdHVzMiJ9?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: + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr/routes/asotest-ipv4route-hayhtc?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-JNKROT/providers/Microsoft.Network/routeTables/ASOTEST-ROUTETABLE-PWLCKR + 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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr?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-jnkrot/providers/Microsoft.Network/routeTables/asotest-routetable-pwlckr + 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: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot","name":"asotest-rg-jnkrot","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" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-jnkrot?api-version=2020-06-01 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-jnkrot'' + 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: "" diff --git a/v2/pkg/genruntime/helpers.go b/v2/pkg/genruntime/helpers.go index d2159beab7c..892af256dbd 100644 --- a/v2/pkg/genruntime/helpers.go +++ b/v2/pkg/genruntime/helpers.go @@ -64,3 +64,13 @@ func MinInt(a int, b int) int { } return b } + +// ARMSpecNames returns a slice of names from the given ARMResourceSpec slice. +func ARMSpecNames(specs []ARMResourceSpec) []string { + var result []string + for _, s := range specs { + result = append(result, s.GetName()) + } + + return result +}