Skip to content

Commit 6569d02

Browse files
authored
Merge pull request #3 from oracle-devrel/iot-support
add the testing and very 1st pass of iot provider
2 parents d781ff4 + 6600b77 commit 6569d02

File tree

19 files changed

+1489
-10
lines changed

19 files changed

+1489
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ To get started you will also user API signing keys and credentials for the user
1616

1717
To use the code to manage objects in OCI you will need to :
1818

19-
Create an AuthenticationProcessor (com.oracle.timg.oci.authentication) - this does the security work for you, speciy the OCI configuration file section to use for the connection and optionall the OCI region to work on (by defual it will sue the region in the config file)
19+
Create an AuthenticationProcessor (com.oracle.timg.oci.authentication) - this does the security work for you, specify the OCI configuration file section to use for the connection and optionally the OCI region to work on (by default it will use the region in the config file)
2020

2121
From there use the other processor classes as needed, these will all need the AuthenticationProcessor you created as part of their consructor.
2222

2323

2424

2525
### Prerequisites
26-
You will need a development environment with Java (17 is the cersion Im using, earlier versions may not be supported by the OCI Java SDK).
26+
You will need a development environment with Java (21 is the version I'm currently using, earlier versions may not be supported by the OCI Java SDK).
2727

2828
I also use Maven to build this and to manage the dependencies, but if you have other mechanisms feel free.
2929

@@ -40,7 +40,7 @@ This is a **very** limited set of OCI services that are being wrapped here, over
4040
This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.
4141

4242
## License
43-
Copyright (c) 2024 Oracle and/or its affiliates.
43+
Copyright (c) 2025 Oracle and/or its affiliates.
4444

4545
Licensed under the Universal Permissive License (UPL), Version 1.0.
4646

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
<attribute name="optional" value="true"/>
13+
</attributes>
14+
</classpathentry>
15+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
16+
<attributes>
17+
<attribute name="optional" value="true"/>
18+
<attribute name="maven.pomderived" value="true"/>
19+
<attribute name="test" value="true"/>
20+
</attributes>
21+
</classpathentry>
22+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
23+
<attributes>
24+
<attribute name="maven.pomderived" value="true"/>
25+
<attribute name="test" value="true"/>
26+
<attribute name="optional" value="true"/>
27+
</attributes>
28+
</classpathentry>
29+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
30+
<attributes>
31+
<attribute name="maven.pomderived" value="true"/>
32+
</attributes>
33+
</classpathentry>
34+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
35+
<attributes>
36+
<attribute name="maven.pomderived" value="true"/>
37+
</attributes>
38+
</classpathentry>
39+
<classpathentry kind="src" path="target/generated-sources/annotations">
40+
<attributes>
41+
<attribute name="optional" value="true"/>
42+
</attributes>
43+
</classpathentry>
44+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
45+
<attributes>
46+
<attribute name="optional" value="true"/>
47+
<attribute name="test" value="true"/>
48+
</attributes>
49+
</classpathentry>
50+
<classpathentry kind="output" path="target/classes"/>
51+
</classpath>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<factorypath>
2+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-core/3.22.0/oci-java-sdk-core-3.22.0.jar" enabled="true" runInBatchMode="false"/>
3+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-common/3.22.0/oci-java-sdk-common-3.22.0.jar" enabled="true" runInBatchMode="false"/>
4+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.13.1/jackson-annotations-2.13.1.jar" enabled="true" runInBatchMode="false"/>
5+
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcpkix-jdk15to18/1.74/bcpkix-jdk15to18-1.74.jar" enabled="true" runInBatchMode="false"/>
6+
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcutil-jdk15to18/1.74/bcutil-jdk15to18-1.74.jar" enabled="true" runInBatchMode="false"/>
7+
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcprov-jdk15to18/1.74/bcprov-jdk15to18-1.74.jar" enabled="true" runInBatchMode="false"/>
8+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-circuitbreaker/3.22.0/oci-java-sdk-circuitbreaker-3.22.0.jar" enabled="true" runInBatchMode="false"/>
9+
<factorypathentry kind="VARJAR" id="M2_REPO/io/github/resilience4j/resilience4j-circuitbreaker/1.7.1/resilience4j-circuitbreaker-1.7.1.jar" enabled="true" runInBatchMode="false"/>
10+
<factorypathentry kind="VARJAR" id="M2_REPO/io/vavr/vavr/0.10.2/vavr-0.10.2.jar" enabled="true" runInBatchMode="false"/>
11+
<factorypathentry kind="VARJAR" id="M2_REPO/io/vavr/vavr-match/0.10.2/vavr-match-0.10.2.jar" enabled="true" runInBatchMode="false"/>
12+
<factorypathentry kind="VARJAR" id="M2_REPO/io/github/resilience4j/resilience4j-core/1.7.1/resilience4j-core-1.7.1.jar" enabled="true" runInBatchMode="false"/>
13+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-workrequests/3.22.0/oci-java-sdk-workrequests-3.22.0.jar" enabled="true" runInBatchMode="false"/>
14+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-common-httpclient-jersey3/3.22.0/oci-java-sdk-common-httpclient-jersey3-3.22.0.jar" enabled="true" runInBatchMode="false"/>
15+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-common-httpclient/3.22.0/oci-java-sdk-common-httpclient-3.22.0.jar" enabled="true" runInBatchMode="false"/>
16+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/ws/rs/jakarta.ws.rs-api/3.0.0/jakarta.ws.rs-api-3.0.0.jar" enabled="true" runInBatchMode="false"/>
17+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar" enabled="true" runInBatchMode="false"/>
18+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.13.1/jackson-core-2.13.1.jar" enabled="true" runInBatchMode="false"/>
19+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.13.4.2/jackson-databind-2.13.4.2.jar" enabled="true" runInBatchMode="false"/>
20+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/core/jersey-common/3.0.8/jersey-common-3.0.8.jar" enabled="true" runInBatchMode="false"/>
21+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/inject/jakarta.inject-api/2.0.1/jakarta.inject-api-2.0.1.jar" enabled="true" runInBatchMode="false"/>
22+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar" enabled="true" runInBatchMode="false"/>
23+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/core/jersey-client/3.0.8/jersey-client-3.0.8.jar" enabled="true" runInBatchMode="false"/>
24+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/media/jersey-media-json-jackson/3.0.8/jersey-media-json-jackson-3.0.8.jar" enabled="true" runInBatchMode="false"/>
25+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/ext/jersey-entity-filtering/3.0.8/jersey-entity-filtering-3.0.8.jar" enabled="true" runInBatchMode="false"/>
26+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/module/jackson-module-jakarta-xmlbind-annotations/2.13.3/jackson-module-jakarta-xmlbind-annotations-2.13.3.jar" enabled="true" runInBatchMode="false"/>
27+
<factorypathentry kind="VARJAR" id="M2_REPO/com/sun/activation/jakarta.activation/2.0.1/jakarta.activation-2.0.1.jar" enabled="true" runInBatchMode="false"/>
28+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/xml/bind/jakarta.xml.bind-api/3.0.1/jakarta.xml.bind-api-3.0.1.jar" enabled="true" runInBatchMode="false"/>
29+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/inject/jersey-hk2/3.0.8/jersey-hk2-3.0.8.jar" enabled="true" runInBatchMode="false"/>
30+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/hk2/hk2-locator/3.0.3/hk2-locator-3.0.3.jar" enabled="true" runInBatchMode="false"/>
31+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/hk2/external/aopalliance-repackaged/3.0.3/aopalliance-repackaged-3.0.3.jar" enabled="true" runInBatchMode="false"/>
32+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/hk2/hk2-api/3.0.3/hk2-api-3.0.3.jar" enabled="true" runInBatchMode="false"/>
33+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/hk2/hk2-utils/3.0.3/hk2-utils-3.0.3.jar" enabled="true" runInBatchMode="false"/>
34+
<factorypathentry kind="VARJAR" id="M2_REPO/org/javassist/javassist/3.28.0-GA/javassist-3.28.0-GA.jar" enabled="true" runInBatchMode="false"/>
35+
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/jersey/connectors/jersey-apache-connector/3.0.8/jersey-apache-connector-3.0.8.jar" enabled="true" runInBatchMode="false"/>
36+
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar" enabled="true" runInBatchMode="false"/>
37+
<factorypathentry kind="VARJAR" id="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" enabled="true" runInBatchMode="false"/>
38+
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" enabled="true" runInBatchMode="false"/>
39+
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar" enabled="true" runInBatchMode="false"/>
40+
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.33/slf4j-api-1.7.33.jar" enabled="true" runInBatchMode="false"/>
41+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-streaming/3.22.0/oci-java-sdk-streaming-3.22.0.jar" enabled="true" runInBatchMode="false"/>
42+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-objectstorage/3.22.0/oci-java-sdk-objectstorage-3.22.0.jar" enabled="true" runInBatchMode="false"/>
43+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-objectstorage-generated/3.22.0/oci-java-sdk-objectstorage-generated-3.22.0.jar" enabled="true" runInBatchMode="false"/>
44+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-objectstorage-extensions/3.22.0/oci-java-sdk-objectstorage-extensions-3.22.0.jar" enabled="true" runInBatchMode="false"/>
45+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-identity/3.22.0/oci-java-sdk-identity-3.22.0.jar" enabled="true" runInBatchMode="false"/>
46+
<factorypathentry kind="VARJAR" id="M2_REPO/com/oracle/oci/sdk/oci-java-sdk-vault/3.22.0/oci-java-sdk-vault-3.22.0.jar" enabled="true" runInBatchMode="false"/>
47+
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar" enabled="true" runInBatchMode="false"/>
48+
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-jdk14/2.0.7/slf4j-jdk14-2.0.7.jar" enabled="true" runInBatchMode="false"/>
49+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar" enabled="true" runInBatchMode="false"/>
50+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" enabled="true" runInBatchMode="false"/>
51+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" enabled="true" runInBatchMode="false"/>
52+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" enabled="true" runInBatchMode="false"/>
53+
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar" enabled="true" runInBatchMode="false"/>
54+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar" enabled="true" runInBatchMode="false"/>
55+
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar" enabled="true" runInBatchMode="false"/>
56+
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20231013/json-20231013.jar" enabled="true" runInBatchMode="false"/>
57+
<factorypathentry kind="VARJAR" id="M2_REPO/timg/utilities/TimGUtilities/1.0.9/TimGUtilities-1.0.9.jar" enabled="true" runInBatchMode="false"/>
58+
<factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="false" runInBatchMode="false"/>
59+
</factorypath>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.settings/
2+
/target/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>oci-java-sdk-simple-wrappers-testing</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
While the dependencies below are built using Maven the resulting jar files are not in a public Maven repo, you will need to get them and setup your development setup appropriately to access these.
2+
All of these are eclipse projects.
3+
This is a set of examples that use the OCI API Wrappers - see the git hub repo at https://github.com/oracle-devrel/oci-java-sdk-simple-wrappers
4+
To handle the Command line interactions this uses some utility classes to handle the users command line interactions, the project containing those is at https://github.com/atimgraves/timg-utilities
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.oracle.timg.demo</groupId>
6+
<artifactId>oci-java-sdk-simple-wrappers-testing</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>OciTesting</name>
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<version.ocicore>1.0.1</version.ocicore>
12+
<version.timgutils>1.0.9</version.timgutils>
13+
<maven.compiler.source>17</maven.compiler.source>
14+
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
15+
</properties>
16+
<dependencies>
17+
<dependency>
18+
<groupId>com.oracle.timg.demo</groupId>
19+
<artifactId>oci-java-sdk-simple-wrappers</artifactId>
20+
<version>${version.ocicore}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>com.google.guava</groupId>
24+
<artifactId>guava</artifactId>
25+
<version>32.0.1-jre</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.json</groupId>
29+
<artifactId>json</artifactId>
30+
<version>20231013</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>timg.utilities</groupId>
34+
<artifactId>TimGUtilities</artifactId>
35+
<version>${version.timgutils}</version>
36+
</dependency>
37+
</dependencies>
38+
</project>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*Copyright (c) 2023 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
36+
*/
37+
package com.oracle.timg.demo.examples.identity;
38+
39+
import java.io.IOException;
40+
import java.util.stream.Collectors;
41+
42+
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
43+
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
44+
import com.oracle.bmc.identity.Identity;
45+
import com.oracle.bmc.identity.IdentityClient;
46+
import com.oracle.bmc.identity.model.Compartment;
47+
import com.oracle.bmc.identity.model.Compartment.LifecycleState;
48+
import com.oracle.bmc.identity.requests.ListCompartmentsRequest;
49+
import com.oracle.bmc.identity.responses.ListCompartmentsResponse;
50+
import com.oracle.bmc.streaming.StreamAdminClient;
51+
import com.oracle.bmc.streaming.requests.ListStreamsRequest;
52+
import com.oracle.bmc.streaming.responses.ListStreamsResponse;
53+
54+
import lombok.extern.slf4j.Slf4j;
55+
56+
//Have Lombok create a logger for us
57+
@Slf4j
58+
public class ListCompartmentsAndStreams {
59+
60+
public static void main(String[] args) {
61+
AuthenticationDetailsProvider provider;
62+
try {
63+
provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
64+
} catch (IOException e) {
65+
e.printStackTrace();
66+
return;
67+
}
68+
StreamAdminClient streamAdminClient = new StreamAdminClient(provider);
69+
String compartmentId = provider.getTenantId();
70+
try (Identity identityClient = new IdentityClient(provider);) {
71+
System.out.println("ListCompartments: with compartmentIdInSubtree == true");
72+
String nextPageToken = null;
73+
do {
74+
ListCompartmentsResponse response = identityClient
75+
.listCompartments(ListCompartmentsRequest.builder().limit(50).compartmentId(compartmentId)
76+
.compartmentIdInSubtree(Boolean.TRUE).page(nextPageToken).build());
77+
78+
for (Compartment compartment : response.getItems()) {
79+
LifecycleState state = compartment.getLifecycleState();
80+
if (state == LifecycleState.Active) {
81+
System.out.println(compartment);
82+
listStreamsInCompartment(compartment.getId(), streamAdminClient);
83+
}
84+
}
85+
nextPageToken = response.getOpcNextPage();
86+
} while (nextPageToken != null);
87+
} catch (Exception e) {
88+
e.printStackTrace();
89+
}
90+
}
91+
92+
private static void listStreamsInCompartment(String id, StreamAdminClient streamAdminClient) {
93+
ListStreamsRequest request = ListStreamsRequest.builder().compartmentId(id).build();
94+
95+
ListStreamsResponse listResponse = streamAdminClient.listStreams(request);
96+
String streams = listResponse.getItems().stream().map(resp -> resp.toString()).collect(Collectors.joining(","));
97+
System.out.println("Resp = " + streams);
98+
}
99+
100+
}

0 commit comments

Comments
 (0)