This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Resource, ResourceType only (#5)
* Support Resource, ResourceType only Drops the old, dormant implementation for a repository that focuses on hosting the types / schemas of the various resource types, and allows the downstream user to construct the type of their Resource and ResourceType as necessary. This solves the code-reusage problem while keeping downstream implementations performant. * Add Resource, ResourceType to top-level package
- Loading branch information
1 parent
2f8bdc3
commit af96b0b
Showing
106 changed files
with
1,274 additions
and
64 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
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,54 @@ | ||
let Resource | ||
: ∀(_params : { Source : Type, Version : Type }) → | ||
{ Type : Type | ||
, default : | ||
{ icon : Optional Text | ||
, version : Optional _params.Version | ||
, check_every : Optional Text | ||
, tags : Optional (List Text) | ||
, public : Optional Bool | ||
, webhook_token : Optional Text | ||
} | ||
} | ||
= λ(_params : { Source : Type, Version : Type }) → | ||
{ Type = | ||
{ name : Text | ||
, type : Text | ||
, source : _params.Source | ||
, icon : Optional Text | ||
, version : Optional _params.Version | ||
, check_every : Optional Text | ||
, tags : Optional (List Text) | ||
, public : Optional Bool | ||
, webhook_token : Optional Text | ||
} | ||
, default = | ||
{ icon = None Text | ||
, version = None _params.Version | ||
, check_every = None Text | ||
, tags = None (List Text) | ||
, public = None Bool | ||
, webhook_token = None Text | ||
} | ||
} | ||
|
||
let example = | ||
let Git = ./resource-types/Git.dhall | ||
|
||
let S3 = ./resource-types/S3.dhall | ||
|
||
let Source = < Git : Git.Source.Type | S3 : S3.Source.Type > | ||
|
||
let Version = < Git : Git.Version.Type | S3 : S3.Version.Type > | ||
|
||
let Resource = Resource { Source, Version } | ||
|
||
in Resource::{ | ||
, name = "example-repository" | ||
, type = Git.meta.name | ||
, source = | ||
Source.Git | ||
Git.Source::{ uri = "git@github.com:example/example.git" } | ||
} | ||
|
||
in Resource |
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,50 @@ | ||
let ResourceType | ||
: ∀(_params : { Source : Type, SourceGetParams : Type }) → | ||
{ Type : Type | ||
, default : | ||
{ privileged : Optional Bool | ||
, params : Optional _params.SourceGetParams | ||
, check_every : Optional Text | ||
, tags : Optional (List Text) | ||
, unique_version_history : Optional Bool | ||
} | ||
} | ||
= λ(_params : { Source : Type, SourceGetParams : Type }) → | ||
{ Type = | ||
{ name : Text | ||
, type : Text | ||
, source : _params.Source | ||
, privileged : Optional Bool | ||
, params : Optional _params.SourceGetParams | ||
, check_every : Optional Text | ||
, tags : Optional (List Text) | ||
, unique_version_history : Optional Bool | ||
} | ||
, default = | ||
{ privileged = None Bool | ||
, params = None _params.SourceGetParams | ||
, check_every = None Text | ||
, tags = None (List Text) | ||
, unique_version_history = None Bool | ||
} | ||
} | ||
|
||
let example = | ||
let RegistryImage = ./resource-types/RegistryImage.dhall | ||
|
||
let GithubListRepos = ./resource-types/GithubListRepos.dhall | ||
|
||
let Source = RegistryImage.Source.Type | ||
|
||
let SourceGetParams = RegistryImage.Params.Get.Type | ||
|
||
let ResourceType = ResourceType { Source, SourceGetParams } | ||
|
||
in ResourceType::{ | ||
, name = GithubListRepos.meta.name | ||
, type = RegistryImage.meta.name | ||
, source = RegistryImage.Source::GithubListRepos.meta.{ repository } | ||
, params = Some RegistryImage.Params.Get::{ format = Some "rootfs" } | ||
} | ||
|
||
in ResourceType |
Oops, something went wrong.