
    A                        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KJr  SSKJr  SrSrS rS rS rS rS rS rS rS rS rS rS rS r S8S jr!S r"S r#S r$S  r%S! r&S" r'S# r(   S9S$ jr)S% r*S& r+S' r,S( r-S) r.S* r/S+ r0S8S, jr1S- r2S. r3S/ r4\Rj                   " S0 S1\Rl                  5      5       r7\7Rp                  4S2 jr9\7Rp                  4S3 jr:S4 r;S5 r<S6 r=S7 r>g):z/Common flags for network connectivity commands.    )absolute_import)division)unicode_literalsN)arg_parsers)base)concepts)deps)util)	arg_utils)concept_parsers)presentation_specsz--globalz--regionc           
      T    U R                  SS[        R                  " 5       / SUSS9  g)z>Adds the --exclude-export-ranges argument to the given parser.--exclude-export-rangesF
CIDR_RANGEzzSubnet IP address range(s) to hide from other VPC networks that are
        connected through Network Connectivity Center.requiredtypedefaultmetavarhiddenhelpNadd_argumentr   ArgListparserhide_exclude_export_ranges_flags     <lib/googlecloudsdk/command_lib/network_connectivity/flags.pyAddExcludeExportRangesFlagr   %   s5     ,:  ;    c           
      T    U R                  SS[        R                  " 5       / SUSS9  g)z>Adds the --include-export-ranges argument to the given parser.--include-export-rangesFr   zzSubnet IP address range(s) to export to other VPC networks that are
        connected through Network Connectivity Center.r   Nr   r   hide_include_export_ranges_flags     r   AddIncludeExportRangesFlagr%   2   s7     	 ,:  	r    c           
      T    U R                  SS[        R                  " 5       SSUSS9  g)zIAdds the --include-export-ranges argument to the update operation parser.r"   FNr   z'New include export ranges of the spoke.r   r   r#   s     r    AddUpdateIncludeExportRangesFlagr'   A   5    
 	 ,8  r    c           
      T    U R                  SS[        R                  " 5       SSUSS9  g)zIAdds the --exclude-export-ranges argument to the update operation parser.r   FNr   z'New exclude export ranges of the spoke.r   r   r   s     r    AddUpdateExcludeExportRangesFlagr*   Q   r(   r    c                 N    [         R                  " SU R                  SSSS.SSS9$ )	Nz
--capacity)1gz$Gateway will have capacity of 1 Gbps)10gz%Gateway will have capacity of 10 Gbps)100gz&Gateway will have capacity of 100 Gbps)CAPACITY_1_GBPSCAPACITY_10_GBPSCAPACITY_100_GBPSz(Set the capacity of the gateway in Gbps.T)arg_namemessage_enumcustom_mappingshelp_strr   )r   ChoiceEnumMapperCapacityValueValuesEnum)gateway_messages    r   GetCapacityArgr9   a   s9    		#	#"::KN  :
 r    c                 L    [        U 5      R                  R                  U5        g N)r9   
choice_argAddToParser)r8   r   s     r   AddCapacityFlagr>   r   s    !,,88@r    c           	      R    U R                  SS[        R                  " 5       / SSS9  g)z=Adds the --ip-range-reservation argument to the given parser.z--ip-range-reservationsTr   z'The IP range reservation for the spoke.)r   r   r   r   r   Nr   r   s    r   AddIpRangeReservationsFlagrA   v   s0     8  r    c                 $    U R                  SSS9  g)z8Adds the --landing-network argument to the given parser.z--landing-networkzHThe landing network for the spoke. The network must already
      exist.)r   Nr   r@   s    r   AddLandingNetworkFlagrD      s     	  r    c                 B    [         R                  R                  U 5        g)z-Add the --async argument to the given parser.N)r   
ASYNC_FLAGr=   r@   s    r   AddAsyncFlagrG      s    //f%r    c                 &    U R                  SSSS9  g)z,Adds the --hub argument to the given parser.z--hubTz>Hub that the spoke will attach to. The hub must already exist.r   r   NrC   r@   s    r   
AddHubFlagrJ      s!     	K  Mr    c                 &    U R                  SSUS9  g)z*Adds the --spoke flag to the given parser.z--spokeTrI   NrC   r   	help_texts     r   AddSpokeFlagrN      s      r    c                 &    U R                  SSUS9  g)z/Adds the --spoke-etag flag to the given parser.z--spoke-etagTrI   NrC   rL   s     r   AddSpokeEtagFlagrP      s      r    c                 \    U(       a  U R                  SSSSS9  gU R                  SSSSS9  g)z.Adds the --group argument to the given parser.z--groupTFzCGroup that the spoke will be part of. The group must already exist.)r   r   r   NrC   )r   r   s     r   AddGroupFlagrR      sK     
     r    c                 &    U R                  SSSS9  g)z0Adds the --network argument to the given parser.z	--networkTzYour VPC network that contains the peering to the Producer VPC,
      which this spoke connects to the Hub. The peering must already exist and
      be in the ACTIVE state.rI   NrC   r@   s    r   AddNetworkFlagrT      s     !  "r    c                 &    U R                  SSSS9  g)z0Adds the --peering argument to the given parser.z	--peeringTzPeering between your network and the Producer VPC, which this
      spoke connects to the Hub. The peering must already exist and be in the
      ACTIVATE state.rI   NrC   r@   s    r   AddPeeringFlagrV      s       r    c                 &    U R                  SSSS9  g)z4Adds the --vpc-network argument to the given parser.z--vpc-networkTz[VPC network that the spoke provides connectivity to.
      The resource must already exist.rI   NrC   r@   s    r   AddVPCNetworkFlagrX      s"     	*  +r    c                 &    U R                  SSUS9  g)z0Adds the --description flag to the given parser.z--descriptionFrI   NrC   rL   s     r   AddDescriptionFlagrZ      s      r    c                 &    U R                  SSSS9  g)z,Adds the --details flag to the given parser.z	--detailsFz'Additional details behind the rejectionrI   NrC   r@   s    r   AddRejectionDetailsFlagr\      s    8  :r    c                 L    U R                  [        SU[        R                  S9  g)z.Add the --global argument to the given parser.z#Indicates that the spoke is global.)r   r   actionN)r   GLOBAL_ARGUMENTr
   StoreGlobalAction)r   r   s     r   AddGlobalFlagra      s'    0##	  %r    c                 J    SnU(       a  US-  nU R                  [        X#US9  g)z.Add the --region argument to the given parser.z         A Google Cloud region. To see the names of regions, see [Viewing a list of available regions](https://cloud.google.com/compute/docs/regions-zones/viewing-regions-zones#viewing_a_list_of_available_regions).z" Use ``-`` to specify all regions.)r   r   r   N)r   REGION_ARGUMENT)r   supports_region_wildcardr   r   region_help_texts        r   AddRegionFlagrf      s5    Y<<f>N  r    c                 P    U R                  SSS9n[        XB5        [        XAUSS9  g)zOAdd a group which contains the global and region arguments to the given parser.FTr   mutex)r   N)	add_groupra   rf   )r   rd   hide_global_arghide_region_argregion_groups        r   AddRegionGrouprn     s0    
 !!5!=,.or    c           	      V    SnU R                  SSU[        R                  " 5       / SS9  g)z7Add the --spoke-locations argument to the given parser.a@           A comma separated list of locations. The locations can be set to 'global'
        and/or Google Cloud supported regions. To see the names of regions, see
        [Viewing a list of available regions](https://cloud.google.com/compute/docs/regions-zones/viewing-regions-zones#viewing_a_list_of_available_regions).z--spoke-locationsFLOCATION)r   r   r   r   r   Nr   )r   spoke_locations_help_texts     r   AddSpokeLocationsFlagrr     s;    a 	$   r    c                 2    SnU R                  SSSS/SUS9  g)z,Add the --view argument to the given parser.zO        Enumeration to control which spoke fields are included in the response.z--viewFbasicdetailed)r   choicesr   r   NrC   )r   view_help_texts     r   AddViewFlagrx      s1    R.
#  r    c                     [         R                  " SS[        5       [         R                  SS9n[        R
                  " SUSSR                  U5      S9n[        R                  " U/5      R                  U 5        g)	zAdd a resource argument for a hub.

Args:
  parser: the parser for the command.
  desc: the string to describe the resource, such as 'to create'.
z2networkconnectivity.projects.locations.global.hubshubF)resource_namehubsId
projectsIddisable_auto_completersTzName of the hub {}.nameconcept_specr   
group_helpN)
r   ResourceSpecHubAttributeConfig DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   ResourcePresentationSpecformatr   ConceptParserr=   )r   deschub_concept_specpresentation_specs       r   AddHubResourceArgr   ,  sv     **:!::#% )AA#&--d3	5
 !2 34@@Hr    c           
         [         R                  " SSS[        5       [        5       [         R                  SS9n[
        R                  " SUSSR                  U5      S9n[        R                  " U/5      R                  U 5        g	)
zAdd a resource argument for a group.

Args:
  parser: the parser for the command.
  desc: the string to describe the resource, such as 'to create'.
z9networkconnectivity.projects.locations.global.hubs.groupsgroupv1F)r{   api_versiongroupsIdr|   r}   r~   TzName of the group {}.r   N)r   r   GroupAttributeConfigr   r   r   r   r   r   r   r=   )r   r   group_concept_specr   s       r   AddGroupResourceArgr   B  s      ,,A#%!::#% )AA%(//5	7
 !2 34@@Hr    c                  ,    [         R                  " SSS9$ )NspokezThe spoke Id.r   rM   r    ResourceParameterAttributeConfig r    r   SpokeAttributeConfigr   Z  s    		2	2o
/ /r    c                  ,    [         R                  " SSS9$ )Nrz   zThe hub Id.r   r   r   r    r   r   r   _  s    		2	2M
 r    c                  ,    [         R                  " SSS9$ )Nr   zThe group Id.r   r   r   r    r   r   r   e  s    		2	2o
 r    c                     U  Vs/ s H  n[         R                  " U5      PM     nnU(       a%  UR                  [         R                  " S SS95        [        R
                  " SSUS9$ s  snf )z:Get a location argument with the appropriate fallthroughs.c                      g)N-r   r   r    r   <lambda>)LocationAttributeConfig.<locals>.<lambda>u  s    Sr    z(defaults to all regions if not specified)functionhintlocationzThe location Id.)r   rM   fallthroughs)r	   ArgFallthroughappendFallthroughr   r   )location_argumentsregion_resource_commandarglocation_fallthroughss       r   LocationAttributeConfigr   k  sv     +=*<3d#*<  
    ;	=> 
	2	2"(
* *s    A)c           	      r    [         R                  " SS[        5       [        U 5      [         R                  SS9$ )Nz-networkconnectivity.projects.locations.spokesr   F)r{   spokesIdlocationsIdr}   r~   )r   r   r   r   r   r   s    r   GetSpokeResourceSpecr   }  s6    			5#%)*<=::#
% %r    c           	      ^    [         R                  " SS[        U SS9[         R                  SS9$ )Nz&networkconnectivity.projects.locationsregionT)r   F)r{   r   r}   r~   )r   r   r   r   r   s    r   GetRegionResourceSpecr     s6    			.)
d ::#
 r    c                     [         R                  [        /[         R                  [        /[         R
                  [        [        /0nX   $ r;   )ResourceLocationTypeGLOBAL_ONLYr_   REGION_ONLYrc   REGION_AND_GLOBAL)resource_location_typemappings     r   GetResourceLocationArgumentsr     sD    &&(9&&(9,,

/' 
	((r    c                   ~    \ rS rSrSr\R                  " 5       r\R                  " 5       r\R                  " 5       r	Sr
g)r   i  z*Type of locations supported by a resource.r   N)__name__
__module____qualname____firstlineno____doc__enumautor   r   r   __static_attributes__r   r    r   r   r     s'    2		+		+iikr    r   c           	          [        U5      n[        R                  " S[        U5      SSS0SR	                  U5      S9n[
        R                  " U/5      R                  U 5        g)aC  Add a resource argument for a spoke.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  resource_location_type: ResourceLocationType, the type of locations
    supported by the resource.
r   Tr    zName of the spoke {}.r   r   r   flag_name_overridesr   N)r   r   r   r   r   r   r   r=   r   verbr   r   r   s        r   AddSpokeResourceArgr     se     44JK(AA'(:;%r*(//5 !2 34@@Hr    c           	          [        U5      n[        R                  " S[        U5      SSS0SR	                  U5      S9n[
        R                  " U/5      R                  U 5        g)aD  Add a resource argument for a region.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  resource_location_type: ResourceLocationType, the type of locations
    supported by the resource.
r   Tr   r   zThe region of the spokes {}.r   N)r   r   r   r   r   r   r   r=   r   s        r   AddRegionResourceArgr     se     44JK(AA();<%r*/66t< !2 34@@Hr    c                     U R                  SSS9n[        U5        UR                  SSSS9n[        U5        [        U5        g)zIAdd a group which contains the PSC-related arguments to the given parser.FTrh   )r   ri   r   N)rj   AddExportPscFlag6AddExportPscPublishedServicesAndRegionalGoogleApisFlag AddExportPscGlobalGoogleApisFlag)r   	psc_grouppsc_gapi_groups      r   AddPscGroupr     sF    T:)9&&U4&P.8H">2r    c                 D    U R                  S[        R                  SSS9  g)z.Add the --export-psc flag to the given parser.z--export-pscFzCWhether Private Service Connect propagation is enabled for the hub.)r^   r   r   Nr   r   StoreTrueFalseActionr@   s    r   r   r     s'    --T	  r    c                 F    U R                  S[        R                  SSSS9  g)zZAdd the --export-psc-published-services-and-regional-google-apis flag to the given parser.z8--export-psc-published-services-and-regional-google-apisFTzwWhether propagation for Private Service Connect for published services and regional Google APIs is enabled for the hub.r^   r   r   r   Nr   r@   s    r   r   r     s-    @-- I  r    c                 F    U R                  S[        R                  SSSS9  g)zAAdd the --export-psc-global-google-apis flag to the given parser.z--export-psc-global-google-apisFTz^Whether propagation for Private Service Connect for global Google APIs is enabled for the hub.r   Nr   r@   s    r   r   r     s*    '--o  r    )F)FFF)?r   
__future__r   r   r   r   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   r	   /googlecloudsdk.command_lib.network_connectivityr
   $googlecloudsdk.command_lib.util.apisr   (googlecloudsdk.command_lib.util.conceptsr   r   r_   rc   r   r%   r'   r*   r9   r>   rA   rD   rG   rJ   rN   rP   rR   rT   rV   rX   rZ   r\   ra   rf   rn   rr   rx   r   r   r   r   r   r   r   r   r   uniqueEnumr   r   r   r   r   r   r   r   r   r    r   <module>r      sB   6 &  '  / ( 5 1 @ : D G 
;  "A	&
M2"+:% -2#(#(		I,I0/
*$%		) "499 " " *>)O)OI2 *>)O)OI23r    