# 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).

import oci
from datetime import datetime

# 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_authority_response = certificates_management_client.update_certificate_authority(
    certificate_authority_id="ocid1.test.oc1..<unique_ID>EXAMPLE-certificateAuthorityId-Value",
    update_certificate_authority_details=oci.certificates_management.models.UpdateCertificateAuthorityDetails(
        description="EXAMPLE-description-Value",
        current_version_number=934,
        certificate_authority_config=oci.certificates_management.models.UpdateRootCaByGeneratingInternallyConfigDetails(
            config_type="ROOT_CA_GENERATED_INTERNALLY",
            version_name="EXAMPLE-versionName-Value",
            stage="PENDING",
            validity=oci.certificates_management.models.Validity(
                time_of_validity_not_after=datetime.strptime(
                    "2012-04-25T12:45:42.466Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                time_of_validity_not_before=datetime.strptime(
                    "2001-05-04T03:35:38.873Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"))),
        certificate_revocation_list_details=oci.certificates_management.models.CertificateRevocationListDetails(
            object_storage_config=oci.certificates_management.models.ObjectStorageBucketConfigDetails(
                object_storage_bucket_name="EXAMPLE-objectStorageBucketName-Value",
                object_storage_object_name_format="EXAMPLE-objectStorageObjectNameFormat-Value",
                object_storage_namespace="EXAMPLE-objectStorageNamespace-Value"),
            custom_formatted_urls=["EXAMPLE--Value"]),
        external_key_description="EXAMPLE-externalKeyDescription-Value",
        freeform_tags={
            'EXAMPLE_KEY_SAfed': 'EXAMPLE_VALUE_Drd1kDuS4k90AsWMCbjn'},
        defined_tags={
            'EXAMPLE_KEY_RIIYa': {
                'EXAMPLE_KEY_hTzBQ': 'EXAMPLE--Value'}},
        certificate_authority_rules=[
            oci.certificates_management.models.CertificateAuthorityIssuanceRule(
                rule_type="CERTIFICATE_AUTHORITY_ISSUANCE_RULE",
                path_length_constraint=553,
                name_constraint=oci.certificates_management.models.NameConstraint(
                    permitted_subtree=[
                        oci.certificates_management.models.NameConstraintSubtreeNode(
                            type="DIRECTORY_NAME",
                            value="EXAMPLE-value-Value")],
                    excluded_subtree=[
                        oci.certificates_management.models.NameConstraintSubtreeNode(
                            type="DIRECTORY_NAME",
                            value="EXAMPLE-value-Value")]))]),
    opc_request_id="SJ9KKHZAJGCFOOCMGUB2<unique_ID>",
    if_match="EXAMPLE-ifMatch-Value")

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