@build-astron-co/nimbus 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +268 -89
- package/README.md +26 -567
- package/dist/src/agent/compaction-agent.js +24 -12
- package/dist/src/agent/context-manager.js +2 -1
- package/dist/src/agent/expand-files.js +2 -1
- package/dist/src/agent/loop.js +71 -33
- package/dist/src/agent/permissions.js +4 -2
- package/dist/src/agent/system-prompt.js +34 -17
- package/dist/src/app.js +1 -1
- package/dist/src/auth/keychain.js +8 -4
- package/dist/src/auth/store.js +70 -107
- package/dist/src/cli/init.js +35 -19
- package/dist/src/cli/run.js +18 -10
- package/dist/src/cli/serve.js +4 -2
- package/dist/src/cli.js +52 -11
- package/dist/src/commands/alias.js +5 -3
- package/dist/src/commands/audit/index.js +2 -1
- package/dist/src/commands/aws-terraform.js +36 -18
- package/dist/src/commands/completions.js +1 -1
- package/dist/src/commands/config.js +3 -2
- package/dist/src/commands/connect-github.js +92 -0
- package/dist/src/commands/cost/index.js +3 -2
- package/dist/src/commands/deploy.js +15 -10
- package/dist/src/commands/doctor.js +9 -6
- package/dist/src/commands/drift/index.js +2 -1
- package/dist/src/commands/export.js +5 -3
- package/dist/src/commands/generate-terraform.js +110 -2
- package/dist/src/commands/import.js +3 -3
- package/dist/src/commands/incident.js +10 -5
- package/dist/src/commands/login.js +8 -93
- package/dist/src/commands/logs.js +16 -8
- package/dist/src/commands/onboarding.js +6 -4
- package/dist/src/commands/pipeline.js +6 -3
- package/dist/src/commands/plugin.js +3 -2
- package/dist/src/commands/profile.js +27 -14
- package/dist/src/commands/questionnaire.js +1 -1
- package/dist/src/commands/rollback.js +3 -2
- package/dist/src/commands/rollout.js +5 -3
- package/dist/src/commands/runbook.js +17 -10
- package/dist/src/commands/schedule.js +10 -5
- package/dist/src/commands/status.js +2 -1
- package/dist/src/commands/team-context.js +12 -7
- package/dist/src/commands/template.js +1 -1
- package/dist/src/commands/tf/index.js +6 -3
- package/dist/src/commands/upgrade.js +5 -3
- package/dist/src/commands/version.js +6 -3
- package/dist/src/commands/watch.js +6 -3
- package/dist/src/compat/sqlite.js +5 -3
- package/dist/src/config/mode-store.js +2 -1
- package/dist/src/config/profiles.js +4 -2
- package/dist/src/config/types.js +2 -1
- package/dist/src/engine/executor.js +8 -4
- package/dist/src/engine/planner.js +9 -5
- package/dist/src/llm/providers/anthropic.js +6 -3
- package/dist/src/llm/providers/ollama.js +1 -1
- package/dist/src/llm/router.js +22 -7
- package/dist/src/nimbus.js +1 -0
- package/dist/src/sessions/manager.js +6 -3
- package/dist/src/sharing/viewer.js +2 -1
- package/dist/src/tools/file-ops.js +1 -2
- package/dist/src/tools/schemas/devops.js +197 -108
- package/dist/src/tools/schemas/standard.js +1 -1
- package/dist/src/ui/App.js +25 -13
- package/dist/src/ui/FileDiffModal.js +22 -11
- package/dist/src/ui/HelpModal.js +2 -1
- package/dist/src/ui/InputBox.js +6 -3
- package/dist/src/ui/MessageList.js +40 -20
- package/dist/src/ui/TerminalPane.js +2 -1
- package/dist/src/ui/ToolCallDisplay.js +12 -6
- package/dist/src/ui/TreePane.js +2 -1
- package/dist/src/ui/ink/index.js +37 -21
- package/dist/src/version.js +1 -1
- package/dist/src/watcher/index.js +8 -4
- package/package.json +3 -5
- package/src/__tests__/alias.test.ts +0 -133
- package/src/__tests__/app.test.ts +0 -76
- package/src/__tests__/audit.test.ts +0 -877
- package/src/__tests__/circuit-breaker.test.ts +0 -116
- package/src/__tests__/cli-run.test.ts +0 -351
- package/src/__tests__/compat-sqlite.test.ts +0 -68
- package/src/__tests__/context-manager.test.ts +0 -632
- package/src/__tests__/context.test.ts +0 -242
- package/src/__tests__/devops-terminal-gaps.test.ts +0 -718
- package/src/__tests__/doctor.test.ts +0 -48
- package/src/__tests__/enterprise.test.ts +0 -401
- package/src/__tests__/export.test.ts +0 -236
- package/src/__tests__/gap-11-18-20.test.ts +0 -958
- package/src/__tests__/generator.test.ts +0 -433
- package/src/__tests__/helm-streaming.test.ts +0 -127
- package/src/__tests__/hooks.test.ts +0 -582
- package/src/__tests__/incident.test.ts +0 -179
- package/src/__tests__/init.test.ts +0 -487
- package/src/__tests__/intent-parser.test.ts +0 -229
- package/src/__tests__/llm-router.test.ts +0 -209
- package/src/__tests__/logs.test.ts +0 -107
- package/src/__tests__/loop-errors.test.ts +0 -244
- package/src/__tests__/lsp.test.ts +0 -293
- package/src/__tests__/modes.test.ts +0 -336
- package/src/__tests__/perf-optimizations.test.ts +0 -847
- package/src/__tests__/permissions.test.ts +0 -338
- package/src/__tests__/pipeline.test.ts +0 -50
- package/src/__tests__/polish-phase3.test.ts +0 -340
- package/src/__tests__/profile.test.ts +0 -237
- package/src/__tests__/rollback.test.ts +0 -83
- package/src/__tests__/runbook.test.ts +0 -219
- package/src/__tests__/schedule.test.ts +0 -206
- package/src/__tests__/serve.test.ts +0 -275
- package/src/__tests__/sessions.test.ts +0 -322
- package/src/__tests__/sharing.test.ts +0 -340
- package/src/__tests__/snapshots.test.ts +0 -581
- package/src/__tests__/standalone-migration.test.ts +0 -199
- package/src/__tests__/state-db.test.ts +0 -334
- package/src/__tests__/status.test.ts +0 -158
- package/src/__tests__/stream-with-tools.test.ts +0 -778
- package/src/__tests__/subagents.test.ts +0 -176
- package/src/__tests__/system-prompt.test.ts +0 -248
- package/src/__tests__/terminal-gap-v2.test.ts +0 -395
- package/src/__tests__/terminal-parity.test.ts +0 -393
- package/src/__tests__/tf-apply.test.ts +0 -187
- package/src/__tests__/tool-converter.test.ts +0 -256
- package/src/__tests__/tool-schemas.test.ts +0 -602
- package/src/__tests__/tools.test.ts +0 -144
- package/src/__tests__/version-json.test.ts +0 -184
- package/src/__tests__/version.test.ts +0 -49
- package/src/__tests__/watch.test.ts +0 -129
- package/src/agent/compaction-agent.ts +0 -266
- package/src/agent/context-manager.ts +0 -499
- package/src/agent/context.ts +0 -427
- package/src/agent/deploy-preview.ts +0 -487
- package/src/agent/expand-files.ts +0 -108
- package/src/agent/index.ts +0 -68
- package/src/agent/loop.ts +0 -1998
- package/src/agent/modes.ts +0 -429
- package/src/agent/permissions.ts +0 -513
- package/src/agent/subagents/base.ts +0 -116
- package/src/agent/subagents/cost.ts +0 -51
- package/src/agent/subagents/explore.ts +0 -42
- package/src/agent/subagents/general.ts +0 -54
- package/src/agent/subagents/index.ts +0 -102
- package/src/agent/subagents/infra.ts +0 -59
- package/src/agent/subagents/security.ts +0 -69
- package/src/agent/system-prompt.ts +0 -990
- package/src/app.ts +0 -180
- package/src/audit/activity-log.ts +0 -290
- package/src/audit/compliance-checker.ts +0 -540
- package/src/audit/cost-tracker.ts +0 -318
- package/src/audit/index.ts +0 -23
- package/src/audit/security-scanner.ts +0 -641
- package/src/auth/guard.ts +0 -75
- package/src/auth/index.ts +0 -56
- package/src/auth/keychain.ts +0 -82
- package/src/auth/oauth.ts +0 -465
- package/src/auth/providers.ts +0 -470
- package/src/auth/sso.ts +0 -113
- package/src/auth/store.ts +0 -505
- package/src/auth/types.ts +0 -187
- package/src/build.ts +0 -141
- package/src/cli/index.ts +0 -16
- package/src/cli/init.ts +0 -1227
- package/src/cli/openapi-spec.ts +0 -356
- package/src/cli/run.ts +0 -628
- package/src/cli/serve-auth.ts +0 -80
- package/src/cli/serve.ts +0 -539
- package/src/cli/web.ts +0 -71
- package/src/cli.ts +0 -1728
- package/src/clients/core-engine-client.ts +0 -227
- package/src/clients/enterprise-client.ts +0 -334
- package/src/clients/generator-client.ts +0 -351
- package/src/clients/git-client.ts +0 -627
- package/src/clients/github-client.ts +0 -410
- package/src/clients/helm-client.ts +0 -504
- package/src/clients/index.ts +0 -80
- package/src/clients/k8s-client.ts +0 -497
- package/src/clients/llm-client.ts +0 -161
- package/src/clients/rest-client.ts +0 -130
- package/src/clients/service-discovery.ts +0 -38
- package/src/clients/terraform-client.ts +0 -482
- package/src/clients/tools-client.ts +0 -1843
- package/src/clients/ws-client.ts +0 -115
- package/src/commands/alias.ts +0 -100
- package/src/commands/analyze/index.ts +0 -352
- package/src/commands/apply/helm.ts +0 -473
- package/src/commands/apply/index.ts +0 -213
- package/src/commands/apply/k8s.ts +0 -454
- package/src/commands/apply/terraform.ts +0 -582
- package/src/commands/ask.ts +0 -167
- package/src/commands/audit/index.ts +0 -357
- package/src/commands/auth-cloud.ts +0 -407
- package/src/commands/auth-list.ts +0 -134
- package/src/commands/auth-profile.ts +0 -121
- package/src/commands/auth-refresh.ts +0 -187
- package/src/commands/auth-status.ts +0 -141
- package/src/commands/aws/ec2.ts +0 -501
- package/src/commands/aws/iam.ts +0 -397
- package/src/commands/aws/index.ts +0 -133
- package/src/commands/aws/lambda.ts +0 -396
- package/src/commands/aws/rds.ts +0 -439
- package/src/commands/aws/s3.ts +0 -439
- package/src/commands/aws/vpc.ts +0 -393
- package/src/commands/aws-discover.ts +0 -542
- package/src/commands/aws-terraform.ts +0 -755
- package/src/commands/azure/aks.ts +0 -376
- package/src/commands/azure/functions.ts +0 -253
- package/src/commands/azure/index.ts +0 -116
- package/src/commands/azure/storage.ts +0 -478
- package/src/commands/azure/vm.ts +0 -355
- package/src/commands/billing/index.ts +0 -256
- package/src/commands/chat.ts +0 -320
- package/src/commands/completions.ts +0 -268
- package/src/commands/config.ts +0 -372
- package/src/commands/cost/cloud-cost-estimator.ts +0 -266
- package/src/commands/cost/estimator.ts +0 -79
- package/src/commands/cost/index.ts +0 -810
- package/src/commands/cost/parsers/terraform.ts +0 -273
- package/src/commands/cost/parsers/types.ts +0 -25
- package/src/commands/cost/pricing/aws.ts +0 -544
- package/src/commands/cost/pricing/azure.ts +0 -499
- package/src/commands/cost/pricing/gcp.ts +0 -396
- package/src/commands/cost/pricing/index.ts +0 -40
- package/src/commands/demo.ts +0 -250
- package/src/commands/deploy.ts +0 -260
- package/src/commands/doctor.ts +0 -1386
- package/src/commands/drift/index.ts +0 -787
- package/src/commands/explain.ts +0 -277
- package/src/commands/export.ts +0 -146
- package/src/commands/feedback.ts +0 -389
- package/src/commands/fix.ts +0 -324
- package/src/commands/fs/index.ts +0 -402
- package/src/commands/gcp/compute.ts +0 -325
- package/src/commands/gcp/functions.ts +0 -271
- package/src/commands/gcp/gke.ts +0 -438
- package/src/commands/gcp/iam.ts +0 -344
- package/src/commands/gcp/index.ts +0 -129
- package/src/commands/gcp/storage.ts +0 -284
- package/src/commands/generate-helm.ts +0 -1249
- package/src/commands/generate-k8s.ts +0 -1508
- package/src/commands/generate-terraform.ts +0 -1202
- package/src/commands/gh/index.ts +0 -863
- package/src/commands/git/index.ts +0 -1343
- package/src/commands/helm/index.ts +0 -1126
- package/src/commands/help.ts +0 -715
- package/src/commands/history.ts +0 -149
- package/src/commands/import.ts +0 -868
- package/src/commands/incident.ts +0 -166
- package/src/commands/index.ts +0 -367
- package/src/commands/init.ts +0 -1051
- package/src/commands/k8s/index.ts +0 -1137
- package/src/commands/login.ts +0 -716
- package/src/commands/logout.ts +0 -83
- package/src/commands/logs.ts +0 -167
- package/src/commands/onboarding.ts +0 -405
- package/src/commands/pipeline.ts +0 -186
- package/src/commands/plan/display.ts +0 -279
- package/src/commands/plan/index.ts +0 -599
- package/src/commands/plugin.ts +0 -398
- package/src/commands/preview.ts +0 -452
- package/src/commands/profile.ts +0 -342
- package/src/commands/questionnaire.ts +0 -1172
- package/src/commands/resume.ts +0 -47
- package/src/commands/rollback.ts +0 -315
- package/src/commands/rollout.ts +0 -88
- package/src/commands/runbook.ts +0 -346
- package/src/commands/schedule.ts +0 -236
- package/src/commands/status.ts +0 -252
- package/src/commands/team/index.ts +0 -346
- package/src/commands/team-context.ts +0 -220
- package/src/commands/template.ts +0 -233
- package/src/commands/tf/index.ts +0 -1093
- package/src/commands/upgrade.ts +0 -607
- package/src/commands/usage/index.ts +0 -134
- package/src/commands/version.ts +0 -174
- package/src/commands/watch.ts +0 -153
- package/src/compat/index.ts +0 -2
- package/src/compat/runtime.ts +0 -12
- package/src/compat/sqlite.ts +0 -177
- package/src/config/index.ts +0 -17
- package/src/config/manager.ts +0 -530
- package/src/config/mode-store.ts +0 -62
- package/src/config/profiles.ts +0 -84
- package/src/config/safety-policy.ts +0 -358
- package/src/config/schema.ts +0 -125
- package/src/config/types.ts +0 -609
- package/src/config/workspace-state.ts +0 -53
- package/src/context/context-db.ts +0 -199
- package/src/demo/index.ts +0 -349
- package/src/demo/scenarios/full-journey.ts +0 -229
- package/src/demo/scenarios/getting-started.ts +0 -127
- package/src/demo/scenarios/helm-release.ts +0 -341
- package/src/demo/scenarios/k8s-deployment.ts +0 -194
- package/src/demo/scenarios/terraform-vpc.ts +0 -170
- package/src/demo/types.ts +0 -92
- package/src/engine/cost-estimator.ts +0 -480
- package/src/engine/diagram-generator.ts +0 -256
- package/src/engine/drift-detector.ts +0 -902
- package/src/engine/executor.ts +0 -1066
- package/src/engine/index.ts +0 -76
- package/src/engine/orchestrator.ts +0 -636
- package/src/engine/planner.ts +0 -787
- package/src/engine/safety.ts +0 -743
- package/src/engine/verifier.ts +0 -770
- package/src/enterprise/audit.ts +0 -348
- package/src/enterprise/auth.ts +0 -270
- package/src/enterprise/billing.ts +0 -822
- package/src/enterprise/index.ts +0 -17
- package/src/enterprise/teams.ts +0 -443
- package/src/generator/best-practices.ts +0 -1608
- package/src/generator/helm.ts +0 -630
- package/src/generator/index.ts +0 -37
- package/src/generator/intent-parser.ts +0 -514
- package/src/generator/kubernetes.ts +0 -976
- package/src/generator/terraform.ts +0 -1875
- package/src/history/index.ts +0 -8
- package/src/history/manager.ts +0 -250
- package/src/history/types.ts +0 -34
- package/src/hooks/config.ts +0 -432
- package/src/hooks/engine.ts +0 -392
- package/src/hooks/index.ts +0 -4
- package/src/llm/auth-bridge.ts +0 -198
- package/src/llm/circuit-breaker.ts +0 -140
- package/src/llm/config-loader.ts +0 -201
- package/src/llm/cost-calculator.ts +0 -171
- package/src/llm/index.ts +0 -8
- package/src/llm/model-aliases.ts +0 -115
- package/src/llm/provider-registry.ts +0 -63
- package/src/llm/providers/anthropic.ts +0 -462
- package/src/llm/providers/bedrock.ts +0 -477
- package/src/llm/providers/google.ts +0 -405
- package/src/llm/providers/ollama.ts +0 -767
- package/src/llm/providers/openai-compatible.ts +0 -340
- package/src/llm/providers/openai.ts +0 -328
- package/src/llm/providers/openrouter.ts +0 -338
- package/src/llm/router.ts +0 -1104
- package/src/llm/types.ts +0 -232
- package/src/lsp/client.ts +0 -298
- package/src/lsp/languages.ts +0 -119
- package/src/lsp/manager.ts +0 -294
- package/src/mcp/client.ts +0 -402
- package/src/mcp/index.ts +0 -5
- package/src/mcp/manager.ts +0 -133
- package/src/nimbus.ts +0 -233
- package/src/plugins/index.ts +0 -27
- package/src/plugins/loader.ts +0 -334
- package/src/plugins/manager.ts +0 -376
- package/src/plugins/types.ts +0 -284
- package/src/scanners/cicd-scanner.ts +0 -258
- package/src/scanners/cloud-scanner.ts +0 -466
- package/src/scanners/framework-scanner.ts +0 -469
- package/src/scanners/iac-scanner.ts +0 -388
- package/src/scanners/index.ts +0 -539
- package/src/scanners/language-scanner.ts +0 -276
- package/src/scanners/package-manager-scanner.ts +0 -277
- package/src/scanners/types.ts +0 -172
- package/src/sessions/manager.ts +0 -472
- package/src/sessions/types.ts +0 -44
- package/src/sharing/sync.ts +0 -300
- package/src/sharing/viewer.ts +0 -163
- package/src/snapshots/index.ts +0 -2
- package/src/snapshots/manager.ts +0 -530
- package/src/state/artifacts.ts +0 -147
- package/src/state/audit.ts +0 -137
- package/src/state/billing.ts +0 -240
- package/src/state/checkpoints.ts +0 -117
- package/src/state/config.ts +0 -67
- package/src/state/conversations.ts +0 -14
- package/src/state/credentials.ts +0 -154
- package/src/state/db.ts +0 -58
- package/src/state/index.ts +0 -26
- package/src/state/messages.ts +0 -115
- package/src/state/projects.ts +0 -123
- package/src/state/schema.ts +0 -236
- package/src/state/sessions.ts +0 -147
- package/src/state/teams.ts +0 -200
- package/src/telemetry.ts +0 -108
- package/src/tools/aws-ops.ts +0 -952
- package/src/tools/azure-ops.ts +0 -579
- package/src/tools/file-ops.ts +0 -615
- package/src/tools/gcp-ops.ts +0 -625
- package/src/tools/git-ops.ts +0 -773
- package/src/tools/github-ops.ts +0 -799
- package/src/tools/helm-ops.ts +0 -943
- package/src/tools/index.ts +0 -17
- package/src/tools/k8s-ops.ts +0 -819
- package/src/tools/schemas/converter.ts +0 -184
- package/src/tools/schemas/devops.ts +0 -3502
- package/src/tools/schemas/index.ts +0 -73
- package/src/tools/schemas/standard.ts +0 -1148
- package/src/tools/schemas/types.ts +0 -735
- package/src/tools/spawn-exec.ts +0 -148
- package/src/tools/terraform-ops.ts +0 -862
- package/src/types/ambient.d.ts +0 -193
- package/src/types/config.ts +0 -83
- package/src/types/drift.ts +0 -116
- package/src/types/enterprise.ts +0 -335
- package/src/types/index.ts +0 -20
- package/src/types/plan.ts +0 -44
- package/src/types/request.ts +0 -65
- package/src/types/response.ts +0 -54
- package/src/types/service.ts +0 -51
- package/src/ui/App.tsx +0 -2114
- package/src/ui/DeployPreview.tsx +0 -174
- package/src/ui/FileDiffModal.tsx +0 -162
- package/src/ui/Header.tsx +0 -131
- package/src/ui/HelpModal.tsx +0 -57
- package/src/ui/InputBox.tsx +0 -503
- package/src/ui/MessageList.tsx +0 -1032
- package/src/ui/PermissionPrompt.tsx +0 -163
- package/src/ui/StatusBar.tsx +0 -277
- package/src/ui/TerminalPane.tsx +0 -84
- package/src/ui/ToolCallDisplay.tsx +0 -643
- package/src/ui/TreePane.tsx +0 -132
- package/src/ui/chat-ui.ts +0 -850
- package/src/ui/index.ts +0 -33
- package/src/ui/ink/index.ts +0 -1444
- package/src/ui/streaming.ts +0 -176
- package/src/ui/theme.ts +0 -104
- package/src/ui/types.ts +0 -75
- package/src/utils/analytics.ts +0 -72
- package/src/utils/cost-warning.ts +0 -27
- package/src/utils/env.ts +0 -46
- package/src/utils/errors.ts +0 -69
- package/src/utils/event-bus.ts +0 -38
- package/src/utils/index.ts +0 -24
- package/src/utils/logger.ts +0 -171
- package/src/utils/rate-limiter.ts +0 -121
- package/src/utils/service-auth.ts +0 -49
- package/src/utils/validation.ts +0 -53
- package/src/version.ts +0 -4
- package/src/watcher/index.ts +0 -214
- package/src/wizard/approval.ts +0 -383
- package/src/wizard/index.ts +0 -25
- package/src/wizard/prompts.ts +0 -338
- package/src/wizard/types.ts +0 -172
- package/src/wizard/ui.ts +0 -556
- package/src/wizard/wizard.ts +0 -304
- package/tsconfig.json +0 -24
|
@@ -1,1843 +0,0 @@
|
|
|
1
|
-
import { RestClient, type RestClientOptions } from './rest-client';
|
|
2
|
-
import { ServiceURLs } from './service-discovery';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Unified Tools Client for MCP Tools Services
|
|
6
|
-
* Provides a single interface to interact with all tool services
|
|
7
|
-
*/
|
|
8
|
-
export class ToolsClient {
|
|
9
|
-
private gitClient: RestClient;
|
|
10
|
-
private fsClient: RestClient;
|
|
11
|
-
private terraformClient: RestClient;
|
|
12
|
-
private k8sClient: RestClient;
|
|
13
|
-
private helmClient: RestClient;
|
|
14
|
-
private awsClient: RestClient;
|
|
15
|
-
private githubClient: RestClient;
|
|
16
|
-
private gcpClient: RestClient;
|
|
17
|
-
private azureClient: RestClient;
|
|
18
|
-
|
|
19
|
-
constructor(options: RestClientOptions = {}) {
|
|
20
|
-
this.gitClient = new RestClient(ServiceURLs.GIT_TOOLS, options);
|
|
21
|
-
this.fsClient = new RestClient(ServiceURLs.FS_TOOLS, options);
|
|
22
|
-
this.terraformClient = new RestClient(ServiceURLs.TERRAFORM_TOOLS, options);
|
|
23
|
-
this.k8sClient = new RestClient(ServiceURLs.K8S_TOOLS, options);
|
|
24
|
-
this.helmClient = new RestClient(ServiceURLs.HELM_TOOLS, options);
|
|
25
|
-
this.awsClient = new RestClient(ServiceURLs.AWS_TOOLS, options);
|
|
26
|
-
this.githubClient = new RestClient(ServiceURLs.GITHUB_TOOLS, options);
|
|
27
|
-
this.gcpClient = new RestClient(ServiceURLs.GCP_TOOLS, options);
|
|
28
|
-
this.azureClient = new RestClient(ServiceURLs.AZURE_TOOLS, options);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ==================== Git Operations ====================
|
|
32
|
-
|
|
33
|
-
git = {
|
|
34
|
-
clone: async (url: string, path: string, options?: { branch?: string; depth?: number }) => {
|
|
35
|
-
return this.gitClient.post('/api/git/clone', { url, path, ...options });
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
status: async (path?: string) => {
|
|
39
|
-
const query = path ? `?path=${encodeURIComponent(path)}` : '';
|
|
40
|
-
return this.gitClient.get(`/api/git/status${query}`);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
add: async (files?: string | string[], path?: string) => {
|
|
44
|
-
return this.gitClient.post('/api/git/add', { files, path });
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
commit: async (
|
|
48
|
-
message: string,
|
|
49
|
-
options?: { path?: string; amend?: boolean; allowEmpty?: boolean }
|
|
50
|
-
) => {
|
|
51
|
-
return this.gitClient.post('/api/git/commit', { message, ...options });
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
push: async (options?: {
|
|
55
|
-
path?: string;
|
|
56
|
-
remote?: string;
|
|
57
|
-
branch?: string;
|
|
58
|
-
force?: boolean;
|
|
59
|
-
setUpstream?: boolean;
|
|
60
|
-
}) => {
|
|
61
|
-
return this.gitClient.post('/api/git/push', options);
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
pull: async (options?: {
|
|
65
|
-
path?: string;
|
|
66
|
-
remote?: string;
|
|
67
|
-
branch?: string;
|
|
68
|
-
rebase?: boolean;
|
|
69
|
-
}) => {
|
|
70
|
-
return this.gitClient.post('/api/git/pull', options);
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
createBranch: async (
|
|
74
|
-
name: string,
|
|
75
|
-
options?: { path?: string; checkout?: boolean; startPoint?: string }
|
|
76
|
-
) => {
|
|
77
|
-
return this.gitClient.post('/api/git/branch', { name, ...options });
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
listBranches: async (path?: string, showRemote?: boolean) => {
|
|
81
|
-
const params = new URLSearchParams();
|
|
82
|
-
if (path) {
|
|
83
|
-
params.set('path', path);
|
|
84
|
-
}
|
|
85
|
-
if (showRemote) {
|
|
86
|
-
params.set('remote', 'true');
|
|
87
|
-
}
|
|
88
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
89
|
-
return this.gitClient.get(`/api/git/branches${query}`);
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
checkout: async (target: string, options?: { path?: string; create?: boolean }) => {
|
|
93
|
-
return this.gitClient.post('/api/git/checkout', { target, ...options });
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
diff: async (options?: {
|
|
97
|
-
path?: string;
|
|
98
|
-
cached?: boolean;
|
|
99
|
-
nameOnly?: boolean;
|
|
100
|
-
from?: string;
|
|
101
|
-
to?: string;
|
|
102
|
-
}) => {
|
|
103
|
-
const params = new URLSearchParams();
|
|
104
|
-
if (options?.path) {
|
|
105
|
-
params.set('path', options.path);
|
|
106
|
-
}
|
|
107
|
-
if (options?.cached) {
|
|
108
|
-
params.set('cached', 'true');
|
|
109
|
-
}
|
|
110
|
-
if (options?.nameOnly) {
|
|
111
|
-
params.set('nameOnly', 'true');
|
|
112
|
-
}
|
|
113
|
-
if (options?.from) {
|
|
114
|
-
params.set('from', options.from);
|
|
115
|
-
}
|
|
116
|
-
if (options?.to) {
|
|
117
|
-
params.set('to', options.to);
|
|
118
|
-
}
|
|
119
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
120
|
-
return this.gitClient.get(`/api/git/diff${query}`);
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
log: async (options?: {
|
|
124
|
-
path?: string;
|
|
125
|
-
maxCount?: number;
|
|
126
|
-
from?: string;
|
|
127
|
-
to?: string;
|
|
128
|
-
file?: string;
|
|
129
|
-
}) => {
|
|
130
|
-
const params = new URLSearchParams();
|
|
131
|
-
if (options?.path) {
|
|
132
|
-
params.set('path', options.path);
|
|
133
|
-
}
|
|
134
|
-
if (options?.maxCount) {
|
|
135
|
-
params.set('maxCount', options.maxCount.toString());
|
|
136
|
-
}
|
|
137
|
-
if (options?.from) {
|
|
138
|
-
params.set('from', options.from);
|
|
139
|
-
}
|
|
140
|
-
if (options?.to) {
|
|
141
|
-
params.set('to', options.to);
|
|
142
|
-
}
|
|
143
|
-
if (options?.file) {
|
|
144
|
-
params.set('file', options.file);
|
|
145
|
-
}
|
|
146
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
147
|
-
return this.gitClient.get(`/api/git/log${query}`);
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
merge: async (
|
|
151
|
-
branch: string,
|
|
152
|
-
options?: { path?: string; noFf?: boolean; squash?: boolean; message?: string }
|
|
153
|
-
) => {
|
|
154
|
-
return this.gitClient.post('/api/git/merge', { branch, ...options });
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
stash: async (
|
|
158
|
-
command: 'push' | 'pop' | 'list' | 'drop' | 'apply' | 'clear',
|
|
159
|
-
options?: { path?: string; message?: string; index?: number }
|
|
160
|
-
) => {
|
|
161
|
-
return this.gitClient.post('/api/git/stash', { command, ...options });
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
fetch: async (options?: { path?: string; remote?: string; prune?: boolean }) => {
|
|
165
|
-
return this.gitClient.post('/api/git/fetch', options);
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
reset: async (
|
|
169
|
-
target: string,
|
|
170
|
-
options?: { path?: string; mode?: 'soft' | 'mixed' | 'hard' }
|
|
171
|
-
) => {
|
|
172
|
-
return this.gitClient.post('/api/git/reset', { target, ...options });
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
init: async (options?: { path?: string; bare?: boolean }) => {
|
|
176
|
-
return this.gitClient.post('/api/git/init', options);
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
remote: async (options?: { path?: string; name?: string }) => {
|
|
180
|
-
const params = new URLSearchParams();
|
|
181
|
-
if (options?.path) {
|
|
182
|
-
params.set('path', options.path);
|
|
183
|
-
}
|
|
184
|
-
if (options?.name) {
|
|
185
|
-
params.set('name', options.name);
|
|
186
|
-
}
|
|
187
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
188
|
-
return this.gitClient.get(`/api/git/remote${query}`);
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
revert: async (
|
|
192
|
-
commit: string,
|
|
193
|
-
options?: { cwd?: string; noCommit?: boolean; noEdit?: boolean }
|
|
194
|
-
) => {
|
|
195
|
-
return this.gitClient.post('/api/git/revert', { commit, ...options });
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
cherryPick: async (
|
|
199
|
-
commit: string,
|
|
200
|
-
options?: {
|
|
201
|
-
path?: string;
|
|
202
|
-
noCommit?: boolean;
|
|
203
|
-
edit?: boolean;
|
|
204
|
-
signoff?: boolean;
|
|
205
|
-
strategy?: string;
|
|
206
|
-
}
|
|
207
|
-
) => {
|
|
208
|
-
return this.gitClient.post('/api/git/cherry-pick', { commit, ...options });
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
cherryPickAbort: async (options?: { path?: string }) => {
|
|
212
|
-
return this.gitClient.post('/api/git/cherry-pick/abort', options || {});
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
cherryPickContinue: async (options?: { path?: string }) => {
|
|
216
|
-
return this.gitClient.post('/api/git/cherry-pick/continue', options || {});
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
tag: async (
|
|
220
|
-
name: string,
|
|
221
|
-
options?: {
|
|
222
|
-
path?: string;
|
|
223
|
-
message?: string;
|
|
224
|
-
annotated?: boolean;
|
|
225
|
-
force?: boolean;
|
|
226
|
-
commit?: string;
|
|
227
|
-
}
|
|
228
|
-
) => {
|
|
229
|
-
return this.gitClient.post('/api/git/tag', { name, ...options });
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
deleteTag: async (name: string, options?: { path?: string; remote?: string }) => {
|
|
233
|
-
const params = new URLSearchParams();
|
|
234
|
-
params.set('name', name);
|
|
235
|
-
if (options?.path) {
|
|
236
|
-
params.set('path', options.path);
|
|
237
|
-
}
|
|
238
|
-
if (options?.remote) {
|
|
239
|
-
params.set('remote', options.remote);
|
|
240
|
-
}
|
|
241
|
-
return this.gitClient.delete(`/api/git/tag?${params.toString()}`);
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
listTags: async (options?: { path?: string; pattern?: string }) => {
|
|
245
|
-
const params = new URLSearchParams();
|
|
246
|
-
if (options?.path) {
|
|
247
|
-
params.set('path', options.path);
|
|
248
|
-
}
|
|
249
|
-
if (options?.pattern) {
|
|
250
|
-
params.set('pattern', options.pattern);
|
|
251
|
-
}
|
|
252
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
253
|
-
return this.gitClient.get(`/api/git/tags${query}`);
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
pushTags: async (options?: { path?: string; remote?: string; tagName?: string }) => {
|
|
257
|
-
return this.gitClient.post('/api/git/tag/push', options || {});
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
showTag: async (name: string, options?: { path?: string }) => {
|
|
261
|
-
const params = new URLSearchParams();
|
|
262
|
-
params.set('name', name);
|
|
263
|
-
if (options?.path) {
|
|
264
|
-
params.set('path', options.path);
|
|
265
|
-
}
|
|
266
|
-
return this.gitClient.get(`/api/git/tag/show?${params.toString()}`);
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
blame: async (
|
|
270
|
-
file: string,
|
|
271
|
-
options?: { path?: string; startLine?: number; endLine?: number }
|
|
272
|
-
) => {
|
|
273
|
-
const params = new URLSearchParams();
|
|
274
|
-
params.set('file', file);
|
|
275
|
-
if (options?.path) {
|
|
276
|
-
params.set('path', options.path);
|
|
277
|
-
}
|
|
278
|
-
if (options?.startLine) {
|
|
279
|
-
params.set('startLine', options.startLine.toString());
|
|
280
|
-
}
|
|
281
|
-
if (options?.endLine) {
|
|
282
|
-
params.set('endLine', options.endLine.toString());
|
|
283
|
-
}
|
|
284
|
-
return this.gitClient.get(`/api/git/blame?${params.toString()}`);
|
|
285
|
-
},
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
// ==================== File System Operations ====================
|
|
289
|
-
|
|
290
|
-
fs = {
|
|
291
|
-
read: async (filePath: string, options?: { basePath?: string; encoding?: string }) => {
|
|
292
|
-
const params = new URLSearchParams();
|
|
293
|
-
params.set('path', filePath);
|
|
294
|
-
if (options?.basePath) {
|
|
295
|
-
params.set('basePath', options.basePath);
|
|
296
|
-
}
|
|
297
|
-
if (options?.encoding) {
|
|
298
|
-
params.set('encoding', options.encoding);
|
|
299
|
-
}
|
|
300
|
-
return this.fsClient.get(`/api/fs/read?${params.toString()}`);
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
write: async (
|
|
304
|
-
filePath: string,
|
|
305
|
-
content: string,
|
|
306
|
-
options?: { basePath?: string; encoding?: string; createDirs?: boolean }
|
|
307
|
-
) => {
|
|
308
|
-
return this.fsClient.post('/api/fs/write', { path: filePath, content, ...options });
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
list: async (
|
|
312
|
-
dirPath: string,
|
|
313
|
-
options?: { basePath?: string; recursive?: boolean; pattern?: string }
|
|
314
|
-
) => {
|
|
315
|
-
const params = new URLSearchParams();
|
|
316
|
-
params.set('path', dirPath);
|
|
317
|
-
if (options?.basePath) {
|
|
318
|
-
params.set('basePath', options.basePath);
|
|
319
|
-
}
|
|
320
|
-
if (options?.recursive) {
|
|
321
|
-
params.set('recursive', 'true');
|
|
322
|
-
}
|
|
323
|
-
if (options?.pattern) {
|
|
324
|
-
params.set('pattern', options.pattern);
|
|
325
|
-
}
|
|
326
|
-
return this.fsClient.get(`/api/fs/list?${params.toString()}`);
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
search: async (
|
|
330
|
-
pattern: string,
|
|
331
|
-
options?: { basePath?: string; path?: string; type?: string; maxResults?: number }
|
|
332
|
-
) => {
|
|
333
|
-
const params = new URLSearchParams();
|
|
334
|
-
params.set('pattern', pattern);
|
|
335
|
-
if (options?.basePath) {
|
|
336
|
-
params.set('basePath', options.basePath);
|
|
337
|
-
}
|
|
338
|
-
if (options?.path) {
|
|
339
|
-
params.set('path', options.path);
|
|
340
|
-
}
|
|
341
|
-
if (options?.type) {
|
|
342
|
-
params.set('type', options.type);
|
|
343
|
-
}
|
|
344
|
-
if (options?.maxResults) {
|
|
345
|
-
params.set('maxResults', options.maxResults.toString());
|
|
346
|
-
}
|
|
347
|
-
return this.fsClient.get(`/api/fs/search?${params.toString()}`);
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
delete: async (filePath: string, options?: { basePath?: string; recursive?: boolean }) => {
|
|
351
|
-
return this.fsClient.post('/api/fs/delete', { path: filePath, ...options });
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
copy: async (
|
|
355
|
-
source: string,
|
|
356
|
-
destination: string,
|
|
357
|
-
options?: { basePath?: string; overwrite?: boolean }
|
|
358
|
-
) => {
|
|
359
|
-
return this.fsClient.post('/api/fs/copy', { source, destination, ...options });
|
|
360
|
-
},
|
|
361
|
-
|
|
362
|
-
move: async (
|
|
363
|
-
source: string,
|
|
364
|
-
destination: string,
|
|
365
|
-
options?: { basePath?: string; overwrite?: boolean }
|
|
366
|
-
) => {
|
|
367
|
-
return this.fsClient.post('/api/fs/move', { source, destination, ...options });
|
|
368
|
-
},
|
|
369
|
-
|
|
370
|
-
tree: async (
|
|
371
|
-
directory: string,
|
|
372
|
-
options?: { maxDepth?: number; includeHidden?: boolean; includeFiles?: boolean }
|
|
373
|
-
) => {
|
|
374
|
-
return this.fsClient.post('/api/fs/tree', { directory, ...options });
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
mkdir: async (dirPath: string, options?: { basePath?: string; recursive?: boolean }) => {
|
|
378
|
-
return this.fsClient.post('/api/fs/mkdir', { path: dirPath, ...options });
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
exists: async (filePath: string, basePath?: string) => {
|
|
382
|
-
const params = new URLSearchParams();
|
|
383
|
-
params.set('path', filePath);
|
|
384
|
-
if (basePath) {
|
|
385
|
-
params.set('basePath', basePath);
|
|
386
|
-
}
|
|
387
|
-
return this.fsClient.get(`/api/fs/exists?${params.toString()}`);
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
stat: async (filePath: string, basePath?: string) => {
|
|
391
|
-
const params = new URLSearchParams();
|
|
392
|
-
params.set('path', filePath);
|
|
393
|
-
if (basePath) {
|
|
394
|
-
params.set('basePath', basePath);
|
|
395
|
-
}
|
|
396
|
-
return this.fsClient.get(`/api/fs/stat?${params.toString()}`);
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
// ==================== Terraform Operations ====================
|
|
401
|
-
|
|
402
|
-
terraform = {
|
|
403
|
-
init: async (
|
|
404
|
-
workingDir?: string,
|
|
405
|
-
options?: { backend?: boolean; upgrade?: boolean; reconfigure?: boolean }
|
|
406
|
-
) => {
|
|
407
|
-
return this.terraformClient.post('/api/terraform/init', { workingDir, ...options });
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
plan: async (options?: {
|
|
411
|
-
workingDir?: string;
|
|
412
|
-
out?: string;
|
|
413
|
-
vars?: Record<string, string>;
|
|
414
|
-
varFiles?: string[];
|
|
415
|
-
target?: string[];
|
|
416
|
-
destroy?: boolean;
|
|
417
|
-
}) => {
|
|
418
|
-
return this.terraformClient.post('/api/terraform/plan', options);
|
|
419
|
-
},
|
|
420
|
-
|
|
421
|
-
apply: async (options?: {
|
|
422
|
-
workingDir?: string;
|
|
423
|
-
planFile?: string;
|
|
424
|
-
vars?: Record<string, string>;
|
|
425
|
-
varFiles?: string[];
|
|
426
|
-
target?: string[];
|
|
427
|
-
autoApprove?: boolean;
|
|
428
|
-
}) => {
|
|
429
|
-
return this.terraformClient.post('/api/terraform/apply', options);
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
destroy: async (options?: {
|
|
433
|
-
workingDir?: string;
|
|
434
|
-
vars?: Record<string, string>;
|
|
435
|
-
varFiles?: string[];
|
|
436
|
-
target?: string[];
|
|
437
|
-
autoApprove?: boolean;
|
|
438
|
-
}) => {
|
|
439
|
-
return this.terraformClient.post('/api/terraform/destroy', options);
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
output: async (workingDir?: string, name?: string) => {
|
|
443
|
-
const params = new URLSearchParams();
|
|
444
|
-
if (workingDir) {
|
|
445
|
-
params.set('workingDir', workingDir);
|
|
446
|
-
}
|
|
447
|
-
if (name) {
|
|
448
|
-
params.set('name', name);
|
|
449
|
-
}
|
|
450
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
451
|
-
return this.terraformClient.get(`/api/terraform/output${query}`);
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
show: async (options?: { workingDir?: string; planFile?: string; address?: string }) => {
|
|
455
|
-
const params = new URLSearchParams();
|
|
456
|
-
if (options?.workingDir) {
|
|
457
|
-
params.set('workingDir', options.workingDir);
|
|
458
|
-
}
|
|
459
|
-
if (options?.planFile) {
|
|
460
|
-
params.set('planFile', options.planFile);
|
|
461
|
-
}
|
|
462
|
-
if (options?.address) {
|
|
463
|
-
params.set('address', options.address);
|
|
464
|
-
}
|
|
465
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
466
|
-
return this.terraformClient.get(`/api/terraform/show${query}`);
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
validate: async (workingDir?: string) => {
|
|
470
|
-
return this.terraformClient.post('/api/terraform/validate', { workingDir });
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
fmt: async (options?: {
|
|
474
|
-
workingDir?: string;
|
|
475
|
-
check?: boolean;
|
|
476
|
-
recursive?: boolean;
|
|
477
|
-
diff?: boolean;
|
|
478
|
-
}) => {
|
|
479
|
-
return this.terraformClient.post('/api/terraform/fmt', options);
|
|
480
|
-
},
|
|
481
|
-
|
|
482
|
-
workspace: {
|
|
483
|
-
list: async (workingDir?: string) => {
|
|
484
|
-
const params = new URLSearchParams();
|
|
485
|
-
if (workingDir) {
|
|
486
|
-
params.set('workingDir', workingDir);
|
|
487
|
-
}
|
|
488
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
489
|
-
return this.terraformClient.get(`/api/terraform/workspace/list${query}`);
|
|
490
|
-
},
|
|
491
|
-
select: async (name: string, workingDir?: string) => {
|
|
492
|
-
return this.terraformClient.post('/api/terraform/workspace/select', { name, workingDir });
|
|
493
|
-
},
|
|
494
|
-
new: async (name: string, workingDir?: string) => {
|
|
495
|
-
return this.terraformClient.post('/api/terraform/workspace/new', { name, workingDir });
|
|
496
|
-
},
|
|
497
|
-
delete: async (name: string, workingDir?: string) => {
|
|
498
|
-
return this.terraformClient.post('/api/terraform/workspace/delete', { name, workingDir });
|
|
499
|
-
},
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
state: {
|
|
503
|
-
list: async (workingDir?: string) => {
|
|
504
|
-
const params = new URLSearchParams();
|
|
505
|
-
if (workingDir) {
|
|
506
|
-
params.set('workingDir', workingDir);
|
|
507
|
-
}
|
|
508
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
509
|
-
return this.terraformClient.get(`/api/terraform/state/list${query}`);
|
|
510
|
-
},
|
|
511
|
-
show: async (address: string, workingDir?: string) => {
|
|
512
|
-
const params = new URLSearchParams();
|
|
513
|
-
params.set('address', address);
|
|
514
|
-
if (workingDir) {
|
|
515
|
-
params.set('workingDir', workingDir);
|
|
516
|
-
}
|
|
517
|
-
return this.terraformClient.get(`/api/terraform/state/show?${params.toString()}`);
|
|
518
|
-
},
|
|
519
|
-
mv: async (directory: string, source: string, destination: string) => {
|
|
520
|
-
return this.terraformClient.post('/api/terraform/state/mv', {
|
|
521
|
-
directory,
|
|
522
|
-
source,
|
|
523
|
-
destination,
|
|
524
|
-
});
|
|
525
|
-
},
|
|
526
|
-
pull: async (directory: string) => {
|
|
527
|
-
const params = new URLSearchParams();
|
|
528
|
-
params.set('directory', directory);
|
|
529
|
-
return this.terraformClient.get(`/api/terraform/state/pull?${params.toString()}`);
|
|
530
|
-
},
|
|
531
|
-
push: async (directory: string, options?: { stateFile?: string; force?: boolean }) => {
|
|
532
|
-
return this.terraformClient.post('/api/terraform/state/push', { directory, ...options });
|
|
533
|
-
},
|
|
534
|
-
},
|
|
535
|
-
|
|
536
|
-
taint: async (directory: string, address: string) => {
|
|
537
|
-
return this.terraformClient.post('/api/terraform/taint', { directory, address });
|
|
538
|
-
},
|
|
539
|
-
|
|
540
|
-
untaint: async (directory: string, address: string) => {
|
|
541
|
-
return this.terraformClient.post('/api/terraform/untaint', { directory, address });
|
|
542
|
-
},
|
|
543
|
-
|
|
544
|
-
graph: async (directory: string, options?: { type?: 'plan' | 'apply' }) => {
|
|
545
|
-
const params = new URLSearchParams();
|
|
546
|
-
params.set('directory', directory);
|
|
547
|
-
if (options?.type) {
|
|
548
|
-
params.set('type', options.type);
|
|
549
|
-
}
|
|
550
|
-
return this.terraformClient.get(`/api/terraform/graph?${params.toString()}`);
|
|
551
|
-
},
|
|
552
|
-
|
|
553
|
-
forceUnlock: async (directory: string, lockId: string) => {
|
|
554
|
-
return this.terraformClient.post('/api/terraform/force-unlock', { directory, lockId });
|
|
555
|
-
},
|
|
556
|
-
|
|
557
|
-
refresh: async (directory: string, options?: { varFile?: string }) => {
|
|
558
|
-
return this.terraformClient.post('/api/terraform/refresh', { directory, ...options });
|
|
559
|
-
},
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
// ==================== Kubernetes Operations ====================
|
|
563
|
-
|
|
564
|
-
k8s = {
|
|
565
|
-
get: async (
|
|
566
|
-
resource: string,
|
|
567
|
-
options?: {
|
|
568
|
-
name?: string;
|
|
569
|
-
namespace?: string;
|
|
570
|
-
selector?: string;
|
|
571
|
-
allNamespaces?: boolean;
|
|
572
|
-
output?: 'json' | 'yaml' | 'wide' | 'name';
|
|
573
|
-
kubeconfig?: string;
|
|
574
|
-
context?: string;
|
|
575
|
-
}
|
|
576
|
-
) => {
|
|
577
|
-
const params = new URLSearchParams();
|
|
578
|
-
params.set('resource', resource);
|
|
579
|
-
if (options?.name) {
|
|
580
|
-
params.set('name', options.name);
|
|
581
|
-
}
|
|
582
|
-
if (options?.namespace) {
|
|
583
|
-
params.set('namespace', options.namespace);
|
|
584
|
-
}
|
|
585
|
-
if (options?.selector) {
|
|
586
|
-
params.set('selector', options.selector);
|
|
587
|
-
}
|
|
588
|
-
if (options?.allNamespaces) {
|
|
589
|
-
params.set('allNamespaces', 'true');
|
|
590
|
-
}
|
|
591
|
-
if (options?.output) {
|
|
592
|
-
params.set('output', options.output);
|
|
593
|
-
}
|
|
594
|
-
if (options?.kubeconfig) {
|
|
595
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
596
|
-
}
|
|
597
|
-
if (options?.context) {
|
|
598
|
-
params.set('context', options.context);
|
|
599
|
-
}
|
|
600
|
-
return this.k8sClient.get(`/api/k8s/resources?${params.toString()}`);
|
|
601
|
-
},
|
|
602
|
-
|
|
603
|
-
apply: async (
|
|
604
|
-
manifest: string,
|
|
605
|
-
options?: {
|
|
606
|
-
namespace?: string;
|
|
607
|
-
dryRun?: boolean;
|
|
608
|
-
force?: boolean;
|
|
609
|
-
serverSide?: boolean;
|
|
610
|
-
kubeconfig?: string;
|
|
611
|
-
context?: string;
|
|
612
|
-
}
|
|
613
|
-
) => {
|
|
614
|
-
return this.k8sClient.post('/api/k8s/apply', { manifest, ...options });
|
|
615
|
-
},
|
|
616
|
-
|
|
617
|
-
delete: async (
|
|
618
|
-
resource: string,
|
|
619
|
-
options?: {
|
|
620
|
-
name?: string;
|
|
621
|
-
namespace?: string;
|
|
622
|
-
selector?: string;
|
|
623
|
-
force?: boolean;
|
|
624
|
-
gracePeriod?: number;
|
|
625
|
-
kubeconfig?: string;
|
|
626
|
-
context?: string;
|
|
627
|
-
}
|
|
628
|
-
) => {
|
|
629
|
-
return this.k8sClient.post('/api/k8s/delete', { resource, ...options });
|
|
630
|
-
},
|
|
631
|
-
|
|
632
|
-
logs: async (
|
|
633
|
-
pod: string,
|
|
634
|
-
options?: {
|
|
635
|
-
namespace?: string;
|
|
636
|
-
container?: string;
|
|
637
|
-
tail?: number;
|
|
638
|
-
previous?: boolean;
|
|
639
|
-
since?: string;
|
|
640
|
-
timestamps?: boolean;
|
|
641
|
-
kubeconfig?: string;
|
|
642
|
-
context?: string;
|
|
643
|
-
}
|
|
644
|
-
) => {
|
|
645
|
-
const params = new URLSearchParams();
|
|
646
|
-
params.set('pod', pod);
|
|
647
|
-
if (options?.namespace) {
|
|
648
|
-
params.set('namespace', options.namespace);
|
|
649
|
-
}
|
|
650
|
-
if (options?.container) {
|
|
651
|
-
params.set('container', options.container);
|
|
652
|
-
}
|
|
653
|
-
if (options?.tail) {
|
|
654
|
-
params.set('tail', options.tail.toString());
|
|
655
|
-
}
|
|
656
|
-
if (options?.previous) {
|
|
657
|
-
params.set('previous', 'true');
|
|
658
|
-
}
|
|
659
|
-
if (options?.since) {
|
|
660
|
-
params.set('since', options.since);
|
|
661
|
-
}
|
|
662
|
-
if (options?.timestamps) {
|
|
663
|
-
params.set('timestamps', 'true');
|
|
664
|
-
}
|
|
665
|
-
if (options?.kubeconfig) {
|
|
666
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
667
|
-
}
|
|
668
|
-
if (options?.context) {
|
|
669
|
-
params.set('context', options.context);
|
|
670
|
-
}
|
|
671
|
-
return this.k8sClient.get(`/api/k8s/logs?${params.toString()}`);
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
exec: async (
|
|
675
|
-
pod: string,
|
|
676
|
-
command: string[],
|
|
677
|
-
options?: { namespace?: string; container?: string; kubeconfig?: string; context?: string }
|
|
678
|
-
) => {
|
|
679
|
-
return this.k8sClient.post('/api/k8s/exec', { pod, command, ...options });
|
|
680
|
-
},
|
|
681
|
-
|
|
682
|
-
describe: async (
|
|
683
|
-
resource: string,
|
|
684
|
-
options?: {
|
|
685
|
-
name?: string;
|
|
686
|
-
namespace?: string;
|
|
687
|
-
selector?: string;
|
|
688
|
-
allNamespaces?: boolean;
|
|
689
|
-
kubeconfig?: string;
|
|
690
|
-
context?: string;
|
|
691
|
-
}
|
|
692
|
-
) => {
|
|
693
|
-
const params = new URLSearchParams();
|
|
694
|
-
params.set('resource', resource);
|
|
695
|
-
if (options?.name) {
|
|
696
|
-
params.set('name', options.name);
|
|
697
|
-
}
|
|
698
|
-
if (options?.namespace) {
|
|
699
|
-
params.set('namespace', options.namespace);
|
|
700
|
-
}
|
|
701
|
-
if (options?.selector) {
|
|
702
|
-
params.set('selector', options.selector);
|
|
703
|
-
}
|
|
704
|
-
if (options?.allNamespaces) {
|
|
705
|
-
params.set('allNamespaces', 'true');
|
|
706
|
-
}
|
|
707
|
-
if (options?.kubeconfig) {
|
|
708
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
709
|
-
}
|
|
710
|
-
if (options?.context) {
|
|
711
|
-
params.set('context', options.context);
|
|
712
|
-
}
|
|
713
|
-
return this.k8sClient.get(`/api/k8s/describe?${params.toString()}`);
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
scale: async (
|
|
717
|
-
resource: string,
|
|
718
|
-
name: string,
|
|
719
|
-
replicas: number,
|
|
720
|
-
options?: { namespace?: string; kubeconfig?: string; context?: string }
|
|
721
|
-
) => {
|
|
722
|
-
return this.k8sClient.post('/api/k8s/scale', { resource, name, replicas, ...options });
|
|
723
|
-
},
|
|
724
|
-
|
|
725
|
-
rollout: async (
|
|
726
|
-
resource: string,
|
|
727
|
-
name: string,
|
|
728
|
-
action: 'status' | 'history' | 'restart' | 'undo' | 'pause' | 'resume',
|
|
729
|
-
options?: { namespace?: string; revision?: number; kubeconfig?: string; context?: string }
|
|
730
|
-
) => {
|
|
731
|
-
return this.k8sClient.post('/api/k8s/rollout', { resource, name, action, ...options });
|
|
732
|
-
},
|
|
733
|
-
|
|
734
|
-
contexts: async (kubeconfig?: string) => {
|
|
735
|
-
const params = new URLSearchParams();
|
|
736
|
-
if (kubeconfig) {
|
|
737
|
-
params.set('kubeconfig', kubeconfig);
|
|
738
|
-
}
|
|
739
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
740
|
-
return this.k8sClient.get(`/api/k8s/contexts${query}`);
|
|
741
|
-
},
|
|
742
|
-
|
|
743
|
-
namespaces: async (kubeconfig?: string, context?: string) => {
|
|
744
|
-
const params = new URLSearchParams();
|
|
745
|
-
if (kubeconfig) {
|
|
746
|
-
params.set('kubeconfig', kubeconfig);
|
|
747
|
-
}
|
|
748
|
-
if (context) {
|
|
749
|
-
params.set('context', context);
|
|
750
|
-
}
|
|
751
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
752
|
-
return this.k8sClient.get(`/api/k8s/namespaces${query}`);
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
createNamespace: async (name: string, options?: { kubeconfig?: string; context?: string }) => {
|
|
756
|
-
return this.k8sClient.post('/api/k8s/namespace', { name, ...options });
|
|
757
|
-
},
|
|
758
|
-
|
|
759
|
-
deleteNamespace: async (name: string, options?: { kubeconfig?: string; context?: string }) => {
|
|
760
|
-
return this.k8sClient.post('/api/k8s/namespace/delete', { name, ...options });
|
|
761
|
-
},
|
|
762
|
-
|
|
763
|
-
portForward: async (
|
|
764
|
-
pod: string,
|
|
765
|
-
ports: string,
|
|
766
|
-
options?: { namespace?: string; kubeconfig?: string; context?: string }
|
|
767
|
-
) => {
|
|
768
|
-
return this.k8sClient.post('/api/k8s/port-forward', { pod, ports, ...options });
|
|
769
|
-
},
|
|
770
|
-
|
|
771
|
-
top: async (
|
|
772
|
-
resourceType: 'pods' | 'nodes',
|
|
773
|
-
options?: { namespace?: string; kubeconfig?: string; context?: string }
|
|
774
|
-
) => {
|
|
775
|
-
const params = new URLSearchParams();
|
|
776
|
-
if (options?.namespace) {
|
|
777
|
-
params.set('namespace', options.namespace);
|
|
778
|
-
}
|
|
779
|
-
if (options?.kubeconfig) {
|
|
780
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
781
|
-
}
|
|
782
|
-
if (options?.context) {
|
|
783
|
-
params.set('context', options.context);
|
|
784
|
-
}
|
|
785
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
786
|
-
return this.k8sClient.get(`/api/k8s/top/${resourceType}${query}`);
|
|
787
|
-
},
|
|
788
|
-
|
|
789
|
-
patch: async (
|
|
790
|
-
resource: string,
|
|
791
|
-
name: string,
|
|
792
|
-
patch: string,
|
|
793
|
-
options?: {
|
|
794
|
-
namespace?: string;
|
|
795
|
-
type?: 'strategic' | 'merge' | 'json';
|
|
796
|
-
kubeconfig?: string;
|
|
797
|
-
context?: string;
|
|
798
|
-
}
|
|
799
|
-
) => {
|
|
800
|
-
return this.k8sClient.post('/api/k8s/patch', { resource, name, patch, ...options });
|
|
801
|
-
},
|
|
802
|
-
|
|
803
|
-
label: async (
|
|
804
|
-
resource: string,
|
|
805
|
-
name: string,
|
|
806
|
-
labels: Record<string, string>,
|
|
807
|
-
options?: { namespace?: string; overwrite?: boolean; kubeconfig?: string; context?: string }
|
|
808
|
-
) => {
|
|
809
|
-
return this.k8sClient.post('/api/k8s/label', { resource, name, labels, ...options });
|
|
810
|
-
},
|
|
811
|
-
|
|
812
|
-
annotate: async (
|
|
813
|
-
resource: string,
|
|
814
|
-
name: string,
|
|
815
|
-
annotations: Record<string, string>,
|
|
816
|
-
options?: { namespace?: string; overwrite?: boolean; kubeconfig?: string; context?: string }
|
|
817
|
-
) => {
|
|
818
|
-
return this.k8sClient.post('/api/k8s/annotate', { resource, name, annotations, ...options });
|
|
819
|
-
},
|
|
820
|
-
};
|
|
821
|
-
|
|
822
|
-
// ==================== Helm Operations ====================
|
|
823
|
-
|
|
824
|
-
helm = {
|
|
825
|
-
install: async (
|
|
826
|
-
name: string,
|
|
827
|
-
chart: string,
|
|
828
|
-
options?: {
|
|
829
|
-
namespace?: string;
|
|
830
|
-
values?: string;
|
|
831
|
-
valuesFiles?: string[];
|
|
832
|
-
set?: Record<string, string>;
|
|
833
|
-
version?: string;
|
|
834
|
-
createNamespace?: boolean;
|
|
835
|
-
dryRun?: boolean;
|
|
836
|
-
wait?: boolean;
|
|
837
|
-
timeout?: string;
|
|
838
|
-
atomic?: boolean;
|
|
839
|
-
kubeconfig?: string;
|
|
840
|
-
kubeContext?: string;
|
|
841
|
-
}
|
|
842
|
-
) => {
|
|
843
|
-
return this.helmClient.post('/api/helm/install', { name, chart, ...options });
|
|
844
|
-
},
|
|
845
|
-
|
|
846
|
-
upgrade: async (
|
|
847
|
-
name: string,
|
|
848
|
-
chart: string,
|
|
849
|
-
options?: {
|
|
850
|
-
namespace?: string;
|
|
851
|
-
values?: string;
|
|
852
|
-
valuesFiles?: string[];
|
|
853
|
-
set?: Record<string, string>;
|
|
854
|
-
version?: string;
|
|
855
|
-
install?: boolean;
|
|
856
|
-
createNamespace?: boolean;
|
|
857
|
-
dryRun?: boolean;
|
|
858
|
-
wait?: boolean;
|
|
859
|
-
timeout?: string;
|
|
860
|
-
atomic?: boolean;
|
|
861
|
-
reuseValues?: boolean;
|
|
862
|
-
kubeconfig?: string;
|
|
863
|
-
kubeContext?: string;
|
|
864
|
-
}
|
|
865
|
-
) => {
|
|
866
|
-
return this.helmClient.post('/api/helm/upgrade', { name, chart, ...options });
|
|
867
|
-
},
|
|
868
|
-
|
|
869
|
-
uninstall: async (
|
|
870
|
-
name: string,
|
|
871
|
-
options?: {
|
|
872
|
-
namespace?: string;
|
|
873
|
-
keepHistory?: boolean;
|
|
874
|
-
dryRun?: boolean;
|
|
875
|
-
wait?: boolean;
|
|
876
|
-
timeout?: string;
|
|
877
|
-
kubeconfig?: string;
|
|
878
|
-
kubeContext?: string;
|
|
879
|
-
}
|
|
880
|
-
) => {
|
|
881
|
-
return this.helmClient.post('/api/helm/uninstall', { name, ...options });
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
list: async (options?: {
|
|
885
|
-
namespace?: string;
|
|
886
|
-
allNamespaces?: boolean;
|
|
887
|
-
filter?: string;
|
|
888
|
-
maxResults?: number;
|
|
889
|
-
kubeconfig?: string;
|
|
890
|
-
kubeContext?: string;
|
|
891
|
-
}) => {
|
|
892
|
-
const params = new URLSearchParams();
|
|
893
|
-
if (options?.namespace) {
|
|
894
|
-
params.set('namespace', options.namespace);
|
|
895
|
-
}
|
|
896
|
-
if (options?.allNamespaces) {
|
|
897
|
-
params.set('allNamespaces', 'true');
|
|
898
|
-
}
|
|
899
|
-
if (options?.filter) {
|
|
900
|
-
params.set('filter', options.filter);
|
|
901
|
-
}
|
|
902
|
-
if (options?.maxResults) {
|
|
903
|
-
params.set('maxResults', options.maxResults.toString());
|
|
904
|
-
}
|
|
905
|
-
if (options?.kubeconfig) {
|
|
906
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
907
|
-
}
|
|
908
|
-
if (options?.kubeContext) {
|
|
909
|
-
params.set('kubeContext', options.kubeContext);
|
|
910
|
-
}
|
|
911
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
912
|
-
return this.helmClient.get(`/api/helm/list${query}`);
|
|
913
|
-
},
|
|
914
|
-
|
|
915
|
-
rollback: async (
|
|
916
|
-
name: string,
|
|
917
|
-
revision: number,
|
|
918
|
-
options?: {
|
|
919
|
-
namespace?: string;
|
|
920
|
-
dryRun?: boolean;
|
|
921
|
-
wait?: boolean;
|
|
922
|
-
timeout?: string;
|
|
923
|
-
force?: boolean;
|
|
924
|
-
kubeconfig?: string;
|
|
925
|
-
kubeContext?: string;
|
|
926
|
-
}
|
|
927
|
-
) => {
|
|
928
|
-
return this.helmClient.post('/api/helm/rollback', { name, revision, ...options });
|
|
929
|
-
},
|
|
930
|
-
|
|
931
|
-
getValues: async (
|
|
932
|
-
name: string,
|
|
933
|
-
options?: {
|
|
934
|
-
namespace?: string;
|
|
935
|
-
allValues?: boolean;
|
|
936
|
-
revision?: number;
|
|
937
|
-
kubeconfig?: string;
|
|
938
|
-
kubeContext?: string;
|
|
939
|
-
}
|
|
940
|
-
) => {
|
|
941
|
-
const params = new URLSearchParams();
|
|
942
|
-
params.set('name', name);
|
|
943
|
-
if (options?.namespace) {
|
|
944
|
-
params.set('namespace', options.namespace);
|
|
945
|
-
}
|
|
946
|
-
if (options?.allValues) {
|
|
947
|
-
params.set('allValues', 'true');
|
|
948
|
-
}
|
|
949
|
-
if (options?.revision) {
|
|
950
|
-
params.set('revision', options.revision.toString());
|
|
951
|
-
}
|
|
952
|
-
if (options?.kubeconfig) {
|
|
953
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
954
|
-
}
|
|
955
|
-
if (options?.kubeContext) {
|
|
956
|
-
params.set('kubeContext', options.kubeContext);
|
|
957
|
-
}
|
|
958
|
-
return this.helmClient.get(`/api/helm/values?${params.toString()}`);
|
|
959
|
-
},
|
|
960
|
-
|
|
961
|
-
history: async (
|
|
962
|
-
name: string,
|
|
963
|
-
options?: {
|
|
964
|
-
namespace?: string;
|
|
965
|
-
maxResults?: number;
|
|
966
|
-
kubeconfig?: string;
|
|
967
|
-
kubeContext?: string;
|
|
968
|
-
}
|
|
969
|
-
) => {
|
|
970
|
-
const params = new URLSearchParams();
|
|
971
|
-
params.set('name', name);
|
|
972
|
-
if (options?.namespace) {
|
|
973
|
-
params.set('namespace', options.namespace);
|
|
974
|
-
}
|
|
975
|
-
if (options?.maxResults) {
|
|
976
|
-
params.set('maxResults', options.maxResults.toString());
|
|
977
|
-
}
|
|
978
|
-
if (options?.kubeconfig) {
|
|
979
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
980
|
-
}
|
|
981
|
-
if (options?.kubeContext) {
|
|
982
|
-
params.set('kubeContext', options.kubeContext);
|
|
983
|
-
}
|
|
984
|
-
return this.helmClient.get(`/api/helm/history?${params.toString()}`);
|
|
985
|
-
},
|
|
986
|
-
|
|
987
|
-
repo: {
|
|
988
|
-
add: async (
|
|
989
|
-
name: string,
|
|
990
|
-
url: string,
|
|
991
|
-
options?: {
|
|
992
|
-
username?: string;
|
|
993
|
-
password?: string;
|
|
994
|
-
kubeconfig?: string;
|
|
995
|
-
kubeContext?: string;
|
|
996
|
-
}
|
|
997
|
-
) => {
|
|
998
|
-
return this.helmClient.post('/api/helm/repo', { action: 'add', name, url, ...options });
|
|
999
|
-
},
|
|
1000
|
-
remove: async (name: string) => {
|
|
1001
|
-
return this.helmClient.post('/api/helm/repo', { action: 'remove', name });
|
|
1002
|
-
},
|
|
1003
|
-
list: async () => {
|
|
1004
|
-
return this.helmClient.post('/api/helm/repo', { action: 'list' });
|
|
1005
|
-
},
|
|
1006
|
-
update: async () => {
|
|
1007
|
-
return this.helmClient.post('/api/helm/repo', { action: 'update' });
|
|
1008
|
-
},
|
|
1009
|
-
},
|
|
1010
|
-
|
|
1011
|
-
search: async (
|
|
1012
|
-
keyword: string,
|
|
1013
|
-
options?: {
|
|
1014
|
-
version?: string;
|
|
1015
|
-
versions?: boolean;
|
|
1016
|
-
hub?: boolean;
|
|
1017
|
-
maxResults?: number;
|
|
1018
|
-
kubeconfig?: string;
|
|
1019
|
-
kubeContext?: string;
|
|
1020
|
-
}
|
|
1021
|
-
) => {
|
|
1022
|
-
const params = new URLSearchParams();
|
|
1023
|
-
params.set('keyword', keyword);
|
|
1024
|
-
if (options?.version) {
|
|
1025
|
-
params.set('version', options.version);
|
|
1026
|
-
}
|
|
1027
|
-
if (options?.versions) {
|
|
1028
|
-
params.set('versions', 'true');
|
|
1029
|
-
}
|
|
1030
|
-
if (options?.hub) {
|
|
1031
|
-
params.set('hub', 'true');
|
|
1032
|
-
}
|
|
1033
|
-
if (options?.maxResults) {
|
|
1034
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1035
|
-
}
|
|
1036
|
-
if (options?.kubeconfig) {
|
|
1037
|
-
params.set('kubeconfig', options.kubeconfig);
|
|
1038
|
-
}
|
|
1039
|
-
if (options?.kubeContext) {
|
|
1040
|
-
params.set('kubeContext', options.kubeContext);
|
|
1041
|
-
}
|
|
1042
|
-
return this.helmClient.get(`/api/helm/search?${params.toString()}`);
|
|
1043
|
-
},
|
|
1044
|
-
|
|
1045
|
-
template: async (
|
|
1046
|
-
name: string,
|
|
1047
|
-
chart: string,
|
|
1048
|
-
options?: {
|
|
1049
|
-
namespace?: string;
|
|
1050
|
-
values?: string;
|
|
1051
|
-
valuesFiles?: string[];
|
|
1052
|
-
set?: Record<string, string>;
|
|
1053
|
-
version?: string;
|
|
1054
|
-
kubeconfig?: string;
|
|
1055
|
-
kubeContext?: string;
|
|
1056
|
-
}
|
|
1057
|
-
) => {
|
|
1058
|
-
return this.helmClient.post('/api/helm/template', { name, chart, ...options });
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1061
|
-
show: async (
|
|
1062
|
-
chart: string,
|
|
1063
|
-
options?: { subcommand?: 'all' | 'chart' | 'readme' | 'values' | 'crds'; version?: string }
|
|
1064
|
-
) => {
|
|
1065
|
-
const params = new URLSearchParams();
|
|
1066
|
-
params.set('chart', chart);
|
|
1067
|
-
if (options?.subcommand) {
|
|
1068
|
-
params.set('subcommand', options.subcommand);
|
|
1069
|
-
}
|
|
1070
|
-
if (options?.version) {
|
|
1071
|
-
params.set('version', options.version);
|
|
1072
|
-
}
|
|
1073
|
-
return this.helmClient.get(`/api/helm/show?${params.toString()}`);
|
|
1074
|
-
},
|
|
1075
|
-
|
|
1076
|
-
lint: async (
|
|
1077
|
-
chartPath: string,
|
|
1078
|
-
options?: { strict?: boolean; valuesFiles?: string[]; namespace?: string }
|
|
1079
|
-
) => {
|
|
1080
|
-
return this.helmClient.post('/api/helm/lint', { chartPath, ...options });
|
|
1081
|
-
},
|
|
1082
|
-
};
|
|
1083
|
-
|
|
1084
|
-
// ==================== GitHub Operations ====================
|
|
1085
|
-
|
|
1086
|
-
github = {
|
|
1087
|
-
/**
|
|
1088
|
-
* Set authorization token for GitHub API requests
|
|
1089
|
-
*/
|
|
1090
|
-
setToken: (token: string) => {
|
|
1091
|
-
this.githubClient = new RestClient(ServiceURLs.GITHUB_TOOLS, {
|
|
1092
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
1093
|
-
});
|
|
1094
|
-
},
|
|
1095
|
-
|
|
1096
|
-
// Pull Request Operations
|
|
1097
|
-
prs: {
|
|
1098
|
-
list: async (
|
|
1099
|
-
owner: string,
|
|
1100
|
-
repo: string,
|
|
1101
|
-
options?: { state?: 'open' | 'closed' | 'all'; perPage?: number }
|
|
1102
|
-
) => {
|
|
1103
|
-
const params = new URLSearchParams();
|
|
1104
|
-
params.set('owner', owner);
|
|
1105
|
-
params.set('repo', repo);
|
|
1106
|
-
if (options?.state) {
|
|
1107
|
-
params.set('state', options.state);
|
|
1108
|
-
}
|
|
1109
|
-
if (options?.perPage) {
|
|
1110
|
-
params.set('per_page', options.perPage.toString());
|
|
1111
|
-
}
|
|
1112
|
-
return this.githubClient.get(`/api/github/prs?${params.toString()}`);
|
|
1113
|
-
},
|
|
1114
|
-
|
|
1115
|
-
get: async (owner: string, repo: string, prNumber: number) => {
|
|
1116
|
-
const params = new URLSearchParams();
|
|
1117
|
-
params.set('owner', owner);
|
|
1118
|
-
params.set('repo', repo);
|
|
1119
|
-
return this.githubClient.get(`/api/github/prs/${prNumber}?${params.toString()}`);
|
|
1120
|
-
},
|
|
1121
|
-
|
|
1122
|
-
create: async (
|
|
1123
|
-
owner: string,
|
|
1124
|
-
repo: string,
|
|
1125
|
-
params: { title: string; head: string; base: string; body?: string; draft?: boolean }
|
|
1126
|
-
) => {
|
|
1127
|
-
return this.githubClient.post('/api/github/prs', { owner, repo, ...params });
|
|
1128
|
-
},
|
|
1129
|
-
|
|
1130
|
-
merge: async (
|
|
1131
|
-
owner: string,
|
|
1132
|
-
repo: string,
|
|
1133
|
-
prNumber: number,
|
|
1134
|
-
options?: {
|
|
1135
|
-
commitTitle?: string;
|
|
1136
|
-
commitMessage?: string;
|
|
1137
|
-
mergeMethod?: 'merge' | 'squash' | 'rebase';
|
|
1138
|
-
}
|
|
1139
|
-
) => {
|
|
1140
|
-
return this.githubClient.post(`/api/github/prs/${prNumber}/merge`, {
|
|
1141
|
-
owner,
|
|
1142
|
-
repo,
|
|
1143
|
-
commit_title: options?.commitTitle,
|
|
1144
|
-
commit_message: options?.commitMessage,
|
|
1145
|
-
merge_method: options?.mergeMethod,
|
|
1146
|
-
});
|
|
1147
|
-
},
|
|
1148
|
-
},
|
|
1149
|
-
|
|
1150
|
-
// Issue Operations
|
|
1151
|
-
issues: {
|
|
1152
|
-
list: async (
|
|
1153
|
-
owner: string,
|
|
1154
|
-
repo: string,
|
|
1155
|
-
options?: { state?: 'open' | 'closed' | 'all'; perPage?: number }
|
|
1156
|
-
) => {
|
|
1157
|
-
const params = new URLSearchParams();
|
|
1158
|
-
params.set('owner', owner);
|
|
1159
|
-
params.set('repo', repo);
|
|
1160
|
-
if (options?.state) {
|
|
1161
|
-
params.set('state', options.state);
|
|
1162
|
-
}
|
|
1163
|
-
if (options?.perPage) {
|
|
1164
|
-
params.set('per_page', options.perPage.toString());
|
|
1165
|
-
}
|
|
1166
|
-
return this.githubClient.get(`/api/github/issues?${params.toString()}`);
|
|
1167
|
-
},
|
|
1168
|
-
|
|
1169
|
-
get: async (owner: string, repo: string, issueNumber: number) => {
|
|
1170
|
-
const params = new URLSearchParams();
|
|
1171
|
-
params.set('owner', owner);
|
|
1172
|
-
params.set('repo', repo);
|
|
1173
|
-
return this.githubClient.get(`/api/github/issues/${issueNumber}?${params.toString()}`);
|
|
1174
|
-
},
|
|
1175
|
-
|
|
1176
|
-
create: async (
|
|
1177
|
-
owner: string,
|
|
1178
|
-
repo: string,
|
|
1179
|
-
params: { title: string; body?: string; labels?: string[]; assignees?: string[] }
|
|
1180
|
-
) => {
|
|
1181
|
-
return this.githubClient.post('/api/github/issues', { owner, repo, ...params });
|
|
1182
|
-
},
|
|
1183
|
-
|
|
1184
|
-
close: async (owner: string, repo: string, issueNumber: number) => {
|
|
1185
|
-
const params = new URLSearchParams();
|
|
1186
|
-
params.set('owner', owner);
|
|
1187
|
-
params.set('repo', repo);
|
|
1188
|
-
return this.githubClient.put(
|
|
1189
|
-
`/api/github/issues/${issueNumber}/close?${params.toString()}`,
|
|
1190
|
-
{}
|
|
1191
|
-
);
|
|
1192
|
-
},
|
|
1193
|
-
|
|
1194
|
-
addComment: async (owner: string, repo: string, issueNumber: number, body: string) => {
|
|
1195
|
-
return this.githubClient.post(`/api/github/issues/${issueNumber}/comments`, {
|
|
1196
|
-
owner,
|
|
1197
|
-
repo,
|
|
1198
|
-
body,
|
|
1199
|
-
});
|
|
1200
|
-
},
|
|
1201
|
-
},
|
|
1202
|
-
|
|
1203
|
-
// Repository Operations
|
|
1204
|
-
repos: {
|
|
1205
|
-
get: async (owner: string, repo: string) => {
|
|
1206
|
-
const params = new URLSearchParams();
|
|
1207
|
-
params.set('owner', owner);
|
|
1208
|
-
params.set('repo', repo);
|
|
1209
|
-
return this.githubClient.get(`/api/github/repos?${params.toString()}`);
|
|
1210
|
-
},
|
|
1211
|
-
|
|
1212
|
-
listBranches: async (owner: string, repo: string, options?: { perPage?: number }) => {
|
|
1213
|
-
const params = new URLSearchParams();
|
|
1214
|
-
params.set('owner', owner);
|
|
1215
|
-
params.set('repo', repo);
|
|
1216
|
-
if (options?.perPage) {
|
|
1217
|
-
params.set('per_page', options.perPage.toString());
|
|
1218
|
-
}
|
|
1219
|
-
return this.githubClient.get(`/api/github/repos/branches?${params.toString()}`);
|
|
1220
|
-
},
|
|
1221
|
-
|
|
1222
|
-
createBranch: async (owner: string, repo: string, branch: string, sha: string) => {
|
|
1223
|
-
return this.githubClient.post('/api/github/repos/branches', { owner, repo, branch, sha });
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1226
|
-
deleteBranch: async (owner: string, repo: string, branch: string) => {
|
|
1227
|
-
const params = new URLSearchParams();
|
|
1228
|
-
params.set('owner', owner);
|
|
1229
|
-
params.set('repo', repo);
|
|
1230
|
-
params.set('branch', branch);
|
|
1231
|
-
return this.githubClient.delete(`/api/github/repos/branches?${params.toString()}`);
|
|
1232
|
-
},
|
|
1233
|
-
},
|
|
1234
|
-
|
|
1235
|
-
// User Operations
|
|
1236
|
-
user: {
|
|
1237
|
-
get: async () => {
|
|
1238
|
-
return this.githubClient.get('/api/github/user');
|
|
1239
|
-
},
|
|
1240
|
-
},
|
|
1241
|
-
};
|
|
1242
|
-
|
|
1243
|
-
// ==================== AWS Operations ====================
|
|
1244
|
-
|
|
1245
|
-
aws = {
|
|
1246
|
-
ec2: {
|
|
1247
|
-
listInstances: async (options?: {
|
|
1248
|
-
instanceIds?: string[];
|
|
1249
|
-
maxResults?: number;
|
|
1250
|
-
nextToken?: string;
|
|
1251
|
-
region?: string;
|
|
1252
|
-
}) => {
|
|
1253
|
-
const params = new URLSearchParams();
|
|
1254
|
-
if (options?.instanceIds) {
|
|
1255
|
-
params.set('instanceIds', options.instanceIds.join(','));
|
|
1256
|
-
}
|
|
1257
|
-
if (options?.maxResults) {
|
|
1258
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1259
|
-
}
|
|
1260
|
-
if (options?.nextToken) {
|
|
1261
|
-
params.set('nextToken', options.nextToken);
|
|
1262
|
-
}
|
|
1263
|
-
if (options?.region) {
|
|
1264
|
-
params.set('region', options.region);
|
|
1265
|
-
}
|
|
1266
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1267
|
-
return this.awsClient.get(`/api/aws/ec2/instances${query}`);
|
|
1268
|
-
},
|
|
1269
|
-
|
|
1270
|
-
startInstances: async (instanceIds: string[], region?: string) => {
|
|
1271
|
-
return this.awsClient.post('/api/aws/ec2/instances/start', { instanceIds, region });
|
|
1272
|
-
},
|
|
1273
|
-
|
|
1274
|
-
stopInstances: async (
|
|
1275
|
-
instanceIds: string[],
|
|
1276
|
-
options?: { force?: boolean; region?: string }
|
|
1277
|
-
) => {
|
|
1278
|
-
return this.awsClient.post('/api/aws/ec2/instances/stop', { instanceIds, ...options });
|
|
1279
|
-
},
|
|
1280
|
-
|
|
1281
|
-
rebootInstances: async (instanceIds: string[], region?: string) => {
|
|
1282
|
-
return this.awsClient.post('/api/aws/ec2/instances/reboot', { instanceIds, region });
|
|
1283
|
-
},
|
|
1284
|
-
|
|
1285
|
-
terminateInstances: async (instanceIds: string[], region?: string) => {
|
|
1286
|
-
return this.awsClient.post('/api/aws/ec2/instances/terminate', { instanceIds, region });
|
|
1287
|
-
},
|
|
1288
|
-
|
|
1289
|
-
runInstances: async (
|
|
1290
|
-
imageId: string,
|
|
1291
|
-
instanceType: string,
|
|
1292
|
-
options?: {
|
|
1293
|
-
minCount?: number;
|
|
1294
|
-
maxCount?: number;
|
|
1295
|
-
keyName?: string;
|
|
1296
|
-
securityGroupIds?: string[];
|
|
1297
|
-
subnetId?: string;
|
|
1298
|
-
userData?: string;
|
|
1299
|
-
tags?: Record<string, string>;
|
|
1300
|
-
region?: string;
|
|
1301
|
-
}
|
|
1302
|
-
) => {
|
|
1303
|
-
return this.awsClient.post('/api/aws/ec2/instances/run', {
|
|
1304
|
-
imageId,
|
|
1305
|
-
instanceType,
|
|
1306
|
-
...options,
|
|
1307
|
-
});
|
|
1308
|
-
},
|
|
1309
|
-
|
|
1310
|
-
listRegions: async (region?: string) => {
|
|
1311
|
-
const query = region ? `?region=${encodeURIComponent(region)}` : '';
|
|
1312
|
-
return this.awsClient.get(`/api/aws/ec2/regions${query}`);
|
|
1313
|
-
},
|
|
1314
|
-
|
|
1315
|
-
listVpcs: async (region?: string) => {
|
|
1316
|
-
const query = region ? `?region=${encodeURIComponent(region)}` : '';
|
|
1317
|
-
return this.awsClient.get(`/api/aws/ec2/vpcs${query}`);
|
|
1318
|
-
},
|
|
1319
|
-
|
|
1320
|
-
listSubnets: async (options?: { vpcId?: string; region?: string }) => {
|
|
1321
|
-
const params = new URLSearchParams();
|
|
1322
|
-
if (options?.vpcId) {
|
|
1323
|
-
params.set('vpcId', options.vpcId);
|
|
1324
|
-
}
|
|
1325
|
-
if (options?.region) {
|
|
1326
|
-
params.set('region', options.region);
|
|
1327
|
-
}
|
|
1328
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1329
|
-
return this.awsClient.get(`/api/aws/ec2/subnets${query}`);
|
|
1330
|
-
},
|
|
1331
|
-
|
|
1332
|
-
listSecurityGroups: async (options?: { vpcId?: string; region?: string }) => {
|
|
1333
|
-
const params = new URLSearchParams();
|
|
1334
|
-
if (options?.vpcId) {
|
|
1335
|
-
params.set('vpcId', options.vpcId);
|
|
1336
|
-
}
|
|
1337
|
-
if (options?.region) {
|
|
1338
|
-
params.set('region', options.region);
|
|
1339
|
-
}
|
|
1340
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1341
|
-
return this.awsClient.get(`/api/aws/ec2/security-groups${query}`);
|
|
1342
|
-
},
|
|
1343
|
-
},
|
|
1344
|
-
|
|
1345
|
-
s3: {
|
|
1346
|
-
listBuckets: async (region?: string) => {
|
|
1347
|
-
const query = region ? `?region=${encodeURIComponent(region)}` : '';
|
|
1348
|
-
return this.awsClient.get(`/api/aws/s3/buckets${query}`);
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1351
|
-
listObjects: async (
|
|
1352
|
-
bucket: string,
|
|
1353
|
-
options?: {
|
|
1354
|
-
prefix?: string;
|
|
1355
|
-
delimiter?: string;
|
|
1356
|
-
maxKeys?: number;
|
|
1357
|
-
continuationToken?: string;
|
|
1358
|
-
region?: string;
|
|
1359
|
-
}
|
|
1360
|
-
) => {
|
|
1361
|
-
const params = new URLSearchParams();
|
|
1362
|
-
params.set('bucket', bucket);
|
|
1363
|
-
if (options?.prefix) {
|
|
1364
|
-
params.set('prefix', options.prefix);
|
|
1365
|
-
}
|
|
1366
|
-
if (options?.delimiter) {
|
|
1367
|
-
params.set('delimiter', options.delimiter);
|
|
1368
|
-
}
|
|
1369
|
-
if (options?.maxKeys) {
|
|
1370
|
-
params.set('maxKeys', options.maxKeys.toString());
|
|
1371
|
-
}
|
|
1372
|
-
if (options?.continuationToken) {
|
|
1373
|
-
params.set('continuationToken', options.continuationToken);
|
|
1374
|
-
}
|
|
1375
|
-
if (options?.region) {
|
|
1376
|
-
params.set('region', options.region);
|
|
1377
|
-
}
|
|
1378
|
-
return this.awsClient.get(`/api/aws/s3/objects?${params.toString()}`);
|
|
1379
|
-
},
|
|
1380
|
-
|
|
1381
|
-
getObject: async (bucket: string, key: string, region?: string) => {
|
|
1382
|
-
const params = new URLSearchParams();
|
|
1383
|
-
params.set('bucket', bucket);
|
|
1384
|
-
params.set('key', key);
|
|
1385
|
-
if (region) {
|
|
1386
|
-
params.set('region', region);
|
|
1387
|
-
}
|
|
1388
|
-
return this.awsClient.get(`/api/aws/s3/object?${params.toString()}`);
|
|
1389
|
-
},
|
|
1390
|
-
|
|
1391
|
-
putObject: async (
|
|
1392
|
-
bucket: string,
|
|
1393
|
-
key: string,
|
|
1394
|
-
body: string,
|
|
1395
|
-
options?: {
|
|
1396
|
-
contentType?: string;
|
|
1397
|
-
metadata?: Record<string, string>;
|
|
1398
|
-
tags?: Record<string, string>;
|
|
1399
|
-
region?: string;
|
|
1400
|
-
}
|
|
1401
|
-
) => {
|
|
1402
|
-
return this.awsClient.post('/api/aws/s3/object', { bucket, key, body, ...options });
|
|
1403
|
-
},
|
|
1404
|
-
|
|
1405
|
-
deleteObject: async (bucket: string, key: string, region?: string) => {
|
|
1406
|
-
const params = new URLSearchParams();
|
|
1407
|
-
params.set('bucket', bucket);
|
|
1408
|
-
params.set('key', key);
|
|
1409
|
-
if (region) {
|
|
1410
|
-
params.set('region', region);
|
|
1411
|
-
}
|
|
1412
|
-
return this.awsClient.delete(`/api/aws/s3/object?${params.toString()}`);
|
|
1413
|
-
},
|
|
1414
|
-
|
|
1415
|
-
createBucket: async (bucket: string, region?: string) => {
|
|
1416
|
-
return this.awsClient.post('/api/aws/s3/bucket', { bucket, region });
|
|
1417
|
-
},
|
|
1418
|
-
|
|
1419
|
-
deleteBucket: async (bucket: string, region?: string) => {
|
|
1420
|
-
const params = new URLSearchParams();
|
|
1421
|
-
params.set('bucket', bucket);
|
|
1422
|
-
if (region) {
|
|
1423
|
-
params.set('region', region);
|
|
1424
|
-
}
|
|
1425
|
-
return this.awsClient.delete(`/api/aws/s3/bucket?${params.toString()}`);
|
|
1426
|
-
},
|
|
1427
|
-
},
|
|
1428
|
-
|
|
1429
|
-
iam: {
|
|
1430
|
-
listUsers: async (options?: {
|
|
1431
|
-
maxItems?: number;
|
|
1432
|
-
marker?: string;
|
|
1433
|
-
pathPrefix?: string;
|
|
1434
|
-
region?: string;
|
|
1435
|
-
}) => {
|
|
1436
|
-
const params = new URLSearchParams();
|
|
1437
|
-
if (options?.maxItems) {
|
|
1438
|
-
params.set('maxItems', options.maxItems.toString());
|
|
1439
|
-
}
|
|
1440
|
-
if (options?.marker) {
|
|
1441
|
-
params.set('marker', options.marker);
|
|
1442
|
-
}
|
|
1443
|
-
if (options?.pathPrefix) {
|
|
1444
|
-
params.set('pathPrefix', options.pathPrefix);
|
|
1445
|
-
}
|
|
1446
|
-
if (options?.region) {
|
|
1447
|
-
params.set('region', options.region);
|
|
1448
|
-
}
|
|
1449
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1450
|
-
return this.awsClient.get(`/api/aws/iam/users${query}`);
|
|
1451
|
-
},
|
|
1452
|
-
|
|
1453
|
-
getUser: async (userName: string, region?: string) => {
|
|
1454
|
-
const params = new URLSearchParams();
|
|
1455
|
-
params.set('userName', userName);
|
|
1456
|
-
if (region) {
|
|
1457
|
-
params.set('region', region);
|
|
1458
|
-
}
|
|
1459
|
-
return this.awsClient.get(`/api/aws/iam/user?${params.toString()}`);
|
|
1460
|
-
},
|
|
1461
|
-
|
|
1462
|
-
createUser: async (
|
|
1463
|
-
userName: string,
|
|
1464
|
-
options?: { path?: string; tags?: Record<string, string>; region?: string }
|
|
1465
|
-
) => {
|
|
1466
|
-
return this.awsClient.post('/api/aws/iam/user', { userName, ...options });
|
|
1467
|
-
},
|
|
1468
|
-
|
|
1469
|
-
deleteUser: async (userName: string, region?: string) => {
|
|
1470
|
-
const params = new URLSearchParams();
|
|
1471
|
-
params.set('userName', userName);
|
|
1472
|
-
if (region) {
|
|
1473
|
-
params.set('region', region);
|
|
1474
|
-
}
|
|
1475
|
-
return this.awsClient.delete(`/api/aws/iam/user?${params.toString()}`);
|
|
1476
|
-
},
|
|
1477
|
-
|
|
1478
|
-
listRoles: async (options?: {
|
|
1479
|
-
maxItems?: number;
|
|
1480
|
-
marker?: string;
|
|
1481
|
-
pathPrefix?: string;
|
|
1482
|
-
region?: string;
|
|
1483
|
-
}) => {
|
|
1484
|
-
const params = new URLSearchParams();
|
|
1485
|
-
if (options?.maxItems) {
|
|
1486
|
-
params.set('maxItems', options.maxItems.toString());
|
|
1487
|
-
}
|
|
1488
|
-
if (options?.marker) {
|
|
1489
|
-
params.set('marker', options.marker);
|
|
1490
|
-
}
|
|
1491
|
-
if (options?.pathPrefix) {
|
|
1492
|
-
params.set('pathPrefix', options.pathPrefix);
|
|
1493
|
-
}
|
|
1494
|
-
if (options?.region) {
|
|
1495
|
-
params.set('region', options.region);
|
|
1496
|
-
}
|
|
1497
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1498
|
-
return this.awsClient.get(`/api/aws/iam/roles${query}`);
|
|
1499
|
-
},
|
|
1500
|
-
|
|
1501
|
-
getRole: async (roleName: string, region?: string) => {
|
|
1502
|
-
const params = new URLSearchParams();
|
|
1503
|
-
params.set('roleName', roleName);
|
|
1504
|
-
if (region) {
|
|
1505
|
-
params.set('region', region);
|
|
1506
|
-
}
|
|
1507
|
-
return this.awsClient.get(`/api/aws/iam/role?${params.toString()}`);
|
|
1508
|
-
},
|
|
1509
|
-
|
|
1510
|
-
listPolicies: async (options?: {
|
|
1511
|
-
maxItems?: number;
|
|
1512
|
-
marker?: string;
|
|
1513
|
-
scope?: 'All' | 'AWS' | 'Local';
|
|
1514
|
-
onlyAttached?: boolean;
|
|
1515
|
-
region?: string;
|
|
1516
|
-
}) => {
|
|
1517
|
-
const params = new URLSearchParams();
|
|
1518
|
-
if (options?.maxItems) {
|
|
1519
|
-
params.set('maxItems', options.maxItems.toString());
|
|
1520
|
-
}
|
|
1521
|
-
if (options?.marker) {
|
|
1522
|
-
params.set('marker', options.marker);
|
|
1523
|
-
}
|
|
1524
|
-
if (options?.scope) {
|
|
1525
|
-
params.set('scope', options.scope);
|
|
1526
|
-
}
|
|
1527
|
-
if (options?.onlyAttached) {
|
|
1528
|
-
params.set('onlyAttached', 'true');
|
|
1529
|
-
}
|
|
1530
|
-
if (options?.region) {
|
|
1531
|
-
params.set('region', options.region);
|
|
1532
|
-
}
|
|
1533
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1534
|
-
return this.awsClient.get(`/api/aws/iam/policies${query}`);
|
|
1535
|
-
},
|
|
1536
|
-
|
|
1537
|
-
listGroups: async (options?: {
|
|
1538
|
-
maxItems?: number;
|
|
1539
|
-
marker?: string;
|
|
1540
|
-
pathPrefix?: string;
|
|
1541
|
-
region?: string;
|
|
1542
|
-
}) => {
|
|
1543
|
-
const params = new URLSearchParams();
|
|
1544
|
-
if (options?.maxItems) {
|
|
1545
|
-
params.set('maxItems', options.maxItems.toString());
|
|
1546
|
-
}
|
|
1547
|
-
if (options?.marker) {
|
|
1548
|
-
params.set('marker', options.marker);
|
|
1549
|
-
}
|
|
1550
|
-
if (options?.pathPrefix) {
|
|
1551
|
-
params.set('pathPrefix', options.pathPrefix);
|
|
1552
|
-
}
|
|
1553
|
-
if (options?.region) {
|
|
1554
|
-
params.set('region', options.region);
|
|
1555
|
-
}
|
|
1556
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1557
|
-
return this.awsClient.get(`/api/aws/iam/groups${query}`);
|
|
1558
|
-
},
|
|
1559
|
-
},
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
// ==================== GCP Operations ====================
|
|
1563
|
-
|
|
1564
|
-
gcp = {
|
|
1565
|
-
compute: {
|
|
1566
|
-
listInstances: async (options?: {
|
|
1567
|
-
project?: string;
|
|
1568
|
-
zone?: string;
|
|
1569
|
-
maxResults?: number;
|
|
1570
|
-
pageToken?: string;
|
|
1571
|
-
}) => {
|
|
1572
|
-
const params = new URLSearchParams();
|
|
1573
|
-
if (options?.project) {
|
|
1574
|
-
params.set('project', options.project);
|
|
1575
|
-
}
|
|
1576
|
-
if (options?.zone) {
|
|
1577
|
-
params.set('zone', options.zone);
|
|
1578
|
-
}
|
|
1579
|
-
if (options?.maxResults) {
|
|
1580
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1581
|
-
}
|
|
1582
|
-
if (options?.pageToken) {
|
|
1583
|
-
params.set('pageToken', options.pageToken);
|
|
1584
|
-
}
|
|
1585
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1586
|
-
return this.gcpClient.get(`/api/gcp/compute/instances${query}`);
|
|
1587
|
-
},
|
|
1588
|
-
|
|
1589
|
-
startInstance: async (instance: string, options?: { project?: string; zone?: string }) => {
|
|
1590
|
-
return this.gcpClient.post('/api/gcp/compute/instances/start', { instance, ...options });
|
|
1591
|
-
},
|
|
1592
|
-
|
|
1593
|
-
stopInstance: async (instance: string, options?: { project?: string; zone?: string }) => {
|
|
1594
|
-
return this.gcpClient.post('/api/gcp/compute/instances/stop', { instance, ...options });
|
|
1595
|
-
},
|
|
1596
|
-
},
|
|
1597
|
-
|
|
1598
|
-
storage: {
|
|
1599
|
-
listBuckets: async (options?: {
|
|
1600
|
-
project?: string;
|
|
1601
|
-
maxResults?: number;
|
|
1602
|
-
pageToken?: string;
|
|
1603
|
-
}) => {
|
|
1604
|
-
const params = new URLSearchParams();
|
|
1605
|
-
if (options?.project) {
|
|
1606
|
-
params.set('project', options.project);
|
|
1607
|
-
}
|
|
1608
|
-
if (options?.maxResults) {
|
|
1609
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1610
|
-
}
|
|
1611
|
-
if (options?.pageToken) {
|
|
1612
|
-
params.set('pageToken', options.pageToken);
|
|
1613
|
-
}
|
|
1614
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1615
|
-
return this.gcpClient.get(`/api/gcp/storage/buckets${query}`);
|
|
1616
|
-
},
|
|
1617
|
-
},
|
|
1618
|
-
|
|
1619
|
-
gke: {
|
|
1620
|
-
listClusters: async (options?: { project?: string; zone?: string }) => {
|
|
1621
|
-
const params = new URLSearchParams();
|
|
1622
|
-
if (options?.project) {
|
|
1623
|
-
params.set('project', options.project);
|
|
1624
|
-
}
|
|
1625
|
-
if (options?.zone) {
|
|
1626
|
-
params.set('zone', options.zone);
|
|
1627
|
-
}
|
|
1628
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1629
|
-
return this.gcpClient.get(`/api/gcp/gke/clusters${query}`);
|
|
1630
|
-
},
|
|
1631
|
-
},
|
|
1632
|
-
|
|
1633
|
-
iam: {
|
|
1634
|
-
listServiceAccounts: async (options?: {
|
|
1635
|
-
project?: string;
|
|
1636
|
-
maxResults?: number;
|
|
1637
|
-
pageToken?: string;
|
|
1638
|
-
}) => {
|
|
1639
|
-
const params = new URLSearchParams();
|
|
1640
|
-
if (options?.project) {
|
|
1641
|
-
params.set('project', options.project);
|
|
1642
|
-
}
|
|
1643
|
-
if (options?.maxResults) {
|
|
1644
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1645
|
-
}
|
|
1646
|
-
if (options?.pageToken) {
|
|
1647
|
-
params.set('pageToken', options.pageToken);
|
|
1648
|
-
}
|
|
1649
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1650
|
-
return this.gcpClient.get(`/api/gcp/iam/service-accounts${query}`);
|
|
1651
|
-
},
|
|
1652
|
-
|
|
1653
|
-
listRoles: async (options?: {
|
|
1654
|
-
project?: string;
|
|
1655
|
-
maxResults?: number;
|
|
1656
|
-
pageToken?: string;
|
|
1657
|
-
}) => {
|
|
1658
|
-
const params = new URLSearchParams();
|
|
1659
|
-
if (options?.project) {
|
|
1660
|
-
params.set('project', options.project);
|
|
1661
|
-
}
|
|
1662
|
-
if (options?.maxResults) {
|
|
1663
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1664
|
-
}
|
|
1665
|
-
if (options?.pageToken) {
|
|
1666
|
-
params.set('pageToken', options.pageToken);
|
|
1667
|
-
}
|
|
1668
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1669
|
-
return this.gcpClient.get(`/api/gcp/iam/roles${query}`);
|
|
1670
|
-
},
|
|
1671
|
-
},
|
|
1672
|
-
|
|
1673
|
-
discover: {
|
|
1674
|
-
startDiscovery: async (options?: { project?: string; regions?: string[] }) => {
|
|
1675
|
-
return this.gcpClient.post('/api/gcp/discover/start', options);
|
|
1676
|
-
},
|
|
1677
|
-
|
|
1678
|
-
getSession: async (sessionId: string) => {
|
|
1679
|
-
return this.gcpClient.get(`/api/gcp/discover/session/${sessionId}`);
|
|
1680
|
-
},
|
|
1681
|
-
},
|
|
1682
|
-
|
|
1683
|
-
terraform: {
|
|
1684
|
-
generate: async (options?: {
|
|
1685
|
-
project?: string;
|
|
1686
|
-
resources?: string[];
|
|
1687
|
-
outputDir?: string;
|
|
1688
|
-
}) => {
|
|
1689
|
-
return this.gcpClient.post('/api/gcp/terraform/generate', options);
|
|
1690
|
-
},
|
|
1691
|
-
},
|
|
1692
|
-
};
|
|
1693
|
-
|
|
1694
|
-
// ==================== Azure Operations ====================
|
|
1695
|
-
|
|
1696
|
-
azure = {
|
|
1697
|
-
compute: {
|
|
1698
|
-
listVMs: async (options?: {
|
|
1699
|
-
subscriptionId?: string;
|
|
1700
|
-
resourceGroup?: string;
|
|
1701
|
-
maxResults?: number;
|
|
1702
|
-
}) => {
|
|
1703
|
-
const params = new URLSearchParams();
|
|
1704
|
-
if (options?.subscriptionId) {
|
|
1705
|
-
params.set('subscriptionId', options.subscriptionId);
|
|
1706
|
-
}
|
|
1707
|
-
if (options?.resourceGroup) {
|
|
1708
|
-
params.set('resourceGroup', options.resourceGroup);
|
|
1709
|
-
}
|
|
1710
|
-
if (options?.maxResults) {
|
|
1711
|
-
params.set('maxResults', options.maxResults.toString());
|
|
1712
|
-
}
|
|
1713
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1714
|
-
return this.azureClient.get(`/api/azure/compute/vms${query}`);
|
|
1715
|
-
},
|
|
1716
|
-
|
|
1717
|
-
startVM: async (
|
|
1718
|
-
vmName: string,
|
|
1719
|
-
options?: { subscriptionId?: string; resourceGroup?: string }
|
|
1720
|
-
) => {
|
|
1721
|
-
return this.azureClient.post('/api/azure/compute/vms/start', { vmName, ...options });
|
|
1722
|
-
},
|
|
1723
|
-
|
|
1724
|
-
stopVM: async (
|
|
1725
|
-
vmName: string,
|
|
1726
|
-
options?: { subscriptionId?: string; resourceGroup?: string; deallocate?: boolean }
|
|
1727
|
-
) => {
|
|
1728
|
-
return this.azureClient.post('/api/azure/compute/vms/stop', { vmName, ...options });
|
|
1729
|
-
},
|
|
1730
|
-
},
|
|
1731
|
-
|
|
1732
|
-
storage: {
|
|
1733
|
-
listAccounts: async (options?: { subscriptionId?: string; resourceGroup?: string }) => {
|
|
1734
|
-
const params = new URLSearchParams();
|
|
1735
|
-
if (options?.subscriptionId) {
|
|
1736
|
-
params.set('subscriptionId', options.subscriptionId);
|
|
1737
|
-
}
|
|
1738
|
-
if (options?.resourceGroup) {
|
|
1739
|
-
params.set('resourceGroup', options.resourceGroup);
|
|
1740
|
-
}
|
|
1741
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1742
|
-
return this.azureClient.get(`/api/azure/storage/accounts${query}`);
|
|
1743
|
-
},
|
|
1744
|
-
},
|
|
1745
|
-
|
|
1746
|
-
aks: {
|
|
1747
|
-
listClusters: async (options?: { subscriptionId?: string; resourceGroup?: string }) => {
|
|
1748
|
-
const params = new URLSearchParams();
|
|
1749
|
-
if (options?.subscriptionId) {
|
|
1750
|
-
params.set('subscriptionId', options.subscriptionId);
|
|
1751
|
-
}
|
|
1752
|
-
if (options?.resourceGroup) {
|
|
1753
|
-
params.set('resourceGroup', options.resourceGroup);
|
|
1754
|
-
}
|
|
1755
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1756
|
-
return this.azureClient.get(`/api/azure/aks/clusters${query}`);
|
|
1757
|
-
},
|
|
1758
|
-
},
|
|
1759
|
-
|
|
1760
|
-
iam: {
|
|
1761
|
-
listRoleAssignments: async (options?: {
|
|
1762
|
-
subscriptionId?: string;
|
|
1763
|
-
resourceGroup?: string;
|
|
1764
|
-
scope?: string;
|
|
1765
|
-
}) => {
|
|
1766
|
-
const params = new URLSearchParams();
|
|
1767
|
-
if (options?.subscriptionId) {
|
|
1768
|
-
params.set('subscriptionId', options.subscriptionId);
|
|
1769
|
-
}
|
|
1770
|
-
if (options?.resourceGroup) {
|
|
1771
|
-
params.set('resourceGroup', options.resourceGroup);
|
|
1772
|
-
}
|
|
1773
|
-
if (options?.scope) {
|
|
1774
|
-
params.set('scope', options.scope);
|
|
1775
|
-
}
|
|
1776
|
-
const query = params.toString() ? `?${params.toString()}` : '';
|
|
1777
|
-
return this.azureClient.get(`/api/azure/iam/role-assignments${query}`);
|
|
1778
|
-
},
|
|
1779
|
-
},
|
|
1780
|
-
|
|
1781
|
-
discover: {
|
|
1782
|
-
startDiscovery: async (options?: { subscriptionId?: string; resourceGroups?: string[] }) => {
|
|
1783
|
-
return this.azureClient.post('/api/azure/discover/start', options);
|
|
1784
|
-
},
|
|
1785
|
-
|
|
1786
|
-
getSession: async (sessionId: string) => {
|
|
1787
|
-
return this.azureClient.get(`/api/azure/discover/session/${sessionId}`);
|
|
1788
|
-
},
|
|
1789
|
-
},
|
|
1790
|
-
|
|
1791
|
-
terraform: {
|
|
1792
|
-
generate: async (options?: {
|
|
1793
|
-
subscriptionId?: string;
|
|
1794
|
-
resources?: string[];
|
|
1795
|
-
outputDir?: string;
|
|
1796
|
-
}) => {
|
|
1797
|
-
return this.azureClient.post('/api/azure/terraform/generate', options);
|
|
1798
|
-
},
|
|
1799
|
-
},
|
|
1800
|
-
};
|
|
1801
|
-
|
|
1802
|
-
// ==================== Health Checks ====================
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* Check health of all tool services
|
|
1806
|
-
*/
|
|
1807
|
-
async healthCheck(): Promise<Record<string, boolean>> {
|
|
1808
|
-
const [git, fs, terraform, k8s, helm, aws, github, gcp, azure] = await Promise.all([
|
|
1809
|
-
this.gitClient.healthCheck(),
|
|
1810
|
-
this.fsClient.healthCheck(),
|
|
1811
|
-
this.terraformClient.healthCheck(),
|
|
1812
|
-
this.k8sClient.healthCheck(),
|
|
1813
|
-
this.helmClient.healthCheck(),
|
|
1814
|
-
this.awsClient.healthCheck(),
|
|
1815
|
-
this.githubClient.healthCheck(),
|
|
1816
|
-
this.gcpClient.healthCheck(),
|
|
1817
|
-
this.azureClient.healthCheck(),
|
|
1818
|
-
]);
|
|
1819
|
-
|
|
1820
|
-
return { git, fs, terraform, k8s, helm, aws, github, gcp, azure };
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
/**
|
|
1824
|
-
* Check health of a specific service
|
|
1825
|
-
*/
|
|
1826
|
-
async healthCheckService(
|
|
1827
|
-
service: 'git' | 'fs' | 'terraform' | 'k8s' | 'helm' | 'aws' | 'github' | 'gcp' | 'azure'
|
|
1828
|
-
): Promise<boolean> {
|
|
1829
|
-
const clients: Record<string, RestClient> = {
|
|
1830
|
-
git: this.gitClient,
|
|
1831
|
-
fs: this.fsClient,
|
|
1832
|
-
terraform: this.terraformClient,
|
|
1833
|
-
k8s: this.k8sClient,
|
|
1834
|
-
helm: this.helmClient,
|
|
1835
|
-
aws: this.awsClient,
|
|
1836
|
-
github: this.githubClient,
|
|
1837
|
-
gcp: this.gcpClient,
|
|
1838
|
-
azure: this.azureClient,
|
|
1839
|
-
};
|
|
1840
|
-
|
|
1841
|
-
return clients[service].healthCheck();
|
|
1842
|
-
}
|
|
1843
|
-
}
|