ConoHaNet.OpenStackMember.CreateNetworkSecurityGroupRule C# (CSharp) Method

CreateNetworkSecurityGroupRule() public method

public CreateNetworkSecurityGroupRule ( string securityGroupId, string direction, string etherType, string portRangeMin = null, string portRangeMax = null, string protocol = null, string remoteGroupId = null, string remoteIpPrefix = null ) : NetworkSecurityGroupRule
securityGroupId string
direction string
etherType string
portRangeMin string
portRangeMax string
protocol string
remoteGroupId string
remoteIpPrefix string
return NetworkSecurityGroupRule
        public NetworkSecurityGroupRule CreateNetworkSecurityGroupRule(string securityGroupId, string direction, string etherType, string portRangeMin = null, string portRangeMax = null, string protocol = null, string remoteGroupId = null, string remoteIpPrefix = null)
        {
            return NetworksProvider.CreatSecurityGroupRule(securityGroupId, direction, etherType, portRangeMin, portRangeMax, protocol, remoteGroupId, remoteIpPrefix, this.DefaultRegion, this.Identity);
        }

Usage Example

        public void CreateNetworkSecurityRuleTest()
        {

            string name = TesterName;
            string description = null;
            var os = new OpenStackMember(UserName, Password, TenantName, TenantId);
            var group = os.CreateNetworkSecurityGroup(name, description);
            Assert.IsNotNull(group);
            try
            {
                string direction = "ingress"; // "ingress" or "egress"
                string etherType = "IPv4"; // "IPv4" or "IPv6"
                string portRangeMin = null;
                string portRangeMax = null;
                string protocol = null;
                string remoteGroupId = null;
                string remoteIpPrefix = null;

                var rule = os.CreateNetworkSecurityGroupRule(group.Id, direction, etherType, portRangeMin, portRangeMax, protocol, remoteGroupId, remoteIpPrefix);
                Assert.IsNotNull(rule);

                Assert.IsTrue(os.DeleteNetworkSecurityGroupRule(rule.Id));
            }
            finally
            {
                Assert.IsTrue(os.DeleteNetworkSecurityGroup(group.Id));
            }
        }
All Usage Examples Of ConoHaNet.OpenStackMember::CreateNetworkSecurityGroupRule
OpenStackMember