
    
                         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  G d dej$                        Zy)z.Cloud Pub/Sub schemas delete revision command.    )absolute_import)division)unicode_literals)
exceptions)schemas)base)resource_args)util)logc                   .    e Zd ZdZddiZed        Zd Zy)DeleteRevisionz!Delete a Pub/Sub schema revision.EXAMPLESz          To roll back to an existing schema revision called "key-schema" with revision_id: "0a0b0c0d", run:
                    
$ {command} key-schema@0a0b0c0d
          c                 0    t        j                  | d       y )Nzrevision to delete.)r	   AddSchemaResourceArg)parsers    -lib/surface/pubsub/schemas/delete_revision.pyArgszDeleteRevision.Args*   s     &&v/DE    c                    t        j                         }t        j                  |j                        }	 |j                  |      }t        j                  |j                  d       |S # t        j                  $ r^}t        j                  |      }t        j                  |dt        j                  |j                  j                               Y d}~yd}~ww xY w)a  This is what gets called when the user runs this command.

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

    Returns:
      A serialized object (dict) describing the results of the operation.
      This description fits the Resource described in the ResourceRegistry under
      'pubsub.projects.schemas'.

    Raises:
      util.RequestFailedError: if any of the requests to the API failed.
    )
schema_refzschema revision)kindfailedN)r   )r   SchemasClientr
   ParseSchemaNameschemar   api_ex	HttpErrorr   HttpExceptionr   DeletedResourceCreateFailureErrorMessagepayloadstatus_messagename)selfargsclientr   resulterrorexcs          r   RunzDeleteRevision.Run/   s     ""$F%%dkk2J	$$
$;f *;<M  $$U+c	
 //0J0JK
 s   A* *C=ACCN)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r*    r   r   r   r      s1    )  - F Fr   r   N)r.   
__future__r   r   r   apitools.base.pyr   r   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper   !googlecloudsdk.command_lib.pubsubr	   r
   googlecloudsdk.corer   Commandr   r1   r   r   <module>r:      s8    5 &  ' 1 1 2 ( ; 2 #-T\\ -r   