
    
                     *   d 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
dZd	Zej                  ej                   ej                  ej                   j"                  ej                   j$                         G d
 dej&                                             Zy)z'services policies test-enabled command.    )serviceusage)base)common_flags)
propertieszprojects/%sz
folders/%szorganizations/%szservices/%sc                   &    e Zd ZdZed        Zd Zy)TestEnableda  Test a value against the result of merging consumer policies in the resource hierarchy.

  Test a value against the result of merging consumer policies in the resource
  hierarchy.

  ## EXAMPLES

  Test for service my-service for current project:

    $ {command} my-service

  Test for service my-service for project `my-project`:

    $ {command} my-service --project=my-project
  c                 T    t        j                  |        | j                  dd       y )NservicezName of the service.)help)r   add_resource_argsadd_argument)parsers    -lib/surface/services/policies/test_enabled.pyArgszTestEnabled.Args0   s$    ""6*
	(>?    c                    |j                  d      rt        |j                  z  }n|j                  d      rt        |j                  z  }nb|j                  d      rt
        |j                  z  }n=t        j                  j                  j                  j                  d      }t
        |z  }t        j                  |t        |j                  z        }|j                  rd|j                   d| dS d|j                   d	| dS )
zRun command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      The enablement of the given service.
    folderorganizationprojectT)requiredzService z is ENABLED for resource .z is NOT ENABLED for resource )IsSpecified_FOLDER_RESOURCEr   _ORGANIZATION_RESOURCEr   _PROJECT_RESOURCEr   r   VALUEScoreGetr   r   _SERVICEr
   enableRules)selfargsresource_namer   responses        r   RunzTestEnabled.Run5   s     !&4m			.	),t/@/@@m			)	$'$,,6m!!&&..22D2Ag''1m''x$,,7NOH ~%>}oQOO T\\N"?a
Pr   N)__name__
__module____qualname____doc__staticmethodr   r%    r   r   r   r      s"      @ @r   r   N)r)   googlecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   googlecloudsdk.corer   r   r   r   r   UniverseCompatibleHiddenReleaseTracksReleaseTrackALPHABETACommandr   r+   r   r   <module>r7      s    . 8 ( < *!  +  D%%++T->->-C-CD2$,, 2 E  2r   