// 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 * as certificatesmanagement from "oci-certificatesmanagement";
import common = require("oci-common");

// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
    try {
     // Create a service client
     const client = new certificatesmanagement.CertificatesManagementClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  updateCertificateAuthorityDetails = {
		description: "EXAMPLE-description-Value",
		currentVersionNumber: 783,
		certificateAuthorityConfig: {
			configType: "ROOT_CA_GENERATED_INTERNALLY",			validity: {
				timeOfValidityNotBefore: new Date("Mon Sep 11 02:09:26 UTC 2045"),
				timeOfValidityNotAfter: new Date("Sun Feb 28 23:12:27 UTC 2016"),

				}
,
			versionName: "EXAMPLE-versionName-Value",
			stage: certificatesmanagement.models.UpdateCertificateAuthorityConfigDetails.Stage.Current

			}
,
		certificateRevocationListDetails: {
			objectStorageConfig: {
				objectStorageNamespace: "EXAMPLE-objectStorageNamespace-Value",
				objectStorageBucketName: "EXAMPLE-objectStorageBucketName-Value",
				objectStorageObjectNameFormat: "EXAMPLE-objectStorageObjectNameFormat-Value",

				}
,
			customFormattedUrls: ["EXAMPLE--Value"					],

			}
,
		freeformTags: {
			EXAMPLE_KEY_01r1n :"EXAMPLE_VALUE_TaxlN2gAHOHTgJlfx21Q"
			},
		definedTags: {
			EXAMPLE_KEY_jqL9S :{
				EXAMPLE_KEY_i6eiL :"EXAMPLE--Value"
				}
			},
		certificateAuthorityRules: [{
				ruleType: "CERTIFICATE_AUTHORITY_ISSUANCE_EXPIRY_RULE",				leafCertificateMaxValidityDuration: "EXAMPLE-leafCertificateMaxValidityDuration-Value",
				certificateAuthorityMaxValidityDuration: "EXAMPLE-certificateAuthorityMaxValidityDuration-Value"

				}
				],

		}

	const updateCertificateAuthorityRequest: certificatesmanagement.requests.UpdateCertificateAuthorityRequest = { 
	certificateAuthorityId: "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateAuthorityId-Value",
	updateCertificateAuthorityDetails: updateCertificateAuthorityDetails,
	opcRequestId: "XVKYNIGD02L3QLR8O16W<unique_ID>",
	ifMatch: "EXAMPLE-ifMatch-Value",

		}; 


     // Send request to the Client.
     const updateCertificateAuthorityResponse = await client.updateCertificateAuthority(updateCertificateAuthorityRequest);
     }
     catch (error) {
         console.log("updateCertificateAuthority Failed with error  " + error);
     }
})();