Skip to content

Commit ac25cfe

Browse files
Merge pull request #30 from oracle-samples/apex-updates
fix: 🐛 Implemented multiple bug fixes, including resolving issues with the instance detail chart functionality and addressing the matching of external keys with certificate common names.
2 parents 20e63b7 + e8287b1 commit ac25cfe

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:52e7946a4ab55536826c70a64ecb3f0b0a2768a96637f9936d2e262a4dda3989
3-
size 1331661
2+
oid sha256:70482074ed1e38ff34787d2198f36c0bfcc41e63e36f248c3cf21ef0041bec93
3+
size 1334652

apex/dashboard/iot_explorer.sql

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2324,11 +2324,19 @@ create or replace package body iot_oci as
23242324
v_config json_object_t; -- Config
23252325
v_return json_object_t; -- JSON output for status/PEM/chain/private
23262326
results dbms_cloud_oci_cert_certificates_get_certificate_bundle_response_t; -- API response
2327+
get_cert_results dbms_cloud_oci_certm_certificates_management_get_certificate_response_t;
2328+
cert_cn varchar2(100); -- store common name of certificate
23272329
begin
23282330

23292331
-- Fetch the OCI configuration from the app-owned table
23302332
v_config := iot_apex.iot_config; -- Get the OCI configuration
23312333

2334+
get_cert_results := dbms_cloud_oci_certm_certificates_management.get_certificate(
2335+
certificate_id => p_cert_ocid, -- Certificate OCID
2336+
region => v_config.get_string('tenancy_region'), -- Region
2337+
credential_name => v_config.get_string('credentials') -- Credential name
2338+
);
2339+
23322340
-- Call the OCI API to get the certificate bundle
23332341
results := dbms_cloud_oci_cert_certificates.get_certificate_bundle(
23342342
certificate_id => p_cert_ocid, -- Certificate OCID
@@ -2337,10 +2345,18 @@ create or replace package body iot_oci as
23372345
credential_name => v_config.get_string('credentials') -- Credential name
23382346
); -- Get the certificate bundle
23392347

2348+
if get_cert_results.status_code = '200' then -- check for success of get_certificate
2349+
cert_cn := treat(
2350+
treat(
2351+
get_cert_results.response_body as dbms_cloud_oci_certificates_management_certificate_t
2352+
).subject as dbms_cloud_oci_certificates_management_certificate_subject_t
2353+
).common_name;
2354+
end if;
2355+
23402356
-- Package the result for output as a JSON clob
23412357
v_return := json_object_t(); -- Create a new JSON object
23422358
v_return.put('status',results.status_code); -- Status code of the API response
2343-
2359+
v_return.put('common_name',cert_cn); -- common name of the cert
23442360
v_return.put('cert_pem',
23452361
treat(
23462362
results.response_body as dbms_cloud_oci_certificates_certificate_bundle_t

0 commit comments

Comments
 (0)