Skip to content

Commit

Permalink
NetworkSecurityGroup as an optional parameter in NetworkInterface.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Nov 30, 2017
1 parent 7c247af commit 5d6cb34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static ResourceConfig<NetworkInterface> CreateNetworkInterfaceConfig(
string name,
NestedResourceConfig<Subnet, VirtualNetwork> subnet,
ResourceConfig<PublicIPAddress> publicIPAddress,
ResourceConfig<NetworkSecurityGroup> networkSecurityGroup)
ResourceConfig<NetworkSecurityGroup> networkSecurityGroup = null)
=> Strategy.CreateConfig(
resourceGroup,
name,
Expand All @@ -53,10 +53,12 @@ public static ResourceConfig<NetworkInterface> CreateNetworkInterfaceConfig(
}
}
},
NetworkSecurityGroup = new NetworkSecurityGroup
{
Id = networkSecurityGroup.GetId(subscription).IdToString()
}
NetworkSecurityGroup = networkSecurityGroup == null
? null
: new NetworkSecurityGroup
{
Id = networkSecurityGroup.GetId(subscription).IdToString()
}
},
new IEntityConfig[] { subnet, publicIPAddress, networkSecurityGroup });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static ResourceConfig<TModel> CreateConfig<TModel>(
resourceGroup.Name,
name,
createModel,
dependencies.EmptyIfNull().Concat(new[] { resourceGroup }));
dependencies.EmptyIfNull().Where(d => d != null).Concat(new[] { resourceGroup }));

public static async Task<TModel> GetAsync<TModel>(
this ResourceConfig<TModel> config,
Expand Down

0 comments on commit 5d6cb34

Please sign in to comment.