
    O                     <   S 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SBS jrS rS rS r S r!S r"S r#S  r$   SCS! jr%S" r&S# r'S$ r(S% r)S& r*S' r+S( r,SBS) jr-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4\Rj                   " S1 S2\Rl                  5      5       r7\7Rp                  4S3 jr9\7Rp                  4S4 jr:S5 r;S6 r<S7 r=S8 r>S9 r?S: r@S; rAS< rBSDS= jrCS> rDS? rES@ rFSA rGg)Ez/Common flags for network connectivity commands.    N)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"   /   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$   >   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'   N   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   GetCapacityArgr6   ^   s9    		#	#"::KN  :
 r   c                 L    [        U 5      R                  R                  U5        g N)r6   
choice_argAddToParser)r5   r   s     r   AddCapacityFlagr;   o   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   AddIpRangeReservationsFlagr>   s   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   AddLandingNetworkFlagrA      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   AddAsyncFlagrD      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   Nr@   r=   s    r   
AddHubFlagrG      s!     	K  Mr   c                 &    U R                  SSUS9  g)z*Adds the --spoke flag to the given parser.z--spokeTrF   Nr@   r   	help_texts     r   AddSpokeFlagrK      s      r   c                 &    U R                  SSUS9  g)z/Adds the --spoke-etag flag to the given parser.z--spoke-etagTrF   Nr@   rI   s     r   AddSpokeEtagFlagrM      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   Nr@   )r   r   s     r   AddGroupFlagrO      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.rF   Nr@   r=   s    r   AddNetworkFlagrQ      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.rF   Nr@   r=   s    r   AddPeeringFlagrS      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.rF   Nr@   r=   s    r   AddVPCNetworkFlagrU      s"     	*  +r   c                 &    U R                  SSUS9  g)z0Adds the --description flag to the given parser.z--descriptionFrF   Nr@   rI   s     r   AddDescriptionFlagrW      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 rejectionrF   Nr@   r=   s    r   AddRejectionDetailsFlagrY      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   AddGlobalFlagr^      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   AddRegionFlagrc      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_groupr^   rc   )r   ra   hide_global_arghide_region_argregion_groups        r   AddRegionGrouprk     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   AddSpokeLocationsFlagro     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   Nr@   )r   view_help_texts     r   AddViewFlagru     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)rx   api_versiongroupsIdry   rz   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   ?  s      ,,A#%!::#% )AA%(//5	7
 !2 34@@Hr   c                  ,    [         R                  " SSS9$ )NspokezThe spoke Id.r}   rJ   r    ResourceParameterAttributeConfig r   r   SpokeAttributeConfigr   W  s    		2	2o
/ /r   c                  ,    [         R                  " SSS9$ )Nrw   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   b  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>r  s    Sr   z(defaults to all regions if not specified)functionhintlocationzThe location Id.)r}   rJ   fallthroughs)r   ArgFallthroughappendFallthroughr   r   )location_argumentsregion_resource_commandarglocation_fallthroughss       r   LocationAttributeConfigr   h  sv     +=*<3d#*<  
    ;	=> 
	2	2"(
* *s    A)c                  ,    [         R                  " SSS9$ )N	transportzThe transport Id.r   r   r   r   r   TransportAttributeConfigr   z  s    		2	2"5
 r   c                  ,    [         R                  " SSS9$ )Nremote_profilezThe remote profile Id.r   r   r   r   r   RemoteProfileAttributeConfigr     s    		2	2(
 r   c           	      r    [         R                  " SS[        5       [        U 5      [         R                  SS9$ )Nz-networkconnectivity.projects.locations.spokesr   F)rx   spokesIdlocationsIdrz   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)rx   r   rz   r{   )r   r   r   r   r   s    r   GetRegionResourceSpecr     s6    			.)
d ::#
 r   c           
      t    [         R                  " SS[        5       [        U 5      [         R                  SSS9$ )Nz1networkconnectivity.projects.locations.transportsr   v1betaF)rx   transportsIdr   rz   r   r{   )r   r   r   r   r   r   s    r   GetTransportResourceSpecr     s9    			9+-)*<=::#
 r   c           
      t    [         R                  " SS[        5       [        U 5      [         R                  SSS9$ )Nz>networkconnectivity.projects.locations.remoteTransportProfilesremoteProfiler   F)rx   remoteTransportProfilesIdr   rz   r   r{   )r   r   r   r   r   r   s    r   GetRemoteProfileResourceSpecr     s9    			F# < >)*<=::#
 r   c                     [         R                  [        /[         R                  [        /[         R
                  [        [        /0nX   $ r8   )ResourceLocationTypeGLOBAL_ONLYr\   REGION_ONLYr`   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.FTre   )r   rf   r   N)rg   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   c                 &    U R                  SSUS9  g)z3Adds the --activation-key flag to the given parser.z--activation-keyFrF   Nr@   rI   s     r   AddActivationKeyFlagr   #      (5yIr   c                 &    U R                  SSUS9  g)z6Adds the --remote-account-id flag to the given parser.z--remote-account-idFrF   Nr@   rI   s     r   AddRemoteAccountIdFlagr   (  s    +e)Lr   c                 &    U R                  SSUS9  g)z3Adds the --remote_profile flag to the given parser.z--remote-profileFrF   Nr@   rI   s     r   AddProfileFlagr   -  r   r   c                 &    U R                  SSUS9  g)z.Adds the --bandwidth flag to the given parser.z--bandwidthTrF   Nr@   rI   s     r   AddBandwidthFlagr   2  s    mdCr   c                 $    U R                  SX!S9  g)z6Adds the --advertised-routes flag to the given parser.z--advertised-routesrF   Nr@   )r   rJ   r   s      r   AddAdvertisedRoutesFlagr   7  s    +hOr   c                 D    U R                  S[        R                  SUS9  g)z1Adds the --enable-admin flag to the given parser.z--enable-adminFr   Nr   rI   s     r   AddEnableAdminFlagr   <  s'    --	  r   c                 (    U R                  SSUSS9  g)z/Adds the --stack-type flag to the given parser.z--stack-typeF	IPV4_ONLY)r   r   r   Nr@   rI   s     r   AddStackTypeFlagr   F  s!    	  r   c                     [        [        R                  5      n[        R                  " S[        U5      SSR                  U5      S9n[        R                  " U/5      R                  U 5        g)zAdd a resource argument for a transport.

Args:
  parser: the parser for the command.
  desc: the string to describe the resource, such as 'to create'.
r   TzName of the transport {}.r|   N)
r   r   r   r
   r   r   r   r	   r   r:   r   r   r   r   s       r   AddTransportResourceArgr   P  sg     4&& )AA+,>?,33D9	 !2 34@@Hr   c                     [        [        R                  5      n[        R                  " S[        U5      SSR                  U5      S9n[        R                  " U/5      R                  U 5        g)z7Add a resource argument for a remote transport profile.r   Tz(Name of the remote transport profile {}.r|   N)
r   r   r   r
   r   r   r   r	   r   r:   r   s       r   AddRemoteProfileResourceArgr   d  se    3&& )AA/0BC;BB4H	 !2 34@@Hr   )F)FFF)T)Hr   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\   r`   r   r"   r$   r'   r6   r;   r>   rA   rD   rG   rK   rM   rO   rQ   rS   rU   rW   rY   r^   rc   rk   ro   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   uniqueEnumr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r     s   6  / ( 5 1 @ : D G 
;  "A	&
M2"+:% -2#(#(		I,I0/
*$%				) "499 " " *>)O)OI2 *>)O)OI23J
M
J
D
P
I(Ir   