forked from Deuxfleurs/garage
Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
4d6c0500cb | |||
0fbc9bbb05 |
3 changed files with 134 additions and 0 deletions
30
build.gradle.kts
Normal file
30
build.gradle.kts
Normal file
|
@ -0,0 +1,30 @@
|
|||
plugins {
|
||||
id("software.amazon.smithy").version("0.6.0")
|
||||
}
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
|
||||
// This dependency is required in order to apply the "openapi"
|
||||
// plugin in smithy-build.json
|
||||
classpath("software.amazon.smithy:smithy-openapi:1.29.0")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("software.amazon.smithy:smithy-model:1.29.0")
|
||||
implementation("software.amazon.smithy:smithy-aws-traits:1.29.0")
|
||||
}
|
||||
|
||||
configure<software.amazon.smithy.gradle.SmithyExtension> {
|
||||
// Uncomment this to use a custom projection when building the JAR.
|
||||
// projection = "foo"
|
||||
}
|
||||
|
||||
// Uncomment to disable creating a JAR.
|
||||
//tasks["jar"].enabled = false
|
96
model/k2v.smithy
Normal file
96
model/k2v.smithy
Normal file
|
@ -0,0 +1,96 @@
|
|||
$version: "2"
|
||||
namespace org.deuxfleurs.garage.k2v
|
||||
|
||||
use aws.api#service
|
||||
use aws.auth#sigv4
|
||||
use aws.protocols#restJson1
|
||||
|
||||
@service(sdkId: "k2v")
|
||||
@sigv4(name: "k2v")
|
||||
@restJson1
|
||||
service K2V {
|
||||
version: "2023-04-10"
|
||||
resources: [ Item ]
|
||||
//operations: [ PollItem, ReadIndex, InsertBatch, DeleteBatch, PollRange ]
|
||||
}
|
||||
|
||||
resource Item {
|
||||
read: ReadItem
|
||||
put: InsertItem
|
||||
//delete: DeleteItem
|
||||
//list: ReadBatch
|
||||
}
|
||||
|
||||
@mixin
|
||||
structure KeySelector {
|
||||
@required
|
||||
@httpLabel
|
||||
bucketName: String
|
||||
|
||||
@required
|
||||
@httpLabel
|
||||
partitionKey: String
|
||||
|
||||
@required
|
||||
@httpQuery("sort_key")
|
||||
sortKey: String
|
||||
}
|
||||
|
||||
@readonly
|
||||
@http(method: "GET", uri: "/{bucketName}/{partitionKey}", code: 200)
|
||||
operation ReadItem {
|
||||
input: ReadItemInput
|
||||
output: ReadItemOutput
|
||||
}
|
||||
|
||||
@input
|
||||
structure ReadItemInput with [KeySelector] {}
|
||||
|
||||
@output
|
||||
structure ReadItemOutput {
|
||||
value: ItemList
|
||||
}
|
||||
|
||||
@sparse
|
||||
list ItemList {
|
||||
member: Blob
|
||||
}
|
||||
|
||||
@idempotent
|
||||
@http(method: "PUT", uri: "/{bucketName}/{partitionKey}", code: 204)
|
||||
operation InsertItem {
|
||||
input: InsertItemInput
|
||||
}
|
||||
|
||||
@input
|
||||
structure InsertItemInput with [KeySelector] {}
|
||||
|
||||
//operation DeleteItem {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
||||
|
||||
//operation PollItem {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
||||
|
||||
//operation ReadIndex {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
||||
|
||||
//operation InsertBatch {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
||||
|
||||
//operation DeleteBatch {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
||||
|
||||
//operation PollRange {
|
||||
// input: String
|
||||
// output: String
|
||||
//}
|
8
smithy-build.json
Normal file
8
smithy-build.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"plugins": {
|
||||
"openapi": {
|
||||
"service": "org.deuxfleurs.garage.k2v#K2V"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue