mirror of
https://github.com/foomo/posh-providers.git
synced 2025-10-16 12:35:41 +00:00
feat: add schema
This commit is contained in:
parent
eaa5cceffd
commit
4588a19b45
45
Makefile
45
Makefile
@ -1,4 +1,7 @@
|
|||||||
.DEFAULT_GOAL:=help
|
.DEFAULT_GOAL:=help
|
||||||
|
-include .makerc
|
||||||
|
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
|
||||||
## === Tasks ===
|
## === Tasks ===
|
||||||
|
|
||||||
@ -12,6 +15,46 @@ tidy:
|
|||||||
lint:
|
lint:
|
||||||
@golangci-lint run
|
@golangci-lint run
|
||||||
|
|
||||||
|
.PHONY: schema
|
||||||
|
## Run linter
|
||||||
|
schema:
|
||||||
|
@jsonschema bundle config.schema.base.json \
|
||||||
|
--resolve ./arbitrary/open/config.schema.json \
|
||||||
|
--resolve ./arbitrary/zip/config.schema.json \
|
||||||
|
--resolve ./azure/az/config.schema.json \
|
||||||
|
--resolve ./cloudflare/cloudflared/config.schema.json \
|
||||||
|
--resolve ./digitalocean/doctl/config.schema.json \
|
||||||
|
--resolve ./etcd-io/etcd/config.schema.json \
|
||||||
|
--resolve ./facebook/docusaurus/config.schema.json \
|
||||||
|
--resolve ./filosottile/mkcert/config.schema.json \
|
||||||
|
--resolve ./foomo/beam/config.schema.json \
|
||||||
|
--resolve ./foomo/gocontentful/config.schema.json \
|
||||||
|
--resolve ./foomo/sesamy/config.schema.json \
|
||||||
|
--resolve ./foomo/squadron/config.schema.json \
|
||||||
|
--resolve ./goharbor/harbor/config.schema.json \
|
||||||
|
--resolve ./golang-migrate/migrate/config.schema.json \
|
||||||
|
--resolve ./google/gcloud/config.schema.json \
|
||||||
|
--resolve ./grafana/k6/config.schema.json \
|
||||||
|
--resolve ./gravitational/teleport/config.schema.json \
|
||||||
|
--resolve ./gruntwork-io/terragrunt/config.schema.json \
|
||||||
|
--resolve ./hashicorp/cdktf/config.schema.json \
|
||||||
|
--resolve ./jondot/hygen/config.schema.json \
|
||||||
|
--resolve ./k3d-io/k3d/config.schema.json \
|
||||||
|
--resolve ./kubernets/kubectl/config.schema.json \
|
||||||
|
--resolve ./onepassword/config.schema.json \
|
||||||
|
--resolve ./pivotal/licensefinder/config.schema.json \
|
||||||
|
--resolve ./pulumi/pulumi/azure/config.schema.json \
|
||||||
|
--resolve ./pulumi/pulumi/gcloud/config.schema.json \
|
||||||
|
--resolve ./rclone/rclone/config.schema.json \
|
||||||
|
--resolve ./slack-go/slack/config.schema.json \
|
||||||
|
--resolve ./sqlc-dev/sqlc/config.schema.json \
|
||||||
|
--resolve ./stackitcloud/stackit/config.schema.json \
|
||||||
|
--resolve ./stern/stern/config.schema.json \
|
||||||
|
--resolve ./usebruno/bruno/config.schema.json \
|
||||||
|
--resolve ./webdriverio/webdriverio/config.schema.json \
|
||||||
|
--without-id \
|
||||||
|
> config.schema.json
|
||||||
|
|
||||||
.PHONY: outdated
|
.PHONY: outdated
|
||||||
## Show outdated direct dependencies
|
## Show outdated direct dependencies
|
||||||
outdated:
|
outdated:
|
||||||
@ -20,7 +63,7 @@ outdated:
|
|||||||
.PHONY: test
|
.PHONY: test
|
||||||
## Run tests
|
## Run tests
|
||||||
test:
|
test:
|
||||||
@go test -coverprofile=coverage.out -race -json ./... | gotestfmt
|
@GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -race -json ./... | gotestfmt
|
||||||
|
|
||||||
.PHONY: lint.fix
|
.PHONY: lint.fix
|
||||||
## Fix lint violations
|
## Fix lint violations
|
||||||
|
|||||||
@ -8,21 +8,21 @@ type (
|
|||||||
Config map[string]ConfigRouter
|
Config map[string]ConfigRouter
|
||||||
ConfigRouter struct {
|
ConfigRouter struct {
|
||||||
// Router base url
|
// Router base url
|
||||||
URL string `yaml:"url"`
|
URL string `json:"url" yaml:"url"`
|
||||||
// Router Child routes
|
// Router Child routes
|
||||||
Routes map[string]ConfigRoute `yaml:"routes"`
|
Routes map[string]ConfigRoute `json:"routes" yaml:"routes"`
|
||||||
// Router descriotion
|
// Router descriotion
|
||||||
Description string `yaml:"description"`
|
Description string `json:"description" yaml:"description"`
|
||||||
}
|
}
|
||||||
ConfigRoute struct {
|
ConfigRoute struct {
|
||||||
// Route path
|
// Route path
|
||||||
Path string `yaml:"path"`
|
Path string `json:"path" yaml:"path"`
|
||||||
// Route description
|
// Route description
|
||||||
Description string `yaml:"description"`
|
Description string `json:"description" yaml:"description"`
|
||||||
// Child routes
|
// Child routes
|
||||||
Routes map[string]ConfigRoute `yaml:"routes"`
|
Routes map[string]ConfigRoute `json:"routes" yaml:"routes"`
|
||||||
// Basic authentication secret
|
// Basic authentication secret
|
||||||
BasicAuth *onepassword.Secret `yaml:"basicAuth"`
|
BasicAuth *onepassword.Secret `json:"basicAuth" yaml:"basicAuth"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
94
arbitrary/open/config.schema.json
Normal file
94
arbitrary/open/config.schema.json
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/arbitrary/open/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigRouter"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"ConfigRoute": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Route path"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Route description"
|
||||||
|
},
|
||||||
|
"routes": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigRoute"
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"description": "Child routes"
|
||||||
|
},
|
||||||
|
"basicAuth": {
|
||||||
|
"$ref": "#/$defs/Secret",
|
||||||
|
"description": "Basic authentication secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"description",
|
||||||
|
"routes",
|
||||||
|
"basicAuth"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigRouter": {
|
||||||
|
"properties": {
|
||||||
|
"url": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Router base url"
|
||||||
|
},
|
||||||
|
"routes": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigRoute"
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"description": "Router Child routes"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Router descriotion"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"url",
|
||||||
|
"routes",
|
||||||
|
"description"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
arbitrary/open/config_test.go
Normal file
40
arbitrary/open/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package open_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/arbitrary/open"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/arbitrary/open", "./"))
|
||||||
|
schema := reflector.Reflect(&open.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
46
arbitrary/zip/config.schema.json
Normal file
46
arbitrary/zip/config.schema.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/arbitrary/zip/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"credentials": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"credentials"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
arbitrary/zip/config_test.go
Normal file
40
arbitrary/zip/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package zip_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/arbitrary/zip"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/arbitrary/zip", "./"))
|
||||||
|
schema := reflector.Reflect(&zip.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
88
azure/az/config.schema.json
Normal file
88
azure/az/config.schema.json
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/azure/az/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Artifactory": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceGroup": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"resourceGroup"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Cluster"
|
||||||
|
},
|
||||||
|
"resourceGroup": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Cluster resource group name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"resourceGroup"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"configPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Config path"
|
||||||
|
},
|
||||||
|
"subscriptions": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Subscription"
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"description": "Subscription configurations"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"configPath",
|
||||||
|
"subscriptions"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Subscription": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"artifactories": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Artifactory"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"clusters",
|
||||||
|
"artifactories"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
azure/az/config_test.go
Normal file
40
azure/az/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package az_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/azure/az"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/azure/az", "./"))
|
||||||
|
schema := reflector.Reflect(&az.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package cloudflared
|
package cloudflared
|
||||||
|
|
||||||
type Access struct {
|
type Access struct {
|
||||||
Type string `yaml:"type"`
|
Type string `json:"type" yaml:"type"`
|
||||||
Hostname string `yaml:"hostname"`
|
Hostname string `json:"hostname" yaml:"hostname"`
|
||||||
Port int `yaml:"port"`
|
Port int `json:"port" yaml:"port"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Path string `yaml:"path"`
|
Path string `json:"path" yaml:"path"`
|
||||||
Access map[string]Access `yaml:"access"`
|
Access map[string]Access `json:"access" yaml:"access"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) AccessNames() []string {
|
func (c Config) AccessNames() []string {
|
||||||
|
|||||||
46
cloudflare/cloudflared/config.schema.json
Normal file
46
cloudflare/cloudflared/config.schema.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/cloudflare/cloudflared/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Access": {
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"type",
|
||||||
|
"hostname",
|
||||||
|
"port"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"access": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Access"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"access"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
cloudflare/cloudflared/config_test.go
Normal file
40
cloudflare/cloudflared/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package cloudflared_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/cloudflare/cloudflared"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/cloudflare/cloudflared", "./"))
|
||||||
|
schema := reflector.Reflect(&cloudflared.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
120
config.schema.base.json
Normal file
120
config.schema.base.json
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-provider",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"version": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^[0-9]\\.[0-9]$",
|
||||||
|
"description": "Version of the schema"
|
||||||
|
},
|
||||||
|
"rclone": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/rclone/rclone/config"
|
||||||
|
},
|
||||||
|
"cdktf": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/hashicorp/cdktf/config"
|
||||||
|
},
|
||||||
|
"az": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/azure/az/config"
|
||||||
|
},
|
||||||
|
"gcloud": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/google/gcloud/config"
|
||||||
|
},
|
||||||
|
"terragrunt": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/gruntwork-io/terragrunt/config"
|
||||||
|
},
|
||||||
|
"doctl": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/digitalocean/doctl/config"
|
||||||
|
},
|
||||||
|
"onepassword": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/onepassword/config"
|
||||||
|
},
|
||||||
|
"cloudflared": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/cloudflare/cloudflared/config"
|
||||||
|
},
|
||||||
|
"zip": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/arbitrary/zip/config"
|
||||||
|
},
|
||||||
|
"open": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/arbitrary/open/config"
|
||||||
|
},
|
||||||
|
"stern": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/stern/stern/config"
|
||||||
|
},
|
||||||
|
"k6": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/grafana/k6/config"
|
||||||
|
},
|
||||||
|
"k3d": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/k3d-io/k3d/config"
|
||||||
|
},
|
||||||
|
"etcd": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/etcd-io/etcd/config"
|
||||||
|
},
|
||||||
|
"hygen": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/jondot/hygen/config"
|
||||||
|
},
|
||||||
|
"sqlc": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/sqlc-dev/sqlc/config"
|
||||||
|
},
|
||||||
|
"mkcert": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/filosottile/mkcert/config"
|
||||||
|
},
|
||||||
|
"licensefinder": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/pivotal/licensefinder/config"
|
||||||
|
},
|
||||||
|
"docusaurus": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/facebook/docusaurus/config"
|
||||||
|
},
|
||||||
|
"stackit": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/stackitcloud/stackit/config"
|
||||||
|
},
|
||||||
|
"slack": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/slack-go/slack/config"
|
||||||
|
},
|
||||||
|
"teleport": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/gravitational/teleport/config"
|
||||||
|
},
|
||||||
|
"kubectl": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/kubernets/kubectl/config"
|
||||||
|
},
|
||||||
|
"pulumi-gcloud": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/pulumi/pulumi/gcloud/config"
|
||||||
|
},
|
||||||
|
"pulumi-azure": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/pulumi/pulumi/azure/config"
|
||||||
|
},
|
||||||
|
"gocontentful": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/foomo/gocontentful/config"
|
||||||
|
},
|
||||||
|
"beam": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/foomo/beam/config"
|
||||||
|
},
|
||||||
|
"sesamy": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/foomo/sesamy/config"
|
||||||
|
},
|
||||||
|
"squadron": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/foomo/squadron/config"
|
||||||
|
},
|
||||||
|
"webdriverio": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/webdriverio/webdriverio/config"
|
||||||
|
},
|
||||||
|
"migrate": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/golang-migrate/migrate/config"
|
||||||
|
},
|
||||||
|
"bruno": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/usebruno/bruno/config"
|
||||||
|
},
|
||||||
|
"harbor": {
|
||||||
|
"$ref": "https://github.com/foomo/posh-providers/goharbor/harbor/config"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"version"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1732
config.schema.json
Normal file
1732
config.schema.json
Normal file
File diff suppressed because it is too large
Load Diff
2
config.yaml
Normal file
2
config.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# yaml-language-server: $schema=config.schema.json
|
||||||
|
version: '1.0'
|
||||||
38
digitalocean/doctl/config.schema.json
Normal file
38
digitalocean/doctl/config.schema.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/digitalocean/doctl/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"configPath",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
digitalocean/doctl/config_test.go
Normal file
40
digitalocean/doctl/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package doctl_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/digitalocean/doctl"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/digitalocean/doctl", "./"))
|
||||||
|
schema := reflector.Reflect(&doctl.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
53
etcd-io/etcd/config.schema.json
Normal file
53
etcd-io/etcd/config.schema.json
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/etcd-io/etcd/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"podName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"namespace": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"podName",
|
||||||
|
"namespace",
|
||||||
|
"paths"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"configPath",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
etcd-io/etcd/config_test.go
Normal file
40
etcd-io/etcd/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package etcd_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/etcd-io/etcd"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/etcd-io/etcd", "./"))
|
||||||
|
schema := reflector.Reflect(&etcd.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
42
facebook/docusaurus/config.schema.json
Normal file
42
facebook/docusaurus/config.schema.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/facebook/docusaurus/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"sourcePath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"localPort": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"nodeTag": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"imageTag": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"imageName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"volumes": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"sourcePath",
|
||||||
|
"localPort",
|
||||||
|
"nodeTag",
|
||||||
|
"imageTag",
|
||||||
|
"imageName",
|
||||||
|
"volumes"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
facebook/docusaurus/config_test.go
Normal file
40
facebook/docusaurus/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package docusaurus_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/facebook/docusaurus"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/facebook/docusaurus", "./"))
|
||||||
|
schema := reflector.Reflect(&docusaurus.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package mkcert
|
package mkcert
|
||||||
|
|
||||||
type Certificate struct {
|
type Certificate struct {
|
||||||
Name string `yaml:"name"`
|
Name string `json:"name" yaml:"name"`
|
||||||
Names []string `yaml:"names"`
|
Names []string `json:"names" yaml:"names"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package mkcert
|
package mkcert
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
CertificatePath string `yaml:"certificatePath"`
|
CertificatePath string `json:"certificatePath" yaml:"certificatePath"`
|
||||||
Certificates []Certificate `yaml:"certificates"`
|
Certificates []Certificate `json:"certificates" yaml:"certificates"`
|
||||||
}
|
}
|
||||||
|
|||||||
45
filosottile/mkcert/config.schema.json
Normal file
45
filosottile/mkcert/config.schema.json
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/filosottile/mkcert/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Certificate": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"names": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"names"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"certificatePath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"certificates": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/Certificate"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"certificatePath",
|
||||||
|
"certificates"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
filosottile/mkcert/config_test.go
Normal file
40
filosottile/mkcert/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package mkcert_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/filosottile/mkcert"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/filosottile/mkcert", "./"))
|
||||||
|
schema := reflector.Reflect(&mkcert.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
Port int `yaml:"port"`
|
Port int `json:"port" yaml:"port"`
|
||||||
Hostname string `yaml:"hostname"`
|
Hostname string `json:"hostname" yaml:"hostname"`
|
||||||
Kubeconfig onepassword.Secret `yaml:"kubeconfig"`
|
Kubeconfig onepassword.Secret `json:"kubeconfig" yaml:"kubeconfig"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Clusters map[string]Cluster `yaml:"clusters"`
|
Clusters map[string]Cluster `json:"clusters" yaml:"clusters"`
|
||||||
Databases map[string]Database `yaml:"databases"`
|
Databases map[string]Database `json:"databases" yaml:"databases"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) GetDatabase(name string) Database {
|
func (c Config) GetDatabase(name string) Database {
|
||||||
|
|||||||
89
foomo/beam/config.schema.json
Normal file
89
foomo/beam/config.schema.json
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/foomo/beam/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"port": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"kubeconfig": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"port",
|
||||||
|
"hostname",
|
||||||
|
"kubeconfig"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"databases": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Database"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"clusters",
|
||||||
|
"databases"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Database": {
|
||||||
|
"properties": {
|
||||||
|
"port": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"port",
|
||||||
|
"hostname"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
foomo/beam/config_test.go
Normal file
40
foomo/beam/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package beam_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/foomo/beam"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/beam", "./"))
|
||||||
|
schema := reflector.Reflect(&beam.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package gocontentful
|
package gocontentful
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
SpaceID string `yaml:"spaceId"`
|
SpaceID string `json:"spaceId" yaml:"spaceId"`
|
||||||
CMAKey string `yaml:"cmaKey"`
|
CMAKey string `json:"cmaKey" yaml:"cmaKey"`
|
||||||
Environment string `yaml:"environment,omitempty"`
|
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
|
||||||
ContentTypes []string `yaml:"contentTypes"`
|
ContentTypes []string `json:"contentTypes" yaml:"contentTypes"`
|
||||||
}
|
}
|
||||||
|
|||||||
33
foomo/gocontentful/config.schema.json
Normal file
33
foomo/gocontentful/config.schema.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/foomo/gocontentful/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"spaceId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cmaKey": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"contentTypes": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"spaceId",
|
||||||
|
"cmaKey",
|
||||||
|
"contentTypes"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
foomo/gocontentful/config_test.go
Normal file
40
foomo/gocontentful/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package gocontentful_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/foomo/gocontentful"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/gocontentful", "./"))
|
||||||
|
schema := reflector.Reflect(&gocontentful.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
16
foomo/sesamy/config.schema.json
Normal file
16
foomo/sesamy/config.schema.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/foomo/sesamy/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
foomo/sesamy/config_test.go
Normal file
40
foomo/sesamy/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package sesamy_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/foomo/sesamy"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/sesamy", "./"))
|
||||||
|
schema := reflector.Reflect(&sesamy.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,8 @@ type Cluster struct {
|
|||||||
Name string `json:"name" yaml:"name"`
|
Name string `json:"name" yaml:"name"`
|
||||||
// Enable notification by default
|
// Enable notification by default
|
||||||
Notify bool `json:"notify" yaml:"notify"`
|
Notify bool `json:"notify" yaml:"notify"`
|
||||||
|
// Enable confirmation
|
||||||
|
Confirm bool `json:"confirm" yaml:"confirm"`
|
||||||
// Cluster fleet names
|
// Cluster fleet names
|
||||||
Fleets []string `json:"fleets" yaml:"fleets"`
|
Fleets []string `json:"fleets" yaml:"fleets"`
|
||||||
}
|
}
|
||||||
|
|||||||
59
foomo/squadron/config.schema.json
Normal file
59
foomo/squadron/config.schema.json
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/foomo/squadron/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Cluser name"
|
||||||
|
},
|
||||||
|
"notify": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Enable notification by default"
|
||||||
|
},
|
||||||
|
"confirm": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Enable confirmation"
|
||||||
|
},
|
||||||
|
"fleets": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"description": "Cluster fleet names"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"notify",
|
||||||
|
"confirm",
|
||||||
|
"fleets"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Path to the squadron root"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"description": "Cluster configurations"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
foomo/squadron/config_test.go
Normal file
40
foomo/squadron/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package squadron_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/foomo/squadron"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/squadron", "./"))
|
||||||
|
schema := reflector.Reflect(&squadron.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
27
goharbor/harbor/config.schema.json
Normal file
27
goharbor/harbor/config.schema.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/goharbor/harbor/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"url": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"authUrl": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"url",
|
||||||
|
"authUrl",
|
||||||
|
"project"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
goharbor/harbor/config_test.go
Normal file
40
goharbor/harbor/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package harbor_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/goharbor/harbor"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/goharbor/harbor", "./"))
|
||||||
|
schema := reflector.Reflect(&harbor.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
29
golang-migrate/migrate/config.schema.json
Normal file
29
golang-migrate/migrate/config.schema.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/golang-migrate/migrate/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"sources": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"databases": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"sources",
|
||||||
|
"databases"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
golang-migrate/migrate/config_test.go
Normal file
40
golang-migrate/migrate/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package migrate_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/golang-migrate/migrate"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/golang-migrate/migrate", "./"))
|
||||||
|
schema := reflector.Reflect(&migrate.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
101
google/gcloud/config.schema.json
Normal file
101
google/gcloud/config.schema.json
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/google/gcloud/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Account": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"email",
|
||||||
|
"key"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"project",
|
||||||
|
"region",
|
||||||
|
"account"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Account"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"configPath",
|
||||||
|
"accounts",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
google/gcloud/config_test.go
Normal file
40
google/gcloud/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package gcloud_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/google/gcloud"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/google/gcloud", "./"))
|
||||||
|
schema := reflector.Reflect(&gcloud.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,8 +10,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Path string `yaml:"path"`
|
Path string `json:"path" yaml:"path"`
|
||||||
Envs map[string]Env `yaml:"envs"`
|
Envs map[string]Env `json:"envs" yaml:"envs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) Env(name string) Env {
|
func (c Config) Env(name string) Env {
|
||||||
|
|||||||
32
grafana/k6/config.schema.json
Normal file
32
grafana/k6/config.schema.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/grafana/k6/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"envs": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Env"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"envs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Env": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
grafana/k6/config_test.go
Normal file
40
grafana/k6/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package k6_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/grafana/k6"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/grafana/k6", "./"))
|
||||||
|
schema := reflector.Reflect(&k6.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
75
gravitational/teleport/config.schema.json
Normal file
75
gravitational/teleport/config.schema.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/gravitational/teleport/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"kubernetes": {
|
||||||
|
"$ref": "#/$defs/Kubernetes"
|
||||||
|
},
|
||||||
|
"apps": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"database": {
|
||||||
|
"$ref": "#/$defs/Database"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"labels",
|
||||||
|
"hostname",
|
||||||
|
"kubernetes",
|
||||||
|
"apps",
|
||||||
|
"database"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Database": {
|
||||||
|
"properties": {
|
||||||
|
"user": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"user"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Kubernetes": {
|
||||||
|
"properties": {
|
||||||
|
"aliases": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"aliases"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
gravitational/teleport/config_test.go
Normal file
40
gravitational/teleport/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package teleport_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/gravitational/teleport"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/gravitational/teleport", "./"))
|
||||||
|
schema := reflector.Reflect(&teleport.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
23
gruntwork-io/terragrunt/config.schema.json
Normal file
23
gruntwork-io/terragrunt/config.schema.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/gruntwork-io/terragrunt/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cachePath": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"cachePath"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
gruntwork-io/terragrunt/config_test.go
Normal file
40
gruntwork-io/terragrunt/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package terragrunt_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/gruntwork-io/terragrunt"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/gruntwork-io/terragrunt", "./"))
|
||||||
|
schema := reflector.Reflect(&terragrunt.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
23
hashicorp/cdktf/config.schema.json
Normal file
23
hashicorp/cdktf/config.schema.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/hashicorp/cdktf/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"outPath": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"outPath"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
hashicorp/cdktf/config_test.go
Normal file
40
hashicorp/cdktf/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package cdktf_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/hashicorp/cdktf"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/hashicorp/cdktf", "./"))
|
||||||
|
schema := reflector.Reflect(&cdktf.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
package hygen
|
package hygen
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
TemplatePath string `yaml:"templatePath"`
|
TemplatePath string `json:"templatePath" yaml:"templatePath"`
|
||||||
}
|
}
|
||||||
|
|||||||
19
jondot/hygen/config.schema.json
Normal file
19
jondot/hygen/config.schema.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/jondot/hygen/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"templatePath": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"templatePath"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
jondot/hygen/config_test.go
Normal file
40
jondot/hygen/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package hygen_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/jondot/hygen"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/jondot/hygen", "./"))
|
||||||
|
schema := reflector.Reflect(&hygen.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
98
k3d-io/k3d/config.schema.json
Normal file
98
k3d-io/k3d/config.schema.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/k3d-io/k3d/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"charts": {
|
||||||
|
"$ref": "#/$defs/ConfigCharts"
|
||||||
|
},
|
||||||
|
"registry": {
|
||||||
|
"$ref": "#/$defs/ConfigRegistry"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigCluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"charts",
|
||||||
|
"registry",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigCharts": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"prefix": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"prefix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigCluster": {
|
||||||
|
"properties": {
|
||||||
|
"alias": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "K3d cluster name"
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Docker image to use"
|
||||||
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Port to bind to"
|
||||||
|
},
|
||||||
|
"enableTraefikRouter": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "EnableTraefikRouter allows to create the cluster with the default traefik router"
|
||||||
|
},
|
||||||
|
"args": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"description": "Additional arguments"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"alias",
|
||||||
|
"image",
|
||||||
|
"port",
|
||||||
|
"enableTraefikRouter",
|
||||||
|
"args"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigRegistry": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"port"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
k3d-io/k3d/config_test.go
Normal file
40
k3d-io/k3d/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package k3d_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/k3d-io/k3d"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/k3d-io/k3d", "./"))
|
||||||
|
schema := reflector.Reflect(&k3d.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
19
kubernets/kubectl/config.schema.json
Normal file
19
kubernets/kubectl/config.schema.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/kubernets/kubectl/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"configPath"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
kubernets/kubectl/config_test.go
Normal file
40
kubernets/kubectl/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package kubectl_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/kubernets/kubectl"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/kubernets/kubectl", "./"))
|
||||||
|
schema := reflector.Reflect(&kubectl.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
23
onepassword/config.schema.json
Normal file
23
onepassword/config.schema.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/onepassword/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tokenFilename": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"tokenFilename"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
onepassword/config_test.go
Normal file
40
onepassword/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package onepassword_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/onepassword"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/onepassword", "./"))
|
||||||
|
schema := reflector.Reflect(&onepassword.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
30
pivotal/licensefinder/config.schema.json
Normal file
30
pivotal/licensefinder/config.schema.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/pivotal/licensefinder/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"logPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"decisionsPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sources": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"logPath",
|
||||||
|
"decisionsPath",
|
||||||
|
"sources"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
pivotal/licensefinder/config_test.go
Normal file
40
pivotal/licensefinder/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package licensefinder_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/pivotal/licensefinder"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pivotal/licensefinder", "./"))
|
||||||
|
schema := reflector.Reflect(&licensefinder.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
86
pulumi/pulumi/azure/config.schema.json
Normal file
86
pulumi/pulumi/azure/config.schema.json
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/pulumi/pulumi/azure/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Backend": {
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"container": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"subscription": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceGroup": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"storageAccount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passphrase": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"location",
|
||||||
|
"container",
|
||||||
|
"subscription",
|
||||||
|
"resourceGroup",
|
||||||
|
"storageAccount",
|
||||||
|
"passphrase"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"backends": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Backend"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"configPath",
|
||||||
|
"backends"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
pulumi/pulumi/azure/config_test.go
Normal file
40
pulumi/pulumi/azure/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package pulumi_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/pulumi/pulumi/azure"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pulumi/pulumi/azure", "./"))
|
||||||
|
schema := reflector.Reflect(&pulumi.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
78
pulumi/pulumi/gcloud/config.schema.json
Normal file
78
pulumi/pulumi/gcloud/config.schema.json
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/pulumi/pulumi/gcloud/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Backend": {
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"bucket": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passphrase": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"location",
|
||||||
|
"bucket",
|
||||||
|
"project",
|
||||||
|
"passphrase"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"configPath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"backends": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Backend"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"configPath",
|
||||||
|
"backends"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
pulumi/pulumi/gcloud/config_test.go
Normal file
40
pulumi/pulumi/gcloud/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package pulumi_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/pulumi/pulumi/gcloud"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pulumi/pulumi/gcloud", "./"))
|
||||||
|
schema := reflector.Reflect(&pulumi.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
23
rclone/rclone/config.schema.json
Normal file
23
rclone/rclone/config.schema.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/rclone/rclone/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path",
|
||||||
|
"config"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
rclone/rclone/config_test.go
Normal file
40
rclone/rclone/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package rclone_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/rclone/rclone"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/rclone/rclone", "./"))
|
||||||
|
schema := reflector.Reflect(&rclone.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Token onepassword.Secret `yaml:"token"`
|
Token onepassword.Secret `json:"token" yaml:"token"`
|
||||||
Channels map[string]string `yaml:"channels"`
|
Channels map[string]string `json:"channels" yaml:"channels"`
|
||||||
Webhooks map[string]onepassword.Secret `yaml:"webhooks"`
|
Webhooks map[string]onepassword.Secret `json:"webhooks" yaml:"webhooks"`
|
||||||
}
|
}
|
||||||
|
|||||||
57
slack-go/slack/config.schema.json
Normal file
57
slack-go/slack/config.schema.json
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/slack-go/slack/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
},
|
||||||
|
"channels": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"webhooks": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"token",
|
||||||
|
"channels",
|
||||||
|
"webhooks"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
slack-go/slack/config_test.go
Normal file
40
slack-go/slack/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package slack_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/slack-go/slack"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/slack-go/slack", "./"))
|
||||||
|
schema := reflector.Reflect(&slack.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
23
sqlc-dev/sqlc/config.schema.json
Normal file
23
sqlc-dev/sqlc/config.schema.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/sqlc-dev/sqlc/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"tempDir": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"cacheDir": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"tempDir",
|
||||||
|
"cacheDir"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
sqlc-dev/sqlc/config_test.go
Normal file
40
sqlc-dev/sqlc/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package sqlc_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/sqlc-dev/sqlc"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/sqlc-dev/sqlc", "./"))
|
||||||
|
schema := reflector.Reflect(&sqlc.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
53
stackitcloud/stackit/config.schema.json
Normal file
53
stackitcloud/stackit/config.schema.json
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/stackitcloud/stackit/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Cluster": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"projects": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Project"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"projects"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Project": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"clusters": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Cluster"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"clusters"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
stackitcloud/stackit/config_test.go
Normal file
40
stackitcloud/stackit/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package stackit_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/stackitcloud/stackit"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/stackitcloud/stackit", "./"))
|
||||||
|
schema := reflector.Reflect(&stackit.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
44
stern/stern/config.schema.json
Normal file
44
stern/stern/config.schema.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/stern/stern/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"queries": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Query"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"queries"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Query": {
|
||||||
|
"properties": {
|
||||||
|
"query": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"queries": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Query"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"query",
|
||||||
|
"queries"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
stern/stern/config_test.go
Normal file
40
stern/stern/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package stern_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/stern/stern"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/stern/stern", "./"))
|
||||||
|
schema := reflector.Reflect(&stern.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
19
usebruno/bruno/config.schema.json
Normal file
19
usebruno/bruno/config.schema.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/usebruno/bruno/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"path": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"path"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
usebruno/bruno/config_test.go
Normal file
40
usebruno/bruno/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package bruno_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/usebruno/bruno"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/usebruno/bruno", "./"))
|
||||||
|
schema := reflector.Reflect(&bruno.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
115
webdriverio/webdriverio/config.schema.json
Normal file
115
webdriverio/webdriverio/config.schema.json
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://github.com/foomo/posh-providers/webdriverio/webdriverio/config",
|
||||||
|
"$ref": "#/$defs/Config",
|
||||||
|
"$defs": {
|
||||||
|
"Config": {
|
||||||
|
"properties": {
|
||||||
|
"dirs": {
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"modes": {
|
||||||
|
"$ref": "#/$defs/ConfigModes"
|
||||||
|
},
|
||||||
|
"sites": {
|
||||||
|
"$ref": "#/$defs/ConfigSites"
|
||||||
|
},
|
||||||
|
"secrets": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"browserStack": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"dirs",
|
||||||
|
"modes",
|
||||||
|
"sites",
|
||||||
|
"secrets",
|
||||||
|
"browserStack"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigEnv": {
|
||||||
|
"properties": {
|
||||||
|
"auth": {
|
||||||
|
"$ref": "#/$defs/Secret"
|
||||||
|
},
|
||||||
|
"domain": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"auth",
|
||||||
|
"domain"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigEnvs": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigEnv"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"ConfigMode": {
|
||||||
|
"properties": {
|
||||||
|
"port": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hostPrefix": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"port",
|
||||||
|
"hostPrefix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ConfigModes": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigMode"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"ConfigSites": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/$defs/ConfigEnvs"
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"Secret": {
|
||||||
|
"properties": {
|
||||||
|
"account": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"vault": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"item": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"account",
|
||||||
|
"vault",
|
||||||
|
"item",
|
||||||
|
"field"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
webdriverio/webdriverio/config_test.go
Normal file
40
webdriverio/webdriverio/config_test.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package webdriverio_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
testingx "github.com/foomo/go/testing"
|
||||||
|
tagx "github.com/foomo/go/testing/tag"
|
||||||
|
"github.com/foomo/posh-providers/webdriverio/webdriverio"
|
||||||
|
"github.com/invopop/jsonschema"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestConfig(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
testingx.Tags(t, tagx.Short)
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
reflector := new(jsonschema.Reflector)
|
||||||
|
require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/webdriverio/webdriverio", "./"))
|
||||||
|
schema := reflector.Reflect(&webdriverio.Config{})
|
||||||
|
actual, err := json.MarshalIndent(schema, "", " ")
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
filename := path.Join(cwd, "config.schema.json")
|
||||||
|
expected, err := os.ReadFile(filename)
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !assert.Equal(t, string(expected), string(actual)) {
|
||||||
|
require.NoError(t, os.WriteFile(filename, actual, 0600))
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user