
                            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S rS r g)z1Command for adding interconnects to a wire group.    )absolute_import)division)unicode_literals)base_classes)client)base)scope)flags)
propertiesz        *{command}* is used to remove interconnects from a wire group endpoint.

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

          $ {command} example-wg --cross-site-network=example-csn               --endpoint-label=endpoint-1               --interconnect-label=example-interconnect
        )DESCRIPTIONEXAMPLESc                   @    \ rS rSrSr\rSrSr\	S 5       r
S rS rSrg)RemoveInterconnect.   zeRemove interconnect from a wire group.

*{command}* removes interconnect from a wire group endpoint.
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        [        R                  " U5        g )NF)pluralupdate)operation_type)	cross_site_network_flags(CrossSiteNetworkArgumentForOtherResourceCROSS_SITE_NETWORK_ARGAddArgumentr
   WireGroupArgumentWIRE_GROUP_ARGAddEndpointLabelAddInterconnectLabel)clsparsers     Dlib/surface/compute/interconnects/wire_groups/remove_interconnect.pyArgsRemoveInterconnect.Args>   sv     	!IIK  **6200>C""6("C	6"	v&    c                     g)Nzcompute.wireGroups )selfs    r   
CollectionRemoveInterconnect.CollectionI   s    r"   c                 t   [         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(                  nUR+                  5       R,                  n[/        U5      n	Xi;  a  [1        S5      $ Xi;   aQ  X   R2                  n
[5        U
5      nX{;   a  X	 [7        U R"                  U5      n
U R"                  R9                  U
S9X'   [;        U R"                  U	5      nUR=                  US9$ )a  Runs the remove-interconnect command.

Modifies the existing endpoints and their interconnects. We need to break
down the endpoints and interconnects to make it easier to add or update the
interconnects. Since they are nested resources of a WireGroup, it can get
tricky to do modifications.

Args:
  args: Object containing CLI parameter values
Returns:
  Result of running the request.

crossSiteNetwork)default_scopeadditional_params)refprojectcross_site_networkcompute_client	resourceszEndpoint not found.)interconnects)	endpoints)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer0   compute_scope	ScopeEnumGLOBALr.   r   VALUEScorer-   	GetOrFailr   messages	_messages	WireGroupendpoint_labelinterconnect_labelDescriber2   _convert_endpoints_to_dictAttributeErrorr1   _convert_interconnects_to_dict_build_interconnect_messagesWireGroupEndpoint_build_endpoint_messagesPatch)r%   argsholderr,   r-   
wire_groupr?   r@   r2   endpoints_mapr1   interconnects_maps               r   RunRemoveInterconnect.RunL   s    **4+<+<+>?F



/
/#--44-t/F/FG	 0 C $$,,668G]]++DN!!22}}""J ((N00##%//I /y9M*122&#3AAm 9G 
	01 3
..+m '+nn&F&F% 'G 'm# )GI   r"   )r=   )__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpr   r   classmethodr    r&   rN   __static_attributes__r$   r"   r   r   r   .   s6    
 !-.' ' Br"   r   c                     0 nU (       a  U R                   (       d  U$ U R                    H  nUR                  UR                  pCXAU'   M      U$ )zExtracts key value pairs from additionalProperties attribute.

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

Args:
  interconnects: the list of interconnect additionalProperties messages

Returns:
  dictionary containing key value pairs
additionalPropertieskeyvalue)r1   rM   interconnect_propertyr\   r]   s        r   rD   rD      sQ     	m@@,AA&**,A,G,G"c  B 
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.
rZ   )r2   rL   endpoint_propertyr\   r]   s        r   rB   rB      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$ )a  Builds a WireGroupEndpoint.InterconnectsValue message.

Args:
  messages: the messages module
  interconnects_map: map of interconnects with label as the key and the
    interconnect message as the value

Returns:
  WireGroupEndpoint.InterconnectsValue message
Nr\   r]   r[   )itemsappendrF   InterconnectsValueAdditionalProperty)r<   rM   interconnect_properties_listr@   interconnect_messages        r   rE   rE      s     
!#4E4K4K4M0 ''""55HH"& 	I 	
 5N 
	#	#	6	67 
7 
 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
Nrb   rc   )rd   re   r>   EndpointsValuerg   )r<   rL   endpoint_properties_listr?   endpoints_messages        r   rG   rG      s}     
-:-@-@-B)~##))<<# 	= 	
 .C 
			*	*3 
+ 
 r"   N)!rT   
__future__r   r   r   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.interconnects.wire_groupsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r6   Dgooglecloudsdk.command_lib.compute.interconnects.cross_site_networksr
   r   <googlecloudsdk.command_lib.compute.interconnects.wire_groupsgooglecloudsdk.corer   rU   UniverseCompatibleReleaseTracksr4   ALPHABETAGAUpdateCommandr   rD   rB   rE   rG   r$   r"   r   <module>r|      s     8 &  ' 7 K ( E r N *
  T..33T5F5F5I5I\++ \ \~..:r"   