
                         h   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ dd	lmZ dd	lmZ dd
lmZ dddZe
j*                   e
j,                  e
j.                  j0                  e
j.                  j2                         G d de
j4                                      Zd Zd Zee_        y)z1Command for removing endpoints from a wire-group.    )absolute_import)division)unicode_literals)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 endpoint example-endpoint from wire group example-wire-group, run:

          $ {command} example-wire-group --project=example-project --cross-site-network=example-cross-site-network --endpoint-label=example-endpoint
        )DESCRIPTIONEXAMPLESc                   4    e Zd ZdZdZdZed        Zd Zd Z	y)RemoveEndpointzuRemove endpoint from a Compute Engine wire group.

  *{command}* remove endpoint from a Compute Engine wire group.
  Nc                    t        j                         | _        | j                  j                  |       t	        j
                  d      | _        | j                  j                  |d       t	        j                  |       y )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ArgszRemoveEndpoint.Args9   sh     	!IIK  **6200>C""6("C	6"    c                      y)Nzcompute.wireGroups )selfs    r   
CollectionzRemoveEndpoint.CollectionC   s    r   c                    t        j                  | j                               }| j                  j	                  ||j
                  t        j                  j                  d|j                  i      }t        j                  j                  j                  j                         }|j                  j                   | _        t        j$                  |||j                  |j                  |j
                        }|j&                  }|j)                         j*                  }t-        |      }||v r||= t/        | j"                  |      }d }	|sdg}	|j1                  ||	      S )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   RunzRemoveEndpoint.RunF   s;   **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   )
__name__
__module____qualname____doc__r   r   classmethodr   r#   rD   r!   r   r   r   r   .   s0    
 .# # &r   r   c                     i }| r| j                   s|S | j                   D ]  }|j                  |j                  }}|||<   ! |S )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_propertyrL   rM   s        r   r=   r=   o   sS     -	)88$99"&&(9(?(?CM# : 
r   c                     |syg }|j                         D ];  \  }}|j                  | j                  j                  j	                  ||             = | j                  j                  |      S )ac  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)rL   rM   )rK   )itemsappendr:   EndpointsValueAdditionalProperty)r8   rC   endpoint_properties_listr;   endpoints_messages        r   r>   r>      s     
-:-@-@-B)~(##))<<# 	= 	
 .C 
			*	*3 
+ 
 r   N)rH   
__future__r   r   r   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   DETAILED_HELPUniverseCompatibleReleaseTracksr0   ALPHABETAUpdateCommandr   r=   r>   detailed_helpr!   r   r   <module>re      s     8 &  ' 7 K ( E r N *  D%%++T->->-C-CD<T'' < E <~.@  - r   