# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

from datetime import datetime
import oci

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
certificates_management_client = oci.certificates_management.CertificatesManagementClient(
    config)


# Send the request to service, some parameters are not required, see API
# doc for more info
update_certificate_response = certificates_management_client.update_certificate(
    certificate_id="ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
    update_certificate_details=oci.certificates_management.models.UpdateCertificateDetails(
        description="EXAMPLE-description-Value",
        current_version_number=283,
        certificate_config=oci.certificates_management.models.UpdateCertificateIssuedByInternalCaConfigDetails(
            config_type="ISSUED_BY_INTERNAL_CA",
            version_name="EXAMPLE-versionName-Value",
            stage="CURRENT",
            validity=oci.certificates_management.models.Validity(
                time_of_validity_not_after=datetime.strptime(
                    "2032-07-17T00:19:17.019Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                time_of_validity_not_before=datetime.strptime(
                    "2009-11-21T22:00:40.067Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"))),
        freeform_tags={
            'EXAMPLE_KEY_4MiHM': 'EXAMPLE_VALUE_uqXzP6PvC4n8eoZ5B4wk'},
        defined_tags={
            'EXAMPLE_KEY_HPOxh': {
                'EXAMPLE_KEY_ElNiG': 'EXAMPLE--Value'}},
        certificate_rules=[
            oci.certificates_management.models.CertificateRenewalRule(
                rule_type="CERTIFICATE_RENEWAL_RULE",
                renewal_interval="EXAMPLE-renewalInterval-Value",
                advance_renewal_period="EXAMPLE-advanceRenewalPeriod-Value")]),
    opc_request_id="MCNZERAQWFSR0GIQCUMR<unique_ID>",
    if_match="EXAMPLE-ifMatch-Value")

# Get the data from response
print(update_certificate_response.data)