Skip to content

Workspace and Workmachine Api Implementation #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: release-v1.1.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .tools/nvim/__http__/workmachine/workmachine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
label: "Upsert Workmachine"
query: |+
mutation Infra_upsertWorkMachine($clusterName: String!, $workmachine: WorkmachineIn!) {
infra_upsertWorkMachine(clusterName: $clusterName, workmachine: $workmachine) {
accountName
}
}
variables:
{
"clusterName": "test-clus",
"workmachine": {
"displayName": "test wm1",
"metadata": {
"name": "test-wm1"
}
}
}

---

label: "update Workmachine"
query: |+
mutation Infra_updateWorkMachine($clusterName: String!, $workmachine: WorkmachineIn!) {
infra_updateWorkMachine(clusterName: $clusterName, workmachine: $workmachine) {
accountName
}
}
variables:
{
"clusterName": "test-clus",
"workmachine": {
"displayName": "test wmm1",
"metadata": {
"name": "test-wm1"
}
}
}

---

label: "update Workmachine Status"
query: |+
mutation Infra_updateWorkMachineStatus($clusterName: String!, $status: Boolean!, $name: String!) {
infra_updateWorkMachineStatus(clusterName: $clusterName, status: $status, name: $name)
}
variables:
{
"clusterName": "test-clus",
"status": true,
"name": "test-wm1"
}

---

label: "get workmachine"
query: |+
query Infra_getWorkmachine($clusterName: String!, $name: String!) {
infra_getWorkmachine(clusterName: $clusterName, name: $name) {
accountName
}
}
variables:
{
"clusterName": "test-clus",
"name": "test-wm1"
}

---

label: "list App"
query: |+
query Iot_listApps($projectName: String!, $deviceBlueprintName: String!) {
iot_listApps(projectName: $projectName, deviceBlueprintName: $deviceBlueprintName) {
totalCount
edges {
node {
displayName
id
}
}
}
}
variables:
{
"projectName": "sample-project",
"deviceBlueprintName": "sample-device-blueprint",
}

---
82 changes: 82 additions & 0 deletions .tools/nvim/__http__/workmachine/workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
label: "Create workspace"
query: |+
mutation Infra_createWorkspace($workspace: WorkspaceIn!, $clusterName: String!) {
infra_createWorkspace(workspace: $workspace, clusterName: $clusterName) {
accountName
}
}
variables:
{
"workspace": {
"metadata": {
"name": "test-ws1"
},
"displayName": "test ws1"
},
"clusterName": "test-clus"
}

---

label: "update workspace"
query: |+
mutation Infra_updateWorkspace($clusterName: String!, $workspace: WorkspaceIn!) {
infra_updateWorkspace(clusterName: $clusterName, workspace: $workspace) {
accountName
}
}
variables:
{
"workspace": {
"metadata": {
"name": "test-ws1"
},
"displayName": "test wss1"
},
"clusterName": "test-clus"
}

---

label: "delete Workspace"
query: |+
mutation Infra_deleteWorkspace($clusterName: String!, $name: String!) {
infra_deleteWorkspace(clusterName: $clusterName, name: $name)
}
variables:
{
"clusterName": "test-clus",
"name": "test-ws1"
}

---

label: "get workspace"
query: |+
query Infra_getWorkspace($clusterName: String!, $name: String!) {
infra_getWorkspace(clusterName: $clusterName, name: $name) {
accountName
}
}
variables:
{
"clusterName": "test-clus",
"name": "test-ws1"
}

---

label: "list workspace"
query: |+
query Infra_listWorkspaces($clusterName: String!) {
infra_listWorkspaces(clusterName: $clusterName) {
totalCount
}
}
variables:
{
"clusterName": "test-clus",
}

---
4 changes: 3 additions & 1 deletion apps/infra/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ tasks:
--struct github.com/kloudlite/api/apps/infra/internal/entities.PersistentVolume
--struct github.com/kloudlite/api/apps/infra/internal/entities.Namespace
--struct github.com/kloudlite/api/apps/infra/internal/entities.VolumeAttachment
--struct github.com/kloudlite/api/apps/infra/internal/entities.Workspace
--struct github.com/kloudlite/api/apps/infra/internal/entities.Workmachine
--struct github.com/kloudlite/api/pkg/repos.MatchFilter
--struct github.com/kloudlite/api/apps/infra/internal/domain.BYOKSetupInstruction
--struct github.com/kloudlite/api/pkg/repos.CursorPagination
> ./internal/app/_struct-to-graphql/main.go
- |+
pushd ./internal/app/_struct-to-graphql
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Cluster,BYOKCluster,Node,NodePool,GlobalVPN,GlobalVPNDevice,CloudProviderSecret,DomainEntry,PersistentVolumeClaim,Namespace,VolumeAttachment,PersistentVolume
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Cluster,BYOKCluster,Node,NodePool,GlobalVPN,GlobalVPNDevice,CloudProviderSecret,DomainEntry,PersistentVolumeClaim,Namespace,VolumeAttachment,PersistentVolume,Workspace,Workmachine
popd
- rm -rf ./internal/app/_struct-to-graphql

Expand Down
4 changes: 4 additions & 0 deletions apps/infra/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ var Module = fx.Module(
repos.NewFxMongoRepo[*entities.PersistentVolume]("pv", "pv", entities.PersistentVolumeIndices),
repos.NewFxMongoRepo[*entities.VolumeAttachment]("volume_attachments", "volatt", entities.VolumeAttachmentIndices),

// Workspace
repos.NewFxMongoRepo[*entities.Workspace]("workspaces", "wsp", entities.WorkspaceIndexes),
repos.NewFxMongoRepo[*entities.Workmachine]("work_machines", "wm", entities.WorkmachineIndexes),

fx.Provide(
func(conn IAMGrpcClient) iam.IAMClient {
return iam.NewIAMClient(conn)
Expand Down
8 changes: 8 additions & 0 deletions apps/infra/internal/app/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ models:
model: github.com/kloudlite/api/apps/infra/internal/entities.VolumeAttachment
VolumeAttachmentIn: *volume-attachment-model

Workspace: &workspace-model
model: github.com/kloudlite/api/apps/infra/internal/entities.Workspace
WorkspaceIn: *workspace-model

Workmachine: &workmachine-model
model: github.com/kloudlite/api/apps/infra/internal/entities.Workmachine
WorkmachineIn: *workmachine-model

Node: &node-model
model: github.com/kloudlite/api/apps/infra/internal/entities.Node

Expand Down
Loading
Loading