
                         4   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr	  SSKJ
r
  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKr\R2                  " \R4                  R6                  5       " S S\R8                  5      5       rg)z$Delete a root certificate authority.    )absolute_import)division)unicode_literals)tz)base)request_utils)waiter)flags)
operations)resource_args)log)
console_io)timesNc                   .    \ rS rSrSr\S 5       rS rSrg)Delete$   a  Delete a Root Certificate Authority.

Delete a Root Certificate Authority. Deleted Root Certificate Authorities
may be recovered with the `{parent_command} undelete` command within a grace
period of 30 days.

Use the --skip-grace-period flag to delete as soon as possible without the
30-day grace period to undelete.

Note that any user-managed KMS keys or Google Cloud Storage buckets
will not be affected by this operation. You will need to delete the user-
managed resources separately once the CA is deleted. Any Google-managed
resources will be cleaned up.

The CA specified in this command MUST:

  1) be in the DISABLED or STAGED state.
  2) have no un-revoked or un-expired certificates. Use the revoke command
     to revoke any active certificates.

Use the `--ignore-active-certificates` flag to remove 2) as a requirement.

## EXAMPLES

To delete a root CA:

  $ {command} prod-root --pool=my-pool --location=us-west1

To delete a CA while skipping the confirmation
input:

  $ {command} prod-root --pool=my-pool --location=us-west1 --quiet

To undo the deletion for a root CA:

  $ {parent_command} undelete prod-root --pool=my-pool --location=us-west1
c                     [         R                  " U S5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        g )Nz	to delete)r   %AddCertAuthorityPositionalResourceArgr
   AddIgnoreActiveCertificatesFlagAddSkipGracePeriodFlagAddIgnoreDependentResourcesFlag)parsers    %lib/surface/privateca/roots/delete.pyArgsDelete.ArgsL   s<    77L	))&1	  (	))&1    c           
      $   [         R                  " SS9n[         R                  " SS9nUR                  R                  R                  5       nSR                  UR                  5       5      nUR                  (       a  US-  nUR                  (       a  US-  n[        R                  " USS9(       d   [        R                  R                  S5        g UR                  R!                  UR#                  UR                  5       S	95      n[$        R&                  " UR(                  R*                  R,                  USS
9  UR                  R/                  UR1                  UR                  5       UR2                  UR                  UR                  [4        R6                  " 5       S95      n [8        R:                  " USSS9n[8        RF                  " UUR(                  5      n
[H        RJ                  " U
RL                  5      RO                  [P        RR                  " 5       5      RU                  S5      nUR                  (       a=  [        R                  R                  SR                  UR                  5       5      5        g [        R                  R                  SR                  UR                  5       U5      5        g ! [<        R>                   a?  n	[8        R>                  " [@        RB                  " U	5      RE                  SS5      5      eS n	A	ff = f)Nv1)api_versionz3You are about to delete Certificate Authority [{}].z
This deletion will happen without checking if the CA's CA Pool is being used by another resource, which may cause unintended and effects on any dependent resource(s) since the CA Pool would not be able to issue certificates.z
This deletion will happen as soon as possible without a 30-day grace period where undeletion would have been allowed. If you proceed, there will be no way to recover this CA.T)messagedefaultzAborted by user.)name)version)r"   ignoreActiveCertificatesskipGracePeriodignoreDependentResources	requestIdzDeleting Root CAz&`ignore_active_certificates` parameterz#`--ignore-active-certificates` flagz%Y-%m-%dT%H:%MZz.Deleted Root CA [{}]. CA can not be undeleted.z3Deleted Root CA [{}]. CA can be undeleted until {}.)+privateca_baseGetClientInstanceGetMessagesModuleCONCEPTScertificate_authorityParseformatRelativeNameignore_dependent_resourcesskip_grace_periodr   PromptContinuer   statusPrint1projects_locations_caPools_certificateAuthoritiesGetAPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesGetRequestr   CheckExpectedCATypeCertificateAuthorityTypeValueValuesEnumSELF_SIGNEDr   DPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesDeleteRequestignore_active_certificatesr   GenerateRequestIdr   Awaitr	   OperationErrorsix	text_typereplaceGetMessageFromResponser   ParseDateTime
expireTime
astimezoner   tzutcstrftime)selfargsclientmessagesca_refprompt_message
current_ca	operationca_responseecaformatted_expire_times               r   Run
Delete.RunS   s   --$?F//DAH]]00668F 	>vv!@#  &&()n /0n $$^TJ	jj)*IIMM	J	J$$& 
K 
()J
 %%%%99EE
 HHOO	M	M$$&%)%D%D 22%)%D%D#557 
N 
9:IK$$
'T;k 
	*	*;+3+H+H
JB "//>II

H./  	jjGNN



! " 
jj
?
F
F!!#%:<=!    K %%
--

"
"#K#HJK KKs   (J< <L:L

L N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rV   __static_attributes__rX   r   r   r   r   $   s"    $L 2 2C=r   r   )r]   
__future__r   r   r   dateutilr    googlecloudsdk.api_lib.privatecar   r(   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.calliope$googlecloudsdk.command_lib.privatecar
   r   r   googlecloudsdk.corer   googlecloudsdk.core.consoler   googlecloudsdk.core.utilr   rA   ReleaseTracksReleaseTrackGADeleteCommandr   rX   r   r   <module>rm      sr    + &  '  C : . ( 6 ; > # 2 * 
 D%%(()q=T q= *q=r   