Skip to content

Commit dcdc09a

Browse files
authored
Merge pull request #82 from davidkhala/patch-1
Update identity.js
2 parents 1aa7865 + 859d353 commit dcdc09a

File tree

6 files changed

+16
-23
lines changed

6 files changed

+16
-23
lines changed

examples/javascript/audit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
33
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
4-
4+
55
66
This script retrieves all audit logs across an Oracle Cloud Infrastructure Tenancy.
77
for a timespan defined by startTime and endTime.
@@ -24,7 +24,7 @@ let auditClient;
2424
async function getSubscriptionRegions(tenancyId) {
2525
// To retrieve the list of all available regions.
2626
const listRegionSubscriptionsRequest = {
27-
tenancyId: tenancyId
27+
tenancyId
2828
};
2929

3030
const regions = await identityClient.listRegionSubscriptions(listRegionSubscriptionsRequest);

examples/javascript/identity.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ const identity = require("oci-identity");
88

99
const provider = new common.ConfigFileAuthenticationDetailsProvider();
1010

11-
const tenancyId = {
12-
tenancyId: provider.getTenantId() || ""
13-
};
14-
1511
(async () => {
1612
const identityClient = new identity.IdentityClient({
1713
authenticationDetailsProvider: provider
1814
});
19-
const regions = await identityClient.listRegionSubscriptions(tenancyId);
15+
const regions = await identityClient.listRegionSubscriptions({
16+
tenancyId: provider.getTenantId() || ""
17+
});
2018
for (let i = 0; i < regions.items.length; i++) {
2119
if (regions.items[i].isHomeRegion) {
2220
identityClient.regionId = regions.items[i].regionName;

examples/javascript/logging.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ var bunLog = bunyan.createLogger({ name: "LoggingExample", level: "debug" });
1717
common.LOG.logger = bunLog;
1818
const provider = new common.ConfigFileAuthenticationDetailsProvider();
1919

20-
const tenancyId = {
21-
tenancyId: provider.getTenantId() || ""
22-
};
23-
2420
(async () => {
2521
const identityClient = new identity.IdentityClient({
2622
authenticationDetailsProvider: provider
2723
});
28-
const regions = await identityClient.listRegionSubscriptions(tenancyId);
24+
const regions = await identityClient.listRegionSubscriptions({
25+
tenancyId: provider.getTenantId() || ""
26+
});
2927
for (let i = 0; i < regions.items.length; i++) {
3028
console.log(`Region fetched ${regions.items[i].regionName}`);
3129
}

examples/typescript/audit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import * as identity from "oci-identity";
1313
import * as audit from "oci-audit";
14-
import common = require("oci-common");
14+
import * as common from "oci-common";
1515

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

@@ -23,7 +23,7 @@ let auditClient: audit.AuditClient;
2323
export async function getSubscriptionRegions(tenancyId: string) {
2424
// To retrieve the list of all available regions.
2525
const listRegionSubscriptionsRequest: identity.requests.ListRegionSubscriptionsRequest = {
26-
tenancyId: tenancyId
26+
tenancyId
2727
};
2828

2929
const regions = await identityClient.listRegionSubscriptions(listRegionSubscriptionsRequest);

examples/typescript/identity.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ import common = require("oci-common");
1313
const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();
1414

1515
const tenancy = provider.getTenantId();
16-
const tenancyId: identity.requests.ListRegionSubscriptionsRequest = {
17-
tenancyId: tenancy || ""
18-
};
1916

2017
(async () => {
2118
const identityClient = new identity.IdentityClient({ authenticationDetailsProvider: provider });
22-
const regions = await identityClient.listRegionSubscriptions(tenancyId);
19+
const regions = await identityClient.listRegionSubscriptions({
20+
tenancyId: tenancy || ""
21+
});
2322
for (let i = 0; i < regions.items.length; i++) {
2423
if (regions.items[i].isHomeRegion) {
2524
identityClient.regionId = regions.items[i].regionName;

examples/typescript/logging.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ oci.LOG.logger = bunLog;
1717

1818
const provider = new oci.common.ConfigFileAuthenticationDetailsProvider();
1919

20-
const tenancyId = {
21-
tenancyId: provider.getTenantId() || ""
22-
};
23-
2420
(async () => {
2521
const identityClient = new oci.identity.IdentityClient({
2622
authenticationDetailsProvider: provider
2723
});
28-
const regions = await identityClient.listRegionSubscriptions(tenancyId);
24+
const regions = await identityClient.listRegionSubscriptions({
25+
tenancyId: provider.getTenantId() || ""
26+
});
2927
for (let i = 0; i < regions.items.length; i++) {
3028
console.log(`Region fetched ${regions.items[i].regionName}`);
3129
}

0 commit comments

Comments
 (0)