Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Greengrass V2 IPC models #290

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package software.amazon.awssdk.aws.greengrass;

import java.lang.Override;
import java.lang.Void;
import java.util.concurrent.CompletableFuture;
import software.amazon.awssdk.aws.greengrass.model.AuthorizeClientDeviceActionResponse;
import software.amazon.awssdk.eventstreamrpc.OperationResponse;
import software.amazon.awssdk.eventstreamrpc.StreamResponse;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

public final class AuthorizeClientDeviceActionResponseHandler implements StreamResponse<AuthorizeClientDeviceActionResponse, EventStreamJsonMessage> {
private final OperationResponse<AuthorizeClientDeviceActionResponse, EventStreamJsonMessage> operationResponse;

public AuthorizeClientDeviceActionResponseHandler(
final OperationResponse<AuthorizeClientDeviceActionResponse, EventStreamJsonMessage> operationResponse) {
this.operationResponse = operationResponse;
}

@Override
public CompletableFuture<Void> getRequestFlushFuture() {
return operationResponse.getRequestFlushFuture();
}

@Override
public CompletableFuture<AuthorizeClientDeviceActionResponse> getResponse() {
return operationResponse.getResponse();
}

@Override
public CompletableFuture<Void> sendStreamEvent(final EventStreamJsonMessage event) {
return operationResponse.sendStreamEvent(event);
}

@Override
public CompletableFuture<Void> closeStream() {
return operationResponse.closeStream();
}

@Override
public boolean isClosed() {
return operationResponse.isClosed();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package software.amazon.awssdk.aws.greengrass;

import java.lang.Override;
import java.lang.Void;
import java.util.concurrent.CompletableFuture;
import software.amazon.awssdk.aws.greengrass.model.GetClientDeviceAuthTokenResponse;
import software.amazon.awssdk.eventstreamrpc.OperationResponse;
import software.amazon.awssdk.eventstreamrpc.StreamResponse;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

public final class GetClientDeviceAuthTokenResponseHandler implements StreamResponse<GetClientDeviceAuthTokenResponse, EventStreamJsonMessage> {
private final OperationResponse<GetClientDeviceAuthTokenResponse, EventStreamJsonMessage> operationResponse;

public GetClientDeviceAuthTokenResponseHandler(
final OperationResponse<GetClientDeviceAuthTokenResponse, EventStreamJsonMessage> operationResponse) {
this.operationResponse = operationResponse;
}

@Override
public CompletableFuture<Void> getRequestFlushFuture() {
return operationResponse.getRequestFlushFuture();
}

@Override
public CompletableFuture<GetClientDeviceAuthTokenResponse> getResponse() {
return operationResponse.getResponse();
}

@Override
public CompletableFuture<Void> sendStreamEvent(final EventStreamJsonMessage event) {
return operationResponse.sendStreamEvent(event);
}

@Override
public CompletableFuture<Void> closeStream() {
return operationResponse.closeStream();
}

@Override
public boolean isClosed() {
return operationResponse.isClosed();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package software.amazon.awssdk.aws.greengrass;

import java.util.Optional;
import software.amazon.awssdk.aws.greengrass.model.AuthorizeClientDeviceActionRequest;
import software.amazon.awssdk.aws.greengrass.model.CertificateUpdateEvent;
import software.amazon.awssdk.aws.greengrass.model.ComponentUpdatePolicyEvents;
import software.amazon.awssdk.aws.greengrass.model.ConfigurationUpdateEvents;
import software.amazon.awssdk.aws.greengrass.model.CreateDebugPasswordRequest;
import software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest;
import software.amazon.awssdk.aws.greengrass.model.DeferComponentUpdateRequest;
import software.amazon.awssdk.aws.greengrass.model.DeleteThingShadowRequest;
import software.amazon.awssdk.aws.greengrass.model.GetClientDeviceAuthTokenRequest;
import software.amazon.awssdk.aws.greengrass.model.GetComponentDetailsRequest;
import software.amazon.awssdk.aws.greengrass.model.GetConfigurationRequest;
import software.amazon.awssdk.aws.greengrass.model.GetLocalDeploymentStatusRequest;
Expand All @@ -23,6 +26,7 @@
import software.amazon.awssdk.aws.greengrass.model.ResumeComponentRequest;
import software.amazon.awssdk.aws.greengrass.model.SendConfigurationValidityReportRequest;
import software.amazon.awssdk.aws.greengrass.model.StopComponentRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToCertificateUpdatesRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToComponentUpdatesRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToConfigurationUpdateRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToIoTCoreRequest;
Expand All @@ -34,10 +38,15 @@
import software.amazon.awssdk.aws.greengrass.model.UpdateThingShadowRequest;
import software.amazon.awssdk.aws.greengrass.model.ValidateAuthorizationTokenRequest;
import software.amazon.awssdk.aws.greengrass.model.ValidateConfigurationUpdateEvents;
import software.amazon.awssdk.aws.greengrass.model.VerifyClientDeviceIdentityRequest;
import software.amazon.awssdk.eventstreamrpc.StreamResponseHandler;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

public interface GreengrassCoreIPC {
AuthorizeClientDeviceActionResponseHandler authorizeClientDeviceAction(
final AuthorizeClientDeviceActionRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

CreateDebugPasswordResponseHandler createDebugPassword(final CreateDebugPasswordRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

Expand All @@ -52,6 +61,10 @@ DeferComponentUpdateResponseHandler deferComponentUpdate(
DeleteThingShadowResponseHandler deleteThingShadow(final DeleteThingShadowRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

GetClientDeviceAuthTokenResponseHandler getClientDeviceAuthToken(
final GetClientDeviceAuthTokenRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

GetComponentDetailsResponseHandler getComponentDetails(final GetComponentDetailsRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

Expand Down Expand Up @@ -101,6 +114,10 @@ SendConfigurationValidityReportResponseHandler sendConfigurationValidityReport(
StopComponentResponseHandler stopComponent(final StopComponentRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

SubscribeToCertificateUpdatesResponseHandler subscribeToCertificateUpdates(
final SubscribeToCertificateUpdatesRequest request,
final Optional<StreamResponseHandler<CertificateUpdateEvent>> streamResponseHandler);

SubscribeToComponentUpdatesResponseHandler subscribeToComponentUpdates(
final SubscribeToComponentUpdatesRequest request,
final Optional<StreamResponseHandler<ComponentUpdatePolicyEvents>> streamResponseHandler);
Expand Down Expand Up @@ -131,4 +148,8 @@ UpdateThingShadowResponseHandler updateThingShadow(final UpdateThingShadowReques
ValidateAuthorizationTokenResponseHandler validateAuthorizationToken(
final ValidateAuthorizationTokenRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);

VerifyClientDeviceIdentityResponseHandler verifyClientDeviceIdentity(
final VerifyClientDeviceIdentityRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import java.lang.Override;
import java.util.Optional;
import software.amazon.awssdk.aws.greengrass.model.AuthorizeClientDeviceActionRequest;
import software.amazon.awssdk.aws.greengrass.model.CertificateUpdateEvent;
import software.amazon.awssdk.aws.greengrass.model.ComponentUpdatePolicyEvents;
import software.amazon.awssdk.aws.greengrass.model.ConfigurationUpdateEvents;
import software.amazon.awssdk.aws.greengrass.model.CreateDebugPasswordRequest;
import software.amazon.awssdk.aws.greengrass.model.CreateLocalDeploymentRequest;
import software.amazon.awssdk.aws.greengrass.model.DeferComponentUpdateRequest;
import software.amazon.awssdk.aws.greengrass.model.DeleteThingShadowRequest;
import software.amazon.awssdk.aws.greengrass.model.GetClientDeviceAuthTokenRequest;
import software.amazon.awssdk.aws.greengrass.model.GetComponentDetailsRequest;
import software.amazon.awssdk.aws.greengrass.model.GetConfigurationRequest;
import software.amazon.awssdk.aws.greengrass.model.GetLocalDeploymentStatusRequest;
Expand All @@ -24,6 +27,7 @@
import software.amazon.awssdk.aws.greengrass.model.ResumeComponentRequest;
import software.amazon.awssdk.aws.greengrass.model.SendConfigurationValidityReportRequest;
import software.amazon.awssdk.aws.greengrass.model.StopComponentRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToCertificateUpdatesRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToComponentUpdatesRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToConfigurationUpdateRequest;
import software.amazon.awssdk.aws.greengrass.model.SubscribeToIoTCoreRequest;
Expand All @@ -35,6 +39,7 @@
import software.amazon.awssdk.aws.greengrass.model.UpdateThingShadowRequest;
import software.amazon.awssdk.aws.greengrass.model.ValidateAuthorizationTokenRequest;
import software.amazon.awssdk.aws.greengrass.model.ValidateConfigurationUpdateEvents;
import software.amazon.awssdk.aws.greengrass.model.VerifyClientDeviceIdentityRequest;
import software.amazon.awssdk.eventstreamrpc.EventStreamRPCClient;
import software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection;
import software.amazon.awssdk.eventstreamrpc.StreamResponseHandler;
Expand All @@ -45,6 +50,14 @@ public GreengrassCoreIPCClient(final EventStreamRPCConnection connection) {
super(connection);
}

@Override
public AuthorizeClientDeviceActionResponseHandler authorizeClientDeviceAction(
final AuthorizeClientDeviceActionRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler) {
final AuthorizeClientDeviceActionOperationContext operationContext = GreengrassCoreIPCServiceModel.getAuthorizeClientDeviceActionModelContext();
return new AuthorizeClientDeviceActionResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public CreateDebugPasswordResponseHandler createDebugPassword(
final CreateDebugPasswordRequest request,
Expand Down Expand Up @@ -76,6 +89,14 @@ public DeleteThingShadowResponseHandler deleteThingShadow(final DeleteThingShado
return new DeleteThingShadowResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public GetClientDeviceAuthTokenResponseHandler getClientDeviceAuthToken(
final GetClientDeviceAuthTokenRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler) {
final GetClientDeviceAuthTokenOperationContext operationContext = GreengrassCoreIPCServiceModel.getGetClientDeviceAuthTokenModelContext();
return new GetClientDeviceAuthTokenResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public GetComponentDetailsResponseHandler getComponentDetails(
final GetComponentDetailsRequest request,
Expand Down Expand Up @@ -186,6 +207,14 @@ public StopComponentResponseHandler stopComponent(final StopComponentRequest req
return new StopComponentResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public SubscribeToCertificateUpdatesResponseHandler subscribeToCertificateUpdates(
final SubscribeToCertificateUpdatesRequest request,
final Optional<StreamResponseHandler<CertificateUpdateEvent>> streamResponseHandler) {
final SubscribeToCertificateUpdatesOperationContext operationContext = GreengrassCoreIPCServiceModel.getSubscribeToCertificateUpdatesModelContext();
return new SubscribeToCertificateUpdatesResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public SubscribeToComponentUpdatesResponseHandler subscribeToComponentUpdates(
final SubscribeToComponentUpdatesRequest request,
Expand Down Expand Up @@ -254,4 +283,12 @@ public ValidateAuthorizationTokenResponseHandler validateAuthorizationToken(
final ValidateAuthorizationTokenOperationContext operationContext = GreengrassCoreIPCServiceModel.getValidateAuthorizationTokenModelContext();
return new ValidateAuthorizationTokenResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}

@Override
public VerifyClientDeviceIdentityResponseHandler verifyClientDeviceIdentity(
final VerifyClientDeviceIdentityRequest request,
final Optional<StreamResponseHandler<EventStreamJsonMessage>> streamResponseHandler) {
final VerifyClientDeviceIdentityOperationContext operationContext = GreengrassCoreIPCServiceModel.getVerifyClientDeviceIdentityModelContext();
return new VerifyClientDeviceIdentityResponseHandler(doOperationInvoke(operationContext, request, streamResponseHandler));
}
}
Loading