
                         L    S r SSKJr  SSKJr  SSKJr  SSKJr  SrSr	S r
S	 rg
)z7Convenience functions for dealing with alias IP ranges.    )absolute_import)division)unicode_literals)
exceptionszAn alias IP range must contain range name and IP range separated by a colon, or only the IP range.  The IP range portion can be expressed as a full IP CIDR range (e.g. 10.1.1.0/24), or a single IP address (e.g. 10.1.1.1), or an IP CIDR net mask (e.g. /24)zAn alias IP range must contain range name and IP CIDR net mask (e.g. /24) separated by a colon, or only the IP CIDR net mask (e.g. /24).c                 z    U(       d  / $ UR                  S5      nU Vs/ s H  n[        XU5      PM     sn$ s  snf )a  Returns a list of AliasIpRange messages by parsing the input string.

Args:
  messages: GCE API messages.
  instance: If True, this call is for parsing instance flags; otherwise
      it is for instance template.
  alias_ip_ranges_string: Command line string that specifies a list of
      alias IP ranges. Alias IP ranges are separated by semicolons.
      Each alias IP range has the format <alias-ip-range> or
      {range-name}:<alias-ip-range>.  The range-name is the name of the
      range within the network interface's subnet from which to allocate
      an alias range. alias-ip-range can be a CIDR range, an IP address,
      or a net mask (e.g. "/24"). Note that the validation is done on
      the server. This method just creates the request message by parsing
      the input string.
      Example string:
      "/24;range2:192.168.100.0/24;range3:192.168.101.0/24"

Returns:
  A list of AliasIpRange messages.
;)split$_CreateAliasIpRangeMessageFromString)messagesinstancealias_ip_ranges_stringalias_ip_range_stringsss        :lib/googlecloudsdk/api_lib/compute/alias_ip_range_utils.py$CreateAliasIpRangeMessagesFromStringr   "   sI    . 
 I177<%
'%! /x1
E%
' ' 
's   8c                    U R                  5       nUR                  S5      n[        U5      S:X  a  US   Ul        U$ [        U5      S:X  a  US   Ul        US   Ul        U$ [
        R                  " SU(       a
  [        5      e[        5      e)z?Returns a new AliasIpRange message by parsing the input string.:   r      aliases)	AliasIpRanger	   lenipCidrRangesubnetworkRangeNamecalliope_exceptionsInvalidArgumentException$_INVALID_FORMAT_MESSAGE_FOR_INSTANCE-_INVALID_FORMAT_MESSAGE_FOR_INSTANCE_TEMPLATE)r   r   alias_ip_range_stringalias_ip_rangetokenss        r   r
   r
   @   s     ((*. &&s+&[A!'N 
 6{a)/N&!'N 
	 
6
608,< < ;< <    N)__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r   r   r   r
    r"   r   <module>r'      s6    > &  ' EA %J .
'<r"   