
                             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  G d
 dej                        Zy)z"service-management delete command.    )absolute_import)division)unicode_literals)services_util)base)arg_parsers)common_flags)
console_ioc                   &    e Zd ZdZed        Zd Zy)Deletea  Deletes a service from Google Service Management.

     Services that are deleted will be retained in the system for 30 days.
     If a deleted service is still within this retention window, it can be
     undeleted with the undelete command.

     ## EXAMPLES
     To delete a service named `my-service`, run:

       $ {command} my-service

     To run the same command asynchronously (non-blocking), run:

       $ {command} my-service --async
  c                     t        j                  d      j                  |        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.
    z	to delete)suffixN)r	   producer_service_flagAddToParserr   
ASYNC_FLAGdisplay_infoAddCacheUpdater)parsers    (lib/surface/endpoints/services/delete.pyArgszDelete.Args0   sC     &&k:FFvNOO'
''-    c                 ^   t        j                         }t        j                         }t        j                  ddddd       t        j                  |j                        }|j                  |      }|j                  j                  |      }t        j                  ||j                        S )zRun 'service-management delete'.

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

    Returns:
      The response from the Delete API call (or None if cancelled).
    a=  Are you sure? This will set the service configuration to be deleted, along with all of the associated consumer information. Note: This does not immediately delete the service configuration or data and can be undone using the undelete command for 30 days. Only after 30 days will the service be purged from the system.zContinue anywayT)messageprompt_stringdefaultthrow_if_unattendedcancel_on_no)serviceName)r   GetMessagesModuleGetClientInstancer
   PromptContinuer   GetServiceNameFromArgservice&ServicemanagementServicesDeleteRequestservicesr   ProcessOperationResultasync_)selfargsmessagesclientr#   request	operations          r   Runz
Delete.Run>   s     ..0H,,.F - ( 
 //=G== > G &&w/I//	4;;GGr   N)__name__
__module____qualname____doc__staticmethodr   r.    r   r   r   r      s!    " . .!Hr   r   N)r2   
__future__r   r   r    googlecloudsdk.api_lib.endpointsr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.endpointsr   r	   googlecloudsdk.core.consoler
   DeleteCommandr   r4   r   r   <module>r;      s8     ) &  ' : ( < = 2BHT BHr   