
                         D    d Z ddlmZ ddlmZ dZdZdZd Zd Zd	 Z	d
 Z
y)z9Module for deletion protection related utility functions.    )arg_parsers)parser_errorsziDeletion protection control options. When deletion protection is enabled,
the instance cannot be deleted.z-Enables deletion protection for the instance.z=The reason for enabling deletion protection for the instance.c                     | j                  t        d      }|j                  ddddt               |j                  ddt        	       y)
z<Adds deletion protection related create flags to the parser.F)helprequired--deletion-protection
store_trueNT)actiondefaultr   r   --deletion-protection-reason)r   r   )	add_group_DELETION_PROTECTION_GROUP_HELPadd_argument_DELETION_PROTECTION_HELP _DELETION_PROTECTION_REASON_HELPparsergroups     =lib/googlecloudsdk/command_lib/filestore/instances/dp_util.pyAddDeletionProtectionCreateArgsr      sa     

*  % $  & $+  -    c                     | j                  t              }|j                  dt        j                  t
               |j                  dt               y)z<Adds deletion protection related update flags to the parser.)r   r   )r
   r   r   N)r   r   r   r   StoreTrueFalseActionr   r   r   s     r   AddDeletionProtectionUpdateArgsr   2   sY    


*  ,% --$  &
 $+  -r   c                     g }| j                  d      r|j                  d       | j                  d      r|j                  d       |S )zaReturns the update mask for deletion protection.

  Args:
    args: The args from the command.
  deletion_protectiondeletionProtectionEnableddeletion_protection_reasondeletionProtectionReason)IsSpecifiedappend)argsmasks     r   GetDeletionProtectionUpdateMaskr$   A   sF     
$
,-KK+,	23KK*+	+r   c                 n    | j                   }| j                  }||s|t        j                  d      yyy)zXValidates the deletion protection args.

  Args:
    args: The args from the command.
  NzI--deletion-protection-reason cannot be used with --no-deletion-protection)r   r   r   ArgumentException)r"   deletion_protection_enabledr   s      r   $ValidateDeletionProtectionUpdateArgsr(   R   sR     !% 8 8#>>!-)
$
0

)
)	#$ $ 1 * .r   N)__doc__googlecloudsdk.callioper   r   r   r   r   r   r   r$   r(    r   r   <module>r,      s?    @ / 1##  L $A  -(-"$r   