-
Notifications
You must be signed in to change notification settings - Fork 98
Network.ListSecurityGroupAsync #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using Newtonsoft.Json; | ||
| using OpenStack.Networking.v2; | ||
| using OpenStack.Serialization; | ||
|
|
||
| namespace OpenStack.Networking.v2.Layer3 | ||
| { | ||
| /// <summary> | ||
| ///Regpresents the security group of the <see cref="NetworkingService"/> | ||
| /// </summary> | ||
| [JsonConverterWithConstructor(typeof(RootWrapperConverter), "securitygroup")] | ||
| public class SecurityGroup | ||
| { | ||
| /// <summary> | ||
| ///the security group description | ||
| /// </summary> | ||
| [JsonProperty("description")] | ||
| public string Description; | ||
|
|
||
| /// <summary> | ||
| ///the UUID of security group | ||
| /// </summary> | ||
| [JsonProperty("id")] | ||
| public Identifier Id; | ||
|
|
||
| /// <summary> | ||
| /// the security group name | ||
| /// </summary> | ||
| [JsonProperty("name")] | ||
| public string Name; | ||
|
|
||
| /// <summary> | ||
| ///A list of <see cref="SecurityGroup"/> objects. | ||
| /// </summary> | ||
| [JsonProperty("security_group_rules")] | ||
| public IList<SecurityGroupRule> SecurityGroupRules; | ||
|
|
||
| /// <summary> | ||
| ///The UUId of tenant who owns the scurity group | ||
| /// </summary> | ||
| [JsonProperty("tenant_id")] | ||
| public string TenantId; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using Newtonsoft.Json; | ||
| namespace OpenStack.Networking.v2.Layer3 | ||
| { | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| public class SecurityGroupRule | ||
| { | ||
| /// <summary> | ||
| ///ngress or egress: the direction in which the security group rule is applied. | ||
| ///For a compute instance, an ingress security group rule is applied to incoming (ingress) traffic for that instance. | ||
| ///An egress rule is applied to traffic leaving the instance. | ||
| /// </summary> | ||
| [JsonProperty("direction")] | ||
| public string Direction; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a subclass of When a resource property has a fixed set of values, it helps to wrap that in a enum-like class so that user's don't have to go to the API documentation to know what the allowed values are, in this case "egress" and "ingress". The hierarchy of the |
||
|
|
||
| /// <summary> | ||
| ///Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. | ||
| /// </summary> | ||
| [JsonProperty("ethertype")] | ||
| public string Ethertype; | ||
|
|
||
| /// <summary> | ||
| /// The UUID of the security group rule. | ||
| /// </summary> | ||
| [JsonProperty("id")] | ||
| public Identifier Id; | ||
|
|
||
| /// <summary> | ||
| ///The maximum port number in the range that is matched by the security group rule. | ||
| ///The port_range_min attribute constrains the port_range_max attribute. | ||
| ///If the protocol is ICMP, this value must be an ICMP type. | ||
| /// </summary> | ||
| [JsonProperty("port_range_max")] | ||
| public int PortRangeMax; | ||
|
|
||
| ///<summary> | ||
| ///The minimum port number in the range that is matched by the security group rule. | ||
| ///If the protocol is TCP or UDP, this value must be less than or equal to the port_range_max attribute value. | ||
| ///If the protocol is ICMP, this value must be an ICMP type. | ||
| /// </summary> | ||
| [JsonProperty("port_range_min")] | ||
| public int PortRangeMin; | ||
|
|
||
| /// <summary> | ||
| ///The protocol that is matched by the security group rule. Value is null, icmp, icmpv6, tcp, or udp. | ||
| /// </summary> | ||
| [JsonProperty("protocol")] | ||
| public string Protocol; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a subclass of |
||
|
|
||
| ///<summary> | ||
| ///The remote group UUID to associate with this security group rule. | ||
| ///You can specify either the remote_group_id or remote_ip_prefix attribute in the request body. | ||
| /// </summary> | ||
| [JsonProperty("remote_group_id")] | ||
| public string RemoteGroupId; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be an |
||
|
|
||
| /// <summary> | ||
| ///The remote IP prefix to associate with this security group rule. | ||
| ///You can specify either the remote_group_id or remote_ip_prefix attribute in the request body. | ||
| ///This attribute value matches the IP prefix as the source IP address of the IP packet. | ||
| /// </summary> | ||
| [JsonProperty("remote_ip_prefix")] | ||
| public string RemoteIpPrefix; | ||
|
|
||
| /// <summary> | ||
| ///The UUId of security group | ||
| /// </summary> | ||
| [JsonProperty("security_group_id")] | ||
| public string SecurityGroupId; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be an |
||
|
|
||
| /// <summary> | ||
| /// The UUID of the tenant who owns the security group rule. Only administrative users can specify a tenant UUID other than their own. | ||
| /// </summary> | ||
| [JsonProperty("tenant_id")] | ||
| public string TenantId; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using OpenStack.Serialization; | ||
| using OpenStack.Networking.v2.Layer3; | ||
|
|
||
| namespace OpenStack.Networking.v2.Serialization | ||
| { | ||
| /// <summary> | ||
| /// Represents a collection of security groups resources returned by the <see cref="NetworkingService"/>. | ||
| /// <para>Intended for custom implementations and stubbing responses in unit tests.</para> | ||
| /// </summary> | ||
| [JsonConverterWithConstructor(typeof(RootWrapperConverter), "security_groups")] | ||
| public class NetSecurityGroupCollection : List<SecurityGroup> | ||
| { | ||
|
|
||
| /// <summary> | ||
| ///Initializes a new instance of the<see cref="SecurityGroup"/> class. | ||
| /// </summary> | ||
| public NetSecurityGroupCollection() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| /// <summary> | ||
| ///Initializes a new instance of the<see cref="SecurityGroup"/> class. | ||
| /// </summary> | ||
| /// <param name="securityGroups"></param> | ||
| public NetSecurityGroupCollection(IEnumerable<SecurityGroup> securityGroups) : base(securityGroups) | ||
| { | ||
|
|
||
| } | ||
|
|
||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TenantIdshould be removed.In general, admin-only properties should not be exposed in the main namespaces. The idea being that if a user picks up the SDK, they only see functionality and data that they are able to work with. If an operator wants to add admin functionality to the SDK, it is implemented in an
XXX.Operatornamespace, so that users don't see it unless they explicitly import it. 😄