
                            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S	KJr  SS	KJr  SS
KJr  SSS.r\
R*                  \
R,                  " \
R.                  R0                  \
R.                  R2                  \
R.                  R4                  5       " S S\
R6                  5      5       5       rS rS rg)z-Command for adding endpoints to a wire group.    )absolute_import)division)unicode_literals)base_classes)client)base)scope)flags)
propertiesz        *{command}* is used to add endpoints to a wire group.

        For an example, refer to the *EXAMPLES* section below.
        z        To add an endpoint to a wire group, run:

          $ {command} example-wg               --cross-site-network=example-csn               --endpoint-label=endpoint-1
        )DESCRIPTIONEXAMPLESc                   @    \ rS rSrSr\rSrSr\	S 5       r
S rS rSrg)AddEndpoint.   zhAdd endpoint to a Compute Engine wire group.

*{command}* adds endpoint to a Compute Engine wire group.
Nc                     [         R                  " 5       U l        U R                  R                  U5        [        R
                  " SS9U l        U R                  R                  USS9  [        R                  " U5        g )NF)pluralupdate)operation_type)cross_site_network_flags(CrossSiteNetworkArgumentForOtherResourceCROSS_SITE_NETWORK_ARGAddArgumentr
   WireGroupArgumentWIRE_GROUP_ARGAddEndpointLabel)clsparsers     =lib/surface/compute/interconnects/wire_groups/add_endpoint.pyArgsAddEndpoint.Args>   sh     	!IIK  **6200>C""6("C	6"    c                     g)Nzcompute.wireGroups )selfs    r   
CollectionAddEndpoint.CollectionH   s    r!   c                    [         R                  " U R                  5       5      nU R                  R	                  UUR
                  [        R                  R                  SUR                  0S9n[        R                  R                  R                  R                  5       nUR                  R                   U l        [        R$                  " UUUR                  UR                  UR
                  S9nUR&                  nUR)                  5       R*                  n[-        U5      nUR                  R                   R/                  5       X'   [1        U R"                  U5      nUR3                  US9$ )NcrossSiteNetwork)default_scopeadditional_params)refprojectcross_site_networkcompute_client	resources)	endpoints)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer/   compute_scope	ScopeEnumGLOBALr-   r   VALUEScorer,   	GetOrFailr   messages	_messages	WireGroupendpoint_labelDescriber0   convert_endpoints_to_dictWireGroupEndpoint_build_endpoint_messagesPatch)	r$   argsholderr+   r,   
wire_groupr=   r0   endpoints_maps	            r   RunAddEndpoint.RunK   s2   **4+<+<+>?F



/
/#--44-t/F/FG	 0 C $$,,668G]]++DN!!22}}""J ((N##%//I-i8M$*MM$:$:$L$L$NM!(GI   r!   )r;   )__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpr   r   classmethodr   r%   rG   __static_attributes__r#   r!   r   r   r   .   s5    
 !-.# # r!   r   c                     0 nU (       a  U R                   (       d  U$ U R                    H  nUR                  UR                  pCXAU'   M      U$ )a  Extracts the key,value pairs from the additionalProperties attribute.

Creates a python dict to be able to pass them into the client.

Args:
  endpoints: the list of additionalProperties messages

Returns:
  Python dictionary containing the key value pairs.
)additionalPropertieskeyvalue)r0   rF   endpoint_propertyrT   rU   s        r   r?   r?   l   sO     -	)88$99"&&(9(?(?# : 
r!   c                     / nUR                  5        H8  u  p4UR                  U R                  R                  R	                  UUS95        M:     U R                  R                  US9$ )aQ  Builds a WireGroup.EndpointValue message.

This is so we can re-assign them to the additionalProperties attribute on
the WireGroup.EndpointsValue message.

Args:
  messages: the messages module
  endpoints_map: map of endpoints with label as the key and the
    endpoint message as the value

Returns:
  WireGroup.EndpointsValue message
)rT   rU   )rS   )itemsappendr<   EndpointsValueAdditionalProperty)r:   rF   endpoint_properties_listr=   endpoints_messages        r   rA   rA      sw      +8+>+>+@'n##))<<# 	= 	
 ,A 
			*	*3 
+ 
 r!   N)rM   
__future__r   r   r   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.wire_groupsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r4   Dgooglecloudsdk.command_lib.compute.interconnects.cross_site_networksr
   r   <googlecloudsdk.command_lib.compute.interconnects.wire_groupsgooglecloudsdk.corer   rN   UniverseCompatibleReleaseTracksr2   ALPHABETAGAUpdateCommandr   r?   rA   r#   r!   r   <module>rl      s     4 &  ' 7 K ( E r N *
  T..33T5F5F5I5I7$$$ 7 7t.r!   