Skip to content

Commit

Permalink
Update codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
sfodagain committed Apr 12, 2024
1 parent babbe2c commit 96c3da3
Show file tree
Hide file tree
Showing 62 changed files with 262 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.eventstream.ClientConnectionContinuation;
Expand Down Expand Up @@ -145,7 +150,7 @@ protected void onContinuationMessage(List<Header> headers, byte[] payload, Messa
}
}
}

@Override
protected void onContinuationClosed() {
super.onContinuationClosed();
Expand All @@ -169,10 +174,8 @@ protected void onContinuationClosed() {
return response;
}



/**
* Sends an empty close message on the open stream.
* Sends an empty close message on the open stream.
* @param continuation continuation to send the close message on
* @return CompletableFuture indicating flush of the close message.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.CRT;
Expand Down Expand Up @@ -34,12 +39,12 @@ enum Phase {
CONNECTED,
CLOSING
};

Phase connectionPhase;
ClientConnection connection;
Throwable closeReason;
boolean onConnectCalled;

protected ConnectionState(Phase phase, ClientConnection connection) {
this.connectionPhase = phase;
this.connection = connection;
Expand Down Expand Up @@ -75,7 +80,7 @@ protected String getVersionString() {

/**
* Connects to the event stream RPC server asynchronously
*
*
* @return A future that completes when connected
*/
public CompletableFuture<Void> connect(final LifecycleHandler lifecycleHandler) {
Expand Down Expand Up @@ -156,7 +161,7 @@ protected void onProtocolMessage(List<Header> headers, byte[] payload, MessageTy
LOGGER.warning("AccessDenied to event stream RPC server");
connectionState.connectionPhase = ConnectionState.Phase.CLOSING;
connectionState.connection.closeConnection(0);

final AccessDeniedException ade = new AccessDeniedException("Connection access denied to event stream RPC server");
if (!initialConnectFuture.isDone()) {
initialConnectFuture.completeExceptionally(ade);
Expand All @@ -179,7 +184,7 @@ protected void onProtocolMessage(List<Header> headers, byte[] payload, MessageTy
disconnect();
} else if (MessageType.ProtocolError.equals(messageType) || MessageType.ServerError.equals(messageType)) {
LOGGER.severe("Received " + messageType.name() + ": " + CRT.awsErrorName(CRT.awsLastError()));
connectionState.closeReason = EventStreamError.create(headers, payload, messageType);
connectionState.closeReason = EventStreamError.create(headers, payload, messageType);
doOnError(lifecycleHandler, connectionState.closeReason);
disconnect();
} else {
Expand Down Expand Up @@ -222,7 +227,7 @@ protected void onConnectionClosed(int errorCode) {
/**
* Creates a new stream with the given continuation handler.
* Trhows an exception if not connected
*
*
* @param continuationHandler The continuation handler to use
* @return A new ClientConnectionContinuation containing the new stream.
*/
Expand Down Expand Up @@ -375,7 +380,7 @@ public interface LifecycleHandler {
* Do nothing on ping by default. Inform handler of ping data
*
* TODO: Could use boolean return here as a hint on whether a pong reply should be sent?
*
*
* @param headers The ping headers
* @param payload The ping payload
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.io.ClientBootstrap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import com.google.gson.Gson;
Expand All @@ -13,7 +18,7 @@
* The connect message supplier for Greengrass
*/
public class GreengrassConnectMessageSupplier {

/**
* Returns a new connect message supplier using the given token
* @param authToken The auth token to use
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.eventstream.ClientConnectionContinuation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import org.junit.jupiter.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import com.google.gson.Gson;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.eventstream.MessageType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.crt.eventstream.Header;
Expand Down Expand Up @@ -36,7 +41,7 @@ public MessageAmendInfo(List<Header> headers, byte[] payload) {
* Returns the headers stored in the object. For sent messages,
* the headers stored in the object may be used to append to existing headers,
* where it won't overwrite an existing one that may be outgoing.
*
*
* @return The headers stored
*/
public List<Header> getHeaders() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;
Expand All @@ -11,7 +16,7 @@
* Smithy code generation should produce one of these per model, but we aren't going to take steps to prevent
* hand construction.
*
* @param <RequestType> The initial-request
* @param <RequestType> The initial-request
* @param <ResponseType> The initial-response
* @param <StreamingRequestType> The streaming initial-request
* @param <StreamingResponseType> The streaming initial-response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import java.util.Objects;
Expand Down Expand Up @@ -62,7 +67,7 @@ public String toString() {
/**
* Returns a new Version class from the given version string.
* Will throw an exception if it cannot convert.
*
*
* @param versionString The version string to convert
* @return The Version class created from the string
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

/**
Expand Down Expand Up @@ -27,7 +32,7 @@ public AccessDeniedException(String serviceName, String message) {
* or the principal/authN that was rejected
*
* Do not overexpose reason or logic for AccessDenied. Prefer internal logging
*
*
* @param serviceName The name of the service that caused the exception
*/
public AccessDeniedException(String serviceName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

import com.google.gson.JsonSyntaxException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

import com.google.gson.Gson;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

import com.google.gson.annotations.Expose;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc.model;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

package software.amazon.awssdk.eventstreamrpc;

import org.json.JSONObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import software.amazon.awssdk.eventstreamrpc.OperationModelContext;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

/**
* Send a request to authorize action on some resource
*/
public class AuthorizeClientDeviceActionOperationContext implements OperationModelContext<AuthorizeClientDeviceActionRequest, AuthorizeClientDeviceActionResponse, EventStreamJsonMessage, EventStreamJsonMessage> {
@Override
public EventStreamRPCServiceModel getServiceModel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import software.amazon.awssdk.eventstreamrpc.OperationModelContext;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

/**
* Cancel a local deployment on the device.
*/
public class CancelLocalDeploymentOperationContext implements OperationModelContext<CancelLocalDeploymentRequest, CancelLocalDeploymentResponse, EventStreamJsonMessage, EventStreamJsonMessage> {
@Override
public EventStreamRPCServiceModel getServiceModel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import software.amazon.awssdk.eventstreamrpc.OperationModelContext;
import software.amazon.awssdk.eventstreamrpc.model.EventStreamJsonMessage;

/**
* Generate a password for the LocalDebugConsole component
*/
public class CreateDebugPasswordOperationContext implements OperationModelContext<CreateDebugPasswordRequest, CreateDebugPasswordResponse, EventStreamJsonMessage, EventStreamJsonMessage> {
@Override
public EventStreamRPCServiceModel getServiceModel() {
Expand Down
Loading

0 comments on commit 96c3da3

Please sign in to comment.