Skip to content

Commit

Permalink
guides: Add Change Service Guide (#253)
Browse files Browse the repository at this point in the history
This patch also adds Organization to the Author API as an example of a
regular expression constraint.
  • Loading branch information
jeffmccune committed Sep 24, 2024
1 parent 67d00f1 commit 6a47edb
Show file tree
Hide file tree
Showing 15 changed files with 778 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"words": [
"acraccesstokens",
"admissionregistration",
"anthos",
"apiextensions",
"applicationset",
"applicationsets",
Expand All @@ -31,6 +32,7 @@
"clusterrole",
"clusterrolebinding",
"clustersecretstores",
"CNCF",
"configmap",
"cookiesecret",
"coredns",
Expand Down
19 changes: 19 additions & 0 deletions api/author/v1alpha3/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,22 @@ type Platform struct {
// platform operators to define.
Domain string `cue:"string | *\"holos.localhost\""`
}

// Organization represents organizational metadata useful across the platform.
type Organization struct {
Name string
DisplayName string
}

// OrganizationStrict represents organizational metadata useful across the
// platform. This is an example of using CUE regular expressions to constrain
// and validate configuration.
type OrganizationStrict struct {
Organization `json:",inline"`
// Name represents the organization name as a resource name. Must be 63
// characters or less. Must start with a letter. May contain non-repeating
// hyphens, letters, and numbers. Must end with a letter or number.
Name string `cue:"=~ \"^[a-z][0-9a-z-]{1,61}[0-9a-z]$\" & !~ \"--\""`
// DisplayName represents the human readable organization name.
DisplayName string `cue:"=~ \"^[0-9A-Za-z][0-9A-Za-z ]{2,61}[0-9A-Za-z]$\" & !~ \" \""`
}
31 changes: 31 additions & 0 deletions doc/md/api/author/v1alpha3.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Package v1alpha3 contains CUE definitions intended as convenience wrappers aroun
- [type Helm](<#Helm>)
- [type Kubernetes](<#Kubernetes>)
- [type Kustomize](<#Kustomize>)
- [type Organization](<#Organization>)
- [type OrganizationStrict](<#OrganizationStrict>)
- [type Platform](<#Platform>)
- [type StandardFleets](<#StandardFleets>)

Expand Down Expand Up @@ -172,6 +174,35 @@ type Kustomize struct {
}
```

<a name="Organization"></a>
## type Organization {#Organization}

Organization represents organizational metadata useful across the platform.

```go
type Organization struct {
Name string
DisplayName string
}
```

<a name="OrganizationStrict"></a>
## type OrganizationStrict {#OrganizationStrict}

OrganizationStrict represents organizational metadata useful across the platform. This is an example of using CUE regular expressions to constrain and validate configuration.

```go
type OrganizationStrict struct {
Organization `json:",inline"`
// Name represents the organization name as a resource name. Must be 63
// characters or less. Must start with a letter. May contain non-repeating
// hyphens, letters, and numbers. Must end with a letter or number.
Name string `cue:"=~ \"^[a-z][0-9a-z-]{1,61}[0-9a-z]$\" & !~ \"--\""`
// DisplayName represents the human readable organization name.
DisplayName string `cue:"=~ \"^[0-9A-Za-z][0-9A-Za-z ]{2,61}[0-9A-Za-z]$\" & !~ \" \""`
}
```

<a name="Platform"></a>
## type Platform {#Platform}

Expand Down
Loading

0 comments on commit 6a47edb

Please sign in to comment.