Skip to content

Commit c89876b

Browse files
authored
Merge pull request [#389](#389)
Api implemantations for secrets and variable at accounts level
2 parents 75be6be + 3a86872 commit c89876b

22 files changed

+4130
-410
lines changed

.tools/nvim/__http__/console/environments.graphql.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ query: |+ #graphql
5757
5858
---
5959

60+
label: Create Secret Variable
61+
mutation: |+ #graphql
62+
mutation Core_createSecretVariable($secretVariable: SecretVariableIn!) {
63+
core_createSecretVariable(secretVariable: $secretVariable) {
64+
id
65+
}
66+
}
67+
variables:
68+
{
69+
"secretVariable": {
70+
"key": "he",
71+
"value": "hello"
72+
}
73+
}
74+
75+
---
76+
6077
label: Create Environment
6178
query: |+ #graphql
6279
mutation Core_createEnvironment($env: EnvironmentIn!) {
@@ -78,9 +95,9 @@ query: |+ #graphql
7895
variables:
7996
env:
8097
displayName: Display Name of a sample environment
81-
clusterName: "__kloudlite_enabled_cluster"
98+
clusterName: "dev-1"
8299
metadata:
83-
name: "{{.envName}}8"
100+
name: "test-env-bb"
84101
---
85102

86103
label: resync environment
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
global: {}
3+
---
4+
5+
label: Create Secret Variable
6+
query: |+ #graphql
7+
mutation Core_createSecretVariable($secretVariable: SecretVariableIn!) {
8+
core_createSecretVariable(secretVariable: $secretVariable) {
9+
id
10+
}
11+
}
12+
variables:
13+
{
14+
"secretVariable": {
15+
"displayName": "my secret",
16+
"name": "my-sec",
17+
"stringData": { }
18+
}
19+
}
20+
21+
---
22+
label: Update Secret Variable
23+
query: |+ #graphql
24+
mutation Core_updateSecretVariable($secretVariable: SecretVariableIn!) {
25+
core_updateSecretVariable(secretVariable: $secretVariable) {
26+
id
27+
}
28+
}
29+
variables:
30+
{
31+
"secretVariable": {
32+
"displayName": "my secret",
33+
"name": "my-sec",
34+
"stringData": { "get": "world" }
35+
}
36+
}
37+
38+
---
39+
label: List Secret Variables
40+
query: |+ #graphql
41+
query Core_listSecretVariables {
42+
core_listSecretVariables {
43+
totalCount
44+
edges {
45+
node {
46+
accountName
47+
id
48+
}
49+
}
50+
}
51+
}
52+
53+
---
54+
label: Get Secret Variable
55+
query: |+ #graphql
56+
query Core_getSecretVariable($name: String!) {
57+
core_getSecretVariable(name: $name) {
58+
id
59+
}
60+
}
61+
variables:
62+
{
63+
"name": "my-sec"
64+
}
65+
66+
---
67+
68+
label: delete Secret Variable
69+
query: |+ #graphql
70+
mutation Core_deleteSecretVariable($name: String!) {
71+
core_deleteSecretVariable(name: $name)
72+
}
73+
variables:
74+
{
75+
"name": "my-sec"
76+
}
77+
78+
---

apps/console/Taskfile.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,22 @@ tasks:
3131
--struct github.com/kloudlite/api/apps/console/internal/domain.SecretKeyValueRef
3232
--struct github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyRef
3333
--struct github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyValueRef
34+
--struct github.com/kloudlite/api/apps/console/internal/domain.SecretVariableKeyRef
35+
--struct github.com/kloudlite/api/apps/console/internal/domain.SecretVariableKeyValueRef
3436
--struct github.com/kloudlite/api/apps/console/internal/entities.Router
3537
--struct github.com/kloudlite/api/apps/console/internal/entities.ManagedResource
3638
--struct github.com/kloudlite/api/apps/console/internal/entities.ClusterManagedService
3739
--struct github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource
3840
--struct github.com/kloudlite/api/apps/console/internal/entities.ImagePullSecret
3941
--struct github.com/kloudlite/api/apps/console/internal/entities.RegistryImage
4042
--struct github.com/kloudlite/api/apps/console/internal/entities.RegistryImageURL
43+
--struct github.com/kloudlite/api/apps/console/internal/entities.SecretVariable
4144
--struct github.com/kloudlite/api/pkg/repos.MatchFilter
4245
--struct github.com/kloudlite/api/pkg/repos.CursorPagination
4346
> ./internal/app/_struct-to-graphql/main.go
4447
- |+
4548
pushd ./internal/app/_struct-to-graphql
46-
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImportedManagedResource,ImagePullSecret,ClusterManagedService,RegistryImage
49+
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImportedManagedResource,ImagePullSecret,ClusterManagedService,RegistryImage,SecretVariable
4750
popd
4851
- rm -rf ./internal/app/_struct-to-graphql
4952

@@ -57,7 +60,7 @@ tasks:
5760
sh: go env GOARCH
5861
GOARCH: "{{ .GOARCH | default .platform_GOARCH }}"
5962
cmds:
60-
- task: gen:constants
63+
# - task: gen:constants
6164
- task: go:build
6265
vars:
6366
out: "{{.binary}}-{{.GOARCH}}"

apps/console/internal/app/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var Module = fx.Module("app",
8787
repos.NewFxMongoRepo[*entities.ServiceBinding]("service_bindings", "svcb", entities.ServiceBindingIndexes),
8888
repos.NewFxMongoRepo[*entities.ClusterManagedService]("cluster_managed_services", "cmsvc", entities.ClusterManagedServiceIndices),
8989
repos.NewFxMongoRepo[*entities.RegistryImage]("registry_images", "reg_img", entities.RegistryImageIndexes),
90+
repos.NewFxMongoRepo[*entities.SecretVariable]("secret_variables", "sec_var", entities.SecretVariableIndexes),
9091

9192
fx.Provide(
9293
func(conn IAMGrpcClient) iam.IAMClient {

apps/console/internal/app/gqlgen.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ models:
152152
model: github.com/kloudlite/api/apps/console/internal/entities.ManagedResource
153153
ManagedResourceIn: *managed-resource-model
154154

155+
SecretVariable: &secret-variable-model
156+
model: github.com/kloudlite/api/apps/console/internal/entities.SecretVariable
157+
SecretVariableIn: *secret-variable-model
158+
155159
ImportedManagedResource: &managed-resource-model
156160
model: github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource
157161
fields:
@@ -170,6 +174,12 @@ models:
170174
ManagedResourceKeyValueRef:
171175
model: github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyValueRef
172176

177+
SecretVariableKeyRefIn:
178+
model: github.com/kloudlite/api/apps/console/internal/domain.SecretVariableKeyRef
179+
180+
SecretVariableKeyValueRef:
181+
model: github.com/kloudlite/api/apps/console/internal/domain.SecretVariableKeyValueRef
182+
173183
ImagePullSecret: &image-pull-secret-model
174184
model: github.com/kloudlite/api/apps/console/internal/entities.ImagePullSecret
175185
ImagePullSecretIn: *image-pull-secret-model

0 commit comments

Comments
 (0)