
                         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 subordinate 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 subordinate certificate authority.

Delete a Subordinate Certificate Authority. Deleted Subordinate 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 subordinate CA:

  $ {command} server-tls-1 --pool=my-pool --location=us-west1

To delete a CA while skipping the confirmation input:

  $ {command} server-tls-1s --pool=my-pool --location=us-west1 --quiet

To undo the deletion for a subordinate CA:

  $ {parent_command} undelete server-tls-1 --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/subordinates/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U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S	95      n[$        R&                  " UR(                  R*                  R,                  USS
9  UR                  R/                  UR1                  U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RV                  UR(                  RX                  RZ                  :X  a/  [        R                  R                  SR                  U5      5        g UR                  (       a/  [        R                  R                  SR                  U5      5        g [        R                  R                  SR                  X\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 Subordinate CAz&`ignore_active_certificates` parameterz#`--ignore-active-certificates` flagz%Y-%m-%dT%H:%MZzoDeleted Subordinate CA [{}]. This CA was never activated and cannot be recovered using `subordinates undelete`.z5Deleted Subordinate CA [{}]. CA can not be undeleted.z:Deleted Subordinate CA [{}]. CA can be undeleted until {}.).privateca_baseGetClientInstanceGetMessagesModuleCONCEPTScertificate_authorityParseRelativeNameformatignore_dependent_resourcesskip_grace_periodr   PromptContinuer   statusPrint1projects_locations_caPools_certificateAuthoritiesGetAPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesGetRequestr   CheckExpectedCATypeCertificateAuthorityTypeValueValuesEnumSUBORDINATEr   DPrivatecaProjectsLocationsCaPoolsCertificateAuthoritiesDeleteRequestignore_active_certificatesr   GenerateRequestIdr   Awaitr	   OperationErrorsix	text_typereplaceGetMessageFromResponser   ParseDateTime
expireTime
astimezoner   tzutcstrftimestateStateValueValuesEnumAWAITING_USER_ACTIVATION)selfargsclientmessagesca_refca_name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!!#G 	>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$$
.DBk 
	*	*;+3+H+H
JB "//>II

H./  	((==VV	W 
jj99? 
			jj
A
H
H 
jj
F
M
M7    K %%
--

"
"#K#HJK KKs   K0 0M:L>>M N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rZ   __static_attributes__r\   r   r   r   r   $   s"    $L 2 2Pr   r   )ra   
__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   r\   r   r   <module>rq      sr    2 &  '  C : . ( 6 ; > # 2 * 
 D%%(()~T ~ *~r   