/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 * 
 *  http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
/*
 * Do not modify this file. This file is generated from the ec2-2016-11-15.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.EC2.Model
{
    /// 
    /// Describes a security group rule.
    /// 
    ///  
    /// 
    /// You must specify exactly one of the following parameters, based on the rule type:
    /// 
    ///   -  
    /// 
    /// CidrIpv4
    /// 
    ///  
-  
    /// 
    /// CidrIpv6
    /// 
    ///  
-  
    /// 
    /// PrefixListId
    /// 
    ///  
-  
    /// 
    /// ReferencedGroupId
    /// 
    ///  
/// 
    /// When you modify a rule, you cannot change the rule type. For example, if the rule
    /// uses an IPv4 address range, you must useCidrIpv4 to specify a new IPv4
    /// address range.
    /// 
    /// 
    public partial class SecurityGroupRuleRequest
    {
        private string _cidrIpv4;
        private string _cidrIpv6;
        private string _description;
        private int? _fromPort;
        private string _ipProtocol;
        private string _prefixListId;
        private string _referencedGroupId;
        private int? _toPort;
        /// 
        /// Gets and sets the property CidrIpv4. 
        /// 
        /// The IPv4 CIDR range. To specify a single IPv4 address, use the /32 prefix length.
        /// 
        /// 
        /// 
        public string CidrIpv4
        {
            get { return this._cidrIpv4; }
            set { this._cidrIpv4 = value; }
        }
        // Check to see if CidrIpv4 property is set
        internal bool IsSetCidrIpv4()
        {
            return this._cidrIpv4 != null;
        }
        /// 
        /// Gets and sets the property CidrIpv6. 
        /// 
        /// The IPv6 CIDR range. To specify a single IPv6 address, use the /128 prefix length.
        /// 
        /// 
        public string CidrIpv6
        {
            get { return this._cidrIpv6; }
            set { this._cidrIpv6 = value; }
        }
        // Check to see if CidrIpv6 property is set
        internal bool IsSetCidrIpv6()
        {
            return this._cidrIpv6 != null;
        }
        /// 
        /// Gets and sets the property Description. 
        /// 
        /// The description of the security group rule.
        /// 
        /// 
        public string Description
        {
            get { return this._description; }
            set { this._description = value; }
        }
        // Check to see if Description property is set
        internal bool IsSetDescription()
        {
            return this._description != null;
        }
        /// 
        /// Gets and sets the property FromPort. 
        /// 
        /// If the protocol is TCP or UDP, this is the start of the port range. If the protocol
        /// is ICMP or ICMPv6, this is the type number. A value of -1 indicates all ICMP/ICMPv6
        /// types. If you specify all ICMP/ICMPv6 types, you must specify all ICMP/ICMPv6 codes.
        /// 
        /// 
        public int FromPort
        {
            get { return this._fromPort.GetValueOrDefault(); }
            set { this._fromPort = value; }
        }
        // Check to see if FromPort property is set
        internal bool IsSetFromPort()
        {
            return this._fromPort.HasValue; 
        }
        /// 
        /// Gets and sets the property IpProtocol. 
        /// 
        /// The IP protocol name (tcp, udp, icmp, icmpv6)
        /// or number (see Protocol
        /// Numbers). 
        /// 
        ///  
        /// 
        /// Use -1 to specify all protocols.
        /// 
        /// 
        public string IpProtocol
        {
            get { return this._ipProtocol; }
            set { this._ipProtocol = value; }
        }
        // Check to see if IpProtocol property is set
        internal bool IsSetIpProtocol()
        {
            return this._ipProtocol != null;
        }
        /// 
        /// Gets and sets the property PrefixListId. 
        /// 
        /// The ID of the prefix list.
        /// 
        /// 
        public string PrefixListId
        {
            get { return this._prefixListId; }
            set { this._prefixListId = value; }
        }
        // Check to see if PrefixListId property is set
        internal bool IsSetPrefixListId()
        {
            return this._prefixListId != null;
        }
        /// 
        /// Gets and sets the property ReferencedGroupId. 
        /// 
        /// The ID of the security group that is referenced in the security group rule.
        /// 
        /// 
        public string ReferencedGroupId
        {
            get { return this._referencedGroupId; }
            set { this._referencedGroupId = value; }
        }
        // Check to see if ReferencedGroupId property is set
        internal bool IsSetReferencedGroupId()
        {
            return this._referencedGroupId != null;
        }
        /// 
        /// Gets and sets the property ToPort. 
        /// 
        /// If the protocol is TCP or UDP, this is the end of the port range. If the protocol
        /// is ICMP or ICMPv6, this is the code. A value of -1 indicates all ICMP/ICMPv6 codes.
        /// If you specify all ICMP/ICMPv6 types, you must specify all ICMP/ICMPv6 codes.
        /// 
        /// 
        public int ToPort
        {
            get { return this._toPort.GetValueOrDefault(); }
            set { this._toPort = value; }
        }
        // Check to see if ToPort property is set
        internal bool IsSetToPort()
        {
            return this._toPort.HasValue; 
        }
    }
}