
                             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edee   fdZy)z$Utilities for enabling service APIs.    )absolute_import)division)unicode_literals)Optional)
enable_api)
exceptions)api_enablement)log)
properties)
console_ioservice_nameenable_by_defaultc                    t         j                  j                  j                  j	                         }	 t        j                  ||       ryt        j                         rt        j                  || |       yt        j                  dj                  |              y# t        j                  $ r' t        j                   dj                  |              Y yw xY w)zPrompts to enable the API if it's not enabled.

  Args:
    service_name: The name of the service to enable.
    enable_by_default: default choice for the enablement prompt.
  N)r   z:Service {} is not enabled. This operation may not succeed.zZCould not verify if service {} is enabled: missing permission 'serviceusage.services.get'.)r   VALUEScoreproject	GetOrFailr   IsServiceEnabledr   	CanPromptr	   PromptToEnableApir
   warningformatr   #GetServicePermissionDeniedExceptioninfo)r   r   
project_ids      6lib/googlecloudsdk/api_lib/functions/api_enablement.pyPromptToEnableApiIfDisabledr      s       %%--779*"":|<&&
l6G 
kk
F
M
M
 
	7	7 HH	((.|(<s   B ,B 8$B 7CCN)F)__doc__
__future__r   r   r   typingr   googlecloudsdk.api_lib.servicesr   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.corer
   r   googlecloudsdk.core.consoler   strboolr        r   <module>r)      sG    + &  '  6 6 6 # * 2 <A*24.r(   