Skip to content

Commit

Permalink
Add codegen for http component in runtime extension
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFossAWS committed Sep 7, 2023
1 parent d3daa89 commit abba99d
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ public enum TypeScriptDependency implements Dependency {

AWS_SDK_CLIENT_DOCGEN("devDependencies", "@smithy/service-client-documentation-generator", "^2.0.0", true),
AWS_SDK_TYPES("dependencies", "@aws-sdk/types", true),
SMITHY_TYPES("dependencies", "@smithy/types", "^2.2.2", true),
AWS_SMITHY_CLIENT("dependencies", "@smithy/smithy-client", "^2.0.5", true),
INVALID_DEPENDENCY("dependencies", "@smithy/invalid-dependency", "^2.0.5", true),
CONFIG_RESOLVER("dependencies", "@smithy/config-resolver", "^2.0.5", true),
SMITHY_TYPES("dependencies", "@smithy/types", "^2.3.0", true),
AWS_SMITHY_CLIENT("dependencies", "@smithy/smithy-client", "^2.1.1", true),
INVALID_DEPENDENCY("dependencies", "@smithy/invalid-dependency", "^2.0.6", true),
CONFIG_RESOLVER("dependencies", "@smithy/config-resolver", "^2.0.6", true),
TYPES_NODE("devDependencies", "@types/node", "^14.14.31", true),

MIDDLEWARE_CONTENT_LENGTH("dependencies", "@smithy/middleware-content-length", "^2.0.5", true),
MIDDLEWARE_SERDE("dependencies", "@smithy/middleware-serde", "^2.0.5", true),
MIDDLEWARE_RETRY("dependencies", "@smithy/middleware-retry", "^2.0.5", true),
MIDDLEWARE_CONTENT_LENGTH("dependencies", "@smithy/middleware-content-length", "^2.0.7", true),
MIDDLEWARE_SERDE("dependencies", "@smithy/middleware-serde", "^2.0.6", true),
MIDDLEWARE_RETRY("dependencies", "@smithy/middleware-retry", "^2.0.7", true),
UTIL_RETRY("dependencies", "@smithy/util-retry", "^2.0.0", false),
MIDDLEWARE_STACK("dependencies", "@smithy/middleware-stack", "^2.0.0", true),
MIDDLEWARE_ENDPOINTS_V2("dependencies", "@smithy/middleware-endpoint", "^2.0.5", false),
MIDDLEWARE_ENDPOINTS_V2("dependencies", "@smithy/middleware-endpoint", "^2.0.6", false),
AWS_SDK_UTIL_ENDPOINTS("dependencies", "@aws-sdk/util-endpoints", false),

AWS_CRYPTO_SHA256_BROWSER("dependencies", "@aws-crypto/sha256-browser", "3.0.0", true),
AWS_CRYPTO_SHA256_JS("dependencies", "@aws-crypto/sha256-js", "3.0.0", true),
AWS_SDK_HASH_NODE("dependencies", "@smithy/hash-node", "^2.0.5", true),
AWS_SDK_HASH_NODE("dependencies", "@smithy/hash-node", "^2.0.6", true),

AWS_SDK_URL_PARSER("dependencies", "@smithy/url-parser", "^2.0.5", true),
AWS_SDK_URL_PARSER("dependencies", "@smithy/url-parser", "^2.0.6", true),

@Deprecated AWS_SDK_UTIL_BASE64_BROWSER("dependencies", "@smithy/util-base64-browser", "^1.0.1", false),
@Deprecated AWS_SDK_UTIL_BASE64_NODE("dependencies", "@smithy/util-base64-node", "^1.0.1", false),
Expand All @@ -69,54 +69,54 @@ public enum TypeScriptDependency implements Dependency {

AWS_SDK_UTIL_UTF8("dependencies", "@smithy/util-utf8", "^2.0.0", true),

AWS_SDK_UTIL_WAITERS("dependencies", "@smithy/util-waiter", "^2.0.5", false),
AWS_SDK_UTIL_WAITERS("dependencies", "@smithy/util-waiter", "^2.0.6", false),

AWS_SDK_UTIL_DEFAULTS_MODE_NODE("dependencies", "@smithy/util-defaults-mode-node", "^2.0.6", true),
AWS_SDK_UTIL_DEFAULTS_MODE_BROWSER("dependencies", "@smithy/util-defaults-mode-browser", "^2.0.6", true),
AWS_SDK_UTIL_DEFAULTS_MODE_NODE("dependencies", "@smithy/util-defaults-mode-node", "^2.0.8", true),
AWS_SDK_UTIL_DEFAULTS_MODE_BROWSER("dependencies", "@smithy/util-defaults-mode-browser", "^2.0.7", true),

NODE_CONFIG_PROVIDER("dependencies", "@smithy/node-config-provider", "^2.0.6", false),
NODE_CONFIG_PROVIDER("dependencies", "@smithy/node-config-provider", "^2.0.8", false),

UUID("dependencies", "uuid", "^8.3.2", false),

// Conditionally added when httpChecksumRequired trait exists
MD5_BROWSER("dependencies", "@smithy/md5-js", "^2.0.5", false),
STREAM_HASHER_NODE("dependencies", "@smithy/hash-stream-node", "^2.0.5", false),
STREAM_HASHER_BROWSER("dependencies", "@smithy/hash-blob-browser", "^2.0.5", false),
BODY_CHECKSUM("dependencies", "@smithy/middleware-apply-body-checksum", "^2.0.5", false),
MD5_BROWSER("dependencies", "@smithy/md5-js", "^2.0.6", false),
STREAM_HASHER_NODE("dependencies", "@smithy/hash-stream-node", "^2.0.6", false),
STREAM_HASHER_BROWSER("dependencies", "@smithy/hash-blob-browser", "^2.0.6", false),
BODY_CHECKSUM("dependencies", "@smithy/middleware-apply-body-checksum", "^2.0.7", false),

// Conditionally added when using an HTTP application protocol.
PROTOCOL_HTTP("dependencies", "@smithy/protocol-http", "^2.0.5", false),
AWS_SDK_FETCH_HTTP_HANDLER("dependencies", "@smithy/fetch-http-handler", "^2.0.5", false),
AWS_SDK_NODE_HTTP_HANDLER("dependencies", "@smithy/node-http-handler", "^2.0.5", false),
PROTOCOL_HTTP("dependencies", "@smithy/protocol-http", "^3.0.1", false),
AWS_SDK_FETCH_HTTP_HANDLER("dependencies", "@smithy/fetch-http-handler", "^2.1.1", false),
AWS_SDK_NODE_HTTP_HANDLER("dependencies", "@smithy/node-http-handler", "^2.1.1", false),

// Conditionally added when setting the auth middleware.
UTIL_MIDDLEWARE("dependencies", "@smithy/util-middleware", "^2.0.0", false),
@Deprecated AWS_SDK_UTIL_MIDDLEWARE("dependencies", "@smithy/util-middleware", "^2.0.0", false),

// Conditionally added if a event stream shape is found anywhere in the model
AWS_SDK_EVENTSTREAM_SERDE_CONFIG_RESOLVER(
"dependencies", "@smithy/eventstream-serde-config-resolver", "^2.0.5", false),
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@smithy/eventstream-serde-node", "^2.0.5", false),
AWS_SDK_EVENTSTREAM_SERDE_BROWSER("dependencies", "@smithy/eventstream-serde-browser", "^2.0.5", false),
"dependencies", "@smithy/eventstream-serde-config-resolver", "^2.0.6", false),
AWS_SDK_EVENTSTREAM_SERDE_NODE("dependencies", "@smithy/eventstream-serde-node", "^2.0.6", false),
AWS_SDK_EVENTSTREAM_SERDE_BROWSER("dependencies", "@smithy/eventstream-serde-browser", "^2.0.6", false),

// Conditionally added if a big decimal shape is found in a model.
BIG_JS("dependencies", "big.js", "^6.0.0", false),
TYPES_BIG_JS("devDependencies", "@types/big.js", "^6.0.0", false),

// Conditionally added when interacting with specific protocol test bodyMediaType values.
AWS_SDK_QUERYSTRING_BUILDER("dependencies", "@smithy/querystring-builder", "^2.0.5", false),
AWS_SDK_QUERYSTRING_BUILDER("dependencies", "@smithy/querystring-builder", "^2.0.6", false),

// Conditionally added when XML parser needs to be used.
XML_PARSER("dependencies", "fast-xml-parser", "4.2.5", false),
HTML_ENTITIES("dependencies", "entities", "2.2.0", false),

// Conditionally added when streaming blob response payload exists.
@Deprecated UTIL_STREAM_NODE("dependencies", "@smithy/util-stream-node", "^2.0.5", false),
@Deprecated UTIL_STREAM_BROWSER("dependencies", "@smithy/util-stream-browser", "^2.0.5", false),
UTIL_STREAM("dependencies", "@smithy/util-stream", "^2.0.5", false),
@Deprecated UTIL_STREAM_NODE("dependencies", "@smithy/util-stream-node", "^2.0.7", false),
@Deprecated UTIL_STREAM_BROWSER("dependencies", "@smithy/util-stream-browser", "^2.0.7", false),
UTIL_STREAM("dependencies", "@smithy/util-stream", "^2.0.7", false),

// Conditionally added when @aws.auth#sigv4 is used
SIGNATURE_V4("dependencies", "@smithy/signature-v4", "^2.0.4", false),
SIGNATURE_V4("dependencies", "@smithy/signature-v4", "^2.0.6", false),

// feat(experimentalIdentityAndAuth): Conditionally added dependencies for `experimentalIdentityAndAuth`.
// This package should never have a major version, and should only use minor and patch versions in development.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.extensions;

import software.amazon.smithy.typescript.codegen.Dependency;
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
import software.amazon.smithy.utils.Pair;

public class HttpHandlerExtensionConfigurationInterface implements ExtensionConfigurationInterface {

@Override
public Pair<String, Dependency> name() {
return Pair.of("HttpHandlerExtensionConfiguration", TypeScriptDependency.PROTOCOL_HTTP);
}

@Override
public Pair<String, Dependency> getExtensionConfigurationFn() {
return Pair.of("getHttpHandlerExtensionConfiguration", TypeScriptDependency.PROTOCOL_HTTP);
}

@Override
public Pair<String, Dependency> resolveRuntimeConfigFn() {
return Pair.of("resolveHttpHandlerRuntimeConfig", TypeScriptDependency.PROTOCOL_HTTP);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
import software.amazon.smithy.typescript.codegen.extensions.DefaultExtensionConfigurationInterface;
import software.amazon.smithy.typescript.codegen.extensions.ExtensionConfigurationInterface;
import software.amazon.smithy.typescript.codegen.extensions.HttpHandlerExtensionConfigurationInterface;
import software.amazon.smithy.utils.MapUtils;
import software.amazon.smithy.utils.SmithyInternalApi;

Expand Down Expand Up @@ -138,6 +139,6 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(

@Override
public List<ExtensionConfigurationInterface> getExtensionConfigurationInterfaces() {
return List.of(new DefaultExtensionConfigurationInterface());
return List.of(new DefaultExtensionConfigurationInterface(), new HttpHandlerExtensionConfigurationInterface());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ${extensionConfigName} } from "./extensionConfiguration";
* @public
*/
export interface RuntimeExtension {
configure(clientConfiguration: ${extensionConfigName}): void;
configure(extensionConfiguration: ${extensionConfigName}): void;
}

/**
Expand Down

0 comments on commit abba99d

Please sign in to comment.