Skip to content

Commit

Permalink
Changing fields of Inners back to SubResource (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenala authored and Hovsep committed Apr 18, 2018
1 parent abcc4ec commit 8220712
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public FrontendIPConfigurationInner()
/// the resource is updated.</param>
/// <param name="zones">A list of availability zones denoting the IP
/// allocated for the resource needs to come from.</param>
public FrontendIPConfigurationInner(string id = default(string), IList<Management.ResourceManager.Fluent.SubResource> inboundNatRules = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> inboundNatPools = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> outboundNatRules = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> loadBalancingRules = default(IList<Management.ResourceManager.Fluent.SubResource>), string privateIPAddress = default(string), IPAllocationMethod privateIPAllocationMethod = default(IPAllocationMethod), SubnetInner subnet = default(SubnetInner), PublicIPAddressInner publicIPAddress = default(PublicIPAddressInner), string provisioningState = default(string), string name = default(string), string etag = default(string), IList<string> zones = default(IList<string>))
public FrontendIPConfigurationInner(string id = default(string), IList<Management.ResourceManager.Fluent.SubResource> inboundNatRules = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> inboundNatPools = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> outboundNatRules = default(IList<Management.ResourceManager.Fluent.SubResource>), IList<Management.ResourceManager.Fluent.SubResource> loadBalancingRules = default(IList<Management.ResourceManager.Fluent.SubResource>), string privateIPAddress = default(string), IPAllocationMethod privateIPAllocationMethod = default(IPAllocationMethod), SubnetInner subnet = default(SubnetInner), SubResource publicIPAddress = default(SubResource), string provisioningState = default(string), string name = default(string), string etag = default(string), IList<string> zones = default(IList<string>))
: base(id)
{
InboundNatRules = inboundNatRules;
Expand Down Expand Up @@ -127,13 +127,13 @@ public FrontendIPConfigurationInner()
/// Gets or sets the reference of the subnet resource.
/// </summary>
[JsonProperty(PropertyName = "properties.subnet")]
public SubnetInner Subnet { get; set; }
public SubResource Subnet { get; set; }

/// <summary>
/// Gets or sets the reference of the Public IP resource.
/// </summary>
[JsonProperty(PropertyName = "properties.publicIPAddress")]
public PublicIPAddressInner PublicIPAddress { get; set; }
public SubResource PublicIPAddress { get; set; }

/// <summary>
/// Gets the provisioning state of the public IP resource. Possible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public NetworkInterfaceIPConfigurationInner()
/// resource.</param>
/// <param name="etag">A unique read-only string that changes whenever
/// the resource is updated.</param>
public NetworkInterfaceIPConfigurationInner(string id = default(string), IList<ApplicationGatewayBackendAddressPoolInner> applicationGatewayBackendAddressPools = default(IList<ApplicationGatewayBackendAddressPoolInner>), IList<BackendAddressPoolInner> loadBalancerBackendAddressPools = default(IList<BackendAddressPoolInner>), IList<InboundNatRuleInner> loadBalancerInboundNatRules = default(IList<InboundNatRuleInner>), string privateIPAddress = default(string), IPAllocationMethod privateIPAllocationMethod = default(IPAllocationMethod), IPVersion privateIPAddressVersion = default(IPVersion), SubnetInner subnet = default(SubnetInner), bool? primary = default(bool?), PublicIPAddressInner publicIPAddress = default(PublicIPAddressInner), IList<ApplicationSecurityGroupInner> applicationSecurityGroups = default(IList<ApplicationSecurityGroupInner>), string provisioningState = default(string), string name = default(string), string etag = default(string))
public NetworkInterfaceIPConfigurationInner(string id = default(string), IList<ApplicationGatewayBackendAddressPoolInner> applicationGatewayBackendAddressPools = default(IList<ApplicationGatewayBackendAddressPoolInner>), IList<BackendAddressPoolInner> loadBalancerBackendAddressPools = default(IList<BackendAddressPoolInner>), IList<InboundNatRuleInner> loadBalancerInboundNatRules = default(IList<InboundNatRuleInner>), string privateIPAddress = default(string), IPAllocationMethod privateIPAllocationMethod = default(IPAllocationMethod), IPVersion privateIPAddressVersion = default(IPVersion), SubnetInner subnet = default(SubnetInner), bool? primary = default(bool?), SubResource publicIPAddress = default(SubResource), IList<ApplicationSecurityGroupInner> applicationSecurityGroups = default(IList<ApplicationSecurityGroupInner>), string provisioningState = default(string), string name = default(string), string etag = default(string))
: base(id)
{
ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools;
Expand Down Expand Up @@ -151,7 +151,7 @@ public NetworkInterfaceIPConfigurationInner()
/// Gets or sets public IP address bound to the IP configuration.
/// </summary>
[JsonProperty(PropertyName = "properties.publicIPAddress")]
public PublicIPAddressInner PublicIPAddress { get; set; }
public SubResource PublicIPAddress { get; set; }

/// <summary>
/// Gets or sets application security groups in which the IP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public NetworkInterfaceInner()
/// and 'Failed'.</param>
/// <param name="etag">A unique read-only string that changes whenever
/// the resource is updated.</param>
public NetworkInterfaceInner(string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Management.ResourceManager.Fluent.SubResource virtualMachine = default(Management.ResourceManager.Fluent.SubResource), NetworkSecurityGroupInner networkSecurityGroup = default(NetworkSecurityGroupInner), IList<NetworkInterfaceIPConfigurationInner> ipConfigurations = default(IList<NetworkInterfaceIPConfigurationInner>), NetworkInterfaceDnsSettings dnsSettings = default(NetworkInterfaceDnsSettings), string macAddress = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? enableIPForwarding = default(bool?), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string))
public NetworkInterfaceInner(string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Management.ResourceManager.Fluent.SubResource virtualMachine = default(Management.ResourceManager.Fluent.SubResource), SubResource networkSecurityGroup = default(SubResource), IList<NetworkInterfaceIPConfigurationInner> ipConfigurations = default(IList<NetworkInterfaceIPConfigurationInner>), NetworkInterfaceDnsSettings dnsSettings = default(NetworkInterfaceDnsSettings), string macAddress = default(string), bool? primary = default(bool?), bool? enableAcceleratedNetworking = default(bool?), bool? enableIPForwarding = default(bool?), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string))
: base(location, id, name, type, tags)
{
VirtualMachine = virtualMachine;
Expand Down Expand Up @@ -89,7 +89,7 @@ public NetworkInterfaceInner()
/// Gets or sets the reference of the NetworkSecurityGroup resource.
/// </summary>
[JsonProperty(PropertyName = "properties.networkSecurityGroup")]
public NetworkSecurityGroupInner NetworkSecurityGroup { get; set; }
public SubResource NetworkSecurityGroup { get; set; }

/// <summary>
/// Gets or sets a list of IPConfigurations of the network interface.
Expand Down Expand Up @@ -159,10 +159,6 @@ public NetworkInterfaceInner()
/// </exception>
public virtual void Validate()
{
if (NetworkSecurityGroup != null)
{
NetworkSecurityGroup.Validate();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public SubnetInner()
/// resource.</param>
/// <param name="etag">A unique read-only string that changes whenever
/// the resource is updated.</param>
public SubnetInner(string id = default(string), string addressPrefix = default(string), NetworkSecurityGroupInner networkSecurityGroup = default(NetworkSecurityGroupInner), RouteTableInner routeTable = default(RouteTableInner), IList<ServiceEndpointPropertiesFormat> serviceEndpoints = default(IList<ServiceEndpointPropertiesFormat>), IList<IPConfigurationInner> ipConfigurations = default(IList<IPConfigurationInner>), IList<ResourceNavigationLinkInner> resourceNavigationLinks = default(IList<ResourceNavigationLinkInner>), string provisioningState = default(string), string name = default(string), string etag = default(string))
public SubnetInner(string id = default(string), string addressPrefix = default(string), SubResource networkSecurityGroup = default(SubResource), SubResource routeTable = default(SubResource), IList<ServiceEndpointPropertiesFormat> serviceEndpoints = default(IList<ServiceEndpointPropertiesFormat>), IList<IPConfigurationInner> ipConfigurations = default(IList<IPConfigurationInner>), IList<ResourceNavigationLinkInner> resourceNavigationLinks = default(IList<ResourceNavigationLinkInner>), string provisioningState = default(string), string name = default(string), string etag = default(string))
: base(id)
{
AddressPrefix = addressPrefix;
Expand Down Expand Up @@ -83,13 +83,13 @@ public SubnetInner()
/// Gets or sets the reference of the NetworkSecurityGroup resource.
/// </summary>
[JsonProperty(PropertyName = "properties.networkSecurityGroup")]
public NetworkSecurityGroupInner NetworkSecurityGroup { get; set; }
public SubResource NetworkSecurityGroup { get; set; }

/// <summary>
/// Gets or sets the reference of the RouteTable resource.
/// </summary>
[JsonProperty(PropertyName = "properties.routeTable")]
public RouteTableInner RouteTable { get; set; }
public SubResource RouteTable { get; set; }

/// <summary>
/// Gets or sets an array of service endpoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public VirtualNetworkGatewayConnectionInner()
/// 'Updating', 'Deleting', and 'Failed'.</param>
/// <param name="etag">Gets a unique read-only string that changes
/// whenever the resource is updated.</param>
public VirtualNetworkGatewayConnectionInner(VirtualNetworkGatewayInner virtualNetworkGateway1, VirtualNetworkGatewayConnectionType connectionType, string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string authorizationKey = default(string), VirtualNetworkGatewayInner virtualNetworkGateway2 = default(VirtualNetworkGatewayInner), LocalNetworkGatewayInner localNetworkGateway2 = default(LocalNetworkGatewayInner), int? routingWeight = default(int?), string sharedKey = default(string), VirtualNetworkGatewayConnectionStatus connectionStatus = default(VirtualNetworkGatewayConnectionStatus), IList<TunnelConnectionHealth> tunnelConnectionStatus = default(IList<TunnelConnectionHealth>), long? egressBytesTransferred = default(long?), long? ingressBytesTransferred = default(long?), Management.ResourceManager.Fluent.SubResource peer = default(Management.ResourceManager.Fluent.SubResource), bool? enableBgp = default(bool?), bool? usePolicyBasedTrafficSelectors = default(bool?), IList<IpsecPolicy> ipsecPolicies = default(IList<IpsecPolicy>), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string))
public VirtualNetworkGatewayConnectionInner(SubResource virtualNetworkGateway1, VirtualNetworkGatewayConnectionType connectionType, string location = default(string), string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string authorizationKey = default(string), SubResource virtualNetworkGateway2 = default(SubResource), SubResource localNetworkGateway2 = default(SubResource), int? routingWeight = default(int?), string sharedKey = default(string), VirtualNetworkGatewayConnectionStatus connectionStatus = default(VirtualNetworkGatewayConnectionStatus), IList<TunnelConnectionHealth> tunnelConnectionStatus = default(IList<TunnelConnectionHealth>), long? egressBytesTransferred = default(long?), long? ingressBytesTransferred = default(long?), Management.ResourceManager.Fluent.SubResource peer = default(Management.ResourceManager.Fluent.SubResource), bool? enableBgp = default(bool?), bool? usePolicyBasedTrafficSelectors = default(bool?), IList<IpsecPolicy> ipsecPolicies = default(IList<IpsecPolicy>), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string))
: base(location, id, name, type, tags)
{
AuthorizationKey = authorizationKey;
Expand Down Expand Up @@ -111,19 +111,19 @@ public VirtualNetworkGatewayConnectionInner()
/// Gets or sets the reference to virtual network gateway resource.
/// </summary>
[JsonProperty(PropertyName = "properties.virtualNetworkGateway1")]
public VirtualNetworkGatewayInner VirtualNetworkGateway1 { get; set; }
public SubResource VirtualNetworkGateway1 { get; set; }

/// <summary>
/// Gets or sets the reference to virtual network gateway resource.
/// </summary>
[JsonProperty(PropertyName = "properties.virtualNetworkGateway2")]
public VirtualNetworkGatewayInner VirtualNetworkGateway2 { get; set; }
public SubResource VirtualNetworkGateway2 { get; set; }

/// <summary>
/// Gets or sets the reference to local network gateway resource.
/// </summary>
[JsonProperty(PropertyName = "properties.localNetworkGateway2")]
public LocalNetworkGatewayInner LocalNetworkGateway2 { get; set; }
public SubResource LocalNetworkGateway2 { get; set; }

/// <summary>
/// Gets or sets gateway connection type. Possible values are:
Expand Down Expand Up @@ -235,18 +235,6 @@ public virtual void Validate()
{
throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionType");
}
if (VirtualNetworkGateway1 != null)
{
VirtualNetworkGateway1.Validate();
}
if (VirtualNetworkGateway2 != null)
{
VirtualNetworkGateway2.Validate();
}
if (LocalNetworkGateway2 != null)
{
LocalNetworkGateway2.Validate();
}
if (IpsecPolicies != null)
{
foreach (var element in IpsecPolicies)
Expand Down
4 changes: 2 additions & 2 deletions src/ResourceManagement/Network/LoadBalancerFrontendImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public LoadBalancerFrontendImpl WithAvailabilityZone(AvailabilityZoneId zoneId)
///GENMHASH:E8683B20FED733D23930E96CCD1EB0A2:9BD654DDBDD539A635C896FC16E2469D
internal LoadBalancerFrontendImpl WithExistingSubnet(string parentNetworkResourceId, string subnetName)
{
Inner.Subnet = new SubnetInner(id: parentNetworkResourceId + "/subnets/" + subnetName);
Inner.Subnet = new SubResource(parentNetworkResourceId + "/subnets/" + subnetName);
Inner.PublicIPAddress = null; // Ensure no conflicting public and private settings
return this;
}
Expand All @@ -203,7 +203,7 @@ internal LoadBalancerFrontendImpl WithExistingPublicIPAddress(IPublicIPAddress p
///GENMHASH:3C078CA3D79C59C878B566E6BDD55B86:83A90EFEAD457402C1239221C836C923
internal LoadBalancerFrontendImpl WithExistingPublicIPAddress(string resourceId)
{
var pipRef = new PublicIPAddressInner(id: resourceId);
var pipRef = new SubResource(id: resourceId);
Inner.PublicIPAddress = pipRef;

// Ensure no conflicting public and private settings
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManagement/Network/NetworkInterfaceImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ override protected void BeforeCreating()
// Associate an NSG if needed
if (networkSecurityGroup != null)
{
Inner.NetworkSecurityGroup = new NetworkSecurityGroupInner(id: networkSecurityGroup.Id);
Inner.NetworkSecurityGroup = new SubResource(networkSecurityGroup.Id);
}

NicIPConfigurationImpl.EnsureConfigurations(new List<INicIPConfiguration>(nicIPConfigurations.Values));
Expand Down
6 changes: 3 additions & 3 deletions src/ResourceManagement/Network/NicIPConfigurationImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private SubnetInner SubnetToAssociate()
/// <returns>public ip SubResource</returns>

///GENMHASH:B45B91A2577A6C77086C36AFAD21CB6C:0762B331D53D3FF3CD6E97D46248B648
private PublicIPAddressInner PublicIPToAssociate()
private SubResource PublicIPToAssociate()
{
string pipId = null;
if (removePrimaryPublicIPAssociation)
Expand All @@ -376,13 +376,13 @@ private PublicIPAddressInner PublicIPToAssociate()

if (pipId != null)
{
return new PublicIPAddressInner(id: pipId);
return new SubResource(pipId);
}
else if (!isInCreateMode)
{
if (Inner.PublicIPAddress != null)
{
return new PublicIPAddressInner(id: Inner.PublicIPAddress.Id);
return new SubResource(Inner.PublicIPAddress.Id);
}
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/ResourceManagement/Network/SubnetImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public IRouteTable GetRouteTable()
///GENMHASH:749BD8C1D070A6DAE2D9F29DAE294FAE:9DD0E90F3B1A067185751A1074341EAF
internal SubnetImpl WithExistingNetworkSecurityGroup(string resourceId)
{
Inner.NetworkSecurityGroup = new NetworkSecurityGroupInner(id: resourceId);
Inner.NetworkSecurityGroup = new SubResource(id: resourceId);
return this;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ public Subnet.Update.IUpdate WithoutRouteTable()
///GENMHASH:C142A0234F22048E67709B65DD642261:61C2A1A23D6BCA62D6705980C8D1BECE
public SubnetImpl WithExistingRouteTable(string resourceId)
{
Inner.RouteTable = new RouteTableInner(id: resourceId);
Inner.RouteTable = new SubResource(id: resourceId);
return this;
}

Expand Down
Loading

0 comments on commit 8220712

Please sign in to comment.