
                         `   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	S
.r\R"                  \R$                  " \R&                  R(                  \R&                  R*                  \R&                  R,                  5       " S S\R.                  5      5       5       rS rS rg)z1Command for removing endpoints from a wire-group.    )base_classes)client)base)scope)flags)
propertiesz        *{command}* is used to remove endpoints from a wire group.

        For an example, refer to the *EXAMPLES* section below.
        z        To remove an endpoint from 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)RemoveEndpoint+   zqRemove endpoint from a Compute Engine wire group.

*{command}* remove endpoint from 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/remove_endpoint.pyArgsRemoveEndpoint.Args;   sh     	!IIK  **6200>C""6("C	6"    c                     g)Nzcompute.wireGroups )selfs    r   
CollectionRemoveEndpoint.CollectionE   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Xh;   a  X	 [/        U R"                  U5      nS n	U(       d  S/n	UR1                  UU	S9$ )NcrossSiteNetwork)default_scopeadditional_params)refprojectcross_site_networkcompute_client	resources	endpoints)r-   update_mask)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer,   compute_scope	ScopeEnumGLOBALr*   r   VALUEScorer)   	GetOrFailr   messages	_messages	WireGroupendpoint_labelDescriber-   convert_endpoints_to_dict_build_endpoint_messagesPatch)
r!   argsholderr(   r)   
wire_groupr;   r-   endpoints_mapr.   s
             r   RunRemoveEndpoint.RunH   s7   **4+<+<+>?F



/
/#--44-t/F/FG	 0 C $$,,668G]]++DN!!22}}""J ((N##%//I-i8M&

'(GIK !Mk   r   )r9   )__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpr   r   classmethodr   r"   rD   __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)r-   rC   endpoint_propertyrQ   rR   s        r   r=   r=   q   sO     -	)88$99"&&(9(?(?# : 
r   c                     U(       d  g/ 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
N)rQ   rR   )rP   )itemsappendr:   EndpointsValueAdditionalProperty)r8   rC   endpoint_properties_listr;   endpoints_messages        r   r>   r>      s}     
-:-@-@-B)~##))<<# 	= 	
 .C 
			*	*3 
+ 
 r   N)rJ   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.wire_groupsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r2   Dgooglecloudsdk.command_lib.compute.interconnects.cross_site_networksr   r   <googlecloudsdk.command_lib.compute.interconnects.wire_groupsgooglecloudsdk.corer   rK   UniverseCompatibleReleaseTracksr0   ALPHABETAGAUpdateCommandr   r=   r>   r    r   r   <module>rh      s     8 8 K ( E r N *
  T..33T5F5F5I5I?T'' ? ?D.r   