
    
                         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Z
d	Z G d
 dej                        Zd Zy)z8Base classes for shared code between Cloud Run commands.    )absolute_import)division)print_function)unicode_literals)base)connection_contextz;labels.'run.googleapis.com/supportsPzs':alias='supportsPzs'zFmetadata.labels.'run.googleapis.com/satisfiesPzs':alias='satisfiesPzs'c                   H    e Zd ZdZdZdZed        Zed        Zed        Z	y)Listz/Base class for `run [resources] list` commands.Nc                    | j                   }|s-	 |j                  }t	        j
                  | j                  |      }dj                  |j                  d      t        |dd            S # t        $ r |j                  }Y cw xY w)aB  Get uri for resource.

    This is a @classmethod because this method is called by
    googlecloudsdk.calliope.display_info.DisplayInfo outside of a List instance.

    Args:
      resource: a googlecloudsdk.command_lib.run.k8s_object.KubernetesObject
        object

    Returns:
      uri: str of the resource's uri
    z{}/{}/	self_link )
complete_api_endpoint
locationIdAttributeErrorregionr   DeriveRegionalEndpointpartial_api_endpointformatrstripgetattr)clsresourcecomplete_endpointr   s       .lib/googlecloudsdk/command_lib/run/commands.py_GetResourceUrizList._GetResourceUri0   s     11!$$ -CC

"
"F,>>  %wxb'IK K	  !!s   A( (B ?B c                     || _         y N)r   )r   r   s     r   SetCompleteApiEndpointzList.SetCompleteApiEndpointI   s
     5C    c                     || _         y r   )r   )r   r   s     r   SetPartialApiEndpointzList.SetPartialApiEndpointM   s
    3Cr    )
__name__
__module____qualname____doc__r   r   classmethodr   r   r"    r    r   r
   r
   "   sQ    7 
 K K0 6 6 4 4r    r
   c                     t        | d       S )z(Return the list_response sorted by name.c                     | j                   S r   )name)xs    r   <lambda>zSortByName.<locals>.<lambda>T   s    QVVr    )key)sorted)list_responses    r   
SortByNamer1   R   s    	#3	44r    N)r&   
__future__r   r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.runr   SUPPORTS_PZS_ALIASSATISFIES_PZS_ALIASListCommandr
   r1   r(   r    r   <module>r8      sJ    ? &  % ' ( = B  M 
-44 -4`5r    