
                             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$The configs variables unset command.    )absolute_import)division)unicode_literals)
exceptions)util)base)flags)logc                   .    e Zd ZdZddiZed        Zd Zy)UnsetzdDelete variable resources.

  This command deletes the variable resource with the specified name.
  EXAMPLESa            To delete a variable named "my-var", run:

            $ {command} --config-name=my-config my-var

          To delete a variable, but fail if it does not exist, run:

            $ {command} --config-name=my-config my-var --fail-if-absent

          To recursively delete a parent variable and its children, run:

            $ {command} --config-name=my-config my-parent-var --recursive
          c                     t        j                  |        | j                  ddd       | j                  ddd       | j                  d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--fail-if-absentz:Fail if a variable with the specified name does not exist.
store_true)helpactionz--recursivez-Delete a parent node and all of its children.namezThe variable name.)r   N)r	   AddRequiredConfigFlagadd_argument)parsers    5lib/surface/runtime_config/configs/variables/unset.pyArgsz
Unset.Args4   sb     
'
I  
 <  
 %9:    c                    t        j                         }t        j                         }t        j                  |j                  |      }	 |j                  |j                  |j                         |j                               t        j                  |       y# t        j                  $ r |j                  r Y yw xY w)a#  Run 'runtime-configs variables set'.

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

    Returns:
      The new variable.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    )r   	recursiveN)r   VariableClientMessagesParseVariableNamer   Delete2RuntimeconfigProjectsConfigsVariablesDeleteRequestRelativeNamer   r
   DeletedResourceapitools_exceptionsHttpNotFoundErrorfail_if_absent)selfargsvariable_clientmessagesvar_resources        r   Runz	Unset.RunK   s     ))+O}}H))$))T:L

E
E,,. F  
,'00 			 
s   
AB  B=<B=N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r*    r   r   r   r      s1      -  ; ;, r   r   N)r.   
__future__r   r   r   apitools.base.pyr   r"   %googlecloudsdk.api_lib.runtime_configr   googlecloudsdk.callioper   )googlecloudsdk.command_lib.runtime_configr	   googlecloudsdk.corer
   DeleteCommandr   r1   r   r   <module>r9      s6     + &  ' > 6 ( ; #MD Mr   