
    '                         S 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	 S
\	R                  5      rS rSS jrS rS rS rS rS rS rS rS rS rSS jrS rS rS rg)z>Flags and helpers for the compute service-attachment commands.    )absolute_import)division)unicode_literals)arg_parsers)
completers)flagszq    table(
      name,
      region.basename(),
      targetService.basename(),
      connection_preference
    )c                   (   ^  \ rS rSrU 4S jrSrU =r$ )ServiceAttachmentsCompleter#   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.serviceAttachmentsz&compute service-attachments list --uri)
collectionlist_command )superr
   __init__)selfkwargs	__class__s     Clib/googlecloudsdk/command_lib/compute/service_attachments/flags.pyr   $ServiceAttachmentsCompleter.__init__%   s(    	
%t5 /=     r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r   s   @r   r
   r
   #   s     r   r
   c                 $    U R                  SSS9  g )Nz--descriptionz<An optional, textual description for the service attachment.)helpadd_argumentparsers    r   AddDescriptionr%   ,   s    I  Kr   c                 H    SSS.nU R                  SUS U(       a  S OSSS9  g )	Nz?Always accept connection requests from consumers automatically.zYOnly accept connection requests from consumers with the approval of the service provider.)ACCEPT_AUTOMATICACCEPT_MANUALz--connection-preferencec                 B    U R                  SS5      R                  5       $ )N-_)replaceupper)xs    r   <lambda>)AddConnectionPreference.<locals>.<lambda>>   s    QYYsC(..0r   r'   z<This defines the service attachment's connection preference.)choicestypedefaultr    r!   )r$   	is_updateconnection_preference_choicess      r   AddConnectionPreferencer6   2   s?     L"	# 	+0d%7I  Kr   c                 (    U R                  SSSSS9  g )N--enable-proxy-protocol
store_trueF      If True, then enable the proxy protocol which is for supplying client
      TCP/IP address data in TCP connections that traverse proxies on their way
      to destination servers.
      actionr3   r    r!   r#   s    r   AddEnableProxyProtocolForCreater=   C   s#    
	  r   c                 B    U R                  S[        R                  SS9  g )Nr8   r:   r<   r    r"   r   StoreTrueFalseActionr#   s    r   AddEnableProxyProtocolForUpdaterB   O   s&    --
  r   c                 &    U R                  SSSS9  g )N--reconcile-connectionsr9   g        Determines whether to apply changes to consumer accept or reject lists
      to existing connections or only to new connections.

      If false, existing endpoints with a connection status of ACCEPTED or
      REJECTED are not updated.

      If true, existing endpoints with a connection status of ACCEPTED or
      REJECTED are updated based on the connection policy update. For example,
      if a project or network is removed from the --consumer-accept-list and
      added to --consumer-reject-list, all the endpoints in that project or
      network with the ACCEPTED state are set to REJECTED.
      r?   r!   r#   s    r    AddReconcileConnectionsForCreaterF   Z   s     
  r   c                 B    U R                  S[        R                  SS9  g )NrD   rE   r?   r@   r#   s    r    AddReconcileConnectionsForUpdaterH   n   s&    --
  r   c                 P    U R                  S[        R                  " 5       SS SS9  g )Nz--domain-namesDOMAIN_NAMESz      Specifies a comma separated list of DNS domain names that are used during
      DNS integration on PSC connected endpoints.
      r2   metavarr3   r    r"   r   ArgListr#   s    r   AddDomainNamesrO      s/     
  r   c                 P    U R                  S[        R                  " 5       SS SS9  g )Nz--consumer-reject-listREJECT_LISTa        Specifies a comma separated list of projects or networks that are not
      allowed to connect to this service attachment. The project can be
      specified using its project ID or project number and the network can be
      specified using its URL. A given service attachment can manage connections
      at either the project or network level. Therefore, both the reject and
      accept lists for a given service attachment must contain either only
      projects or only networks.rK   rM   r#   s    r   AddConsumerRejectListrR      s/     $  %r   c           	      R    U R                  S[        R                  " 5       SSS SS9  g )N--consumer-accept-listappendzPROJECT_OR_NETWORK=LIMITa&      Specifies which consumer projects or networks are allowed to connect to the
    service attachment. Each project or network has a connection limit. A given
    service attachment can manage connections at either the project or network
    level. Therefore, both the accept and reject lists for a given service
    attachment must contain either only projects or only networks.

    For example, `--consumer-accept-list myProjectId1=20` accepts a consumer
    project myProjectId1 with connection limit 20;
    `--consumer-accept-list projects/myProjectId1/global/networks/myNet1=20`
    accepts a consumer network myNet1 with connection limit 20

    * `PROJECT_OR_NETWORK` - Consumer project ID, project number or network URL.
    * `CONNECTION_LIMIT` - The maximum number of allowed connections.
    r2   r<   rL   r3   r    r"   r   ArgDictr#   s    r   AddConsumerAcceptListOldrY      s2     (  	r   c           	      P    U R                  S[        R                  " SS9SSS SS9  g )NrT   T)allow_key_onlyrU   z$PROJECT_OR_NETWORK_OR_ENDPOINT=LIMITa      Specifies which consumer projects/networks/endpoints are allowed to connect to the
    service attachment. Each project or network has a connection limit. For
    endpoints, the connection limit is optional. Both the accept and reject lists for a
    given service attachment must contain either only one of projects, networks
    or endpoints.

    For example, `--consumer-accept-list myProjectId1=20` accepts a consumer
    project myProjectId1 with connection limit 20;
    `--consumer-accept-list projects/myProjectId1/global/networks/myNet1=20`
    accepts a consumer network myNet1 with connection limit 20
    `--consumer-accept-list projects/myProjectId1/regions/myRegion1/forwardingRules/8167352512`
    also accepts a consumer endpoint with ID 8167352512.

    * `PROJECT_OR_NETWORK_OR_ENDPOINT` - Consumer project ID/number or network URL orendpoint URL.
    * `CONNECTION_LIMIT` - The maximum number of allowed connections.
    rV   rW   r#   s    r   AddConsumerAcceptListr\      s4    d34  r   c                 .    U R                  S[        SS9  g )Nz--propagated-connection-limita      The number of consumer spokes that connected Private Service Connect
    endpoints can be propagated to through Network Connectivity Center. This
    limit lets the service producer limit how many propagated Private Service
    Connect connections can be established to this service attachment from a
    single consumer.

    If the connection preference of the service attachment is ACCEPT_MANUAL, the
    limit applies to each project or network that is listed in the consumer
    accept list. If the connection preference of the service attachment is
    ACCEPT_AUTOMATIC, the limit applies to each project that contains a
    connected endpoint.

    If unspecified, the default propagated connection limit is 250.
    )r2   r    )r"   intr#   s    r   AddPropagatedConnectionLimitr_      s     %  r   c           	      X    [         R                  " S[        UU S[         R                  S9$ )Nzservice attachmentr   )resource_name	completerpluralrequiredregional_collectionregion_explanation)compute_flagsResourceArgumentr
   REGION_PROPERTY_EXPLANATION)rd   rc   s     r   ServiceAttachmentArgumentrj      s/    		'	'(+6&BB
D Dr   c                     U R                  SS9n[        R                  " 5       R                  XS9  UR	                  SSSS9  g )NT)rd   )mutex_group--target-serviceF:URL of the target service that receives forwarded traffic.rd   r    )add_mutually_exclusive_groupforwarding_rule_flags*ForwardingRuleArgumentForServiceAttachmentAddArgumentr"   )r$   targets     r   -AddTargetServiceAndProducerForwardingRuleArgsru      sS    ...=&BBDPP Q  	G  r   c                 &    U R                  SSSS9  g)z%Adds target-service flags for update.rm   Frn   ro   Nr!   r#   s    r   AddTargetServiceArgsForUpdaterw      s    G  r   c                 (    U R                  SSSSS9  g)zAdds the --show-nat-ips flag.z--show-nat-ipsr9   Na  Determines whether to include the NAT IPs of connected endpoints in the
        service attachment output. If enabled (--show-nat-ips), the output
        will include the list of NAT IPs for each connected PSC endpoint and
        any endpoints propagated from them.r;   r!   r#   s    r   AddShowNatIpsFlagry     s#    /	  r   N)F)TF) __doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   compute_completersr   rg   3googlecloudsdk.command_lib.compute.forwarding_rulesrq   DEFAULT_LIST_FORMATListCommandCompleterr
   r%   r6   r=   rB   rF   rH   rO   rR   rY   r\   r_   rj   ru   rw   ry   r   r   r   <module>r      s    E &  ' / O E ^	 "4"I"I KK"	((	% 	06,D

r   