
                         *   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 mcp 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)TestEnabledaz  Test a service against the result of merging MCP policies in the resource hierarchy.

  Test a service against the result of merging MCP 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servicez3Name of the service. example: foobar.googleapis.com)help)r   add_resource_argsadd_argument)parsers    1lib/surface/services/mcp/policies/test_enabled.pyArgszTestEnabled.Args0   s)    ""6*
M      c                 $   d}|j                  d      rt        |j                  z  }d}n|j                  d      rt        |j                  z  }d}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| d	S d
|j                   d| 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.
    projectfolderorganizationT)requiredzMCP is ENABLED for Service z	 for the  .zMCP is NOT ENABLED for Service )IsSpecified_FOLDER_RESOURCEr   _ORGANIZATION_RESOURCEr   _PROJECT_RESOURCEr   r   VALUEScoreGetr   TestMcpEnabled_SERVICEr
   mcpEnableRules)selfargsresourceresource_namer   responses         r   RunzTestEnabled.Run7   s    H!&4mh			.	),t/@/@@mh			)	$'$,,6m!!&&..22D2Ag''1m**x$,,.H
 '~ 6Zqq* ,DLL> :Zqq*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>r:      s    2 8 ( < *!  +  D%%++T->->-C-CD=$,, = E  =r   