
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ej                  ej                   ej                  ej                  j                         G d dej                                             Z ej                  ej                  j                  ej                  j                          G d d	ej                               Zy
)zservices list command.    )services_util)serviceusage)base)common_flagsc                   &    e Zd ZdZed        Zd Zy)	ListAlphaa  List services for a project, folder or organization.

  This command lists the services that are enabled or available (Google first
  party services) to be enabled
  by a project, folder or organization. Service enablement can be inherited from
  resource ancestors. A resource's enabled services include services that are
  enabled on the resource itself and enabled on all resource ancestors.
  services by using exactly one of the `--enabled` or `--available` flags.
  `--enabled` is the default.

  ## EXAMPLES

  To list the services the current project has enabled for consumption, run:

    $ {command} --enabled

  To list the Google first party services the current project can enable for
  consumption, run:

    $ {command} --available
  c                 V   | j                  d      }|j                  ddd       |j                  ddd       t        j                  |        t        j
                  j                  | d	       t        j                  j                  |        | j                  j                  d
       y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
    Frequired	--enabled
store_truezT(DEFAULT) Return the services which the project, folder or organization has enabled.actionhelp--availablezReturn the Google first party services available to the project, folder or organization to enable. This list will include any services that the project, folder or organization has already enabled.   zV
        table(
            name:label=NAME:sort=1,
            title
        )
      N)add_mutually_exclusive_groupadd_argumentr   add_resource_argsr   PAGE_SIZE_FLAG
SetDefaultURI_FLAGRemoveFromParserdisplay_info	AddFormatparser
mode_groups     lib/surface/services/list.pyArgszListAlpha.Args3   s     44e4DJ)	   #	  	 ""6*""63/ 	MM""6*
!! #
     c                 *   |j                   s|j                  sd|_         |j                  d      r|j                  }nt	        j
                  |j                        }|j                  d      r|j                  }nd}|j                  d      r|j                  }nd}|j                  d      r9t        j                  ||j                   |j                  |j                  ||      S t        j                  ||j                   |j                  ||      S )zRun 'services list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      The list of services for this project.
    TprojectfolderNorganizationlimit)r$   r%   )enabled	availableIsSpecifiedr#   r   GetValidatedProjectr$   r%   r   ListServicesV2Beta	page_sizer&   )selfargsr#   r$   r%   s        r   RunzListAlpha.Run_   s     LLDNNdl	"g11$,,?g!{{ff'&&ll ,,

,,
..
**#  ,,

,,
..# r!   N__name__
__module____qualname____doc__staticmethodr    r/    r!   r   r   r      s!    , ) )V*r!   r   c                   &    e Zd ZdZed        Zd Zy)Lista  List services for a project.

  This command lists the services that are enabled or available to be enabled
  by a project. You can choose the mode in which the command will list
  services by using exactly one of the `--enabled` or `--available` flags.
  `--enabled` is the default.

  ## EXAMPLES

  To list the services for  the current project has enabled for consumption,
  run:

    $ {command} --enabled

  To list the services for the current project can enable for consumption, run:

    $ {command} --available

  To list the services for project `my-project` has enabled for consumption,
  run:

    $ {command} --enabled --project=my-project

  To list the services the project `my-project` can enable for consumption, run:

    $ {command} --available --project=my-project
  c                 ,   | j                  d      }|j                  ddd       |j                  ddd       t        j                  j	                  | d	       t        j
                  j                  |        | j                  j                  d
       y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    Fr
   r   r   z<(DEFAULT) Return the services which the project has enabled.r   r   zReturn the services available to the project to enable. This list will include any services that the project has already enabled.r   zj
          table(
            config.name:label=NAME:sort=1,
            config.title
          )
        N)	r   r   r   r   r   r   r   r   r   r   s     r   r    z	List.Args   s     44e4DJ%  ' %  ' 	""63/ 	MM""6*
!! # r!   c                     |j                   s|j                  sd|_         t        j                  |j                        }t        j                  ||j                   |j                  |j                        S )zRun 'services list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The list of services for this project.
    T)	r'   r(   r   r*   r#   r   ListServicesr,   r&   )r-   r.   r#   s      r   r/   zList.Run   sT     LLDNNdl//=G$$t~~tzz r!   Nr0   r6   r!   r   r8   r8      s!    8 " "Hr!   r8   N)r4   googlecloudsdk.api_lib.servicesr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   UniverseCompatibleHiddenReleaseTracksReleaseTrackALPHAListCommandr   BETAGAr8   r6   r!   r   <module>rG      s      9 8 ( < D%%++,m   m -  m` D%%**D,=,=,@,@AT4 T BTr!   