-
Notifications
You must be signed in to change notification settings - Fork 3
smithy-call #620
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
Merged
Merged
smithy-call #620
Changes from all commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
28aeba7
Everything except for PicoCLI works
franco2002lu 68f06d4
Working Gradle
franco2002lu a34fe97
Refactor CLI package
franco2002lu 58ac69e
Initial input revamp
franco2002lu b7aac13
Support json file path as an input type
franco2002lu 0371c98
add resource-config.json
franco2002lu be74a26
First attempt in addressing Protocol Trait Issue
franco2002lu 43c1915
Support RestJson and RestXml protocols
franco2002lu eba7049
First working version of CLI (requires retrieving local resource files.
franco2002lu 1b66de0
First working version of CLI (requires retrieving local resource files.
franco2002lu d9f31cb
Add endpoint url requirement for executing operations
franco2002lu c4107a0
Make protocol specification optional
franco2002lu bd3edfb
Improve getResourceFiles() and executeClientCall
franco2002lu b743017
Replace io.* import
franco2002lu 8228a80
Improve model file retrieval
franco2002lu 9e7262a
Have SigV4DSigner accommodate for custom ports
franco2002lu 3b68e3c
First working SigV4 call
franco2002lu 9d3ede0
Initial working CLI version with SigV4
franco2002lu 51ab99d
Enhance auth input handling, make CLI flags more descriptive.
franco2002lu ba3ba69
clean-up build.gradle.kts
franco2002lu 918231d
Remove unused reflect-config.json
franco2002lu 787d9aa
Update error messages.
franco2002lu 10160df
Merge branch 'main' into dynamic-client-cli
franco2002lu 3053b90
Remove explicit transport configuration.
franco2002lu 2b29df3
Rename CLI to smithy-call
franco2002lu 2dbb7c3
Remove unnecessary include
franco2002lu dea93a1
Rename resource file list
franco2002lu 6f581ef
Remove Smithy plugin
franco2002lu 0940f73
Add README example
franco2002lu 228c437
Merge branch 'main' into dynamic-client-cli
franco2002lu 20b64ba
Merge branch 'main' into dynamic-client-cli
franco2002lu 75961a9
Rename URI port check to uriUsingStandardPort.
franco2002lu 51346b7
Update command descriptions
franco2002lu c63bf5f
Make SmithyCall and SmithyCallRunner final classes.
franco2002lu e834fd5
Move protocol types into an Enum.
franco2002lu 3ced7ca
Remove redundant error handling
franco2002lu bc24cf8
Output machine-readable JSON from operation calls.
franco2002lu d02b0d7
Make --list-operations output more readable.
franco2002lu 312c588
Correct document serialization to JSON.
franco2002lu 1cdbb6e
Support multiple --model-path args.
franco2002lu 83fb491
Group together auth-related options.
franco2002lu 3dc2ab3
Implement SEVERE level logs
franco2002lu 9282d99
Implement FINE level logs
franco2002lu b91dbaa
Improve cross-checking for service name in model.
franco2002lu 7a206c9
Add basic tests.
franco2002lu a26e00c
Rename json payload input.
franco2002lu 296d588
Merge branch 'main' into dynamic-client-cli
franco2002lu 9514804
Rename aws-sigv4 implementation.
franco2002lu 4dede25
Include ByteArrayOutputStream in try block
franco2002lu 13d68d7
Revert "Include ByteArrayOutputStream in try block"
franco2002lu 35c8122
Simplify exception handling in tests.
franco2002lu 29e6d76
Simplify exception handling in tests.
franco2002lu 0efd6ef
Add smithy aws traits as dependency
franco2002lu 7f70a9c
Merge branch 'main' into dynamic-client-cli
franco2002lu 8f52ce9
Update RPCV2 package naming
franco2002lu 299c3ec
Add waiters dependency.
franco2002lu cb5a43b
Merge branch 'main' into dynamic-client-cli
franco2002lu 40b81f5
Remove unused dep
adwsingh d6faba1
Improve ProtocolType enum handling.
franco2002lu fe50ee7
Add consistent dependency handling.
franco2002lu 18c1a6b
Merge branch 'main' into dynamic-client-cli
franco2002lu 7bac837
Improve command descriptions.
franco2002lu f838e1f
Merge branch 'main' into dynamic-client-cli
franco2002lu 80845ce
Improve service name description.
franco2002lu 62cbb25
Remove unused interceptor configuration.
franco2002lu 6a10def
Simply auth type switch statement.
franco2002lu cc30c8c
Make out reading more efficient.
franco2002lu 13826de
Remove stacktrace from input validation errors.
franco2002lu d168d80
Change SmithyCall class to package-private.
franco2002lu 0bf5652
Merge branch 'main' into dynamic-client-cli
franco2002lu 8cddc56
Merge branch 'main' into dynamic-client-cli
franco2002lu 1997a2f
Improve arg descriptions and names.
franco2002lu 5aa91be
Support relative shape IDs.
franco2002lu 14253a6
Exclude non-service shape IDs while listing.
franco2002lu e42561b
Add tests for relative shape ID support.
franco2002lu be7c93f
Update cli/src/main/java/software/amazon/smithy/java/cli/SmithyCall.java
franco2002lu d4233ac
Merge branch 'main' into dynamic-client-cli
franco2002lu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## smithy-call | ||
|
||
This module contains the base-version of smithy-call: a CLI that uses ahead-of-time compilation and the dynamic client to make adhoc calls to services. | ||
|
||
|
||
The functionality provided by this CLI includes: | ||
1. Execute operations listed in a service model | ||
2. List operations listed in a service model | ||
3. SigV4 authentication | ||
4. Multi-protocol support | ||
|
||
### Example Call | ||
1. Build the native binary for smithy-call: `./gradlew :cli:nativeCompile` | ||
2. Start-up Cafe service from the end-to-end example: `./gradlew :examples:end-to-end:run` | ||
3. Check the available operations: `./cli/build/native/nativeCompile/smithy-call com.example#CoffeeShop --list-operations -m /Users/fluu/workplace/smithy-java-cli/examples/end-to-end/model` | ||
4. Send a test call to our Cafe service: `./cli/build/native/nativeCompile/smithy-call com.example#CoffeeShop GetMenu -m /Users/fluu/workplace/smithy-java-cli/examples/end-to-end/model --url http://localhost:8888` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
plugins { | ||
`java-library` | ||
application | ||
alias(libs.plugins.graalvm.native) | ||
} | ||
|
||
dependencies { | ||
implementation(libs.picocli) | ||
annotationProcessor(libs.picocli.codegen) | ||
|
||
implementation(libs.smithy.aws.traits) | ||
implementation(libs.smithy.waiters) | ||
|
||
// Client dependencies | ||
implementation(project(":aws:client:aws-client-restjson")) | ||
implementation(project(":aws:client:aws-client-awsjson")) | ||
implementation(project(":aws:client:aws-client-restxml")) | ||
implementation(project(":client:client-rpcv2-cbor")) | ||
|
||
implementation(project(":client:dynamic-client")) | ||
implementation(project(":codecs:json-codec")) | ||
implementation(project(":client:client-http")) | ||
implementation(project(":aws:client:aws-client-core")) | ||
implementation(project(":aws:aws-sigv4")) | ||
|
||
testImplementation(platform(libs.junit.bom)) | ||
testImplementation(libs.junit.jupiter.api) | ||
testImplementation(libs.junit.jupiter.engine) | ||
testImplementation(libs.junit.jupiter.params) | ||
} | ||
|
||
tasks.register<Copy>("copySmithyAwsTraits") { | ||
from(zipTree(configurations.runtimeClasspath.get().filter { it.name.startsWith("smithy-aws-traits-") }.single())) { | ||
include("**/*.smithy") | ||
eachFile { | ||
relativePath = RelativePath(true, name) | ||
} | ||
} | ||
into(layout.buildDirectory.dir("smithy-aws-traits")) | ||
|
||
includeEmptyDirs = false | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
tasks.named("processResources") { | ||
dependsOn("copySmithyAwsTraits") | ||
} | ||
|
||
sourceSets { | ||
main { | ||
resources { | ||
srcDir(layout.buildDirectory.dir("smithy-aws-traits")) | ||
} | ||
} | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
||
application { | ||
mainClass = "software.amazon.smithy.java.cli.SmithyCallRunner" | ||
} | ||
|
||
graalvmNative { | ||
binaries.named("main") { | ||
// Set up correct java JVM to use. | ||
javaLauncher.set( | ||
javaToolchains.launcherFor { | ||
// Use oracle GraalVM JDK for build | ||
languageVersion.set(JavaLanguageVersion.of(23)) | ||
vendor.set(JvmVendorSpec.matching("Oracle Corporation")) | ||
}, | ||
) | ||
|
||
// Ensure resources are detected | ||
resources.autodetect() | ||
|
||
buildArgs.addAll(listOf( | ||
"-H:ResourceConfigurationFiles=${projectDir}/src/resource-config.json", | ||
"--enable-url-protocols=http,https", | ||
)) | ||
|
||
// Debug info | ||
verbose.set(true) | ||
|
||
// Image configuration | ||
imageName.set("smithy-call") | ||
mainClass.set(application.mainClass) | ||
|
||
// Determines if image is a shared library [note: defaults to true if java-library plugin is applied] | ||
sharedLibrary.set(false) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} |
8 changes: 8 additions & 0 deletions
8
cli/src/main/java/software/amazon/smithy/java/cli/ProtocolType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package software.amazon.smithy.java.cli; | ||
|
||
public enum ProtocolType { | ||
AWS_JSON, | ||
RPC_V2_CBOR, | ||
REST_JSON, | ||
REST_XML | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than ship the AWS protocol definitions and auth schemas and other Smithy models in these packages, can you instead add a dependency on them via Maven coordinates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a waiters dependency too if this would ever work with AWS models.
You maybe want to add an
--aut
flag to the CLI to ignore unknown traits at some point. That can wait til later, but the CLI will fail right now if a trait isn't defined.