Skip to content

Commit

Permalink
Merge branch 'RequestResponseWorkspace' into RequestResponseSamples
Browse files Browse the repository at this point in the history
  • Loading branch information
Bret Ambrose committed Feb 24, 2025
2 parents dd23fb6 + 9d10355 commit 40c0cf6
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 125 deletions.
56 changes: 39 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs'

env:
BUILDER_VERSION: v0.9.60
BUILDER_VERSION: v0.9.75
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-iot-device-sdk-java-v2
Expand Down Expand Up @@ -167,18 +167,26 @@ jobs:
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
shell: bash
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
shell: bash
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_cleanup.sh
- name: MQTT5 tests
shell: bash
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_cleanup.sh
- name: Running samples in CI setup
run: |
python -m pip install boto3
Expand Down Expand Up @@ -244,16 +252,23 @@ jobs:
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_cleanup.sh
- name: MQTT5 tests
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_cleanup.sh
- name: Running samples in CI setup
run: |
python3 -m venv .venv
Expand Down Expand Up @@ -319,23 +334,30 @@ jobs:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
java -version
mvn -B test -Daws.crt.debugnative=true
mvn compile
mvn install -Dmaven.test.skip
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=ShadowTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=JobsTests -Dsurefire.failIfNoSpecifiedTests=false
mvn test -Dtest=IdentityTests -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT311 tests
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -DfailIfNoTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=MqttBuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: MQTT5 tests
run: |
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -DfailIfNoTests=false
source utils/mqtt5_test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt cleanup
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
mvn test -Dtest=Mqtt5BuilderTest -Dsurefire.failIfNoSpecifiedTests=false
source utils/test_cleanup.sh
- name: Running samples in CI setup
run: |
python3 -m pip install boto3
Expand Down Expand Up @@ -484,7 +506,7 @@ jobs:
run: |
python3 -m pip install boto3
sudo apt-get update -y
sudo apt-get install softhsm -y
sudo apt-get install softhsm2 -y
softhsm2-util --version
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v2
Expand Down
3 changes: 1 addition & 2 deletions android/iotdevicesdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ repositories {
}

dependencies {
api 'software.amazon.awssdk.crt:aws-crt-android:0.33.5'
api 'software.amazon.awssdk.crt:aws-crt-android:0.35.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
2 changes: 1 addition & 1 deletion documents/MQTT5_Userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ String clientEndpoint = "<prefix>-ats.iot.<region>.amazonaws.com";
AwsIotMqtt5ClientBuilder builder = AwsIotMqtt5ClientBuilder.newWebsocketMqttBuilderWithSigv4Auth(clientEndpoint, null);
~~~

See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then can be set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS`, and `AWS_SESSION_TOKEN` environment variables prior to running the application.
See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then can be set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` environment variables prior to running the application.

Alternatively, if you're connecting to a special region for which standard pattern matching does not work, or if you need a specific credentials provider, you can specify advanced websocket configuration options using the following code:
Expand Down
2 changes: 1 addition & 1 deletion samples/Mqtt5/PubSub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ To Run this sample using Websockets, use the following command:
mvn compile exec:java -pl samples/Mqtt5/PubSub -Dexec.mainClass=mqtt5.pubsub.PubSub -Dexec.args='--endpoint <endpoint> --signing_region <region>'
```

Note that to run this sample using Websockets, you will need to set your AWS credentials in your environment variables or local files. See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then you can set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS`, and `AWS_SESSION_TOKEN` environment variables.
Note that to run this sample using Websockets, you will need to set your AWS credentials in your environment variables or local files. See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then you can set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` environment variables.

## Alternate Connection Configuration Methods supported by AWS IoT Core

Expand Down
3 changes: 2 additions & 1 deletion samples/WebsocketConnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Replace with the following with the data from your AWS account:

Note that in a real application, you may want to avoid the use of wildcards in your ClientID or use them selectively. Please follow best practices when working with AWS on production applications using the SDK. Also, for the purposes of this sample, please make sure your policy allows a client ID of `test-*` to connect or use `--client_id <client ID here>` to send the client ID your policy supports.

For this sample, using WebSockets will attempt to fetch the AWS credentials to authorize the connection from your environment variables or local files. See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then you can set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS`, and `AWS_SESSION_TOKEN` environment variables.
For this sample, using Websockets will attempt to fetch the AWS credentials to authorize the connection from your environment variables or local files. See the [authorizing direct AWS](https://docs.aws.amazon.com/iot/latest/developerguide/authorizing-direct-aws.html) page for documentation on how to get the AWS credentials, which then you can set to the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` environment variables.


</details>

Expand Down
2 changes: 1 addition & 1 deletion sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.35.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void close() {
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<CreateCertificateFromCsrResponse> createCertificateFromCsr(CreateCertificateFromCsrRequest request) {
V2ClientFuture<CreateCertificateFromCsrResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -140,7 +140,7 @@ public CompletableFuture<CreateCertificateFromCsrResponse> createCertificateFrom
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<CreateKeysAndCertificateResponse> createKeysAndCertificate(CreateKeysAndCertificateRequest request) {
V2ClientFuture<CreateKeysAndCertificateResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -191,7 +191,7 @@ public CompletableFuture<CreateKeysAndCertificateResponse> createKeysAndCertific
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<RegisterThingResponse> registerThing(RegisterThingRequest request) {
V2ClientFuture<RegisterThingResponse> responseFuture = new V2ClientFuture<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void close() {
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<DescribeJobExecutionResponse> describeJobExecution(DescribeJobExecutionRequest request) {
V2ClientFuture<DescribeJobExecutionResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -158,7 +158,7 @@ public CompletableFuture<DescribeJobExecutionResponse> describeJobExecution(Desc
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<GetPendingJobExecutionsResponse> getPendingJobExecutions(GetPendingJobExecutionsRequest request) {
V2ClientFuture<GetPendingJobExecutionsResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -219,7 +219,7 @@ public CompletableFuture<GetPendingJobExecutionsResponse> getPendingJobExecution
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<StartNextJobExecutionResponse> startNextPendingJobExecution(StartNextPendingJobExecutionRequest request) {
V2ClientFuture<StartNextJobExecutionResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -280,7 +280,7 @@ public CompletableFuture<StartNextJobExecutionResponse> startNextPendingJobExecu
*
* @param request modeled request to perform
*
* @returns a future that will complete with the corresponding response
* @return a future that will complete with the corresponding response
*/
public CompletableFuture<UpdateJobExecutionResponse> updateJobExecution(UpdateJobExecutionRequest request) {
V2ClientFuture<UpdateJobExecutionResponse> responseFuture = new V2ClientFuture<>();
Expand Down Expand Up @@ -348,7 +348,7 @@ public CompletableFuture<UpdateJobExecutionResponse> updateJobExecution(UpdateJo
* @param request modeled streaming operation subscription configuration
* @param options set of callbacks that the operation should invoke in response to related events
*
* @returns a streaming operation which will invoke a callback every time a message is received on the
* @return a streaming operation which will invoke a callback every time a message is received on the
* associated MQTT topic
*/
public StreamingOperation createJobExecutionsChangedStream(JobExecutionsChangedSubscriptionRequest request, V2ClientStreamOptions<JobExecutionsChangedEvent> options) {
Expand Down Expand Up @@ -389,7 +389,7 @@ public StreamingOperation createJobExecutionsChangedStream(JobExecutionsChangedS
* @param request modeled streaming operation subscription configuration
* @param options set of callbacks that the operation should invoke in response to related events
*
* @returns a streaming operation which will invoke a callback every time a message is received on the
* @return a streaming operation which will invoke a callback every time a message is received on the
* associated MQTT topic
*/
public StreamingOperation createNextJobExecutionChangedStream(NextJobExecutionChangedSubscriptionRequest request, V2ClientStreamOptions<NextJobExecutionChangedEvent> options) {
Expand Down
Loading

0 comments on commit 40c0cf6

Please sign in to comment.