-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf29c86
commit b07f3a0
Showing
8 changed files
with
359 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
build | ||
.smithy.lsp.log | ||
.gradle |
This file contains 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# terraform-registry-api | ||
Terraform registry API definition, in case you want to build it | ||
|
||
Instructions how to use it will follow soon. |
This file contains 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,96 @@ | ||
$version: "2" | ||
namespace tf.registry.module | ||
use tf.registry.shapes#SemVer | ||
use tf.registry.shapes#githubModuleDownloadURL | ||
use tf.registry.shapes#NamespaceDef | ||
|
||
resource Module { | ||
identifiers: { | ||
namespace: NamespaceDef | ||
name: String | ||
version: SemVer | ||
} | ||
read: GetModuleVersion, | ||
list: ListModuleVersions, | ||
} | ||
|
||
@suppress(["HttpUriConflict"]) | ||
@readonly | ||
@http(method: "GET", uri: "/v1/modules/{namespace}/{name}/{system}/{version}/download", code: 200) | ||
operation GetModuleVersion { | ||
input: GetModuleVersionInput | ||
output: GetModuleVersionOutput | ||
} | ||
|
||
@input | ||
structure GetModuleVersionInput { | ||
@required | ||
@httpLabel | ||
namespace: NamespaceDef = "terraform-aws-modules" | ||
|
||
@required | ||
@httpLabel | ||
name: String = "iam" | ||
|
||
@required | ||
@httpLabel | ||
system: String = "aws" | ||
|
||
@required | ||
@httpLabel | ||
version: SemVer = "5.2.0" | ||
} | ||
|
||
@output | ||
structure GetModuleVersionOutput { | ||
@httpHeader("X-Terraform-Get") | ||
xterraformget: githubModuleDownloadURL | ||
} | ||
|
||
@suppress(["HttpUriConflict"]) | ||
@readonly | ||
@http(method: "GET", uri: "/v1/modules/{namespace}/{name}/{system}/versions", code:200) | ||
operation ListModuleVersions { | ||
input: ListModuleVersionsInput | ||
output: ListModuleVersionsOutput | ||
} | ||
|
||
@input | ||
structure ListModuleVersionsInput { | ||
@required | ||
@httpLabel | ||
namespace: NamespaceDef = "terraform-aws-modules" | ||
|
||
@required | ||
@httpLabel | ||
name: String = "iam" | ||
|
||
@required | ||
@httpLabel | ||
system: String = "aws" | ||
} | ||
|
||
@output | ||
structure ListModuleVersionsOutput { | ||
@required | ||
modules: Modules | ||
} | ||
|
||
@length(max:1) | ||
list Modules { | ||
member: VersionsModule | ||
} | ||
|
||
structure VersionsModule { | ||
@required | ||
versions: Versions | ||
} | ||
|
||
list Versions { | ||
member: Version | ||
} | ||
|
||
structure Version { | ||
@required | ||
version: SemVer | ||
} |
This file contains 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,162 @@ | ||
$version: "2" | ||
namespace tf.registry.provider | ||
use tf.registry.shapes#SemVer | ||
use tf.registry.shapes#Arch | ||
use tf.registry.shapes#Protocol | ||
use tf.registry.shapes#SHASum | ||
use tf.registry.shapes#GPGKeyID | ||
use tf.registry.shapes#Filename | ||
use tf.registry.shapes#OS | ||
|
||
resource Provider { | ||
identifiers: { | ||
namespace: String | ||
type: String | ||
version: SemVer | ||
} | ||
read: GetProviderVersion, | ||
list: ListProviderVersions, | ||
} | ||
|
||
// https://registry.opentofu.org/v1/providers/hashicorp/aws/5.20.1/download/darwin/amd64 | ||
@suppress(["HttpUriConflict"]) | ||
@readonly | ||
@http(method: "GET", uri: "/v1/providers/{namespace}/{type}/{version}/download/{os}/{arch}", code: 200) | ||
operation GetProviderVersion { | ||
input: GetProviderVersionInput | ||
output: GetProviderVersionOutput | ||
} | ||
|
||
@input | ||
structure GetProviderVersionInput { | ||
@required | ||
@httpLabel | ||
@length(min: 2) | ||
namespace: String = "hashicorp" | ||
|
||
@required | ||
@httpLabel | ||
type: String = "aws" | ||
|
||
@required | ||
@httpLabel | ||
version: SemVer = "5.20.1" | ||
|
||
@required | ||
@httpLabel | ||
os: String = "darwin" | ||
|
||
@required | ||
@httpLabel | ||
arch: String = "amd64" | ||
} | ||
|
||
@output | ||
structure GetProviderVersionOutput { | ||
@required | ||
arch: Arch | ||
|
||
// https://github.com/opentofu/terraform-provider-aws/releases/download/v5.20.1/terraform-provider-aws_5.20.1_darwin_amd64.zip | ||
@required | ||
@jsonName("download_url") | ||
downloadUrl: String | ||
|
||
@required | ||
filename: Filename | ||
|
||
// darwin | ||
@required | ||
os: OS | ||
|
||
// 5.0 | ||
@required | ||
protocols: Protocols | ||
|
||
// 8d356f2b0f67e9a048f0dafa463541cc0965021364cb689c3481195b304fdbab | ||
@required | ||
shasum: SHASum | ||
|
||
// https://github.com/opentofu/terraform-provider-aws/releases/download/v5.20.1/terraform-provider-aws_5.20.1_SHA256SUMS | ||
@required | ||
@jsonName("shasums_url") | ||
shasumsUrl: String | ||
|
||
// https://github.com/opentofu/terraform-provider-aws/releases/download/v5.20.1/terraform-provider-aws_5.20.1_SHA256SUMS.sig | ||
@required | ||
@jsonName("shasums_signature_url") | ||
shasumsSignatureUrl: String | ||
|
||
@jsonName("signing_keys") | ||
signkeys: SigningKeys | ||
} | ||
|
||
list Protocols { | ||
member: Protocol | ||
} | ||
|
||
structure SigningKeys { | ||
@required | ||
@jsonName("gpg_public_keys") | ||
gpgpublickeys: GPGPubKeys | ||
} | ||
|
||
@length(min:0) | ||
list GPGPubKeys { | ||
member: GPGPubKey | ||
} | ||
|
||
structure GPGPubKey { | ||
@jsonName("key_id") | ||
keyId: GPGKeyID | ||
|
||
@jsonName("ascii_armor") | ||
asciiArmor: String | ||
} | ||
|
||
// /v1/providers/hashicorp/type/versions | ||
@suppress(["HttpUriConflict"]) | ||
@readonly | ||
@http(method: "GET", uri: "/v1/providers/{namespace}/{type}/versions", code: 200) | ||
operation ListProviderVersions { | ||
input: ListProviderVersionsInput | ||
output: ListProviderVersionsOutput | ||
} | ||
|
||
// ^/v1/providers/[^/]+/[^/]+/versions | ||
@input | ||
structure ListProviderVersionsInput { | ||
@required | ||
@httpLabel | ||
@length(min: 2) | ||
namespace: String = "hashicorp" | ||
|
||
@required | ||
@httpLabel | ||
@length(min: 2) | ||
type: String = "aws" | ||
} | ||
|
||
@output | ||
structure ListProviderVersionsOutput { | ||
@required | ||
versions: ProviderVersionsList | ||
} | ||
|
||
list ProviderVersionsList { | ||
member: ProviderVersion | ||
} | ||
|
||
structure ProviderVersion { | ||
version: SemVer | ||
protocols: Protocols | ||
platforms: Platforms | ||
} | ||
|
||
list Platforms { | ||
member: Platform | ||
} | ||
|
||
structure Platform { | ||
os: OS | ||
arch: Arch | ||
} |
This file contains 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,33 @@ | ||
$version: "2" | ||
namespace tf.registry.shapes | ||
|
||
// PATTERNS | ||
@pattern("^amd64|arm64|arm|386$") | ||
string Arch | ||
|
||
// terraform-provider-aws_5.20.1_darwin_amd64.zip | ||
@pattern("^terraform-provider-([a-z]+(-[a-z]+)?)_(([0-9]{1}|[1-9][0-9])\\.){2}([0-9]{1}|[1-9][0-9])_(darwin|linux|windows)_(amd64|arm|arm64|386)\\.zip$") | ||
string Filename | ||
|
||
@pattern("^darwin|linux|windows$") | ||
string OS | ||
|
||
@pattern("^\\d{1,2}\\.\\d$") | ||
string Protocol | ||
|
||
@pattern("^[a-z0-9]{64}$") | ||
string SHASum | ||
|
||
@pattern("^[A-Z0-9]{16}$") | ||
string GPGKeyID | ||
|
||
// "X-Terraform-Get": fmt.Sprintf("git::https://github.com/%s/%s?ref=%s", params.Namespace, repoName, releaseTag)} | ||
@pattern("^git::https://github\\.com/\\w+/\\w+\\?ref=\\w+$") | ||
string githubModuleDownloadURL | ||
|
||
@pattern("^terraform-[a-z0-9]+-[a-z0-9]+$") | ||
string NamespaceDef | ||
|
||
// semver | ||
@pattern("^(([0-9]{1}|[1-9][0-9])\\.){2}([0-9]{1}|[1-9][0-9]{1,2})$") | ||
string SemVer |
This file contains 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,12 @@ | ||
$version: "2" | ||
namespace tf.registry | ||
use aws.protocols#restJson1 | ||
use tf.registry.provider#Provider | ||
use tf.registry.module#Module | ||
use tf.registry.wellknown#WellKnown | ||
|
||
@restJson1 | ||
service Registry { | ||
version: "2006-03-01" | ||
resources: [Provider, Module, WellKnown] | ||
} |
This file contains 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,34 @@ | ||
$version: "2" | ||
namespace tf.registry.wellknown | ||
|
||
// .well-known/terraform.json | ||
resource WellKnown { | ||
read: GetWellKnown | ||
} | ||
|
||
@readonly | ||
@http(method: "GET", uri: "/.well-known/terraform.json", code: 200) | ||
operation GetWellKnown { | ||
output: GetWellKnownOutput | ||
} | ||
|
||
@output | ||
structure GetWellKnownOutput { | ||
@required | ||
@jsonName("modules.v1") | ||
@default("/v1/modules/") | ||
modulesv1: modulesMetadataVersion | ||
|
||
@required | ||
@jsonName("providers.v1") | ||
@default("/v1/providers/") | ||
providersv1: providersMetadataVersion | ||
} | ||
|
||
enum modulesMetadataVersion { | ||
V1 = "/v1/modules/" | ||
} | ||
|
||
enum providersMetadataVersion { | ||
V1 = "/v1/providers/" | ||
} |
This file contains 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 @@ | ||
{ | ||
"version": "1.0", | ||
"maven": { | ||
"dependencies": [ | ||
"software.amazon.smithy:smithy-aws-traits:1.40.0", | ||
"software.amazon.smithy:smithy-openapi:1.40.0" | ||
] | ||
}, | ||
"plugins": { | ||
"openapi": { | ||
"service": "tf.registry#Registry", | ||
"protocol": "aws.protocols#restJson1", | ||
"version": "3.1.0", | ||
"useIntegerType": true | ||
} | ||
} | ||
} |