Skip to content

Commit d9ba138

Browse files
committed
Reuse ip protocol between compute and networking
1 parent a773686 commit d9ba138

4 files changed

Lines changed: 39 additions & 24 deletions

File tree

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
1-
using OpenStack.Serialization;
2-
31
namespace OpenStack.Compute.v2_1
42
{
53
/// <summary>
64
/// Internet Protocols.
75
/// </summary>
8-
public class IPProtocol : StringEnumeration
9-
{
10-
/// <summary />
11-
protected IPProtocol(string displayName)
12-
: base(displayName)
13-
{ }
14-
15-
/// <summary>
16-
/// ICMP
17-
/// </summary>
18-
public static readonly IPProtocol ICMP = new IPProtocol("icmp");
19-
20-
/// <summary>
21-
/// TCP
22-
/// </summary>
23-
public static readonly IPProtocol TCP = new IPProtocol("tcp");
24-
25-
/// <summary>
26-
/// UDP
27-
/// </summary>
28-
public static readonly IPProtocol UDP = new IPProtocol("udp");
29-
}
6+
public class IPProtocol : Networking.v2.Serialization.IPProtocol<IPProtocol>
7+
{ }
308
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using OpenStack.Networking.v2.Serialization;
2+
3+
namespace OpenStack.Networking.v2
4+
{
5+
/// <inheritdoc />
6+
public class IPProtocol : IPProtocol<IPProtocol>
7+
{ }
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using OpenStack.Serialization;
2+
3+
namespace OpenStack.Networking.v2.Serialization
4+
{
5+
/// <summary>
6+
/// Internet Protocols.
7+
/// </summary>
8+
/// <exclude />
9+
public class IPProtocol<T> : StringEnumeration
10+
where T : IPProtocol<T>, new()
11+
{
12+
/// <summary>
13+
/// ICMP
14+
/// </summary>
15+
public static readonly T ICMP = new T {DisplayName = "icmp"};
16+
17+
/// <summary>
18+
/// TCP
19+
/// </summary>
20+
public static readonly T TCP = new T {DisplayName = "tcp"};
21+
22+
/// <summary>
23+
/// UDP
24+
/// </summary>
25+
public static readonly T UDP = new T {DisplayName = "udp"};
26+
}
27+
}

src/corelib/OpenStack.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
<Compile Include="Images\v2\Serialization\ImageStatus.cs" />
195195
<Compile Include="Networking\IPVersion.cs" />
196196
<Compile Include="Networking\NamespaceDoc.cs" />
197+
<Compile Include="Networking\v2\IPProtocol.cs" />
197198
<Compile Include="Networking\v2\Layer3\SecurityGroup.cs" />
198199
<Compile Include="Networking\v2\Layer3\SecurityGroupRule.cs" />
199200
<Compile Include="Networking\v2\AllowedAddress.cs" />
@@ -224,6 +225,7 @@
224225
<Compile Include="Networking\v2\Network.cs" />
225226
<Compile Include="Networking\v2\Operator\NamespaceDoc.cs" />
226227
<Compile Include="Networking\v2\Operator\NetworkDefinition.cs" />
228+
<Compile Include="Networking\v2\Serialization\IPProtocol.cs" />
227229
<Compile Include="Networking\v2\Serialization\RouterCollection.cs" />
228230
<Compile Include="Networking\v2\Serialization\FloatingIPCollection.cs" />
229231
<Compile Include="Networking\v2\Serialization\NetworkResourceStatus.cs" />

0 commit comments

Comments
 (0)