Skip to content

Commit 4a2ea2c

Browse files
committed
Implement a new flag "--asap" argument for "certs-mgmt certificate schedule-deletion"
1 parent 5b26a73 commit 4a2ea2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

services/certificates_management/src/oci_cli_certificates_management/generated/certificatesmanagement_cli.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,13 +1721,14 @@ def schedule_certificate_authority_version_deletion(ctx, from_json, certificate_
17211721
@certificate_group.command(name=cli_util.override('certs_mgmt.schedule_certificate_deletion.command_name', 'schedule-certificate-deletion'), help=u"""Schedules the deletion of the specified certificate. This sets the lifecycle state of the certificate to `PENDING_DELETION` and then deletes it after the specified retention period ends. You can subsequently use `GetCertificate` to determine the current deletion status. \n[Command Reference](scheduleCertificateDeletion)""")
17221722
@cli_util.option('--certificate-id', required=True, help=u"""The OCID of the certificate.""")
17231723
@cli_util.option('--time-of-deletion', type=custom_types.CLI_DATETIME, help=u"""An optional property indicating when to delete the certificate version, expressed in [RFC 3339] timestamp format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
1724+
@cli_util.option('--asap', required=False, is_flag=True, help=u"""Requests deletion of the certificate as soon aa possible (ASAP)""")
17241725
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.""")
17251726
@json_skeleton_utils.get_cli_json_input_option({})
17261727
@cli_util.help_option
17271728
@click.pass_context
17281729
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
17291730
@cli_util.wrap_exceptions
1730-
def schedule_certificate_deletion(ctx, from_json, certificate_id, time_of_deletion, if_match):
1731+
def schedule_certificate_deletion(ctx, from_json, certificate_id, time_of_deletion, asap, if_match):
17311732

17321733
if isinstance(certificate_id, six.string_types) and len(certificate_id.strip()) == 0:
17331734
raise click.UsageError('Parameter --certificate-id cannot be whitespace or empty string')
@@ -1742,6 +1743,12 @@ def schedule_certificate_deletion(ctx, from_json, certificate_id, time_of_deleti
17421743
if time_of_deletion is not None:
17431744
_details['timeOfDeletion'] = time_of_deletion
17441745

1746+
if asap is not None and asap == True:
1747+
from datetime import datetime, timedelta
1748+
at = datetime.now() + timedelta(days=7, minutes=5)
1749+
# _details['timeOfDeletion'] = at.isoformat() + "Z"
1750+
_details['timeOfDeletion'] = at.strftime('%Y-%m-%dT%H:%M:%S.000Z')
1751+
17451752
client = cli_util.build_client('certificates_management', 'certificates_management', ctx)
17461753
result = client.schedule_certificate_deletion(
17471754
certificate_id=certificate_id,

0 commit comments

Comments
 (0)