Skip to content

Commit 72c644f

Browse files
committed
added IoT Fleetwise Java examples
1 parent 8670d41 commit 72c644f

5 files changed

Lines changed: 1083 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>org.example</groupId>
7+
<artifactId>iotfleetwise</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<properties>
10+
<java.version>21</java.version>
11+
<maven.compiler.source>21</maven.compiler.source>
12+
<maven.compiler.target>21</maven.compiler.target>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
</properties>
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.apache.maven.plugins</groupId>
19+
<artifactId>maven-surefire-plugin</artifactId>
20+
<version>3.5.2</version>
21+
</plugin>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-compiler-plugin</artifactId>
25+
<version>3.1</version>
26+
<configuration>
27+
<source>${java.version}</source>
28+
<target>${java.version}</target>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
<dependencyManagement>
34+
<dependencies>
35+
<dependency>
36+
<groupId>software.amazon.awssdk</groupId>
37+
<artifactId>bom</artifactId>
38+
<version>2.31.8</version>
39+
<type>pom</type>
40+
<scope>import</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.apache.logging.log4j</groupId>
44+
<artifactId>log4j-bom</artifactId>
45+
<version>2.23.1</version>
46+
<type>pom</type>
47+
<scope>import</scope>
48+
</dependency>
49+
</dependencies>
50+
</dependencyManagement>
51+
<dependencies>
52+
<dependency>
53+
<groupId>org.junit.jupiter</groupId>
54+
<artifactId>junit-jupiter</artifactId>
55+
<version>5.11.4</version>
56+
<scope>test</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>software.amazon.awssdk</groupId>
60+
<artifactId>secretsmanager</artifactId>
61+
</dependency>
62+
<dependency>
63+
<groupId>software.amazon.awssdk</groupId>
64+
<artifactId>netty-nio-client</artifactId>
65+
</dependency>
66+
<dependency>
67+
<groupId>software.amazon.awssdk</groupId>
68+
<artifactId>iotfleetwise</artifactId>
69+
</dependency>
70+
<dependency>
71+
<groupId>software.amazon.awssdk</groupId>
72+
<artifactId>iot</artifactId>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.google.code.gson</groupId>
76+
<artifactId>gson</artifactId>
77+
<version>2.10.1</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>software.amazon.awssdk</groupId>
81+
<artifactId>sso</artifactId>
82+
</dependency>
83+
<dependency>
84+
<groupId>software.amazon.awssdk</groupId>
85+
<artifactId>ssooidc</artifactId>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.apache.logging.log4j</groupId>
89+
<artifactId>log4j-core</artifactId>
90+
</dependency>
91+
<dependency>
92+
<groupId>org.slf4j</groupId>
93+
<artifactId>slf4j-api</artifactId>
94+
<version>2.0.13</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>software.amazon.awssdk</groupId>
98+
<artifactId>cloudformation</artifactId>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.apache.logging.log4j</groupId>
102+
<artifactId>log4j-slf4j2-impl</artifactId>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.apache.logging.log4j</groupId>
106+
<artifactId>log4j-1.2-api</artifactId>
107+
</dependency>
108+
</dependencies>
109+
</project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package com.example.fleetwise;
5+
6+
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
7+
import software.amazon.awssdk.regions.Region;
8+
import software.amazon.awssdk.services.iotfleetwise.IoTFleetWiseClient;
9+
import software.amazon.awssdk.services.iotfleetwise.model.*;
10+
import software.amazon.awssdk.services.iotfleetwise.paginators.ListSignalCatalogsIterable;
11+
12+
public class HelloFleetwise {
13+
14+
public static void main(String[] args) {
15+
// Create the client
16+
try (IoTFleetWiseClient fleetWiseClient = IoTFleetWiseClient.builder()
17+
.region(Region.US_EAST_1)
18+
.credentialsProvider(DefaultCredentialsProvider.create())
19+
.build()) {
20+
21+
// Create the request
22+
ListSignalCatalogsRequest request = ListSignalCatalogsRequest.builder()
23+
.maxResults(10) // Optional: limit per page
24+
.build();
25+
26+
// Use paginator to iterate through all pages
27+
ListSignalCatalogsIterable paginator = fleetWiseClient.listSignalCatalogsPaginator(request);
28+
for (ListSignalCatalogsResponse response : paginator) {
29+
for (SignalCatalogSummary summary : response.summaries()) {
30+
System.out.println("Catalog Name: " + summary.name());
31+
System.out.println("ARN: " + summary.arn());
32+
System.out.println("Created: " + summary.creationTime());
33+
System.out.println("Last Modified: " + summary.lastModificationTime());
34+
System.out.println("---------------");
35+
}
36+
}
37+
38+
} catch (IoTFleetWiseException e) {
39+
System.err.println("Error listing signal catalogs: " + e.awsErrorDetails().errorMessage());
40+
throw new RuntimeException(e);
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)