
    G                        S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SS	K
Jr  SS
K
Jr  SSK
Jr  SSS.rSSSS.rSSSS.rSSSS.rSSS.r\	R(                  \	R*                  " \	R,                  R.                  \	R,                  R0                  \	R,                  R2                  5       " S S\R4                  5      5       5       rS@S jr  SAS jrS  rS! rS" r S# r!S$ r"SBS% jr#SBS& jr$SBS' jr%S( r&S) r'SBS* jr(S+ r)S, r*S- r+SBS. jr,SBS/ jr-S0 r.S1 r/S2 r0S3 r1S4 r2S5 r3S6 r4S7 r5S8 r6S9 r7S: r8S; r9S< r:S= r;S> r<S? r=g)Cz9Flags and helpers for the compute interconnects commands.    )absolute_import)division)unicode_literalsN)actions)arg_parsers)base)
completers)flags)resource_manager_tags_utilszDedicated private interconnect.z:Partner interconnect. Only available to approved partners.)	DEDICATEDPARTNERz[Dedicated private interconnect. (Warning: IT_PRIVATE is deprecated, use DEDICATED instead.))
IT_PRIVATEr   r   z10Gbps Ethernet, LR Optics.z100Gbps Ethernet, LR Optics.z400Gbps Ethernet, LR4 Optics.)LINK_TYPE_ETHERNET_10G_LRLINK_TYPE_ETHERNET_100G_LRLINK_TYPE_ETHERNET_400G_LR4a  If specified then the interconnect is created on MACsec capable hardware ports. If not specified, the interconnect is created on non-MACsec capable ports first, if available. This parameter can only be provided during interconnect INSERT and cannot be changed using interconnect PATCH.zIf specified then the interconnect is created on Cross-Site Network capable hardware ports. This parameter can only be provided during interconnect INSERT and cannot be changed using interconnect PATCH.zIf specified then the interconnect is created on L2 forwarding capable hardware ports. This parameter can only be provided during interconnect INSERT and cannot be changed using interconnect PATCH.)MACSECCROSS_SITE_NETWORKL2_FORWARDINGz
Subzone a.z
Subzone b.)abc                   (   ^  \ rS rSrU 4S jrSrU =r$ )InterconnectsCompleterN   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.interconnectsz compute interconnects list --uri)
collectionlist_command )superr   __init__)selfkwargs	__class__s     =lib/googlecloudsdk/command_lib/compute/interconnects/flags.pyr    InterconnectsCompleter.__init__T   s(    	
 $0 *7     r   )__name__
__module____qualname____firstlineno__r    __static_attributes____classcell__)r#   s   @r$   r   r   N   s     r&   r   c                 :    [         R                  " S[        UU SS9$ )Ninterconnectr   )resource_name	completerpluralrequiredglobal_collectioncompute_flagsResourceArgumentr   )r2   r1   s     r$   InterconnectArgumentr7   [   s$    		'	'"&/
1 1r&   c                 @    [         R                  " SS[        SUSU US9$ )Nz--interconnectr.   Fr   )namer/   r0   r1   r2   r3   
short_helpdetailed_helpr4   )r:   r2   r;   s      r$   $InterconnectArgumentForOtherResourcer<   d   s/     
	'	'"&/!
# #r&   c                 @    Uc  gU R                   R                  U5      $ )zConverts the interconnect type flag to a message enum.

Args:
  messages: The API messages holder.
  interconnect_type_arg: The interconnect type flag value.

Returns:
  An InterconnectTypeValueValuesEnum of the flag value, or None if absent.
N)InterconnectInterconnectTypeValueValuesEnum)messagesinterconnect_type_args     r$   GetInterconnectTyperB   r   s)     "  @@ r&   c                 @    Uc  gU R                   R                  U5      $ )zConverts the link type flag to a message enum.

Args:
  messages: The API messages holder.
  link_type_arg: The link type flag value.
Returns:
  An LinkTypeValueValuesEnum of the flag value, or None if absent.
N)r>   LinkTypeValueValuesEnum)r@   link_type_args     r$   GetLinkTyperF      s$       88GGr&   c                     U(       d  / $ [        [        SU Vs/ s H  n[        X5      PM     sn5      5      n[        [        R                  R                  U5      5      $ s  snf )a  Converts the requested-features flag to a list of message enums.

Args:
  messages: The API messages holder.
  requested_features_arg: A list of the interconnect feature type flag values.

Returns:
  A list of RequestedFeaturesValueListEntryValuesEnum values, or None if
  absent.
N)listfilterGetRequestedFeaturecollectionsOrderedDictfromkeys)r@   requested_features_argffeaturess       r$   GetRequestedFeaturesrQ      sf     
 I
 .-! "(.-( 
k%%..x8	99s   A!c                     US:X  a  U R                   R                  S5      $ US:X  a  U R                   R                  S5      $ US:X  a  U R                   R                  S5      $ g)zConverts interconnect feature type flag to a message enum.

Args:
  messages: The API messages holder.
  feature_arg: The feature type flag value.

Returns:
  A RequestedFeaturesValueListEntryValuesEnum of the flag value.
r   	IF_MACSECr   IF_CROSS_SITE_NETWORKr   IF_L2_FORWARDINGN)r>   )RequestedFeaturesValueListEntryValuesEnum)r@   feature_args     r$   rJ   rJ      sz     H  JJ  ((  JJ 
 O#  JJ  
r&   c                     US:X  a   U R                   R                  R                  $ US:X  a   U R                   R                  R                  $ g)zConverts the subzone flag to a message enum.

Args:
  messages: The API messages holder.
  subzone_arg: The subzone flag value.

Returns:
  An SubzoneValueValuesEnum of the flag value, or None if absent.
r   r   N)r>   SubzoneValueValuesEnum	SUBZONE_A	SUBZONE_B)r@   subzone_args     r$   
GetSubzoner]      sG     C  77AAAc  77AAA	r&   c                     [        U 5        [        U 5        [        U 5        [        XS9  [	        U 5        [        X5        [        U 5        g)a  Adds shared flags for create command to the argparse.ArgumentParser.

These flags are shared by the create command and the create members command
for interconnect groups.

Args:
  parser: The argparse.ArgumentParser to add the flags to.
  required: Whether the flags are required.
)r2   N)AddAdminEnabledAddDescriptionAddCustomerNameAddLinkTypeAddNocContactEmailAddRequestedLinkCountAddRequestedFeaturesparserr2   s     r$   AddCreateCommonArgsrh      s<     &&f(V)vr&   c                     [        X5        [        U 5        [        U 5        U[        R                  R
                  :X  a  [        X5        g[        U 5        g)z=Adds flags for create command to the argparse.ArgumentParser.N)rh   
AddSubzoneAddResourceManagerTagsr   ReleaseTrackGAAddInterconnectTypeGAAddInterconnectTypeBetaAndAlpha)rg   trackr2   s      r$   AddCreateArgsrq      s>    f'V 
d"""&+#F+r&   c                 0    [        X5        [        X5        g)zYAdds flags for interconnect groups create members command to the argparse.ArgumentParser.N)rh   rn   rf   s     r$   /AddCreateArgsForInterconnectGroupsCreateMembersrs      s    f')r&   c                 $    U R                  SSS9  g)z5Adds description flag to the argparse.ArgumentParser.z--descriptionz6An optional, textual description for the interconnect.helpNadd_argumentrg   s    r$   r`   r`      s    C  Er&   c                 .    U R                  S[        SS9  g)z1Adds subzone flag to the argparse.ArgumentParser.z	--subzonezF      Subzone in the LOCATION specified by the --location flag.
      )choicesrv   N)rx   _SUBZONE_CHOICESry   s    r$   rj   rj     s     
  r&   c                 0    U R                  S[        USS9  g);Adds interconnect-type flag to the argparse.ArgumentParser.--interconnect-type&      Type of the interconnect.
      r{   r2   rv   N)rx   INTERCONNECT_TYPE_CHOICES_GArf   s     r$   rn   rn     s#    *
	  r&   c                 :    U =(       a    U R                  5       S:H  $ )Nr   )upper)values    r$   _ShouldShowDeprecatedWarningr     s    		05;;=L00r&   c                 h    U R                  S[        [        R                  " SSS[        SSS9SSS	9  g
)r~   r   zinterconnect-typeFzLIT_PRIVATE will be deprecated for {flag_name}. Please use DEDICATED instead.zPValue IT_PRIVATE for {flag_name} has been removed. Please use DEDICATED instead.)removedshow_add_helpshow_messagewarnerrorTr   )r{   actionr2   rv   N)rx   )_INTERCONNECT_TYPE_CHOICES_BETA_AND_ALPHAr   DeprecationActionr   ry   s    r$   ro   ro     sI    7&&
300	1 
  r&   c                 T    U R                  S[        R                  " [        S9SSS9  g)z<Adds requested-features flag to the argparse.ArgumentParser.z--requested-features)r{   FEATURESz>      List of features requested for this interconnect.
      typemetavarrv   N)rx   r   ArgListREQUESTED_FEATURES_CHOICESry   s    r$   re   re   2  s/    'AB
	  r&   c                 0    U R                  S[        USS9  g)z3Adds link-type flag to the argparse.ArgumentParser.z--link-typez3      Type of the link for the interconnect.
      r   N)rx   LINK_TYPE_CHOICESrf   s     r$   rb   rb   >  s#    
	  r&   c                 0    U R                  SU[        SS9  g)<Adds requestedLinkCount flag to the argparse.ArgumentParser.--requested-link-count@      Target number of physical links in the link bundle.
      )r2   r   rv   Nrx   intrf   s     r$   rd   rd   J  s#    
	  r&   c                 .    U R                  S[        SS9  g)r   r   r   )r   rv   Nr   ry   s    r$   AddRequestedLinkCountForUpdater   V  s     
  r&   c                 $    U R                  SSS9  g)z9Adds nocContactEmail flag to the argparse.ArgumentParser.z--noc-contact-emailz      Email address to contact the customer NOC for operations and maintenance
      notifications regarding this interconnect.
      ru   Nrw   ry   s    r$   rc   rc   `  s    
  r&   c                 $    U R                  SSS9  g)z6Adds customerName flag to the argparse.ArgumentParser.z--customer-namez    Customer name to put in the Letter of Authorization as the party
    authorized to request an interconnect. This field is required for most
    interconnects, however it is prohibited when creating a Cross-Cloud Interconnect.
    ru   Nrw   ry   s    r$   ra   ra   j  s      r&   c                 H    U R                  5       nUR                  SSSSS9  g)6Adds adminEnabled flag to the argparse.ArgumentParser.--admin-enabled
store_trueNa,        Administrative status of the interconnect. If not provided on creation,
      defaults to enabled.
      When this is enabled, the interconnect is operational and will carry
      traffic across any functioning linked interconnect attachments. Use
      --no-admin-enabled to disable it.
      r   defaultrv   add_mutually_exclusive_grouprx   rg   admin_enabled_argss     r$   r_   r_   v  s2    ::<!!
	 " 
r&   c                 H    U R                  5       nUR                  SSSSS9  g)r   r   r   Nz      Administrative status of the interconnect.
      When this is enabled, the interconnect is operational and will carry
      traffic across any functioning linked interconnect attachments. Use
      --no-admin-enabled to disable it.
      r   r   r   s     r$   AddAdminEnabledForUpdater     s2    ::<!!
	 " 	r&   c                 (    U R                  SSSSS9  g)z7Adds macsecEnabled flag to the argparse.ArgumentParser.	--enabledr   Nz      Enable or disable MACsec on this Interconnect. MACsec enablement will fail
      if the MACsec configuration is not specified. Use --no-enabled to disable
      it.
      r   rw   ry   s    r$   AddMacsecEnabledForUpdater     s#    
	  r&   c                 (    U R                  SSSSS9  g)z2Adds failOpen flag to the argparse.ArgumentParser.z--fail-openr   Na        If enabled, the Interconnect will be configured with a should-secure
      MACsec security policy, that allows the Google router to fallback to
      cleartext traffic if the MKA session cannot be established. By default,
      the Interconnect will be configured with a must-secure security policy
      that drops all traffic if the MKA session cannot be established with your
      router. Use --no-fail-open to disable it.
      r   rw   ry   s    r$   AddFailOpenForUpdater     s#    
	  r&   c                 &    U R                  SSSS9  g)1Adds keyName flag to the argparse.ArgumentParser.
--key-nameTz      A name of pre-shared key being added to MACsec configuration of the
      interconnect. The name must be 1-63 characters long, and comply with
      RFC1035.
      r2   rv   Nrw   ry   s    r$   *AddMacsecPreSharedKeyNameForAddOrUpdateKeyr     s     
  r&   c                 (    U R                  SSSSS9  g)r   z--start-timeFNaN        A RFC3339 timestamp on or after which the key is valid. startTime can be
      in the future. If the keychain has a single key, --start-time can be
      omitted. If the keychain has multiple keys, --start-time is mandatory for
      each key. The start times of two consecutive keys must be at least 6 hours
      apart.
      )r2   r   rv   rw   ry   s    r$   /AddMacsecPreSharedKeyStartTimeForAddOrUpdateKeyr     s#    
	  
r&   c                 &    U R                  SSSS9  g)r   r   Tzj      The name of pre-shared key being removed from MACsec configuration of the
      interconnect.
      r   Nrw   ry   s    r$   %AddMacsecPreSharedKeyNameForRomoveKeyr     s     
  r&   c                 (    U R                  SSSSS9  g)1Adds enabled flag to the argparse.ArgumentParser.r   Nr   z      Enable or disable application awareness on the interconnect. Application awareness enablement will fail
      if the application awareness configuration is not specified. Use --no-enabled to disable
      it.)r   r   rv   rw   ry   s    r$   AddAaiEnabledr     s#    	  r&   c                 (    U R                  SSSSS9  g)r   z--profile-description Fz8      Add profile description for application awareness.)r   r2   rv   Nrw   ry   s    r$   AddAaiProfileDescriptionr     s#    <	  r&   c                     U R                  S[        R                  " [        [        [        [        [        [        S.S9SSS9  g)z>Adds bandwidthPercentages flag to the argparse.ArgumentParser.z--bandwidth-percentages)TC1TC2TC3TC4TC5TC6)specTa        A list of bandwidth percentages, for configuring the bandwidth percentage policy or traffic shaping.

      For configuring bandwidth percentages for the bandwidth percentage policy:

      1. Each bandwidth percentage value must be an integer between 1-100.
      2. It is required to provide a percentage value for each class.
      3. The sum of all bandwidth percentages must be 100.

      For configuring bandwidth percentages for traffic shaping:

      1. Each bandwidth percentage value must be an integer between 1-100.
      2. It is not required to provide a percentage value for each class.
      3. The sum of all bandwidth percentages does not need to be 100.
      )r   r2   rv   N)rx   r   ArgDictr   ry   s    r$   AddAaiBandwidthPercentagesr     sI     		 
  r&   c                 x    0 nUR                  5        H#  u  p4UUU R                  R                  U5      '   M%     U$ )a  Converts the bandwidth percentages argument to a dictionary of enums to ints.

Args:
  messages: The API messages holder.
  bandwidth_percentages_arg: The bandwidth percentages flag value.

Returns:
  An dictionary of TrafficClassValueValuesEnum to percentage
)items;InterconnectApplicationAwareInterconnectBandwidthPercentageTrafficClassValueValuesEnum)r@   bandwidth_percentages_argresulttraffic_class
percentages        r$   GetAaiBandwidthPercentagesr     sM     &#<#B#B#Dm
 		 LLhh	
 $E 
-r&   c                 N    U R                  S[        R                  " 5       SSS9  g)zEAdds the --resource-manager-tags flag to the argparse.ArgumentParser.z--resource-manager-tagsz	KEY=VALUEz^          A comma-separated list of Resource Manager tags to apply to the interconnect.
      r   N)rx   r   r   ry   s    r$   rk   rk   &  s,     
	  r&   c           	          [         R                  " U5      nU R                  n[        UR	                  5       5       VVs/ s H  u  pEUR
                  R                  XES9PM      nnnU" UR                  US9S9$ s  snnf )zDConverts the resource manager tags argument into InterconnectParams.)keyr   )additionalProperties)resourceManagerTags)r   GetResourceManagerTagsInterconnectParamssortedr   ResourceManagerTagsValueAdditionalProperty)r@   resource_manager_tagsresource_manager_tags_mapparamsr   r   additional_propertiess          r$   CreateInterconnectParamsr   2  s     "88
 
 &&& 8>>@AA*# %%88S8NA   
 994 : 
 	s   %A:)TF)TN)T)>__doc__
__future__r   r   r   rK   googlecloudsdk.callioper   r   r   "googlecloudsdk.command_lib.computer	   r
   r5   r   r   r   r   r   r|   UniverseCompatibleReleaseTracksrl   ALPHABETArm   ListCommandCompleterr   r7   r<   rB   rF   rQ   rJ   r]   rh   rq   rs   r`   rj   rn   r   ro   re   rb   rd   r   rc   ra   r_   r   r   r   r   r   r   r   r   r   r   rk   r   r   r&   r$   <module>r      s   @ &  '  + / ( 9 E J 3K  	" 	*D- ) "?"@#B 		N
	O * 
	  T..33T5F5F5I5IZ<<  1 377;#"H:26"&,*E	1*				 
 	
D(	r&   