From 995071027ce0c0ab2caf768f546d129694c88c09 Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Mon, 20 Apr 2026 12:08:06 +0200 Subject: [PATCH 1/5] feat(cloud): refactor deploy server API to manifests/deployments model Adopt the new OpenAPI spec from terraform-hcp-proxy feat/app-stack-assignment branch which replaces runs/versions with first-class manifests and deployments. - Replace `runs` subcommand with `deployments` (list, show, logs, create) - Replace `versions` subcommand with `manifests` (list, show, create, delete, update, versions) - Update `apps create` to use name + optional stack-id instead of organization-id - Update `apps show` to use ReadApp with include=state - Move deploy command under deployments as `create` - Regenerate Speakeasy SDK client from updated OpenAPI spec Co-Authored-By: Claude Opus 4.6 (1M context) --- cmd/cloud/apps/create.go | 23 +- .../apps/{deploy.go => deployments/create.go} | 83 +- cmd/cloud/apps/{runs => deployments}/list.go | 52 +- cmd/cloud/apps/{runs => deployments}/logs.go | 19 +- cmd/cloud/apps/{runs => deployments}/root.go | 9 +- cmd/cloud/apps/deployments/show.go | 115 ++ cmd/cloud/apps/list.go | 17 +- cmd/cloud/apps/manifests/create.go | 102 ++ cmd/cloud/apps/manifests/delete.go | 79 + cmd/cloud/apps/manifests/list.go | 119 ++ cmd/cloud/apps/manifests/root.go | 23 + cmd/cloud/apps/{runs => manifests}/show.go | 37 +- cmd/cloud/apps/manifests/update.go | 89 ++ .../apps/{ => manifests}/versions/list.go | 41 +- cmd/cloud/apps/manifests/versions/push.go | 94 ++ .../apps/{ => manifests}/versions/root.go | 6 +- .../apps/{ => manifests}/versions/show.go | 43 +- cmd/cloud/apps/root.go | 9 +- cmd/cloud/apps/show.go | 39 +- cmd/cloud/apps/versions/archive.go | 81 - cmd/cloud/apps/versions/manifest.go | 75 - .../deployserverclient/.speakeasy/gen.lock | 880 ++++++----- .../deployserverclient/.speakeasy/gen.yaml | 2 +- .../.speakeasy/workflow.lock | 8 +- internal/deployserverclient/README.md | 63 +- internal/deployserverclient/USAGE.md | 2 +- internal/deployserverclient/deployserver.go | 1390 ++++++++++++++--- .../pool.md => apierrors/error.md} | 6 +- .../docs/models/components/app.md | 12 +- .../docs/models/components/application.md | 12 - .../models/components/appversionresponse.md | 8 - .../models/components/configurationversion.md | 12 - .../docs/models/components/connector.md | 11 - .../models/components/createapprequest.md | 7 +- .../components/createdeploymentrequest.md | 10 + .../components/createmanifestresponse.md | 8 + .../components/createmanifestresponsedata.md | 12 + .../models/components/deploymentresource.md | 19 + .../models/components/deploymentresponse.md | 8 + .../docs/models/components/ledger.md | 9 - .../components/listdeploymentsresponse.md | 8 + .../components/listdeploymentsresponsedata.md | 13 + .../components/listmanifestsresponse.md | 8 + .../components/listmanifestsresponsedata.md | 13 + .../listmanifestversionsresponse.md | 8 + .../listmanifestversionsresponsedata.md | 13 + .../models/components/listrunsresponse.md | 8 - .../models/components/listrunsresponsedata.md | 13 - .../models/components/listversionsresponse.md | 8 - .../components/listversionsresponsedata.md | 13 - .../docs/models/components/manifest.md | 13 + .../models/components/manifestresponse.md | 8 + .../docs/models/components/manifestversion.md | 11 + .../components/manifestversionresponse.md | 8 + .../docs/models/components/payments.md | 9 - .../models/components/readstateresponse.md | 8 - .../models/components/reconciliationledger.md | 9 - .../models/components/reconciliationpolicy.md | 10 - .../docs/models/components/regionselector.md | 9 - .../docs/models/components/run.md | 19 - .../docs/models/components/runresponse.md | 8 - .../docs/models/components/stack.md | 10 - .../docs/models/components/status.md | 23 - .../models/components/updateapprequest.md | 5 +- .../components/updatemanifestrequest.md | 8 + .../docs/models/components/v2chartsegment.md | 12 - .../docs/models/components/v2schemadata.md | 9 - .../components/v2transactiontemplate.md | 10 - .../docs/models/components/webhook.md | 11 - .../operations/createdeploymentrawrequest.md | 9 + ...onse.md => createdeploymentrawresponse.md} | 6 +- .../operations/createdeploymentrequest.md | 9 + .../operations/createdeploymentresponse.md | 10 + .../operations/createmanifestrawrequest.md | 10 + .../operations/createmanifestrawresponse.md | 10 + .../operations/createmanifestrequest.md | 10 + .../createmanifestrequestbody.md} | 4 +- .../operations/createmanifestresponse.md | 10 + ...ogsrequest.md => deletemanifestrequest.md} | 4 +- ...nresponse.md => deletemanifestresponse.md} | 5 +- .../deployappconfigurationrawresponse.md | 10 - .../deployappconfigurationrequest.md | 9 - .../deployappconfigurationresponse.md | 10 - .../docs/models/operations/from.md | 18 - .../docs/models/operations/listappsrequest.md | 1 - ...nsrequest.md => listdeploymentsrequest.md} | 4 +- .../operations/listdeploymentsresponse.md | 10 + .../models/operations/listmanifestsrequest.md | 10 + .../operations/listmanifestsresponse.md | 10 + ...uest.md => listmanifestversionsrequest.md} | 4 +- .../listmanifestversionsresponse.md | 10 + ...st.md => pushmanifestversionrawrequest.md} | 4 +- .../pushmanifestversionrawresponse.md | 10 + .../operations/pushmanifestversionrequest.md | 9 + .../pushmanifestversionrequestbody.md} | 4 +- .../operations/pushmanifestversionresponse.md | 10 + .../readappcurrentstateversionrequest.md | 8 - .../readappcurrentstateversionresponse.md | 10 - .../docs/models/operations/readappinclude.md | 18 + .../docs/models/operations/readapprequest.md | 7 +- .../operations/readappversionsresponse.md | 10 - .../readcurrentappversionrequest.md | 9 - .../operations/readcurrentrunlogsrequest.md | 8 - .../operations/readcurrentrunrequest.md | 8 - .../operations/readcurrentrunresponse.md | 10 - .../operations/readdeploymentinclude.md | 18 + .../readdeploymentlogsrequest.md} | 4 +- ...ponse.md => readdeploymentlogsresponse.md} | 4 +- .../operations/readdeploymentrequest.md | 9 + ...nresponse.md => readdeploymentresponse.md} | 8 +- .../models/operations/readmanifestrequest.md | 9 + ...ogsresponse.md => readmanifestresponse.md} | 5 +- .../operations/readmanifestversionrequest.md | 9 + .../operations/readmanifestversionresponse.md | 11 + .../docs/models/operations/readrunrequest.md | 8 - .../models/operations/readversionrequest.md | 8 - .../updatemanifestrequest.md} | 5 +- ...sresponse.md => updatemanifestresponse.md} | 4 +- .../docs/sdks/deployserver/README.md | 543 +++++-- .../models/apierrors/error.go | 20 + .../models/components/app.go | 15 +- .../models/components/application.go | 47 - .../models/components/appversionresponse.go | 15 - .../models/components/configurationversion.go | 94 -- .../models/components/createapprequest.go | 17 +- .../components/createdeploymentrequest.go | 34 + .../components/createmanifestresponse.go | 74 + .../models/components/deploymentresource.go | 119 ++ .../models/components/deploymentresponse.go | 15 + .../models/components/dotself.go | 7 - .../models/components/ledger.go | 23 - .../components/listdeploymentsresponse.go | 71 + ...nsresponse.go => listmanifestsresponse.go} | 30 +- .../listmanifestversionsresponse.go | 71 + .../models/components/listversionsresponse.go | 71 - .../models/components/manifest.go | 77 + .../models/components/manifestresponse.go | 15 + .../models/components/manifestversion.go | 59 + .../components/manifestversionresponse.go | 15 + .../models/components/payments.go | 58 - .../models/components/pool.go | 23 - .../models/components/readstateresponse.go | 15 - .../models/components/reconciliation.go | 15 - .../models/components/reconciliationledger.go | 23 - .../models/components/reconciliationpolicy.go | 31 - .../models/components/regionselector.go | 23 - .../models/components/run.go | 130 -- .../models/components/runresponse.go | 15 - .../models/components/stack.go | 31 - .../models/components/updateapprequest.go | 9 + .../components/updatemanifestrequest.go | 16 + .../components/v2chartaccountmetadata.go | 18 - .../models/components/v2chartaccountrules.go | 10 - .../models/components/v2chartsegment.go | 65 - .../models/components/v2schemadata.go | 26 - .../components/v2transactiontemplate.go | 34 - .../models/components/webhook.go | 39 - .../models/operations/createdeployment.go | 57 + .../models/operations/createdeploymentraw.go | 58 + .../models/operations/createmanifest.go | 70 + .../models/operations/createmanifestraw.go | 67 + .../models/operations/deletemanifest.go | 39 + .../operations/deployappconfiguration.go | 56 - .../operations/deployappconfigurationraw.go | 57 - .../models/operations/listapps.go | 12 +- .../models/operations/listdeployments.go | 64 + .../models/operations/listmanifests.go | 65 + .../models/operations/listmanifestversions.go | 64 + .../models/operations/options.go | 7 +- .../models/operations/pushmanifestversion.go | 60 + .../operations/pushmanifestversionraw.go | 57 + .../models/operations/readapp.go | 36 + .../operations/readappcurrentstateversion.go | 48 - .../models/operations/readappruns.go | 64 - .../models/operations/readappversions.go | 64 - .../operations/readcurrentappversion.go | 102 -- .../models/operations/readcurrentrun.go | 48 - .../models/operations/readdeployment.go | 105 ++ ...urrentrunlogs.go => readdeploymentlogs.go} | 20 +- .../models/operations/readmanifest.go | 68 + .../models/operations/readmanifestversion.go | 68 + .../models/operations/readrun.go | 48 - .../models/operations/readrunlogs.go | 48 - .../models/operations/readversion.go | 69 - .../models/operations/updatemanifest.go | 56 + openapi/deployserver.yaml | 804 ++++++---- 186 files changed, 5476 insertions(+), 3267 deletions(-) rename cmd/cloud/apps/{deploy.go => deployments/create.go} (61%) rename cmd/cloud/apps/{runs => deployments}/list.go (57%) rename cmd/cloud/apps/{runs => deployments}/logs.go (73%) rename cmd/cloud/apps/{runs => deployments}/root.go (54%) create mode 100644 cmd/cloud/apps/deployments/show.go create mode 100644 cmd/cloud/apps/manifests/create.go create mode 100644 cmd/cloud/apps/manifests/delete.go create mode 100644 cmd/cloud/apps/manifests/list.go create mode 100644 cmd/cloud/apps/manifests/root.go rename cmd/cloud/apps/{runs => manifests}/show.go (60%) create mode 100644 cmd/cloud/apps/manifests/update.go rename cmd/cloud/apps/{ => manifests}/versions/list.go (59%) create mode 100644 cmd/cloud/apps/manifests/versions/push.go rename cmd/cloud/apps/{ => manifests}/versions/root.go (69%) rename cmd/cloud/apps/{ => manifests}/versions/show.go (54%) delete mode 100644 cmd/cloud/apps/versions/archive.go delete mode 100644 cmd/cloud/apps/versions/manifest.go rename internal/deployserverclient/docs/models/{components/pool.md => apierrors/error.md} (62%) delete mode 100644 internal/deployserverclient/docs/models/components/application.md delete mode 100644 internal/deployserverclient/docs/models/components/appversionresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/configurationversion.md delete mode 100644 internal/deployserverclient/docs/models/components/connector.md create mode 100644 internal/deployserverclient/docs/models/components/createdeploymentrequest.md create mode 100644 internal/deployserverclient/docs/models/components/createmanifestresponse.md create mode 100644 internal/deployserverclient/docs/models/components/createmanifestresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/deploymentresource.md create mode 100644 internal/deployserverclient/docs/models/components/deploymentresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/ledger.md create mode 100644 internal/deployserverclient/docs/models/components/listdeploymentsresponse.md create mode 100644 internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestsresponse.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md delete mode 100644 internal/deployserverclient/docs/models/components/listrunsresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/listrunsresponsedata.md delete mode 100644 internal/deployserverclient/docs/models/components/listversionsresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/listversionsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/manifest.md create mode 100644 internal/deployserverclient/docs/models/components/manifestresponse.md create mode 100644 internal/deployserverclient/docs/models/components/manifestversion.md create mode 100644 internal/deployserverclient/docs/models/components/manifestversionresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/payments.md delete mode 100644 internal/deployserverclient/docs/models/components/readstateresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/reconciliationledger.md delete mode 100644 internal/deployserverclient/docs/models/components/reconciliationpolicy.md delete mode 100644 internal/deployserverclient/docs/models/components/regionselector.md delete mode 100644 internal/deployserverclient/docs/models/components/run.md delete mode 100644 internal/deployserverclient/docs/models/components/runresponse.md delete mode 100644 internal/deployserverclient/docs/models/components/stack.md delete mode 100644 internal/deployserverclient/docs/models/components/status.md create mode 100644 internal/deployserverclient/docs/models/components/updatemanifestrequest.md delete mode 100644 internal/deployserverclient/docs/models/components/v2chartsegment.md delete mode 100644 internal/deployserverclient/docs/models/components/v2schemadata.md delete mode 100644 internal/deployserverclient/docs/models/components/v2transactiontemplate.md delete mode 100644 internal/deployserverclient/docs/models/components/webhook.md create mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md rename internal/deployserverclient/docs/models/operations/{readcurrentappversionresponse.md => createdeploymentrawresponse.md} (57%) create mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/createmanifestrawresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/createmanifestrequest.md rename internal/deployserverclient/docs/models/{components/v2chartaccountrules.md => operations/createmanifestrequestbody.md} (71%) create mode 100644 internal/deployserverclient/docs/models/operations/createmanifestresponse.md rename internal/deployserverclient/docs/models/operations/{readrunlogsrequest.md => deletemanifestrequest.md} (70%) rename internal/deployserverclient/docs/models/operations/{readrunresponse.md => deletemanifestresponse.md} (74%) delete mode 100644 internal/deployserverclient/docs/models/operations/deployappconfigurationrawresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/deployappconfigurationrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/deployappconfigurationresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/from.md rename internal/deployserverclient/docs/models/operations/{readapprunsrequest.md => listdeploymentsrequest.md} (80%) create mode 100644 internal/deployserverclient/docs/models/operations/listdeploymentsresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/listmanifestsrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/listmanifestsresponse.md rename internal/deployserverclient/docs/models/operations/{readappversionsrequest.md => listmanifestversionsrequest.md} (80%) create mode 100644 internal/deployserverclient/docs/models/operations/listmanifestversionsresponse.md rename internal/deployserverclient/docs/models/operations/{deployappconfigurationrawrequest.md => pushmanifestversionrawrequest.md} (74%) create mode 100644 internal/deployserverclient/docs/models/operations/pushmanifestversionrawresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/pushmanifestversionrequest.md rename internal/deployserverclient/docs/models/{components/dotself.md => operations/pushmanifestversionrequestbody.md} (69%) create mode 100644 internal/deployserverclient/docs/models/operations/pushmanifestversionresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/readappcurrentstateversionrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/readappcurrentstateversionresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/readappinclude.md delete mode 100644 internal/deployserverclient/docs/models/operations/readappversionsresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/readcurrentappversionrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/readcurrentrunlogsrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/readcurrentrunrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/readcurrentrunresponse.md create mode 100644 internal/deployserverclient/docs/models/operations/readdeploymentinclude.md rename internal/deployserverclient/docs/models/{components/v2chartaccountmetadata.md => operations/readdeploymentlogsrequest.md} (69%) rename internal/deployserverclient/docs/models/operations/{readrunlogsresponse.md => readdeploymentlogsresponse.md} (90%) create mode 100644 internal/deployserverclient/docs/models/operations/readdeploymentrequest.md rename internal/deployserverclient/docs/models/operations/{readversionresponse.md => readdeploymentresponse.md} (74%) create mode 100644 internal/deployserverclient/docs/models/operations/readmanifestrequest.md rename internal/deployserverclient/docs/models/operations/{readcurrentrunlogsresponse.md => readmanifestresponse.md} (66%) create mode 100644 internal/deployserverclient/docs/models/operations/readmanifestversionrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/readmanifestversionresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/readrunrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/readversionrequest.md rename internal/deployserverclient/docs/models/{components/reconciliation.md => operations/updatemanifestrequest.md} (56%) rename internal/deployserverclient/docs/models/operations/{readapprunsresponse.md => updatemanifestresponse.md} (78%) create mode 100644 internal/deployserverclient/models/apierrors/error.go delete mode 100644 internal/deployserverclient/models/components/application.go delete mode 100644 internal/deployserverclient/models/components/appversionresponse.go delete mode 100644 internal/deployserverclient/models/components/configurationversion.go create mode 100644 internal/deployserverclient/models/components/createdeploymentrequest.go create mode 100644 internal/deployserverclient/models/components/createmanifestresponse.go create mode 100644 internal/deployserverclient/models/components/deploymentresource.go create mode 100644 internal/deployserverclient/models/components/deploymentresponse.go delete mode 100644 internal/deployserverclient/models/components/dotself.go delete mode 100644 internal/deployserverclient/models/components/ledger.go create mode 100644 internal/deployserverclient/models/components/listdeploymentsresponse.go rename internal/deployserverclient/models/components/{listrunsresponse.go => listmanifestsresponse.go} (50%) create mode 100644 internal/deployserverclient/models/components/listmanifestversionsresponse.go delete mode 100644 internal/deployserverclient/models/components/listversionsresponse.go create mode 100644 internal/deployserverclient/models/components/manifest.go create mode 100644 internal/deployserverclient/models/components/manifestresponse.go create mode 100644 internal/deployserverclient/models/components/manifestversion.go create mode 100644 internal/deployserverclient/models/components/manifestversionresponse.go delete mode 100644 internal/deployserverclient/models/components/payments.go delete mode 100644 internal/deployserverclient/models/components/pool.go delete mode 100644 internal/deployserverclient/models/components/readstateresponse.go delete mode 100644 internal/deployserverclient/models/components/reconciliation.go delete mode 100644 internal/deployserverclient/models/components/reconciliationledger.go delete mode 100644 internal/deployserverclient/models/components/reconciliationpolicy.go delete mode 100644 internal/deployserverclient/models/components/regionselector.go delete mode 100644 internal/deployserverclient/models/components/run.go delete mode 100644 internal/deployserverclient/models/components/runresponse.go delete mode 100644 internal/deployserverclient/models/components/stack.go create mode 100644 internal/deployserverclient/models/components/updatemanifestrequest.go delete mode 100644 internal/deployserverclient/models/components/v2chartaccountmetadata.go delete mode 100644 internal/deployserverclient/models/components/v2chartaccountrules.go delete mode 100644 internal/deployserverclient/models/components/v2chartsegment.go delete mode 100644 internal/deployserverclient/models/components/v2schemadata.go delete mode 100644 internal/deployserverclient/models/components/v2transactiontemplate.go delete mode 100644 internal/deployserverclient/models/components/webhook.go create mode 100644 internal/deployserverclient/models/operations/createdeployment.go create mode 100644 internal/deployserverclient/models/operations/createdeploymentraw.go create mode 100644 internal/deployserverclient/models/operations/createmanifest.go create mode 100644 internal/deployserverclient/models/operations/createmanifestraw.go create mode 100644 internal/deployserverclient/models/operations/deletemanifest.go delete mode 100644 internal/deployserverclient/models/operations/deployappconfiguration.go delete mode 100644 internal/deployserverclient/models/operations/deployappconfigurationraw.go create mode 100644 internal/deployserverclient/models/operations/listdeployments.go create mode 100644 internal/deployserverclient/models/operations/listmanifests.go create mode 100644 internal/deployserverclient/models/operations/listmanifestversions.go create mode 100644 internal/deployserverclient/models/operations/pushmanifestversion.go create mode 100644 internal/deployserverclient/models/operations/pushmanifestversionraw.go delete mode 100644 internal/deployserverclient/models/operations/readappcurrentstateversion.go delete mode 100644 internal/deployserverclient/models/operations/readappruns.go delete mode 100644 internal/deployserverclient/models/operations/readappversions.go delete mode 100644 internal/deployserverclient/models/operations/readcurrentappversion.go delete mode 100644 internal/deployserverclient/models/operations/readcurrentrun.go create mode 100644 internal/deployserverclient/models/operations/readdeployment.go rename internal/deployserverclient/models/operations/{readcurrentrunlogs.go => readdeploymentlogs.go} (52%) create mode 100644 internal/deployserverclient/models/operations/readmanifest.go create mode 100644 internal/deployserverclient/models/operations/readmanifestversion.go delete mode 100644 internal/deployserverclient/models/operations/readrun.go delete mode 100644 internal/deployserverclient/models/operations/readrunlogs.go delete mode 100644 internal/deployserverclient/models/operations/readversion.go create mode 100644 internal/deployserverclient/models/operations/updatemanifest.go diff --git a/cmd/cloud/apps/create.go b/cmd/cloud/apps/create.go index d67f42fe..36ea7bf8 100644 --- a/cmd/cloud/apps/create.go +++ b/cmd/cloud/apps/create.go @@ -1,6 +1,8 @@ package apps import ( + "fmt" + "github.com/pterm/pterm" "github.com/spf13/cobra" @@ -34,6 +36,8 @@ func NewCreateCtrl() *CreateCtrl { func NewCreate() *cobra.Command { return fctl.NewCommand("create", fctl.WithShortDescription("Create an app"), + fctl.WithStringFlag("name", "", "App name"), + fctl.WithStringFlag("stack-id", "", "Optional existing stack ID to claim"), fctl.WithController(NewCreateCtrl()), ) } @@ -49,7 +53,7 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error return nil, err } - organizationID, apiClient, err := fctl.NewAppDeployClientFromFlags( + _, apiClient, err := fctl.NewAppDeployClientFromFlags( cmd, relyingParty, fctl.NewPTermDialog(), @@ -59,9 +63,20 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error if err != nil { return nil, err } - apps, err := apiClient.CreateApp(cmd.Context(), components.CreateAppRequest{ - OrganizationID: organizationID, - }) + + name := fctl.GetString(cmd, "name") + if name == "" { + return nil, fmt.Errorf("name is required") + } + + req := components.CreateAppRequest{ + Name: name, + } + if stackID := fctl.GetString(cmd, "stack-id"); stackID != "" { + req.StackID = &stackID + } + + apps, err := apiClient.CreateApp(cmd.Context(), req) if err != nil { return nil, err } diff --git a/cmd/cloud/apps/deploy.go b/cmd/cloud/apps/deployments/create.go similarity index 61% rename from cmd/cloud/apps/deploy.go rename to cmd/cloud/apps/deployments/create.go index f2e6aa7a..06f0b0cc 100644 --- a/cmd/cloud/apps/deploy.go +++ b/cmd/cloud/apps/deployments/create.go @@ -1,4 +1,4 @@ -package apps +package deployments import ( "fmt" @@ -11,47 +11,48 @@ import ( "github.com/spf13/cobra" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" "github.com/formancehq/fctl/v3/cmd/cloud/apps/printer" fctl "github.com/formancehq/fctl/v3/pkg" ) -type Deploy struct { - *components.Run +type Create struct { + *components.DeploymentResource logs []components.Log } -type DeployCtrl struct { - store *Deploy +type CreateCtrl struct { + store *Create } -var _ fctl.Controller[*Deploy] = (*DeployCtrl)(nil) +var _ fctl.Controller[*Create] = (*CreateCtrl)(nil) -func newDeployStore() *Deploy { - return &Deploy{} +func newCreateStore() *Create { + return &Create{} } -func NewDeployCtrl() *DeployCtrl { - return &DeployCtrl{ - store: newDeployStore(), +func NewCreateCtrl() *CreateCtrl { + return &CreateCtrl{ + store: newCreateStore(), } } -func NewDeploy() *cobra.Command { - return fctl.NewCommand("deploy", - fctl.WithShortDescription("Deploy an app"), - fctl.WithStringFlag("id", "", "App ID"), +func NewCreate() *cobra.Command { + return fctl.NewCommand("create", + fctl.WithShortDescription("Create a deployment (deploy an app)"), + fctl.WithStringFlag("app-id", "", "App ID"), fctl.WithStringFlag("path", "", "Path to the manifest file"), fctl.WithBoolFlag("wait", true, "Wait for the deployment to complete"), - fctl.WithController(NewDeployCtrl()), + fctl.WithController(NewCreateCtrl()), ) } -func (c *DeployCtrl) GetStore() *Deploy { +func (c *CreateCtrl) GetStore() *Create { return c.store } -func (c *DeployCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { +func (c *CreateCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return nil, err @@ -67,9 +68,9 @@ func (c *DeployCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er if err != nil { return nil, err } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") + appID := fctl.GetString(cmd, "app-id") + if appID == "" { + return nil, fmt.Errorf("app-id is required") } path := fctl.GetString(cmd, "path") if path == "" { @@ -81,14 +82,14 @@ func (c *DeployCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er } cmd.SilenceUsage = true - deployment, err := apiClient.DeployAppConfigurationRaw(cmd.Context(), id, data) + deployment, err := apiClient.CreateDeploymentRaw(cmd.Context(), data, &appID) if err != nil { return nil, err } - c.store.Run = &deployment.RunResponse.Data + c.store.DeploymentResource = &deployment.DeploymentResponse.Data if fctl.GetBool(cmd, "wait") { - if err := c.waitRunCompletion(cmd); err != nil { + if err := c.waitDeploymentCompletion(cmd); err != nil { return nil, err } } @@ -96,7 +97,7 @@ func (c *DeployCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er return c, nil } -func (c *DeployCtrl) waitRunCompletion(cmd *cobra.Command) error { +func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { @@ -140,14 +141,14 @@ func (c *DeployCtrl) waitRunCompletion(cmd *cobra.Command) error { return cmd.Context().Err() case <-time.After(waitFor): waitFor = 2 * time.Second - r, err := apiClient.ReadRun(cmd.Context(), c.store.ID) + r, err := apiClient.ReadDeployment(cmd.Context(), c.store.ID, nil) if err != nil { return err } - c.store.Run = &r.RunResponse.Data + c.store.DeploymentResource = &r.DeploymentResponse.Data - spinner.UpdateText(fmt.Sprintf("Deployment status: %s", r.RunResponse.Data.Status)) - switch r.RunResponse.Data.Status { + spinner.UpdateText(fmt.Sprintf("Deployment status: %s", r.DeploymentResponse.Data.RunStatus)) + switch r.DeploymentResponse.Data.RunStatus { case "applied": spinner.UpdateText("Deployment completed successfully") return nil @@ -155,7 +156,7 @@ func (c *DeployCtrl) waitRunCompletion(cmd *cobra.Command) error { spinner.UpdateText("Deployment completed successfully, no changes to apply") return nil case "errored": - l, err := apiClient.ReadRunLogs(cmd.Context(), c.store.ID) + l, err := apiClient.ReadDeploymentLogs(cmd.Context(), c.store.ID) if err != nil { return err } @@ -170,8 +171,8 @@ func (c *DeployCtrl) waitRunCompletion(cmd *cobra.Command) error { } } -func (c *DeployCtrl) Render(cmd *cobra.Command, args []string) error { - if c.store.Run.Status == "errored" { +func (c *CreateCtrl) Render(cmd *cobra.Command, args []string) error { + if c.store.DeploymentResource.RunStatus == "errored" { if len(c.store.logs) > 0 { if err := printer.RenderLogs(cmd.ErrOrStderr(), c.store.logs); err != nil { return err @@ -180,14 +181,11 @@ func (c *DeployCtrl) Render(cmd *cobra.Command, args []string) error { return fmt.Errorf("deployment failed: %s", c.store.ID) } - pterm.Info.Printfln("App deployment accepted with ID: %s", c.store.ID) + pterm.Info.Println("App Deployment accepted", c.store.ID) wait := fctl.GetBool(cmd, "wait") if !wait { return nil } - if err := c.waitRunCompletion(cmd); err != nil { - return err - } cfg, err := fctl.LoadConfig(cmd) if err != nil { @@ -214,25 +212,26 @@ func (c *DeployCtrl) Render(cmd *cobra.Command, args []string) error { if err != nil { return err } - id := fctl.GetString(cmd, "id") - currentStateRes, err := apiClient.ReadAppCurrentStateVersion(cmd.Context(), id) + + appID := fctl.GetString(cmd, "app-id") + appResp, err := apiClient.ReadApp(cmd.Context(), appID, []operations.ReadAppInclude{operations.ReadAppIncludeState}) if err != nil { return err } - if state := currentStateRes.GetReadStateResponse().Data.Stack; state != nil { - apiClient, err := fctl.NewMembershipClientForOrganization(cmd, relyingParty, fctl.NewPTermDialog(), profileName, *profile, organizationID) + if state := appResp.AppResponse.Data.State; state != nil && state.Stack != nil { + membershipClient, err := fctl.NewMembershipClientForOrganization(cmd, relyingParty, fctl.NewPTermDialog(), profileName, *profile, organizationID) if err != nil { return err } - info, err := apiClient.GetServerInfo(cmd.Context()) + info, err := membershipClient.GetServerInfo(cmd.Context()) if err != nil { return err } if info.ServerInfo.ConsoleURL != nil { - pterm.Success.Printfln("View stack in console: %s/%s/%s?region=%s", *info.ServerInfo.ConsoleURL, organizationID, state["id"], state["region_id"]) + pterm.Success.Printfln("View stack in console: %s/%s/%s?region=%s", *info.ServerInfo.ConsoleURL, organizationID, state.Stack["id"], state.Stack["region_id"]) } } return nil diff --git a/cmd/cloud/apps/runs/list.go b/cmd/cloud/apps/deployments/list.go similarity index 57% rename from cmd/cloud/apps/runs/list.go rename to cmd/cloud/apps/deployments/list.go index 7d67191f..bd6e99c3 100644 --- a/cmd/cloud/apps/runs/list.go +++ b/cmd/cloud/apps/deployments/list.go @@ -1,4 +1,4 @@ -package runs +package deployments import ( "fmt" @@ -13,7 +13,7 @@ import ( ) type List struct { - components.ListRunsResponseData + components.ListDeploymentsResponseData } type ListCtrl struct { @@ -24,7 +24,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListRunsResponseData: components.ListRunsResponseData{}, + ListDeploymentsResponseData: components.ListDeploymentsResponseData{}, } } @@ -37,8 +37,8 @@ func NewListCtrl() *ListCtrl { func NewList() *cobra.Command { return fctl.NewCommand("list", fctl.WithAliases("ls"), - fctl.WithShortDescription("List runs for an app"), - fctl.WithStringFlag("id", "", "App ID"), + fctl.WithShortDescription("List deployments"), + fctl.WithStringFlag("app-id", "", "Filter by app ID"), fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), fctl.WithController(NewListCtrl()), @@ -49,8 +49,7 @@ func (c *ListCtrl) GetStore() *List { return c.store } -func (c *ListCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { - +func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return nil, err @@ -66,34 +65,47 @@ func (c *ListCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, erro if err != nil { return nil, err } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") + + var appID *string + if id := fctl.GetString(cmd, "app-id"); id != "" { + appID = &id } - runs, err := apiClient.ReadAppRuns(cmd.Context(), id, pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size")))) + + deployments, err := apiClient.ListDeployments( + cmd.Context(), + appID, + pointer.For(int64(fctl.GetInt(cmd, "page"))), + pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + ) if err != nil { return nil, err } - c.store.ListRunsResponseData = runs.ListRunsResponse.Data + c.store.ListDeploymentsResponseData = deployments.ListDeploymentsResponse.Data return c, nil } -func (c *ListCtrl) Render(cmd *cobra.Command, args []string) error { +func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { data := [][]string{ - {"Created At", "ID", "Configuration Id", "Status", "Message"}, + {"ID", "App ID", "Run Status", "Manifest ID", "Created At"}, } - for _, run := range c.store.Items { + for _, d := range c.store.Items { data = append(data, []string{ - run.CreatedAt.String(), - run.ID, - run.ConfigurationVersion.ID, - run.Status, - run.Message, + d.ID, + d.AppID, + d.RunStatus, + func() string { + if d.ManifestID != nil { + return *d.ManifestID + } + return "inline" + }(), + fmt.Sprint(d.CreatedAt), }) } + if err := pterm. DefaultTable. WithHasHeader(). diff --git a/cmd/cloud/apps/runs/logs.go b/cmd/cloud/apps/deployments/logs.go similarity index 73% rename from cmd/cloud/apps/runs/logs.go rename to cmd/cloud/apps/deployments/logs.go index 190739c5..eb15d2dd 100644 --- a/cmd/cloud/apps/runs/logs.go +++ b/cmd/cloud/apps/deployments/logs.go @@ -1,4 +1,4 @@ -package runs +package deployments import ( "fmt" @@ -30,9 +30,8 @@ func NewLogsCtrl() *LogsCtrl { func NewLogs() *cobra.Command { return fctl.NewCommand("logs", - fctl.WithAliases("ls"), - fctl.WithShortDescription("Read logs related to an app run"), - fctl.WithStringFlag("id", "", "Run ID"), + fctl.WithShortDescription("Read logs for a deployment"), + fctl.WithStringFlag("id", "", "Deployment ID"), fctl.WithController(NewLogsCtrl()), ) } @@ -41,8 +40,7 @@ func (c *LogsCtrl) GetStore() Logs { return c.store } -func (c *LogsCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { - +func (c *LogsCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return nil, err @@ -58,21 +56,22 @@ func (c *LogsCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, erro if err != nil { return nil, err } + id := fctl.GetString(cmd, "id") if id == "" { return nil, fmt.Errorf("id is required") } - logs, err := apiClient.ReadRunLogs(cmd.Context(), id) + + logs, err := apiClient.ReadDeploymentLogs(cmd.Context(), id) if err != nil { return nil, err } - s := Logs(logs.ReadLogsResponse.Data) - c.store = s + c.store = Logs(logs.ReadLogsResponse.Data) return c, nil } -func (c *LogsCtrl) Render(cmd *cobra.Command, args []string) error { +func (c *LogsCtrl) Render(cmd *cobra.Command, _ []string) error { return printer.RenderLogs(cmd.OutOrStdout(), c.store) } diff --git a/cmd/cloud/apps/runs/root.go b/cmd/cloud/apps/deployments/root.go similarity index 54% rename from cmd/cloud/apps/runs/root.go rename to cmd/cloud/apps/deployments/root.go index c85536a0..7fe1fa99 100644 --- a/cmd/cloud/apps/runs/root.go +++ b/cmd/cloud/apps/deployments/root.go @@ -1,4 +1,4 @@ -package runs +package deployments import ( "github.com/spf13/cobra" @@ -7,13 +7,14 @@ import ( ) func NewCommand() *cobra.Command { - return fctl.NewCommand("runs", - fctl.WithShortDescription("Manage app runs"), + return fctl.NewCommand("deployments", + fctl.WithShortDescription("Manage deployments"), + fctl.WithAliases("deploy", "dep"), fctl.WithChildCommands( + NewCreate(), NewList(), NewShow(), NewLogs(), - // NewWait(), ), ) } diff --git a/cmd/cloud/apps/deployments/show.go b/cmd/cloud/apps/deployments/show.go new file mode 100644 index 00000000..8c200a51 --- /dev/null +++ b/cmd/cloud/apps/deployments/show.go @@ -0,0 +1,115 @@ +package deployments + +import ( + "fmt" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type Show struct { + components.DeploymentResource +} + +type ShowCtrl struct { + store *Show +} + +var _ fctl.Controller[*Show] = (*ShowCtrl)(nil) + +func newShowStore() *Show { + return &Show{} +} + +func NewShowCtrl() *ShowCtrl { + return &ShowCtrl{ + store: newShowStore(), + } +} + +func NewShow() *cobra.Command { + return fctl.NewCommand("show", + fctl.WithShortDescription("Show deployment details"), + fctl.WithStringFlag("id", "", "Deployment ID"), + fctl.WithBoolFlag("include-state", false, "Include Terraform state"), + fctl.WithController(NewShowCtrl()), + ) +} + +func (c *ShowCtrl) GetStore() *Show { + return c.store +} + +func (c *ShowCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + id := fctl.GetString(cmd, "id") + if id == "" { + return nil, fmt.Errorf("id is required") + } + + var includes []operations.ReadDeploymentInclude + if fctl.GetBool(cmd, "include-state") { + includes = append(includes, operations.ReadDeploymentIncludeState) + } + + deployment, err := apiClient.ReadDeployment(cmd.Context(), id, includes) + if err != nil { + return nil, err + } + + c.store.DeploymentResource = deployment.DeploymentResponse.Data + + return c, nil +} + +func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.DefaultSection.Println("Deployment") + + items := []pterm.BulletListItem{ + {Level: 0, Text: fmt.Sprintf("ID: %s", c.store.ID)}, + {Level: 0, Text: fmt.Sprintf("App ID: %s", c.store.AppID)}, + {Level: 0, Text: fmt.Sprintf("Run Status: %s", c.store.RunStatus)}, + {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.CreatedAt)}, + {Level: 0, Text: fmt.Sprintf("Updated At: %s", c.store.UpdatedAt)}, + } + + if c.store.ManifestID != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Manifest ID: %s", *c.store.ManifestID)}) + } + if c.store.ManifestVersion != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Manifest Version: %d", *c.store.ManifestVersion)}) + } + if c.store.RunID != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Run ID: %s", *c.store.RunID)}) + } + + if err := pterm. + DefaultBulletList. + WithItems(items). + WithWriter(cmd.OutOrStdout()). + Render(); err != nil { + return err + } + + return nil +} diff --git a/cmd/cloud/apps/list.go b/cmd/cloud/apps/list.go index a4c89045..b41012fb 100644 --- a/cmd/cloud/apps/list.go +++ b/cmd/cloud/apps/list.go @@ -56,7 +56,7 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) pageSize := fctl.GetInt(cmd, "page-size") page := fctl.GetInt(cmd, "page") - organizationID, apiClient, err := fctl.NewAppDeployClientFromFlags( + _, apiClient, err := fctl.NewAppDeployClientFromFlags( cmd, relyingParty, fctl.NewPTermDialog(), @@ -68,7 +68,6 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) } apps, err := apiClient.ListApps( cmd.Context(), - organizationID, pointer.For(int64(page)), pointer.For(int64(pageSize)), ) @@ -83,7 +82,7 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { data := [][]string{ - {"Name", "ID", "Run Status", "Has Configuration Version"}, + {"Name", "ID", "Stack ID"}, } for _, w := range c.store.Items { @@ -91,16 +90,10 @@ func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { w.Name, w.ID, func() string { - if w.CurrentRun == nil { - return "N/A" + if w.StackID != nil { + return *w.StackID } - return w.CurrentRun.Status - }(), - func() string { - if w.CurrentConfigurationVersion != nil { - return "Yes" - } - return "No" + return "N/A" }(), }) } diff --git a/cmd/cloud/apps/manifests/create.go b/cmd/cloud/apps/manifests/create.go new file mode 100644 index 00000000..bf458144 --- /dev/null +++ b/cmd/cloud/apps/manifests/create.go @@ -0,0 +1,102 @@ +package manifests + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type Create struct { + ID string + Name string + Version int64 +} + +type CreateCtrl struct { + store *Create +} + +var _ fctl.Controller[*Create] = (*CreateCtrl)(nil) + +func newCreateStore() *Create { + return &Create{} +} + +func NewCreateCtrl() *CreateCtrl { + return &CreateCtrl{ + store: newCreateStore(), + } +} + +func NewCreate() *cobra.Command { + return fctl.NewCommand("create", + fctl.WithShortDescription("Create a new manifest"), + fctl.WithStringFlag("name", "", "Manifest name"), + fctl.WithStringFlag("app-id", "", "Optional app ID to scope the manifest"), + fctl.WithStringFlag("path", "", "Path to YAML manifest file"), + fctl.WithController(NewCreateCtrl()), + ) +} + +func (c *CreateCtrl) GetStore() *Create { + return c.store +} + +func (c *CreateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + name := fctl.GetString(cmd, "name") + if name == "" { + return nil, fmt.Errorf("name is required") + } + + path := fctl.GetString(cmd, "path") + if path == "" { + return nil, fmt.Errorf("path is required") + } + + data, err := os.ReadFile(filepath.Clean(path)) + if err != nil { + return nil, err + } + + var appID *string + if id := fctl.GetString(cmd, "app-id"); id != "" { + appID = &id + } + + resp, err := apiClient.CreateManifestRaw(cmd.Context(), name, data, appID) + if err != nil { + return nil, err + } + + c.store.ID = resp.CreateManifestResponse.Data.ID + c.store.Name = resp.CreateManifestResponse.Data.Name + c.store.Version = resp.CreateManifestResponse.Data.Version + + return c, nil +} + +func (c *CreateCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.Success.Printfln("Manifest created: %s (version %d)", c.store.ID, c.store.Version) + return nil +} diff --git a/cmd/cloud/apps/manifests/delete.go b/cmd/cloud/apps/manifests/delete.go new file mode 100644 index 00000000..74c9f812 --- /dev/null +++ b/cmd/cloud/apps/manifests/delete.go @@ -0,0 +1,79 @@ +package manifests + +import ( + "fmt" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type Delete struct { + ID string +} + +type DeleteCtrl struct { + store *Delete +} + +var _ fctl.Controller[*Delete] = (*DeleteCtrl)(nil) + +func newDeleteStore() *Delete { + return &Delete{} +} + +func NewDeleteCtrl() *DeleteCtrl { + return &DeleteCtrl{ + store: newDeleteStore(), + } +} + +func NewDelete() *cobra.Command { + return fctl.NewCommand("delete", + fctl.WithShortDescription("Delete a manifest"), + fctl.WithStringFlag("id", "", "Manifest ID"), + fctl.WithController(NewDeleteCtrl()), + ) +} + +func (c *DeleteCtrl) GetStore() *Delete { + return c.store +} + +func (c *DeleteCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + id := fctl.GetString(cmd, "id") + if id == "" { + return nil, fmt.Errorf("id is required") + } + + _, err = apiClient.DeleteManifest(cmd.Context(), id) + if err != nil { + return nil, err + } + + c.store.ID = id + + return c, nil +} + +func (c *DeleteCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.Success.Println("Manifest deleted", c.store.ID) + return nil +} diff --git a/cmd/cloud/apps/manifests/list.go b/cmd/cloud/apps/manifests/list.go new file mode 100644 index 00000000..fe5c1a65 --- /dev/null +++ b/cmd/cloud/apps/manifests/list.go @@ -0,0 +1,119 @@ +package manifests + +import ( + "fmt" + "strconv" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "github.com/formancehq/go-libs/v4/pointer" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type List struct { + components.ListManifestsResponseData +} + +type ListCtrl struct { + store *List +} + +var _ fctl.Controller[*List] = (*ListCtrl)(nil) + +func newDefaultStore() *List { + return &List{ + ListManifestsResponseData: components.ListManifestsResponseData{}, + } +} + +func NewListCtrl() *ListCtrl { + return &ListCtrl{ + store: newDefaultStore(), + } +} + +func NewList() *cobra.Command { + return fctl.NewCommand("list", + fctl.WithAliases("ls"), + fctl.WithShortDescription("List manifests"), + fctl.WithStringFlag("app-id", "", "Filter by app ID"), + fctl.WithIntFlag("page", 1, "Page number"), + fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithController(NewListCtrl()), + ) +} + +func (c *ListCtrl) GetStore() *List { + return c.store +} + +func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + var appID *string + if id := fctl.GetString(cmd, "app-id"); id != "" { + appID = &id + } + + manifests, err := apiClient.ListManifests( + cmd.Context(), + pointer.For(int64(fctl.GetInt(cmd, "page"))), + pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + appID, + ) + if err != nil { + return nil, err + } + + c.store.ListManifestsResponseData = manifests.ListManifestsResponse.Data + + return c, nil +} + +func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { + data := [][]string{ + {"ID", "Name", "App ID", "Latest Version", "Created At"}, + } + + for _, m := range c.store.Items { + data = append(data, []string{ + m.ID, + m.Name, + func() string { + if m.AppID != nil { + return *m.AppID + } + return "org-wide" + }(), + strconv.FormatInt(m.LatestVersion, 10), + fmt.Sprint(m.CreatedAt), + }) + } + + if err := pterm. + DefaultTable. + WithHasHeader(). + WithWriter(cmd.OutOrStdout()). + WithData(data). + Render(); err != nil { + return err + } + return nil +} diff --git a/cmd/cloud/apps/manifests/root.go b/cmd/cloud/apps/manifests/root.go new file mode 100644 index 00000000..db9a1c7e --- /dev/null +++ b/cmd/cloud/apps/manifests/root.go @@ -0,0 +1,23 @@ +package manifests + +import ( + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/v3/cmd/cloud/apps/manifests/versions" + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func NewCommand() *cobra.Command { + return fctl.NewCommand("manifests", + fctl.WithShortDescription("Manage manifests"), + fctl.WithAliases("manifest", "mf"), + fctl.WithChildCommands( + NewList(), + NewShow(), + NewCreate(), + NewDelete(), + NewUpdate(), + versions.NewCommand(), + ), + ) +} diff --git a/cmd/cloud/apps/runs/show.go b/cmd/cloud/apps/manifests/show.go similarity index 60% rename from cmd/cloud/apps/runs/show.go rename to cmd/cloud/apps/manifests/show.go index 53865833..f1d89ce0 100644 --- a/cmd/cloud/apps/runs/show.go +++ b/cmd/cloud/apps/manifests/show.go @@ -1,4 +1,4 @@ -package runs +package manifests import ( "fmt" @@ -12,7 +12,7 @@ import ( ) type Show struct { - components.Run + components.Manifest } type ShowCtrl struct { @@ -22,9 +22,7 @@ type ShowCtrl struct { var _ fctl.Controller[*Show] = (*ShowCtrl)(nil) func newShowStore() *Show { - return &Show{ - Run: components.Run{}, - } + return &Show{} } func NewShowCtrl() *ShowCtrl { @@ -35,8 +33,8 @@ func NewShowCtrl() *ShowCtrl { func NewShow() *cobra.Command { return fctl.NewCommand("show", - fctl.WithShortDescription("Show a run"), - fctl.WithStringFlag("id", "", "Run ID"), + fctl.WithShortDescription("Show manifest details"), + fctl.WithStringFlag("id", "", "Manifest ID"), fctl.WithController(NewShowCtrl()), ) } @@ -61,29 +59,35 @@ func (c *ShowCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) if err != nil { return nil, err } + id := fctl.GetString(cmd, "id") if id == "" { return nil, fmt.Errorf("id is required") } - app, err := apiClient.ReadRun(cmd.Context(), id) + + manifest, err := apiClient.ReadManifest(cmd.Context(), id, nil) if err != nil { return nil, err } - c.store.Run = app.RunResponse.Data + c.store.Manifest = manifest.ManifestResponse.Data return c, nil } -func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { - pterm.DefaultSection.Println("Run") +func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.DefaultSection.Println("Manifest") items := []pterm.BulletListItem{ - {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.Run.CreatedAt)}, - {Level: 0, Text: fmt.Sprintf("Id: %s", c.store.Run.ID)}, - {Level: 0, Text: fmt.Sprintf("Configuration Id: %s", c.store.Run.ConfigurationVersion.ID)}, - {Level: 0, Text: fmt.Sprintf("Status: %s", c.store.Run.Status)}, - {Level: 0, Text: fmt.Sprintf("Message: %s", c.store.Run.Message)}, + {Level: 0, Text: fmt.Sprintf("ID: %s", c.store.ID)}, + {Level: 0, Text: fmt.Sprintf("Name: %s", c.store.Name)}, + {Level: 0, Text: fmt.Sprintf("Latest Version: %d", c.store.LatestVersion)}, + {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.CreatedAt)}, + {Level: 0, Text: fmt.Sprintf("Updated At: %s", c.store.UpdatedAt)}, + } + + if c.store.AppID != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("App ID: %s", *c.store.AppID)}) } if err := pterm. @@ -93,5 +97,6 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { Render(); err != nil { return err } + return nil } diff --git a/cmd/cloud/apps/manifests/update.go b/cmd/cloud/apps/manifests/update.go new file mode 100644 index 00000000..3d0beb76 --- /dev/null +++ b/cmd/cloud/apps/manifests/update.go @@ -0,0 +1,89 @@ +package manifests + +import ( + "fmt" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type Update struct { + components.Manifest +} + +type UpdateCtrl struct { + store *Update +} + +var _ fctl.Controller[*Update] = (*UpdateCtrl)(nil) + +func newUpdateStore() *Update { + return &Update{} +} + +func NewUpdateCtrl() *UpdateCtrl { + return &UpdateCtrl{ + store: newUpdateStore(), + } +} + +func NewUpdate() *cobra.Command { + return fctl.NewCommand("update", + fctl.WithShortDescription("Update manifest metadata"), + fctl.WithStringFlag("id", "", "Manifest ID"), + fctl.WithStringFlag("name", "", "New name for the manifest"), + fctl.WithController(NewUpdateCtrl()), + ) +} + +func (c *UpdateCtrl) GetStore() *Update { + return c.store +} + +func (c *UpdateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + id := fctl.GetString(cmd, "id") + if id == "" { + return nil, fmt.Errorf("id is required") + } + + name := fctl.GetString(cmd, "name") + if name == "" { + return nil, fmt.Errorf("name is required") + } + + resp, err := apiClient.UpdateManifest(cmd.Context(), id, components.UpdateManifestRequest{ + Name: name, + }) + if err != nil { + return nil, err + } + + c.store.Manifest = resp.ManifestResponse.Data + + return c, nil +} + +func (c *UpdateCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.Success.Printfln("Manifest updated: %s", c.store.ID) + return nil +} diff --git a/cmd/cloud/apps/versions/list.go b/cmd/cloud/apps/manifests/versions/list.go similarity index 59% rename from cmd/cloud/apps/versions/list.go rename to cmd/cloud/apps/manifests/versions/list.go index da3b079f..4e046e81 100644 --- a/cmd/cloud/apps/versions/list.go +++ b/cmd/cloud/apps/manifests/versions/list.go @@ -14,7 +14,7 @@ import ( ) type List struct { - components.ListVersionsResponseData + components.ListManifestVersionsResponseData } type ListCtrl struct { @@ -25,7 +25,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListVersionsResponseData: components.ListVersionsResponseData{}, + ListManifestVersionsResponseData: components.ListManifestVersionsResponseData{}, } } @@ -38,8 +38,8 @@ func NewListCtrl() *ListCtrl { func NewList() *cobra.Command { return fctl.NewCommand("list", fctl.WithAliases("ls"), - fctl.WithShortDescription("List versions for an app"), - fctl.WithStringFlag("id", "", "App ID"), + fctl.WithShortDescription("List manifest versions"), + fctl.WithStringFlag("manifest-id", "", "Manifest ID"), fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), fctl.WithController(NewListCtrl()), @@ -50,7 +50,7 @@ func (c *ListCtrl) GetStore() *List { return c.store } -func (c *ListCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { +func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return nil, err @@ -66,35 +66,40 @@ func (c *ListCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, erro if err != nil { return nil, err } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") + + manifestID := fctl.GetString(cmd, "manifest-id") + if manifestID == "" { + return nil, fmt.Errorf("manifest-id is required") } - versions, err := apiClient.ReadAppVersions(cmd.Context(), id, pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size")))) + versions, err := apiClient.ListManifestVersions( + cmd.Context(), + manifestID, + pointer.For(int64(fctl.GetInt(cmd, "page"))), + pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + ) if err != nil { return nil, err } - c.store.ListVersionsResponseData = versions.ListVersionsResponse.Data + c.store.ListManifestVersionsResponseData = versions.ListManifestVersionsResponse.Data return c, nil } -func (c *ListCtrl) Render(cmd *cobra.Command, args []string) error { +func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { data := [][]string{ - {"ID", "AutoRunQueue", "Error", "ErrorMessage", "Status"}, + {"Manifest ID", "Version", "Created At"}, } - for _, version := range c.store.Items { + for _, v := range c.store.Items { data = append(data, []string{ - string(version.ID), - strconv.FormatBool(version.AutoQueueRuns), - version.Error, - version.ErrorMessage, - string(version.Status), + v.ManifestID, + strconv.FormatInt(v.Version, 10), + fmt.Sprint(v.CreatedAt), }) } + if err := pterm. DefaultTable. WithHasHeader(). diff --git a/cmd/cloud/apps/manifests/versions/push.go b/cmd/cloud/apps/manifests/versions/push.go new file mode 100644 index 00000000..0d9cbbbb --- /dev/null +++ b/cmd/cloud/apps/manifests/versions/push.go @@ -0,0 +1,94 @@ +package versions + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type Push struct { + ManifestID string + Version int64 +} + +type PushCtrl struct { + store *Push +} + +var _ fctl.Controller[*Push] = (*PushCtrl)(nil) + +func newPushStore() *Push { + return &Push{} +} + +func NewPushCtrl() *PushCtrl { + return &PushCtrl{ + store: newPushStore(), + } +} + +func NewPush() *cobra.Command { + return fctl.NewCommand("push", + fctl.WithShortDescription("Push a new version of a manifest"), + fctl.WithStringFlag("manifest-id", "", "Manifest ID"), + fctl.WithStringFlag("path", "", "Path to YAML manifest file"), + fctl.WithController(NewPushCtrl()), + ) +} + +func (c *PushCtrl) GetStore() *Push { + return c.store +} + +func (c *PushCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + manifestID := fctl.GetString(cmd, "manifest-id") + if manifestID == "" { + return nil, fmt.Errorf("manifest-id is required") + } + + path := fctl.GetString(cmd, "path") + if path == "" { + return nil, fmt.Errorf("path is required") + } + + data, err := os.ReadFile(filepath.Clean(path)) + if err != nil { + return nil, err + } + + resp, err := apiClient.PushManifestVersionRaw(cmd.Context(), manifestID, data) + if err != nil { + return nil, err + } + + c.store.ManifestID = resp.ManifestVersionResponse.Data.ManifestID + c.store.Version = resp.ManifestVersionResponse.Data.Version + + return c, nil +} + +func (c *PushCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.Success.Printfln("Manifest version %d pushed for %s", c.store.Version, c.store.ManifestID) + return nil +} diff --git a/cmd/cloud/apps/versions/root.go b/cmd/cloud/apps/manifests/versions/root.go similarity index 69% rename from cmd/cloud/apps/versions/root.go rename to cmd/cloud/apps/manifests/versions/root.go index 6d6fccb8..fb949d0b 100644 --- a/cmd/cloud/apps/versions/root.go +++ b/cmd/cloud/apps/manifests/versions/root.go @@ -8,12 +8,12 @@ import ( func NewCommand() *cobra.Command { return fctl.NewCommand("versions", - fctl.WithShortDescription("Manage app versions"), + fctl.WithShortDescription("Manage manifest versions"), + fctl.WithAliases("ver", "v"), fctl.WithChildCommands( NewList(), NewShow(), - NewArchive(), - NewManifest(), + NewPush(), ), ) } diff --git a/cmd/cloud/apps/versions/show.go b/cmd/cloud/apps/manifests/versions/show.go similarity index 54% rename from cmd/cloud/apps/versions/show.go rename to cmd/cloud/apps/manifests/versions/show.go index cb0782c4..75553abb 100644 --- a/cmd/cloud/apps/versions/show.go +++ b/cmd/cloud/apps/manifests/versions/show.go @@ -2,6 +2,7 @@ package versions import ( "fmt" + "strconv" "github.com/pterm/pterm" "github.com/spf13/cobra" @@ -12,7 +13,7 @@ import ( ) type Show struct { - components.ConfigurationVersion + components.ManifestVersion } type ShowCtrl struct { @@ -22,9 +23,7 @@ type ShowCtrl struct { var _ fctl.Controller[*Show] = (*ShowCtrl)(nil) func newShowStore() *Show { - return &Show{ - ConfigurationVersion: components.ConfigurationVersion{}, - } + return &Show{} } func NewShowCtrl() *ShowCtrl { @@ -35,8 +34,9 @@ func NewShowCtrl() *ShowCtrl { func NewShow() *cobra.Command { return fctl.NewCommand("show", - fctl.WithShortDescription("Show a version"), - fctl.WithStringFlag("id", "", "Version ID"), + fctl.WithShortDescription("Show a specific manifest version"), + fctl.WithStringFlag("manifest-id", "", "Manifest ID"), + fctl.WithStringFlag("version", "latest", "Version number or 'latest'"), fctl.WithController(NewShowCtrl()), ) } @@ -61,29 +61,35 @@ func (c *ShowCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) if err != nil { return nil, err } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") + + manifestID := fctl.GetString(cmd, "manifest-id") + if manifestID == "" { + return nil, fmt.Errorf("manifest-id is required") } - version, err := apiClient.ReadVersion(cmd.Context(), id) + + version := fctl.GetString(cmd, "version") + + resp, err := apiClient.ReadManifestVersion(cmd.Context(), manifestID, version) if err != nil { return nil, err } - c.store.ConfigurationVersion = version.AppVersionResponse.Data + c.store.ManifestVersion = resp.ManifestVersionResponse.Data return c, nil } -func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { - pterm.DefaultSection.Println("Version") +func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { + pterm.DefaultSection.Println("Manifest Version") items := []pterm.BulletListItem{ - {Level: 0, Text: fmt.Sprintf("Id: %s", c.store.ConfigurationVersion.ID)}, - {Level: 0, Text: fmt.Sprintf("AutoRunQueue: %t", c.store.ConfigurationVersion.AutoQueueRuns)}, - {Level: 0, Text: fmt.Sprintf("Status: %s", c.store.ConfigurationVersion.Status)}, - {Level: 0, Text: fmt.Sprintf("Error: %s", c.store.ConfigurationVersion.Error)}, - {Level: 0, Text: fmt.Sprintf("ErrorMessage: %s", c.store.ConfigurationVersion.ErrorMessage)}, + {Level: 0, Text: fmt.Sprintf("Manifest ID: %s", c.store.ManifestID)}, + {Level: 0, Text: fmt.Sprintf("Version: %s", strconv.FormatInt(c.store.Version, 10))}, + {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.CreatedAt)}, + } + + if c.store.Content != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Content: %s", *c.store.Content)}) } if err := pterm. @@ -93,5 +99,6 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { Render(); err != nil { return err } + return nil } diff --git a/cmd/cloud/apps/root.go b/cmd/cloud/apps/root.go index 208b9d13..7bc1c024 100644 --- a/cmd/cloud/apps/root.go +++ b/cmd/cloud/apps/root.go @@ -5,9 +5,9 @@ import ( "github.com/spf13/cobra" - "github.com/formancehq/fctl/v3/cmd/cloud/apps/runs" + "github.com/formancehq/fctl/v3/cmd/cloud/apps/deployments" + "github.com/formancehq/fctl/v3/cmd/cloud/apps/manifests" "github.com/formancehq/fctl/v3/cmd/cloud/apps/variables" - "github.com/formancehq/fctl/v3/cmd/cloud/apps/versions" fctl "github.com/formancehq/fctl/v3/pkg" ) @@ -34,9 +34,8 @@ func NewCommand() *cobra.Command { NewCreate(), NewDelete(), NewShow(), - NewDeploy(), - runs.NewCommand(), - versions.NewCommand(), + deployments.NewCommand(), + manifests.NewCommand(), variables.NewCommand(), ), ) diff --git a/cmd/cloud/apps/show.go b/cmd/cloud/apps/show.go index dfb29b40..65523320 100644 --- a/cmd/cloud/apps/show.go +++ b/cmd/cloud/apps/show.go @@ -9,13 +9,13 @@ import ( "github.com/spf13/cobra" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" fctl "github.com/formancehq/fctl/v3/pkg" ) type Show struct { components.App - State components.State } type ShowCtrl struct { @@ -26,8 +26,7 @@ var _ fctl.Controller[*Show] = (*ShowCtrl)(nil) func newShowStore() *Show { return &Show{ - App: components.App{}, - State: components.State{}, + App: components.App{}, } } @@ -69,23 +68,19 @@ func (c *ShowCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, erro if id == "" { return nil, fmt.Errorf("id is required") } - app, err := apiClient.ReadApp(cmd.Context(), id) + + app, err := apiClient.ReadApp(cmd.Context(), id, []operations.ReadAppInclude{operations.ReadAppIncludeState}) if err != nil { return nil, err } c.store.App = app.AppResponse.Data - stateVersion, err := apiClient.ReadAppCurrentStateVersion(cmd.Context(), id) - if err == nil { - c.store.State = stateVersion.ReadStateResponse.Data - } - return c, nil } func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { - if c.store.State.Stack != nil { + if c.store.App.State != nil && c.store.App.State.Stack != nil { _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) if err != nil { return err @@ -101,7 +96,7 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { } if consoleURL := info.GetConsoleURL(); consoleURL != nil { - pterm.Info.Printfln("View stack in console: %s/%s/%s?region=%s", *consoleURL, organizationID, c.store.State.Stack["id"], c.store.State.Stack["region_id"]) + pterm.Info.Printfln("View stack in console: %s/%s/%s?region=%s", *consoleURL, organizationID, c.store.App.State.Stack["id"], c.store.App.State.Stack["region_id"]) } } @@ -110,12 +105,10 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { items := []pterm.BulletListItem{ {Level: 0, Text: fmt.Sprintf("ID: %s", c.store.App.ID)}, {Level: 0, Text: fmt.Sprintf("Name: %s", c.store.App.Name)}, - {Level: 0, Text: fmt.Sprintf("Run Status: %s", func() string { - if c.store.App.CurrentRun == nil { - return "N/A" - } - return c.store.App.CurrentRun.Status - }())}, + } + + if c.store.App.StackID != nil { + items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Stack ID: %s", *c.store.App.StackID)}) } if err := pterm. @@ -126,24 +119,24 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { return err } - if c.store.State.Stack != nil { + if c.store.App.State != nil && c.store.App.State.Stack != nil { pterm.DefaultSection.Println("State") - items = []pterm.BulletListItem{} + stateItems := []pterm.BulletListItem{} - for k, v := range c.store.State.Stack { + for k, v := range c.store.App.State.Stack { if v == nil { continue } - items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("%s: %s", k, v)}) + stateItems = append(stateItems, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("%s: %s", k, v)}) } - slices.SortFunc(items, func(a, b pterm.BulletListItem) int { + slices.SortFunc(stateItems, func(a, b pterm.BulletListItem) int { return strings.Compare(a.Text, b.Text) }) if err := pterm. DefaultBulletList. - WithItems(items). + WithItems(stateItems). WithWriter(cmd.OutOrStdout()). Render(); err != nil { return err diff --git a/cmd/cloud/apps/versions/archive.go b/cmd/cloud/apps/versions/archive.go deleted file mode 100644 index 1685f543..00000000 --- a/cmd/cloud/apps/versions/archive.go +++ /dev/null @@ -1,81 +0,0 @@ -package versions - -import ( - "fmt" - "io" - - "github.com/spf13/cobra" - - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" - - fctl "github.com/formancehq/fctl/v3/pkg" -) - -type Archive []byte - -type ArchiveCtrl struct { - store Archive -} - -var _ fctl.Controller[Archive] = (*ArchiveCtrl)(nil) - -func newArchiveStore() Archive { - return []byte{} -} - -func NewArchiveCtrl() *ArchiveCtrl { - return &ArchiveCtrl{ - store: newArchiveStore(), - } -} - -func NewArchive() *cobra.Command { - return fctl.NewCommand("show-archive", - fctl.WithShortDescription("Archive versions for an app"), - fctl.WithStringFlag("id", "", "App ID"), - fctl.WithController(NewArchiveCtrl()), - ) -} - -func (c *ArchiveCtrl) GetStore() Archive { - return c.store -} - -func (c *ArchiveCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { - _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) - if err != nil { - return nil, err - } - - _, apiClient, err := fctl.NewAppDeployClientFromFlags( - cmd, - relyingParty, - fctl.NewPTermDialog(), - profileName, - *profile, - ) - if err != nil { - return nil, err - } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") - } - versions, err := apiClient.ReadVersion(cmd.Context(), id, operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationGzip)) - if err != nil { - return nil, err - } - defer versions.TwoHundredApplicationGzipResponseStream.Close() - - data, err := io.ReadAll(versions.TwoHundredApplicationGzipResponseStream) - if err != nil { - return nil, err - } - c.store = data - return c, nil -} - -func (c *ArchiveCtrl) Render(cmd *cobra.Command, args []string) error { - fmt.Println(string(c.store)) - return nil -} diff --git a/cmd/cloud/apps/versions/manifest.go b/cmd/cloud/apps/versions/manifest.go deleted file mode 100644 index 6bc411c7..00000000 --- a/cmd/cloud/apps/versions/manifest.go +++ /dev/null @@ -1,75 +0,0 @@ -package versions - -import ( - "fmt" - "io" - - "github.com/spf13/cobra" - - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" - - fctl "github.com/formancehq/fctl/v3/pkg" -) - -type ManifestCtrl struct { - store any -} - -var _ fctl.Controller[any] = (*ManifestCtrl)(nil) - -func NewManifestCtrl() *ManifestCtrl { - return &ManifestCtrl{ - store: nil, - } -} - -func NewManifest() *cobra.Command { - return fctl.NewCommand("show-manifest", - fctl.WithShortDescription("Show the manifest for an app version"), - fctl.WithStringFlag("id", "", "App ID"), - fctl.WithController(NewManifestCtrl()), - ) -} - -func (c *ManifestCtrl) GetStore() any { - return c.store -} - -func (c *ManifestCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, error) { - _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) - if err != nil { - return nil, err - } - - _, apiClient, err := fctl.NewAppDeployClientFromFlags( - cmd, - relyingParty, - fctl.NewPTermDialog(), - profileName, - *profile, - ) - if err != nil { - return nil, err - } - id := fctl.GetString(cmd, "id") - if id == "" { - return nil, fmt.Errorf("id is required") - } - versions, err := apiClient.ReadVersion(cmd.Context(), id, operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationYaml)) - if err != nil { - return nil, err - } - defer versions.TwoHundredApplicationYamlResponseStream.Close() - data, err := io.ReadAll(versions.TwoHundredApplicationYamlResponseStream) - if err != nil { - return nil, err - } - - c.store = string(data) - return c, nil -} - -func (c *ManifestCtrl) Render(cmd *cobra.Command, args []string) error { - fmt.Println(c.store) - return nil -} diff --git a/internal/deployserverclient/.speakeasy/gen.lock b/internal/deployserverclient/.speakeasy/gen.lock index 4cde509a..dc96fbb0 100644 --- a/internal/deployserverclient/.speakeasy/gen.lock +++ b/internal/deployserverclient/.speakeasy/gen.lock @@ -1,21 +1,20 @@ lockVersion: 2.0.0 id: 12df0dd4-09cf-49f5-8116-53c77b28ba01 management: - docChecksum: c7e98d8b5bc9be6f81f0eeed1f3a5870 + docChecksum: ee21a5f5456f3f2188ed953ae3ef8494 docVersion: 0.1.0 speakeasyVersion: 1.759.2 generationVersion: 2.869.23 - releaseVersion: 0.0.1 - configChecksum: ba58a7e3622a973527bb800387385db5 + releaseVersion: 0.1.0 + configChecksum: 0445386bbafa86450656df7324d2976d persistentEdits: - generation_id: 401ab3a5-1eee-4de9-afad-3bc82ced2790 - pristine_commit_hash: 292db5daa074a2c97f651a9e43b687cc06b80421 - pristine_tree_hash: e1516d32bb2dec50c5ed668f769e5c9dd3bfa3e2 + generation_id: 8a99ae7c-50e5-4e11-89b3-0ab5a6df74f8 + pristine_commit_hash: 8672d65ed91534e68c9ae2097ed5580ce6563cc6 + pristine_tree_hash: 8f8f663a8535667ebc4ef9fb30ad2d251692af17 features: go: acceptHeaders: 2.81.2 additionalDependencies: 0.1.0 - additionalProperties: 0.1.2 core: 3.13.40 defaultEnabledRetries: 0.2.0 devContainers: 2.90.0 @@ -25,7 +24,6 @@ features: globalSecurityCallbacks: 0.1.0 globalServerURLs: 2.83.1 intellisenseMarkdownSupport: 0.1.0 - nullables: 0.2.1 responseFormat: 0.1.2 retries: 2.84.2 sdkHooks: 0.3.0 @@ -49,40 +47,40 @@ trackedFiles: pristine_git_object: e6a994416d0f527912d2d272e2583458f4fc9bcb USAGE.md: id: 3aed33ce6e6f - last_write_checksum: sha1:68c17e008e2e932f050412061e71c13887f3166a - pristine_git_object: 7d5b93003c9a9960e3c73c77e63485c123735ae2 + last_write_checksum: sha1:bbacdb3bf345353aefe798258bf788687afab777 + pristine_git_object: eb58123de9ffa74878d22ed28cc871ffefdc7ca6 deployserver.go: id: 4e88cb1c88d3 - last_write_checksum: sha1:6355e1c2c6bbd4571b16db47b164221f81abd033 - pristine_git_object: 053900e8b2c72794c7e28cc7288b1ab1f8ec3d40 + last_write_checksum: sha1:8ecfff0bcfc8fefda875b20771a042dfd9197117 + pristine_git_object: 6f3c1ca2ca0244de5a45cf670edc59ba799d9292 + docs/models/apierrors/error.md: + id: 7c6e7719d689 + last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b + pristine_git_object: 5450343d4870b85f53cb47ab9190928cf72fb86f docs/models/components/app.md: id: a31b0d7743a7 - last_write_checksum: sha1:809583baf0442c12bf75572352cf971c9829cd36 - pristine_git_object: a22cba38ec4d6ac643c4d992ee809f8b80d3eaaf - docs/models/components/application.md: - id: eaa211cc7a8e - last_write_checksum: sha1:970bd87a5ca3b063e55ebc0125238be29681412e - pristine_git_object: ff0d66292a48d55b546a2fd83224b81477ab4524 + last_write_checksum: sha1:247e676731d167fc1e4153bb383c48fcb356582d + pristine_git_object: 579a521cb8e58906bc5c96f80d87e2456d77c43b docs/models/components/appresponse.md: id: d91756763bd8 last_write_checksum: sha1:bc1cb4578672a35de623e2c851eb3cd7ac1ef282 pristine_git_object: 4b41a7e872fa8e853f9b1121498b03f2c9ff7484 - docs/models/components/appversionresponse.md: - id: a7fbfee5e7e9 - last_write_checksum: sha1:f2afe00b929df2f3a047fe3eebfb4aa395fe7979 - pristine_git_object: 0d1545831463f0e6b819cb572b7295f7a2480d1f - docs/models/components/configurationversion.md: - id: fbbe6f7ab145 - last_write_checksum: sha1:c9af04b6508edc467b37187a8eb88d3d80f9a133 - pristine_git_object: 66bd7ff689c656d1350c4cbf6e435c830b5dbccf - docs/models/components/connector.md: - id: c3e2692bb99b - last_write_checksum: sha1:98399c6cd09c8dc96792d5ee2e5cd9b6119658d5 - pristine_git_object: fce666c8269bac8aaa679179fe1d5045651eced2 docs/models/components/createapprequest.md: id: f64ccea218c9 - last_write_checksum: sha1:2d8488fa5d6828d6d95b56f769cf76fe4b70cb9d - pristine_git_object: 5bc2c5c9efedb243ffebdcf592aec214fee2db6a + last_write_checksum: sha1:8281f54cb47b92d3af4f645c6029dd2941ea7572 + pristine_git_object: 8d2ae919f0a7e732719ebf8ed5b29c959c68a54b + docs/models/components/createdeploymentrequest.md: + id: f4fbf8bda1d8 + last_write_checksum: sha1:26fa217edfdff939738d3f03c714a2886772dc5d + pristine_git_object: dc6b0ccc3ad1e46668af053d52a0f30a09c0c4f6 + docs/models/components/createmanifestresponse.md: + id: 2a7b75671c99 + last_write_checksum: sha1:e4ca70d53026357309f5fda874e961576469dd27 + pristine_git_object: 50f2431438296e07de096d4bea3c2dc01d1a5ffe + docs/models/components/createmanifestresponsedata.md: + id: bf8a9aa0fb9d + last_write_checksum: sha1:2d487d881c37e3f1d3cb2b0b3d8dd2370bfc3f68 + pristine_git_object: dd1916f2dcb20050e33f11acfee12ba898728bc1 docs/models/components/createvariablerequest.md: id: 1656d1204270 last_write_checksum: sha1:650be824e43882247b0beb008425e05b8182f946 @@ -91,14 +89,18 @@ trackedFiles: id: 77cc5c4876b1 last_write_checksum: sha1:6f884cdcec2003eaa5bf016cc521b269869a0628 pristine_git_object: 82ba7c122ddd49378c9e1880cde26477645bb5ae + docs/models/components/deploymentresource.md: + id: cdd39d4f1853 + last_write_checksum: sha1:24d0d8ea7c4713a56c5002266ed310a5dbe48ea4 + pristine_git_object: 00ee3a59b7610b57f98608e6d0871101bfb17020 + docs/models/components/deploymentresponse.md: + id: 30bd20db7b83 + last_write_checksum: sha1:5a7aab41fc5ad3264cc5ecc0a7a4e32d5fd3b2e3 + pristine_git_object: e5a1bb0f3398f1826e9712997c145579c6151784 docs/models/components/diagnostic.md: id: 201e27a8a975 last_write_checksum: sha1:317229cc87d1448ed825e407aca88c0adb7442b6 pristine_git_object: 0d90d8be9c298a731d3f1fa6e5866ce0430960a3 - docs/models/components/dotself.md: - id: 90400d31ccf5 - last_write_checksum: sha1:5794f003e20bfcab4f50501881214e2dae5c24e7 - pristine_git_object: c0862a7dfec62cc61cce31ea3e3f54ea6f94df90 docs/models/components/error.md: id: 8ccbea40d025 last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b @@ -107,10 +109,6 @@ trackedFiles: id: 728948c70168 last_write_checksum: sha1:7c40945dac218ce5e5e11e7c907d27a3ea14c417 pristine_git_object: df1fdd59f3c85e4ba70573ff7954b12ac1d33d08 - docs/models/components/ledger.md: - id: caca547955cc - last_write_checksum: sha1:1fcc81fee7ae6662ca8d4c5dfcc491c79835d6a0 - pristine_git_object: cc0f331e8da83acf62f3ad9a79efd9f37b2896e9 docs/models/components/listappsresponse.md: id: e0c61f1197fc last_write_checksum: sha1:913aa9678e2c21b99e8623583272fbde0e36325d @@ -119,42 +117,54 @@ trackedFiles: id: d692cd2a8694 last_write_checksum: sha1:f78fc9143a13813cd301a43b30cac5ac1bad5095 pristine_git_object: 8a07dd0a615eb99b8df520e59dea77b5e263989d - docs/models/components/listrunsresponse.md: - id: 1d029776d9f4 - last_write_checksum: sha1:8a1513e66b60fa351cabba727d7638fcc6d9f4cc - pristine_git_object: 8751277e4328128453533c5fd45dccd6bed80cc6 - docs/models/components/listrunsresponsedata.md: - id: 60b6cc35e1ad - last_write_checksum: sha1:a13d5fe6858bb00a9409cc3d98ec441b658d77ed - pristine_git_object: d29d6c4d5315b117030b5e945f2ed4c772817262 - docs/models/components/listversionsresponse.md: - id: f82b651e7159 - last_write_checksum: sha1:328a745f8ee1ec2021efe8ded9354bd89aaf3af7 - pristine_git_object: 5c0505ae4e68e4ffe89c25493a0b31559f210f5d - docs/models/components/listversionsresponsedata.md: - id: 5719195cbd31 - last_write_checksum: sha1:9766c7f1ce51bd6b361baaf7e4acb8e02cccf290 - pristine_git_object: 4da3b6ad8eff4c783448eae89eb654226ce45fc5 + docs/models/components/listdeploymentsresponse.md: + id: bd1553c8e405 + last_write_checksum: sha1:28fe41b599a6ebf838dfaf6cdad28065c0e0f616 + pristine_git_object: 3154c0e458cc5e706ffa555cb6a848bcdf9bc819 + docs/models/components/listdeploymentsresponsedata.md: + id: 1fbcb1bf6082 + last_write_checksum: sha1:4b4d7528205c4c21f81229c48dc1a509497b6940 + pristine_git_object: d6d948fca91298ecdd890f8173857cef9eed3659 + docs/models/components/listmanifestsresponse.md: + id: e34a1d20941d + last_write_checksum: sha1:05642b5f46cde4a1b8965d97c49f749b07fc9970 + pristine_git_object: ffc6e180d9b95ef9e7c707118b20b0974ed77a12 + docs/models/components/listmanifestsresponsedata.md: + id: 6f25d9ec5a2d + last_write_checksum: sha1:86f2d4b9cf24490d97ed0075e97a5d31b460f5cc + pristine_git_object: bdbe00930aa49fd8e9d11e4091a916d91e87cc52 + docs/models/components/listmanifestversionsresponse.md: + id: b038781da9cd + last_write_checksum: sha1:fdf5ac17cc4c67db490542b19739e57d1955f6ad + pristine_git_object: 90ffe672e4ef660c75ae3e01d26d07cda18b8a9f + docs/models/components/listmanifestversionsresponsedata.md: + id: d76d1e1a29cb + last_write_checksum: sha1:707d98c3872db195d4c2f2c9b41b4a70e4041104 + pristine_git_object: f5f82a0eeb8ccfbd86e0a782fcf4f653fca3547b docs/models/components/log.md: id: e1037d748e03 last_write_checksum: sha1:dad2f73e07553382b0ee972eebdb04229160e357 pristine_git_object: 79e08b9c5265af867fa20da18fcdfdf66565238a - docs/models/components/payments.md: - id: 0f85d60a19d0 - last_write_checksum: sha1:70e1b495f105bee819b57e4c02d92dcc5a00581e - pristine_git_object: 2f9fcb618fa0deb1d19b04fe336f528887aff47d - docs/models/components/pool.md: - id: 4b21215a5609 - last_write_checksum: sha1:0ae7cd84b0b077eaf9c6cb779afe88b9d74b740f - pristine_git_object: d9dc49148747feb8c9749b333ce44d6b3eae66fa + docs/models/components/manifest.md: + id: ab82543dfdb2 + last_write_checksum: sha1:0b0d14cedff0503de24c660fe099b2697f0f02b2 + pristine_git_object: b0e4e353d0778117fb718aa579fd1befdae712fd + docs/models/components/manifestresponse.md: + id: 7599449e468c + last_write_checksum: sha1:80cd053266a1bfea9c64302b2bc5aafdbd2b7ea2 + pristine_git_object: 30a0ca2dbd06afc370502ab1d5d4b59d04fbe884 + docs/models/components/manifestversion.md: + id: 2e7a2a66eda5 + last_write_checksum: sha1:642d679209158616f7ddac2023dcddfbea3b9533 + pristine_git_object: 608ea35c773d2b382929c84bd41e199b18c73624 + docs/models/components/manifestversionresponse.md: + id: eb5b04b5ffcd + last_write_checksum: sha1:ab09b1be64e1f96be13d52b60d95cd13c306199d + pristine_git_object: fe14fcbdf85fca4009fceff944c4a6e8899ecbf8 docs/models/components/readlogsresponse.md: id: ec725d9b453a last_write_checksum: sha1:e057941f9e846b32c1f3b7292f0d7ac7f2584d3f pristine_git_object: 01c385db354d9b90ea38b029551a3bbe27ba6415 - docs/models/components/readstateresponse.md: - id: 99c7113e1f4c - last_write_checksum: sha1:921c94e96eca43c892c9990e3e6d29eb46ce388d - pristine_git_object: 9562394d8ff7d2b0aff07a8c5303153ff17d306e docs/models/components/readvariablesresponse.md: id: 9f63356b6b86 last_write_checksum: sha1:c67b43d758ecd9e97bd4340a2ca74cebded4dd87 @@ -163,66 +173,18 @@ trackedFiles: id: 40c212b90527 last_write_checksum: sha1:9a6983e9988c7be9bd5a855648c1562e9f154e0b pristine_git_object: a8e3d430bcfa588e9f4969e8a8f1ffd24a320a10 - docs/models/components/reconciliation.md: - id: b25325e5d84b - last_write_checksum: sha1:27a055002407b877bb0708ce659d6a248522db08 - pristine_git_object: 2dd49f918f2bc346fdb4ba62022dbe8f578badc1 - docs/models/components/reconciliationledger.md: - id: c9321f8d14a1 - last_write_checksum: sha1:f9a982b46b5c2c95ea6485eaaf3281c663921cf1 - pristine_git_object: 9533b09c1adb569df0a5dcd80e72d4ce6b4abb76 - docs/models/components/reconciliationpolicy.md: - id: 548b47bcf09f - last_write_checksum: sha1:4762e2da2a31d7f533e0fbbf8b06ef2b6679ce96 - pristine_git_object: f27b97c341c1d586b95ba561c7e4c9a4f28ce9fc - docs/models/components/regionselector.md: - id: 9fb20e1b21b3 - last_write_checksum: sha1:077dfd13cc012e65b1c9ffd0b804ab2a2704378f - pristine_git_object: f139fa7441b1a4cbaf814a40a0d0f0211840094a - docs/models/components/run.md: - id: 1e2245374c1c - last_write_checksum: sha1:666fd46a159b439b81770d8cb58d6dc077c052c7 - pristine_git_object: b54edaa2bd58dfff4aeaebdd624f19618ad10699 - docs/models/components/runresponse.md: - id: 8e9357e78010 - last_write_checksum: sha1:5224699dc1b74970f9ab18749048d4f0e00e90a8 - pristine_git_object: cf19aff0640d8665feb362684cbd14dd30c9a377 - docs/models/components/stack.md: - id: 18f72a519773 - last_write_checksum: sha1:35802e911e51cb65f04c564c895b20df0642c991 - pristine_git_object: eba39fffa213e676bb7c5bb994cde0a88956d743 docs/models/components/state.md: id: 441de3ea6229 last_write_checksum: sha1:0ee3cca8c7a402fc1aa36f5e3f8f75d277acc38c pristine_git_object: 1cf3a814d7870e07ddc02391e6be7ce0c29762c2 - docs/models/components/status.md: - id: e26b2fe7f53e - last_write_checksum: sha1:23037d5370fd37594359b6bc4cbd229ebb6e835c - pristine_git_object: 9ae23ca0fd85cdd4dcf724015cb81376a8fbd990 docs/models/components/updateapprequest.md: id: 405074ca5d37 - last_write_checksum: sha1:879ca1e57318e56d07bb0fbe4cc492a149eb2c63 - pristine_git_object: c5cfdb62650f5deb3940dd5faada77367026b092 - docs/models/components/v2chartaccountmetadata.md: - id: 30177efb9960 - last_write_checksum: sha1:bc449c550971b691e6dbff590bc2e5bb7c2f0b07 - pristine_git_object: 2c764179ae9a1d4b4b247d1d61b22e77cd70842d - docs/models/components/v2chartaccountrules.md: - id: daae4f8233b5 - last_write_checksum: sha1:d169735f4e3fc2f0c9ffbda8814db15a9a255507 - pristine_git_object: b79d01a9c3275be88cd13a8c2a0234a1d138f4dd - docs/models/components/v2chartsegment.md: - id: 2d79094ea76c - last_write_checksum: sha1:bad8f31997ce2908f164c00383facfde50e3ebe2 - pristine_git_object: 7358c3d3eecb1958741aba8f741b56925827bc37 - docs/models/components/v2schemadata.md: - id: 0d905b454527 - last_write_checksum: sha1:3225f89bbe8a8bf5d280132150c2a42dc1186ea4 - pristine_git_object: ace0af48b25768eef6b9580dfbff650cb26c0366 - docs/models/components/v2transactiontemplate.md: - id: cd0d1d22daaa - last_write_checksum: sha1:864fed96d500e443f0cd1bd2e2b8a9ef10ea66be - pristine_git_object: a11f6f3bfb7e38c3310affa8868a461e0a47c2f4 + last_write_checksum: sha1:d184f58db2351ccc0fa24f7a7606d63ec53984d4 + pristine_git_object: 61637f46a88b8bfa9bea421bbfab25668bfa47ea + docs/models/components/updatemanifestrequest.md: + id: 0ba0a64236c1 + last_write_checksum: sha1:ade50162ea19a7b5b5f609cf35b9abe6ccde6823 + pristine_git_object: 2df4cefaf6f3c0196b30afce2d6e1b54f58ea3c8 docs/models/components/variable.md: id: 106f069148a0 last_write_checksum: sha1:d276aea6e652e1f698b6e21029c0fc0d98874e83 @@ -231,10 +193,6 @@ trackedFiles: id: 41fd2f11ae57 last_write_checksum: sha1:33a510fe028f18cde19f69ada0334cddfdf263a1 pristine_git_object: e6528690bf3b5e499bccc351abb0657dc36f7b35 - docs/models/components/webhook.md: - id: a698fffd6586 - last_write_checksum: sha1:5f5755013ec2719e06342ff03a4e9fc5edbb6437 - pristine_git_object: 32e7fd8559f5ee52aef65d094b49044d3b813715 docs/models/operations/createappresponse.md: id: 06821c964f8b last_write_checksum: sha1:357317e66e4b7703f26de3777fc0e3438b520cf6 @@ -247,6 +205,42 @@ trackedFiles: id: c22ab459449d last_write_checksum: sha1:2997e3902e9b95ad72de1a228b189e7e4256801c pristine_git_object: 07452bcd2cc549c56e03ecc0d7cb3331351df8f9 + docs/models/operations/createdeploymentrawrequest.md: + id: ea63ae5dcab0 + last_write_checksum: sha1:1aeec59fe968426fa62c5bba7504c025fe9fb60a + pristine_git_object: c91702f162d2d8ba5438d853b923cbb2f7e5959c + docs/models/operations/createdeploymentrawresponse.md: + id: 2c6b707f9b1b + last_write_checksum: sha1:c6f967696062f9b699a0383ba5dcb150e6f4e521 + pristine_git_object: 5a5384b33004ea72c8730fc81b35d9e626ae7bc0 + docs/models/operations/createdeploymentrequest.md: + id: 79e21a5a08cb + last_write_checksum: sha1:afd41fd8b45a8a9ea975034b3bf77ce05ce21aa3 + pristine_git_object: 9b672d38d606232006ca85cf62a2b1cf7481eaa2 + docs/models/operations/createdeploymentresponse.md: + id: 0ca0d30ebb83 + last_write_checksum: sha1:02db410d2fb68c69402305bc027eab8144a2652a + pristine_git_object: d6be343012c94546e5b4c47fe8a3820c0b71a52a + docs/models/operations/createmanifestrawrequest.md: + id: 9c0f7a9c45fc + last_write_checksum: sha1:eb0d79a298a2f0ce9ea151d142eb541ac985233a + pristine_git_object: 878fcaf0ee9878454ccda3bdcf8cb240c591e541 + docs/models/operations/createmanifestrawresponse.md: + id: 9f74a7d48f44 + last_write_checksum: sha1:f19aecd730aa1dd6c522ef982d39767ee80014d0 + pristine_git_object: 3e8b398ef51b79f60250ec70fea3fcd418fa90fd + docs/models/operations/createmanifestrequest.md: + id: 00ac20b869e1 + last_write_checksum: sha1:641b55f717306cb3b6dc43ebe466f53fd31effe2 + pristine_git_object: fc43bc11ea647ca0a25b407d1a301a0e0794c872 + docs/models/operations/createmanifestrequestbody.md: + id: be4690911b9f + last_write_checksum: sha1:a28556106cd526daf14d0784468bd8deefca9c40 + pristine_git_object: 6089e69cc8f0bacf3e67cc1de9cd7227122bb7fa + docs/models/operations/createmanifestresponse.md: + id: a7e3bf8362e6 + last_write_checksum: sha1:9de86374ce0bfe849f090c0ed0c309554ce7ce3f + pristine_git_object: ea064c638fde2204a9e737ad9cb60f93390fe312 docs/models/operations/deleteapprequest.md: id: 2514a7504692 last_write_checksum: sha1:6cb69f5042032d8061fa797e849c73f8945fe8ca @@ -263,62 +257,82 @@ trackedFiles: id: dcb2ef841938 last_write_checksum: sha1:d0801eb3f8fb163d540d5bffb917a9942ce707e2 pristine_git_object: 6a2eb11056337dcb97c23a79ae38149d6e85fab8 - docs/models/operations/deployappconfigurationrawrequest.md: - id: cd0d8954ada3 - last_write_checksum: sha1:0cd7533d820573cb290f91ae4b557bee5756e49f - pristine_git_object: 1fff1b332771b40a0fccb646bec5dd89ce4e5537 - docs/models/operations/deployappconfigurationrawresponse.md: - id: 4914a94f8820 - last_write_checksum: sha1:3a0247f3bc8058126adc6d3adfc1e2e821b6d329 - pristine_git_object: 904ecb0a001344fae56640750d1747f0d90b1431 - docs/models/operations/deployappconfigurationrequest.md: - id: ffb4a188e86d - last_write_checksum: sha1:d1e37c37b0786473a7905cde2bfd14470336fa02 - pristine_git_object: ed26f2936fcbd5bd8d5fe221f2f29dad1c8dad8d - docs/models/operations/deployappconfigurationresponse.md: - id: 5e79df6fc3f3 - last_write_checksum: sha1:c0a96e35ec668fd1a50e00b5a71b150365e377d2 - pristine_git_object: 46edd9bcfcd05a6f1a3e3c6e2915f858f6c6bd63 - docs/models/operations/from.md: - id: b0ad40ce8637 - last_write_checksum: sha1:fdec59c47c541cc589e85734bfa5fe690e4e3db8 - pristine_git_object: c334a966500e44a574bb1b4c729ea2186b9295f7 + docs/models/operations/deletemanifestrequest.md: + id: b942f2d5560f + last_write_checksum: sha1:183ec89c4a6143c58cf43fe71043102c4d379a21 + pristine_git_object: 26341ed15996027d533febb5984e8a67263a4379 + docs/models/operations/deletemanifestresponse.md: + id: 7b9e8dfc4e3e + last_write_checksum: sha1:aec0c2e4f2c0be4ebedd4a65d1ae968b9fb4f753 + pristine_git_object: e8a81fae4aab84de1a75fff7223f70da5d88c2d9 docs/models/operations/listappsrequest.md: id: 5efe8d3cde07 - last_write_checksum: sha1:caace7e250df2baa4ba49427a303601c7316f1dd - pristine_git_object: 3316363e3d0cd6ceb212b81c611cf03bf12d7f67 + last_write_checksum: sha1:738a4635f906b469db0206d6c997bce005b4009d + pristine_git_object: f78151ca352e2a9685b3a0ba260a722151ec07b3 docs/models/operations/listappsresponse.md: id: 2c4aaa805a52 last_write_checksum: sha1:54f047b67d567b402899316ba8dc2bae26889df4 pristine_git_object: 4da0499356a0ebed5078ddfcfb4d5541fb92b223 + docs/models/operations/listdeploymentsrequest.md: + id: 854523666c28 + last_write_checksum: sha1:915f97aeace5bc98f63d3694b0f59c055aa1a0d2 + pristine_git_object: 5fc4d1bbc310678e94dbb68ba59938000544c068 + docs/models/operations/listdeploymentsresponse.md: + id: b3b1e4f8a3b8 + last_write_checksum: sha1:cfcd3928517093a37efd9602f83e8f7020a69599 + pristine_git_object: cc0444002ab9aa126d0cb3dc0eba3c4484128915 + docs/models/operations/listmanifestsrequest.md: + id: 62d8ae59d357 + last_write_checksum: sha1:ad0b1936f3d53a037837b293a3f162ec372d5a5c + pristine_git_object: ada5ef33d29878328aadb6546feb91c000199129 + docs/models/operations/listmanifestsresponse.md: + id: 44929c2f905b + last_write_checksum: sha1:c6302e89d1e353c091cde1af1e9c2dabb23565c1 + pristine_git_object: 7bb7f793707b0d54e26d1747901606391fb28594 + docs/models/operations/listmanifestversionsrequest.md: + id: 533cb7d27434 + last_write_checksum: sha1:a0f5f971d0ea9a3dab0e30023bf8ff9075481356 + pristine_git_object: 05fdaa0e8522c10b2f3af35e63c18b6b39952fcc + docs/models/operations/listmanifestversionsresponse.md: + id: dc6be6e3c23d + last_write_checksum: sha1:d6a291ff40460b4d23cf3a7f68f5c2fb564db1ca + pristine_git_object: 0349721934edc32307e5285695b66d17c340872f docs/models/operations/option.md: id: 2ac1bd52a5fb last_write_checksum: sha1:bcfbc3cd4a67cf8c276f1508b8ffee0ee5bb45ad pristine_git_object: fe22ef08c679fa6cf8f70c453405db97a3e73c80 - docs/models/operations/readappcurrentstateversionrequest.md: - id: ec5736e4b230 - last_write_checksum: sha1:32e4deb3613cd9d1335ca4550012fa166ae4ce14 - pristine_git_object: d505e3a111d79bc8dd96f7ce86a92de4b02e7638 - docs/models/operations/readappcurrentstateversionresponse.md: - id: 7f46e9d1315e - last_write_checksum: sha1:d67508acd7fc69f8ed14ce8a06516abb6abe7bb5 - pristine_git_object: f2b7ce5e4cc8909de15d85e3f3eb249beeb34434 + docs/models/operations/pushmanifestversionrawrequest.md: + id: fc1c2faac987 + last_write_checksum: sha1:f404defcc70c8b6dcb819dfbb63cadaf5dbc4809 + pristine_git_object: a21204cf28b22c88657a4fdabd6d2c1849a7550b + docs/models/operations/pushmanifestversionrawresponse.md: + id: 8e19d2bbdebe + last_write_checksum: sha1:42c73736637c6253ea33c10626d81a9d8f19868c + pristine_git_object: 0985bb7c163ae85312c2176af9982e25729649fc + docs/models/operations/pushmanifestversionrequest.md: + id: 0e437a001784 + last_write_checksum: sha1:10b1465859520d840ff12e567f335fae3d33568f + pristine_git_object: dd1aab9d8253114ab284118c8357803585af63a0 + docs/models/operations/pushmanifestversionrequestbody.md: + id: 529bf30dc215 + last_write_checksum: sha1:4098dfb2722b817a742dc8333b495b98314b9248 + pristine_git_object: 520019e88698de4b25bd9771b104c24bb6e550bb + docs/models/operations/pushmanifestversionresponse.md: + id: 6d1d879fcf12 + last_write_checksum: sha1:27da301023e0c55b1316194a4d94dfbe23be4e61 + pristine_git_object: f1e2e08b597fa4fd9248907d8f63e4fd0bcee1ec + docs/models/operations/readappinclude.md: + id: 666467dbec9f + last_write_checksum: sha1:73d9cf6affda33099b60084d2bb8fde31e13360e + pristine_git_object: 5f20740f220a8cd1fef84fb55deffc75635e0028 docs/models/operations/readapprequest.md: id: 87dd15e3966c - last_write_checksum: sha1:f4680b3cbb6e1110d079c97bddd428ea7d7191c5 - pristine_git_object: 7469fa0524b7317076cc1bc88f6e053cbce9feed + last_write_checksum: sha1:5f5c2f499d72fea65f8f3a29d819b55b17ef67e7 + pristine_git_object: 86116ae7bff6b3043e338b0b48d1d9da42585e53 docs/models/operations/readappresponse.md: id: 516dad5c8317 last_write_checksum: sha1:40f059afc4ded4284b1318ea86c9d6ed9d281d25 pristine_git_object: b82b6c789db1b0f67fd3770e7d9c8c8b0ff4d41f - docs/models/operations/readapprunsrequest.md: - id: eaed81d4d43b - last_write_checksum: sha1:31ca3b7a8cc9b55a9a569f8457a8933f9dc51207 - pristine_git_object: 9dfaf1fee1ef62bef1d46faefcd2058851498554 - docs/models/operations/readapprunsresponse.md: - id: 5e7acaae3161 - last_write_checksum: sha1:79ae975345fc9538c6c1d09e299dd743a7f60398 - pristine_git_object: 05a91a03bfc133a3a18a96c4624aa0291268bf7c docs/models/operations/readappvariablesrequest.md: id: da8db5c99ce3 last_write_checksum: sha1:97fa68ea5d6123afe24cb000390c8c062ac9fb24 @@ -327,62 +341,42 @@ trackedFiles: id: cd4942c5e28a last_write_checksum: sha1:3a9135c3914273ff65e2771e62c72eb0d2702d4a pristine_git_object: 4a2ae584cc7fc046ea3eead91bf6bcfcb2bed3e0 - docs/models/operations/readappversionsrequest.md: - id: bd385dc662eb - last_write_checksum: sha1:cadaac5bfb90ffe103c49e0ea6ca53ff7c5d6d62 - pristine_git_object: 0f9658ff5492f6e9354e6fde1ba1a55b7ddb1ce4 - docs/models/operations/readappversionsresponse.md: - id: 8fe77b5a5bb2 - last_write_checksum: sha1:aeceb78d90617cb7fa775051feb5cfc44569cf9f - pristine_git_object: 6ed33516e7cb048e9279a8073f1b25128070d7fa - docs/models/operations/readcurrentappversionrequest.md: - id: f7bd5b77f296 - last_write_checksum: sha1:3faa1a021b786eaec214c45c2ab0dd4f30eec2aa - pristine_git_object: 21483ef36d7aac60265162643f4ac754a21c8aaf - docs/models/operations/readcurrentappversionresponse.md: - id: cd1a671347dd - last_write_checksum: sha1:9ca5f7e157cd6f76725ac45549de2f05a48c0150 - pristine_git_object: beb7ed138889336f7545f2f93def8ea6e0ef4835 - docs/models/operations/readcurrentrunlogsrequest.md: - id: 981e24d0a502 - last_write_checksum: sha1:7ec962d5a3d71473202ed5de0ac8ec4e23f6dd96 - pristine_git_object: db1a51bf1e72e755c637fa12087db89d46e74226 - docs/models/operations/readcurrentrunlogsresponse.md: - id: 0a2865b9ad10 - last_write_checksum: sha1:c278e8dbfddb9a2220af33436551d2d05cc72a77 - pristine_git_object: 5bd0e6e8ffb3954e3d0d8a6b1af66ef1c62877f9 - docs/models/operations/readcurrentrunrequest.md: - id: 60f964a0a446 - last_write_checksum: sha1:63a01df943dd195ec462ed25e5b91eb4a2e9cd85 - pristine_git_object: 70e92fc2cbbaed3c988b7e5cd5d9167fb472f971 - docs/models/operations/readcurrentrunresponse.md: - id: 83ad8dead255 - last_write_checksum: sha1:ef7881e6c7df498fc6d352870ff34565696bc3fa - pristine_git_object: f7baf2fd2fcff15eea7d6ed2cdba94f7b2f8c1f8 - docs/models/operations/readrunlogsrequest.md: - id: db04c3bed80c - last_write_checksum: sha1:51b4f59c18598a6fab9c9652c9f4844b79e5f50c - pristine_git_object: 38e600c061aafb0e03d5dbc4c14d2bd703912216 - docs/models/operations/readrunlogsresponse.md: - id: 65ad7202de96 - last_write_checksum: sha1:8dcbc1c3a959365ef03495f9e3245b0589acd0c3 - pristine_git_object: bfe621a3db828b6666480e45116d47e9e3dbd195 - docs/models/operations/readrunrequest.md: - id: d5c426ed1f09 - last_write_checksum: sha1:12f7cd2c696a18ab75d909b69fa4e76a0211e4c5 - pristine_git_object: 70575144f3b6e1c15fbfaa1da5f66ffaaf70e138 - docs/models/operations/readrunresponse.md: - id: d38daacb1f09 - last_write_checksum: sha1:8a9336fdf077798032f8dff0f6c9a7550858542e - pristine_git_object: dda5599544bf8b4a35a9f9cc9f831a424c11a100 - docs/models/operations/readversionrequest.md: - id: 4861c19d0c9e - last_write_checksum: sha1:61bc360b2a5a9d5b6c3e44d635860029848c0a21 - pristine_git_object: 30c9ea77d620b87d1228a45fa1aa3f9ccba1ef6e - docs/models/operations/readversionresponse.md: - id: e9a7ce2fd847 - last_write_checksum: sha1:f4ef97789ad28df757c8181b43e22c326f6415c7 - pristine_git_object: af15e4fc987c0cfb6f41fc0d6cb509e180918338 + docs/models/operations/readdeploymentinclude.md: + id: 39b2bf052792 + last_write_checksum: sha1:ea03ce02fe35923c87f3253b0136137259b437b2 + pristine_git_object: 9f5f178921aeaadbe2f04e95347bf6ab8db0ca3e + docs/models/operations/readdeploymentlogsrequest.md: + id: 5ee7d0e5cf67 + last_write_checksum: sha1:d1a47b6ad4adf2c026faa535d14c024d67a29da1 + pristine_git_object: f028eaba2b067fac8e59bf80366fc37d0b94494e + docs/models/operations/readdeploymentlogsresponse.md: + id: 12268f3fcdce + last_write_checksum: sha1:968b5d645086cd919249dcc7400e82fa673d2447 + pristine_git_object: 1388ac812646ffadd823d1bb11cfc4c2228b4499 + docs/models/operations/readdeploymentrequest.md: + id: 5b96618f6491 + last_write_checksum: sha1:351adeb91ac73593b54606db1f25e3fd4321cf88 + pristine_git_object: 1311e46907a17239a80dcf20eb55867c05ecb823 + docs/models/operations/readdeploymentresponse.md: + id: 9d554c8b4f05 + last_write_checksum: sha1:73511946b7723ebca13317d42f663542a2d08ebe + pristine_git_object: 5a248012afe8bb6c2453ec1e359397d1dff3d712 + docs/models/operations/readmanifestrequest.md: + id: 91ea98d58795 + last_write_checksum: sha1:16551ee11c5cc18db61ef5bace565840261c9273 + pristine_git_object: d785ed1deea75440082ca954b41e068c5ceaa1d8 + docs/models/operations/readmanifestresponse.md: + id: e1d36c0ae15b + last_write_checksum: sha1:c8a74e60db5d8cef75ebc600229089a50311be4b + pristine_git_object: 35202fdef3970260c931526e27c74768acfcbd5c + docs/models/operations/readmanifestversionrequest.md: + id: fc96d48d85b9 + last_write_checksum: sha1:00bbd804dbee924382ff97c7f7322961cc51e081 + pristine_git_object: f917413f9384e49e31c840f4921d7ca1b7febe6c + docs/models/operations/readmanifestversionresponse.md: + id: ef7853e4d9d6 + last_write_checksum: sha1:8d353448be94ec6c8c03eb021d351ef4d7dffcca + pristine_git_object: 616ab664638b0561a50a445ac7e012b863a8bf93 docs/models/operations/updateapprequest.md: id: 8a75849387c1 last_write_checksum: sha1:7783b8e18a82e7c2ff9fb2a6ee76b3d125cbab59 @@ -391,10 +385,18 @@ trackedFiles: id: 7b8b6323a779 last_write_checksum: sha1:7d2496e58922053f42abccddb3059ab263e527cc pristine_git_object: bd285862f57bdb86d2b5b56fc222a50516ae07cf + docs/models/operations/updatemanifestrequest.md: + id: f6bf88efcf70 + last_write_checksum: sha1:ab86b7f6b4de5139ec8c707cab821f7c5b56ae4a + pristine_git_object: 0d35f2859440fe6172137d10e6f98833e47ee089 + docs/models/operations/updatemanifestresponse.md: + id: f12a75675f76 + last_write_checksum: sha1:5effe289f872924e6ad0b6c32651c1fdd28acd31 + pristine_git_object: f8b0e9ef7ee64c5c8ade8601fac272aa7909171e docs/sdks/deployserver/README.md: id: 7bbb48696892 - last_write_checksum: sha1:bcecd7f77afaf4734638b474791a0e3ce18ed641 - pristine_git_object: a0e239dc86da0b4cb1ff2e8af7f68d405c19e98e + last_write_checksum: sha1:2fc61dfc531da7caffa63b543e3dd171e155cd0b + pristine_git_object: 39622fe94581bd8457e8936673fe0744004f4514 go.mod: id: c47645c391ad last_write_checksum: sha1:ccfac949478bd60fae3010350a17ef6c9e8580bf @@ -463,30 +465,30 @@ trackedFiles: id: 4cecf27a5a54 last_write_checksum: sha1:381f21ea747ea015453c234c9489aca812e139f2 pristine_git_object: 7974d2a957da853ba871dec5f8b55062e1b6debf + models/apierrors/error.go: + id: 4b4731adf85f + last_write_checksum: sha1:7c904184238189b67c0dc9d852485fa69c993179 + pristine_git_object: 3216263c45c4b5e21766a1f164f0c0a94e1ca931 models/components/app.go: id: 9c69c824fb8f - last_write_checksum: sha1:e4560a1b1c9d492ff4f972d0e8846c1026b80198 - pristine_git_object: f3a2dfe0e05f0521834208de00d6f5df1a7361b8 - models/components/application.go: - id: d580034bf8ac - last_write_checksum: sha1:588ec17f546bb3b2a64ddafaabc67c7389317f6a - pristine_git_object: f930a1c1f6b105437c5da087e0fc71663ce04ad0 + last_write_checksum: sha1:5c99247965bdac4495e994af300d8c15a65242a1 + pristine_git_object: 5a865c0c71ea8511f07395ff527f33915b62624a models/components/appresponse.go: id: b25e95988f98 last_write_checksum: sha1:1bfd097001d33ab7ee59f46af273f580d59d1c58 pristine_git_object: 33edf7fbf66a033955dd4f47651babc06bb5426e - models/components/appversionresponse.go: - id: 2ce94b612933 - last_write_checksum: sha1:cd9055e06058113484b8bef88cde2f54c3b55ff1 - pristine_git_object: 8f5e9ef5424dcb4545a28a12d5fc72431353af4f - models/components/configurationversion.go: - id: a3c0a1673901 - last_write_checksum: sha1:3aa5ffea828eea3e96d799bfb779327001d7b7de - pristine_git_object: 6656d87459dcc258acedfd1584d54f9a06e16d26 models/components/createapprequest.go: id: 0af34a35e29f - last_write_checksum: sha1:0216d9edfcaf7adeee62ec15bef1c7e81fa899aa - pristine_git_object: b79eeb0c171af1cd1e68c1c1dd10fe071fd314ae + last_write_checksum: sha1:40d84c521b00da93908a60a88a094512e2e41518 + pristine_git_object: f8efe94841634e24768fea038a35454ac212c0b9 + models/components/createdeploymentrequest.go: + id: 22e94762a36e + last_write_checksum: sha1:b448c0624d8bc3f86f9aac036a0139b2ef86f667 + pristine_git_object: 37a6dcb6058a1fcfbbfd9191c00717d4b8532dde + models/components/createmanifestresponse.go: + id: 8a09822d66c1 + last_write_checksum: sha1:f883a1731f0716e265a7ed30378cae56dee637d3 + pristine_git_object: 4532b178146d96fc897d246eff45d623ac098558 models/components/createvariablerequest.go: id: 488ed9ed73b4 last_write_checksum: sha1:6dad11fecda3f9df54a90dc5bda33496c7ee5904 @@ -495,10 +497,14 @@ trackedFiles: id: 00d4e6ccb333 last_write_checksum: sha1:5ebf70f308832820ee08a1e7085a783eab30424b pristine_git_object: 8486f09e0ef6802ab6c10d0d0e2d0f2642166964 - models/components/dotself.go: - id: 2870397074a5 - last_write_checksum: sha1:8c6f6c7178872661af9a3908b4e413917c1dab8b - pristine_git_object: 9df4ab4af760098baa5f452b73d9099229473d1f + models/components/deploymentresource.go: + id: 07bccccda991 + last_write_checksum: sha1:f5754ea3eda1d1b9a98e5e12a1fe85a52a8a6fff + pristine_git_object: d2a95779065a5c6c53bd8958d66b3d523e658424 + models/components/deploymentresponse.go: + id: cec4476a3fd8 + last_write_checksum: sha1:3873e3a69107cbb82efbb1ea5f8a0fa5d3f6ac53 + pristine_git_object: e3b7e32d22573b892fcaf72e3512de9b7b0633b5 models/components/error.go: id: 101a721ad2e7 last_write_checksum: sha1:8a2878902488471c0f5886173385bd1762127780 @@ -507,102 +513,62 @@ trackedFiles: id: 790bad4a7abb last_write_checksum: sha1:0198fe52c644528e0ca265e95166b296b70632b4 pristine_git_object: 49b58c940ad027f8d35deb3d19a3f3ba60176296 - models/components/ledger.go: - id: 1ca559704974 - last_write_checksum: sha1:66bc8e24f5e8de909858722988f8332b0c65a1b6 - pristine_git_object: b5768087b0289314bee2c605be653e7eaae32933 models/components/listappsresponse.go: id: be17d7d20579 last_write_checksum: sha1:a5cdc883a1b98de7a257180c85edf40eee182832 pristine_git_object: d91d6e67015ebe40d2d954db984479c2a8957e40 - models/components/listrunsresponse.go: - id: b3658a3c6330 - last_write_checksum: sha1:e88064f4458ce157a6256cf65a8c286aa02cadc7 - pristine_git_object: 820942867f6ed998d7d33767ca888525bb067fae - models/components/listversionsresponse.go: - id: 02d59f99a3a6 - last_write_checksum: sha1:90b23facbd89f0865eef2d70ce8e46b9a4a9fc85 - pristine_git_object: db62864a451f20bd800172f1ab31c305ee78ff33 + models/components/listdeploymentsresponse.go: + id: c81969fa6fd8 + last_write_checksum: sha1:cddfefe4782b7a6824d0e132f4f11d979d595671 + pristine_git_object: 2f8844f16dd202fe745bb6ae649361e2ac2cbd8f + models/components/listmanifestsresponse.go: + id: 8ed2ba8f477d + last_write_checksum: sha1:067bc89e626dcba06625e221e24ea1cf21bd9d7c + pristine_git_object: 4c54c4fc4a971effc6960213e549f03958e6d224 + models/components/listmanifestversionsresponse.go: + id: a74974d4f433 + last_write_checksum: sha1:f519a05edaf19584adbd60ca3aae4ca5c46b43e4 + pristine_git_object: 287c29f3b5e490035182b930ddc3f015d37f1f5c models/components/log.go: id: "076958063552" last_write_checksum: sha1:08f93eab2190052f9affb791dbc491700485388a pristine_git_object: 014faaf92105efcd6b6f480bbeeaa978cd0f7523 - models/components/payments.go: - id: ab1f954b82e7 - last_write_checksum: sha1:afee9eb6d1f645ff7b515b33b5a93f75d17e88ea - pristine_git_object: 7d1b67c94e0c6956220d907a618ddcf496053889 - models/components/pool.go: - id: 69c6fc9f4f70 - last_write_checksum: sha1:ed9a147447d691e540acaaef188515f7ca5ab9ea - pristine_git_object: 46ae746be9782f84e2a2a5a0b7ee28ec8c452818 + models/components/manifest.go: + id: dc929f032587 + last_write_checksum: sha1:3465024c145021a69cc1d2736ce4cb0d5cd68b11 + pristine_git_object: c9cfb7da0d06841c061e2a66d1d6e3337232b132 + models/components/manifestresponse.go: + id: 826d316fa365 + last_write_checksum: sha1:3772dc6ac0335e105bb5c2c3cb798e7aec4e5869 + pristine_git_object: 9e92054721ca35d11dc54993d7e0282fb5e24d7e + models/components/manifestversion.go: + id: ebe526a37dd8 + last_write_checksum: sha1:d2cfcd1b2bf002488b3e38e3f12fa6bfc872c5e7 + pristine_git_object: 0344b172778559a0c1161794d0923b6ef9c955e7 + models/components/manifestversionresponse.go: + id: 30f8a7e13cc2 + last_write_checksum: sha1:6241b4f37a61256bda363111b331e36afc1e0d8f + pristine_git_object: 80e366ca2043ac7158c75269942f9da54943f81c models/components/readlogsresponse.go: id: 90e15a603a44 last_write_checksum: sha1:3cdcbe5ac1e537507ccdc81ec71bef53b0384af0 pristine_git_object: f2d84592e4c2946e92abf391eb06ac2b96015e88 - models/components/readstateresponse.go: - id: ea64d8eddf42 - last_write_checksum: sha1:ffe869d24398ffac7d912a5afddd0e5c82c41231 - pristine_git_object: 06c746db256bf6b78b34ff83cdfd312e192bf116 models/components/readvariablesresponse.go: id: 4b628607f38f last_write_checksum: sha1:50bba846aa0abff0cb644aa6ed9b740100682056 pristine_git_object: f9f233b9b95f0afdaed6dd01a365a53d08592beb - models/components/reconciliation.go: - id: 2c4e0d680f89 - last_write_checksum: sha1:f1d084830097699c8fc24e30a3f579ecdbf512c7 - pristine_git_object: c14e11f6892e1de548af7da7f209ae22c62ecf6b - models/components/reconciliationledger.go: - id: c241d7b93183 - last_write_checksum: sha1:45cd258615b495465c4fe1816b0dd9fc8241e91f - pristine_git_object: 2d622c1a0503c10b0262e26fad4cf7baedce94f6 - models/components/reconciliationpolicy.go: - id: 6d3725c7413c - last_write_checksum: sha1:8280ec6c56c69e241ddf36a252341759f08945b8 - pristine_git_object: b8151f03f6d912769917c905544541c456651ed9 - models/components/regionselector.go: - id: 872366f5702f - last_write_checksum: sha1:d8aad9a68637751cb99dea0be39b0d591b8a76ba - pristine_git_object: 063b9bf2b7412eada2b5c8371afd85018090b088 - models/components/run.go: - id: fba5506d7291 - last_write_checksum: sha1:c9b714f833faefeb359edd275cdad799c69ceda5 - pristine_git_object: 8ecf58a560b63bed0ac54fe73d66f2542bb587d1 - models/components/runresponse.go: - id: 827c0fdb42de - last_write_checksum: sha1:dcdfbfec91d8e01065dd22b851b657ddea4404e6 - pristine_git_object: fd89b6396527c112b4a9bb20cf8d901f6d18e719 - models/components/stack.go: - id: 6a5465dead58 - last_write_checksum: sha1:ecbd1fc7e87484150938d58e50d1b456cfc03e47 - pristine_git_object: 002a18dba3348c8d9286feb9b8b1ae35744a6a25 models/components/state.go: id: cb569493a6e4 last_write_checksum: sha1:2960474737e42f46e1f67bcec0a98270babbeaaf pristine_git_object: 36d6cfe58680824e3652028111ecb28913a98af2 models/components/updateapprequest.go: id: 02e323c36bcb - last_write_checksum: sha1:041547ffed28841a99b7e6bfdea8526f1d220209 - pristine_git_object: c7a05a2d23d7aac465ef93ecfd2b54df73c5c357 - models/components/v2chartaccountmetadata.go: - id: f16fa72ee560 - last_write_checksum: sha1:cb34c9960bf8c40aeb11ecf84f53c4b032117b4a - pristine_git_object: 86a7afa2b5a12868fbc20ae2c6979a2d39dcc38a - models/components/v2chartaccountrules.go: - id: eac3f974ccff - last_write_checksum: sha1:cfc0ba427e8c195af03757ccc72b4342b39b9b78 - pristine_git_object: 76ccec55ba08e20262e9e152475e4a8019b7a7bf - models/components/v2chartsegment.go: - id: 24b4ec7ee8ba - last_write_checksum: sha1:2a33bc69f1d7931f0e0f8ca57b2b06d946f7b7f9 - pristine_git_object: 5ea894482e16dddccf721148c52ec2ec91f8ce1d - models/components/v2schemadata.go: - id: b831e5ad9a8d - last_write_checksum: sha1:d05f8ef7fca18bd4b9ec40d2be549142583c0b22 - pristine_git_object: 7568060234562456795dfa8eee587f6c4e20ecf6 - models/components/v2transactiontemplate.go: - id: e60dda03c1e6 - last_write_checksum: sha1:6aa4488434b226a98b6d6a644002f4802060771d - pristine_git_object: 7222da99066bb531d3f2f477cf21fa3e596454b4 + last_write_checksum: sha1:ef3cc70fe08244f4ebb38742e2086444ac1a67ba + pristine_git_object: 7045a1fba0e3d8531d9773aab4ed0f4689360ee7 + models/components/updatemanifestrequest.go: + id: 2528e271ad88 + last_write_checksum: sha1:86c356f8e623c2092f1788a28e6e963199e5dd08 + pristine_git_object: 8cd2a3858debf89dd5f196c2e7b9750f612f743f models/components/variable.go: id: 37684cf48fa4 last_write_checksum: sha1:716bdab940d9e74422327c676089410b483b134b @@ -611,10 +577,6 @@ trackedFiles: id: c47e6d6b22e2 last_write_checksum: sha1:f18eaccc07eb9c59c6ac2b573d680b09115ec673 pristine_git_object: 9ca7263b061adcb74269a1b7e1738febe66142dc - models/components/webhook.go: - id: d10a35a35a34 - last_write_checksum: sha1:1ceedf3aba089fed66daf2adb66e290951f52cb5 - pristine_git_object: 7e4989592ee33f5f18577a0268fcedbe3143e596 models/operations/createapp.go: id: 5854dfd707b5 last_write_checksum: sha1:662f38efed6fcd5a485f124d983815d71c5b0aae @@ -623,6 +585,22 @@ trackedFiles: id: 23dce5a300a7 last_write_checksum: sha1:7f18af8d0b93a268b6a831856e01c8a892825da3 pristine_git_object: 6e6b587c8a8a6f6381df8bd34c06a9fd11d7578f + models/operations/createdeployment.go: + id: fc879f2c4bd0 + last_write_checksum: sha1:f567f56ff899fc417b32428f3426a3d1f967c421 + pristine_git_object: 65b97e927ff9245e7d3658e07a9ed7579fd29ad5 + models/operations/createdeploymentraw.go: + id: e1dd7c0d9c16 + last_write_checksum: sha1:5798b6f99bf37e6914c92fc48b9dd36f52edcc99 + pristine_git_object: a6896a5109ca246182479739664240ec6be66ab2 + models/operations/createmanifest.go: + id: a6767be7cb3c + last_write_checksum: sha1:40dc3cec8e7e4659d81742b00339774d64a23e1a + pristine_git_object: 99920019b3e7b2a9bfd3244fed6b4bfb949acc55 + models/operations/createmanifestraw.go: + id: 1cb46a50dbc7 + last_write_checksum: sha1:62922e788543039e5bf4eb523bde95048030ae58 + pristine_git_object: 71aeab2d315ef7db71bfa5b302bf822cb3547cf4 models/operations/deleteapp.go: id: 16ffc0588ffa last_write_checksum: sha1:ad8037d95b7d56984167b1e03b0ec31ce82765b8 @@ -631,70 +609,70 @@ trackedFiles: id: a1a35df253e4 last_write_checksum: sha1:e7adcc4d853d2866a7559bf5f0c08d533e0debd8 pristine_git_object: ad5019fede49c81723ca34e1a2bf474752aea945 - models/operations/deployappconfiguration.go: - id: 92230d011e2e - last_write_checksum: sha1:9adfe49e193c12cea89979fb681be6a9b351d42c - pristine_git_object: 35c6066d02a6a8fe132500566c13ffa95d5c0d48 - models/operations/deployappconfigurationraw.go: - id: 63b981dcaa57 - last_write_checksum: sha1:d35f32a9277a6ada51e6ea9f81f19ec9afd16e9f - pristine_git_object: 4e9796f48c416688155972689f7cb7854fa7c519 + models/operations/deletemanifest.go: + id: a9e05f283389 + last_write_checksum: sha1:d9b5b22243bad0bb985c474d9e666147ec8554e2 + pristine_git_object: 06b43a2ff341f3eef670d9e1981915fab88b3613 models/operations/listapps.go: id: 73fbcbeab28f - last_write_checksum: sha1:e1769f9f62b690185f0f72d1ae5b5171df0b5fcb - pristine_git_object: cffd13ece0a73ca2c92ba2154ad28574b3325f22 + last_write_checksum: sha1:696ecf1b2b8144ec3aeb4c0925af9c290b9b1e4d + pristine_git_object: 6f451a515eb38f89905d35ce884df8a117cd26a7 + models/operations/listdeployments.go: + id: 0241618e0c69 + last_write_checksum: sha1:d7b19282703c1464cb5b05c4280ea0d42f0f56d6 + pristine_git_object: ddae0d51f91006ce1a38a3f234517d60d3d257a7 + models/operations/listmanifests.go: + id: c8df7087082a + last_write_checksum: sha1:dd606342315736473b0133d54dfb39586c06cb54 + pristine_git_object: 6d1c50e7c1500c75e90d220d8fde9848deaaca52 + models/operations/listmanifestversions.go: + id: c3d6a0006b82 + last_write_checksum: sha1:b53891beadf5d0b6d6dd46ea3b0075b4b9807302 + pristine_git_object: f74af98d7294c0720cd2cc4f77cd09940026fb01 models/operations/options.go: id: d20dd4db9865 - last_write_checksum: sha1:2f6c1cc5afac268afc3fd2d667a82c81441f48fb - pristine_git_object: 42fca769d914dc3bb60bd33f893b15e1fe8ba0cd + last_write_checksum: sha1:a48cf400249fe4cec80746623cbbd6831141c0f2 + pristine_git_object: 0010ed4393e80d0c29c4360949997aa6422ba8b6 + models/operations/pushmanifestversion.go: + id: 103d3cd7154c + last_write_checksum: sha1:1e79c961001d02886374474081b2f444092bad78 + pristine_git_object: d8c0578c883f8c5b9099bf95a10aa8689760954e + models/operations/pushmanifestversionraw.go: + id: 4407558a1706 + last_write_checksum: sha1:9ce5959e88ad074e86ae993b66b9057fd6e25ca8 + pristine_git_object: 03411e7c0ab6606e466a50ee95861384dab8e0d1 models/operations/readapp.go: id: 5ffcd917de05 - last_write_checksum: sha1:01bca85c3994d2794be2eb34eea64c776e39f881 - pristine_git_object: c0da89ffd5225907b28d7a5246a7a8aeb4f8ec52 - models/operations/readappcurrentstateversion.go: - id: a3205982713f - last_write_checksum: sha1:a43fe8b0b6b98d4af16990c221f92b10a328b23f - pristine_git_object: 25aa5b88b0c81996dccb6590e856ce4fdcbddf66 - models/operations/readappruns.go: - id: 1ebe888ea9e2 - last_write_checksum: sha1:91b805db92d5232b481d3ddf298f725cb8e790c4 - pristine_git_object: 8f5ff67e12113cfb4bc86720899ac194d6a79082 + last_write_checksum: sha1:616311f2d52977d2cc3d7fdb21ae16a111d242dd + pristine_git_object: ff16e36f0a7c3d5e1ec8615c8f74d3cafcf48e6d models/operations/readappvariables.go: id: 3c029298a72b last_write_checksum: sha1:42b249b334f33657dd22a96047018ed05094490d pristine_git_object: f642a034afb0cef123f3eeba201c9aad7134907c - models/operations/readappversions.go: - id: fe3c6439a5a9 - last_write_checksum: sha1:ddf8135ae02cb566e70045f35f876096d5ecfcb6 - pristine_git_object: 5a47d8d16e6945e4fce5daf6a55b1197d53fb43f - models/operations/readcurrentappversion.go: - id: 4cb29afb2b5e - last_write_checksum: sha1:71fa8ba76d9d0c13757309cfce5522f4aa5773ac - pristine_git_object: 5d01da8e3a943abcec7301ddd76381d6266f78f0 - models/operations/readcurrentrun.go: - id: b69915a418ee - last_write_checksum: sha1:58cbe2cdd6f514e99febd0644a5fccfcb6f79494 - pristine_git_object: ab1d0c30be0fda3c7706edbff7a2035913a3e75b - models/operations/readcurrentrunlogs.go: - id: 7e0d537fb0ad - last_write_checksum: sha1:cff758b7e3b9896efad8fb6e724971d61941a25c - pristine_git_object: 7c9fda3ffc5aebf6e4230a200e97f6d35133d356 - models/operations/readrun.go: - id: b4c286732b39 - last_write_checksum: sha1:174977f7e657795821948de25b3c5b1bdc478846 - pristine_git_object: 2970dc1ea1ef9513b20bfbf5aebc798ab093ae1f - models/operations/readrunlogs.go: - id: be3e6748f214 - last_write_checksum: sha1:76b4abe9f35472f464babd26bc42a0336fe3a529 - pristine_git_object: 431dd2ca9bd293492e0076a610491ea8ee0e9955 - models/operations/readversion.go: - id: 482e6ca480a0 - last_write_checksum: sha1:04f9980983a3ec3c2acb3884643914d16e75de8c - pristine_git_object: 9dcc7bc3971b27b70e3432a8d60a7a1ce2b2865c + models/operations/readdeployment.go: + id: 91ac6c44d1bd + last_write_checksum: sha1:34ef44770f6ad1eb358ceb0ccafaed564f81c1b7 + pristine_git_object: d4cd445dc96ddad62666d77517941bbc0090113b + models/operations/readdeploymentlogs.go: + id: 33138b5f3516 + last_write_checksum: sha1:50ac57766820913a5b2874e706f060d7960f2126 + pristine_git_object: 0ac0a7172e2154a2bf949f88dc8cf506b961d86e + models/operations/readmanifest.go: + id: 9724390accda + last_write_checksum: sha1:05f74864cfc4c59747feb25d41ec3bebd6d1c98d + pristine_git_object: 2beac53507d2723d66beb5ff16d1bd7ccdd9112b + models/operations/readmanifestversion.go: + id: 6d717792910c + last_write_checksum: sha1:8c5b0e35b09d98b466e65664f39f4490ebd8ee5e + pristine_git_object: 586511fc2e9efab59cef96a965f108748bb81297 models/operations/updateapp.go: id: d3f1951d5c54 last_write_checksum: sha1:719d31225d99a895e93220742ac70812869b204b pristine_git_object: e0aa500334cedfc25ef02b5d46a340c376904c0d + models/operations/updatemanifest.go: + id: b0676a872835 + last_write_checksum: sha1:38ed2a5a9906f5127af079bd489c45a674456162 + pristine_git_object: 3b64059f09e9cae116efb9f9d8d58ef8bf0a21e2 optionalnullable/optionalnullable.go: id: ce60f259ead3 last_write_checksum: sha1:d65954ba9be9e724bae40a5d2d09b052ed65628e @@ -737,7 +715,7 @@ examples: createApp: speakeasy-default-create-app: requestBody: - application/json: {"organizationId": ""} + application/json: {"name": ""} responses: "201": application/json: {"data": {"id": "", "name": ""}} @@ -749,7 +727,7 @@ examples: path: id: "" requestBody: - application/json: {} + application/json: {"name": ""} responses: default: application/json: {"errorCode": ""} @@ -919,5 +897,159 @@ examples: application/yaml: "x-file: example.file" default: application/json: {"errorCode": ""} + createManifest: + speakeasy-default-create-manifest-raw: + parameters: + query: + name: "" + requestBody: + application/yaml: "x-file: example.file" + responses: + "201": + application/json: {"data": {"id": "", "version": 342622, "name": "", "createdAt": "2026-06-07T23:43:24.174Z"}} + default: + application/json: {"errorCode": ""} + speakeasy-default-create-manifest: + parameters: + query: + name: "" + requestBody: + application/json: {} + responses: + "201": + application/json: {"data": {"id": "", "version": 342622, "name": "", "createdAt": "2026-06-07T23:43:24.174Z"}} + default: + application/json: {"errorCode": ""} + listManifests: + speakeasy-default-list-manifests: + responses: + "200": + application/json: {"data": {"items": []}} + default: + application/json: {"errorCode": ""} + readManifest: + speakeasy-default-read-manifest: + parameters: + path: + manifestId: "" + responses: + "200": + application/json: {"data": {"id": "", "name": "", "latestVersion": 449356, "createdAt": "2025-01-13T21:01:06.775Z", "updatedAt": "2026-12-07T01:47:24.857Z"}} + application/gzip: "x-file: example.file" + default: + application/json: {"errorCode": ""} + updateManifest: + speakeasy-default-update-manifest: + parameters: + path: + manifestId: "" + requestBody: + application/json: {"name": ""} + responses: + "200": + application/json: {"data": {"id": "", "name": "", "latestVersion": 797309, "createdAt": "2026-04-09T21:16:18.941Z", "updatedAt": "2026-09-02T19:43:33.178Z"}} + default: + application/json: {"errorCode": ""} + deleteManifest: + speakeasy-default-delete-manifest: + parameters: + path: + manifestId: "" + responses: + "409": + application/json: {"errorCode": ""} + default: + application/json: {"errorCode": ""} + pushManifestVersion: + speakeasy-default-push-manifest-version-raw: + parameters: + path: + manifestId: "" + requestBody: + application/yaml: "x-file: example.file" + responses: + "201": + application/json: {"data": {"manifestId": "", "version": 836923, "createdAt": "2024-10-29T19:28:36.110Z"}} + default: + application/json: {"errorCode": ""} + speakeasy-default-push-manifest-version: + parameters: + path: + manifestId: "" + requestBody: + application/json: {} + responses: + "201": + application/json: {"data": {"manifestId": "", "version": 836923, "createdAt": "2024-10-29T19:28:36.110Z"}} + default: + application/json: {"errorCode": ""} + listManifestVersions: + speakeasy-default-list-manifest-versions: + parameters: + path: + manifestId: "" + responses: + "200": + application/json: {"data": {"items": [{"manifestId": "", "version": 473763, "createdAt": "2026-09-04T02:17:14.806Z"}]}} + default: + application/json: {"errorCode": ""} + readManifestVersion: + speakeasy-default-read-manifest-version: + parameters: + path: + manifestId: "" + version: "" + responses: + "200": + application/json: {"data": {"manifestId": "", "version": 291553, "createdAt": "2024-12-09T16:22:04.214Z"}} + application/x-yaml: "x-file: example.file" + default: + application/json: {"errorCode": ""} + createDeployment: + speakeasy-default-create-deployment: + requestBody: + application/json: {"appId": ""} + responses: + "201": + application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} + default: + application/json: {"errorCode": ""} + speakeasy-default-create-deployment-raw: + requestBody: + application/yaml: "x-file: example.file" + responses: + "201": + application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} + default: + application/json: {"errorCode": ""} + listDeployments: + speakeasy-default-list-deployments: + responses: + "200": + application/json: {"data": {"items": [{"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2025-10-03T23:17:35.491Z", "updatedAt": "2024-05-13T18:10:51.662Z"}]}} + default: + application/json: {"errorCode": ""} + readDeployment: + speakeasy-default-read-deployment: + parameters: + path: + deploymentId: "" + responses: + "200": + application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2025-06-20T10:16:58.267Z", "updatedAt": "2025-04-30T01:36:03.827Z"}} + application/gzip: "x-file: example.file" + application/yaml: "x-file: example.file" + default: + application/json: {"errorCode": ""} + readDeploymentLogs: + speakeasy-default-read-deployment-logs: + parameters: + path: + deploymentId: "" + responses: + "200": + application/json: {} + default: + application/json: {"errorCode": ""} examplesVersion: 1.0.2 generatedTests: {} diff --git a/internal/deployserverclient/.speakeasy/gen.yaml b/internal/deployserverclient/.speakeasy/gen.yaml index b92b44b7..7d3c6936 100644 --- a/internal/deployserverclient/.speakeasy/gen.yaml +++ b/internal/deployserverclient/.speakeasy/gen.yaml @@ -35,7 +35,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false go: - version: 0.0.1 + version: 0.1.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: DeployServerError diff --git a/internal/deployserverclient/.speakeasy/workflow.lock b/internal/deployserverclient/.speakeasy/workflow.lock index 56f7a3e5..9b6bbe8b 100644 --- a/internal/deployserverclient/.speakeasy/workflow.lock +++ b/internal/deployserverclient/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.759.2 sources: Terraform HCP Proxy API: sourceNamespace: terraform-hcp-proxy-api - sourceRevisionDigest: sha256:10ee0ae3168b95a47c78a3128b465abd28a4beb6b99ab2e27735455138465b20 - sourceBlobDigest: sha256:4e4bf80a183fb2ae17d4ae27d2a6de867db0654fe28483c80ec25e9530e3a967 + sourceRevisionDigest: sha256:f1072e1d4779b29c3be4e72982341411266fed31ce03461435dcce2de61e7faa + sourceBlobDigest: sha256:ffb69b5915493dcf88f1cfc2cf27aae70e5cf54be911d2d5636a1d305a77bf69 tags: - latest - 0.1.0 @@ -11,8 +11,8 @@ targets: deploy-server: source: Terraform HCP Proxy API sourceNamespace: terraform-hcp-proxy-api - sourceRevisionDigest: sha256:10ee0ae3168b95a47c78a3128b465abd28a4beb6b99ab2e27735455138465b20 - sourceBlobDigest: sha256:4e4bf80a183fb2ae17d4ae27d2a6de867db0654fe28483c80ec25e9530e3a967 + sourceRevisionDigest: sha256:f1072e1d4779b29c3be4e72982341411266fed31ce03461435dcce2de61e7faa + sourceBlobDigest: sha256:ffb69b5915493dcf88f1cfc2cf27aae70e5cf54be911d2d5636a1d305a77bf69 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.759.2 diff --git a/internal/deployserverclient/README.md b/internal/deployserverclient/README.md index dac472ae..5b0daa58 100644 --- a/internal/deployserverclient/README.md +++ b/internal/deployserverclient/README.md @@ -65,7 +65,7 @@ func main() { s := deployserverclient.New() - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -90,20 +90,24 @@ func main() { * [UpdateApp](docs/sdks/deployserver/README.md#updateapp) - Update an app * [ReadApp](docs/sdks/deployserver/README.md#readapp) - read app details * [DeleteApp](docs/sdks/deployserver/README.md#deleteapp) - Delete an app -* [ReadAppCurrentStateVersion](docs/sdks/deployserver/README.md#readappcurrentstateversion) - Get the current state version of an app * [ReadAppVariables](docs/sdks/deployserver/README.md#readappvariables) - Get all variables of an app * [CreateAppVariable](docs/sdks/deployserver/README.md#createappvariable) - Create variable for an app * [DeleteAppVariable](docs/sdks/deployserver/README.md#deleteappvariable) - Delete a variable from an app -* [ReadAppRuns](docs/sdks/deployserver/README.md#readappruns) - Get runs of an app -* [ReadAppVersions](docs/sdks/deployserver/README.md#readappversions) - Get versions of an app -* [DeployAppConfigurationRaw](docs/sdks/deployserver/README.md#deployappconfigurationraw) - Deploy a new configuration for an app -* [DeployAppConfiguration](docs/sdks/deployserver/README.md#deployappconfiguration) - Deploy a new configuration for an app -* [ReadCurrentRun](docs/sdks/deployserver/README.md#readcurrentrun) - Get the current run of an app -* [ReadVersion](docs/sdks/deployserver/README.md#readversion) - Get a specific version -* [ReadRun](docs/sdks/deployserver/README.md#readrun) - Get the run of a version -* [ReadRunLogs](docs/sdks/deployserver/README.md#readrunlogs) - Get logs of a run by its ID -* [ReadCurrentRunLogs](docs/sdks/deployserver/README.md#readcurrentrunlogs) - Get logs of the current run of an app -* [ReadCurrentAppVersion](docs/sdks/deployserver/README.md#readcurrentappversion) - Get the current version of an app +* [CreateManifestRaw](docs/sdks/deployserver/README.md#createmanifestraw) - Create a new manifest +* [CreateManifest](docs/sdks/deployserver/README.md#createmanifest) - Create a new manifest +* [ListManifests](docs/sdks/deployserver/README.md#listmanifests) - List manifests in the organization +* [ReadManifest](docs/sdks/deployserver/README.md#readmanifest) - Read a manifest +* [UpdateManifest](docs/sdks/deployserver/README.md#updatemanifest) - Update manifest metadata +* [DeleteManifest](docs/sdks/deployserver/README.md#deletemanifest) - Delete a manifest and all its versions +* [PushManifestVersionRaw](docs/sdks/deployserver/README.md#pushmanifestversionraw) - Push a new version of a manifest +* [PushManifestVersion](docs/sdks/deployserver/README.md#pushmanifestversion) - Push a new version of a manifest +* [ListManifestVersions](docs/sdks/deployserver/README.md#listmanifestversions) - List versions of a manifest +* [ReadManifestVersion](docs/sdks/deployserver/README.md#readmanifestversion) - Get a specific manifest version with content +* [CreateDeployment](docs/sdks/deployserver/README.md#createdeployment) - Create a deployment (triggers a run) +* [CreateDeploymentRaw](docs/sdks/deployserver/README.md#createdeploymentraw) - Create a deployment (triggers a run) +* [ListDeployments](docs/sdks/deployserver/README.md#listdeployments) - List deployments +* [ReadDeployment](docs/sdks/deployserver/README.md#readdeployment) - Get a single deployment +* [ReadDeploymentLogs](docs/sdks/deployserver/README.md#readdeploymentlogs) - Get run logs for a deployment @@ -130,7 +134,7 @@ func main() { s := deployserverclient.New() - res, err := s.ListApps(ctx, "", nil, nil, operations.WithRetries( + res, err := s.ListApps(ctx, nil, nil, operations.WithRetries( retry.Config{ Strategy: "backoff", Backoff: &retry.BackoffStrategy{ @@ -179,7 +183,7 @@ func main() { }), ) - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -198,11 +202,12 @@ Handling errors in this SDK should largely match your expectations. All operatio By Default, an API error will return `apierrors.APIError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. -For example, the `ListApps` function may return the following errors: +For example, the `DeleteManifest` function may return the following errors: -| Error Type | Status Code | Content Type | -| ------------------ | ----------- | ------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | +| Error Type | Status Code | Content Type | +| ------------------ | ----------- | ---------------- | +| apierrors.Error | 409 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | ### Example @@ -222,9 +227,15 @@ func main() { s := deployserverclient.New() - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.DeleteManifest(ctx, "") if err != nil { + var e *apierrors.Error + if errors.As(err, &e) { + // handle error + log.Fatal(e.Error()) + } + var e *apierrors.APIError if errors.As(err, &e) { // handle error @@ -243,11 +254,11 @@ func main() { You can override the default server globally using the `WithServerIndex(serverIndex int)` option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: -| # | Server | Description | -| --- | ---------------------------------------------- | ----------------- | -| 0 | `https://deploy.formance.cloud` | Production server | -| 1 | `https://deploy-server.staging.formance.cloud` | Staging server | -| 2 | `http://localhost:8080` | Local server | +| # | Server | Description | +| --- | --------------------------------------- | ----------------- | +| 0 | `https://deploy.formance.cloud` | Production server | +| 1 | `https://deploy.staging.formance.cloud` | Staging server | +| 2 | `http://localhost:8080` | Local server | #### Example @@ -267,7 +278,7 @@ func main() { deployserverclient.WithServerIndex(0), ) - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -297,7 +308,7 @@ func main() { deployserverclient.WithServerURL("http://localhost:8080"), ) - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } diff --git a/internal/deployserverclient/USAGE.md b/internal/deployserverclient/USAGE.md index 7d5b9300..eb58123d 100644 --- a/internal/deployserverclient/USAGE.md +++ b/internal/deployserverclient/USAGE.md @@ -13,7 +13,7 @@ func main() { s := deployserverclient.New() - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } diff --git a/internal/deployserverclient/deployserver.go b/internal/deployserverclient/deployserver.go index 053900e8..6f3c1ca2 100644 --- a/internal/deployserverclient/deployserver.go +++ b/internal/deployserverclient/deployserver.go @@ -26,7 +26,7 @@ var ServerList = []string{ // Production server "https://deploy.formance.cloud", // Staging server - "https://deploy-server.staging.formance.cloud", + "https://deploy.staging.formance.cloud", // Local server "http://localhost:8080", } @@ -118,9 +118,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *DeployServer { sdk := &DeployServer{ - SDKVersion: "0.0.1", + SDKVersion: "0.1.0", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.0.1 2.869.23 0.1.0 github.com/formancehq/fctl/internal/deployserverclient/v3", + UserAgent: "speakeasy-sdk/go 0.1.0 2.869.23 0.1.0 github.com/formancehq/fctl/internal/deployserverclient/v3", ServerList: ServerList, }, hooks: hooks.New(), @@ -140,11 +140,10 @@ func New(opts ...SDKOption) *DeployServer { } // ListApps - List organization apps -func (s *DeployServer) ListApps(ctx context.Context, organizationID string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListAppsResponse, error) { +func (s *DeployServer) ListApps(ctx context.Context, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListAppsResponse, error) { request := operations.ListAppsRequest{ - OrganizationID: organizationID, - PageNumber: pageNumber, - PageSize: pageSize, + PageNumber: pageNumber, + PageSize: pageSize, } o := operations.Options{} @@ -798,9 +797,10 @@ func (s *DeployServer) UpdateApp(ctx context.Context, id string, updateAppReques } // ReadApp - read app details -func (s *DeployServer) ReadApp(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadAppResponse, error) { +func (s *DeployServer) ReadApp(ctx context.Context, id string, include []operations.ReadAppInclude, opts ...operations.Option) (*operations.ReadAppResponse, error) { request := operations.ReadAppRequest{ - ID: id, + ID: id, + Include: include, } o := operations.Options{} @@ -854,6 +854,10 @@ func (s *DeployServer) ReadApp(ctx context.Context, id string, opts ...operation req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1218,10 +1222,12 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, opts ...operati } -// ReadAppCurrentStateVersion - Get the current state version of an app -func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadAppCurrentStateVersionResponse, error) { - request := operations.ReadAppCurrentStateVersionRequest{ - ID: id, +// ReadAppVariables - Get all variables of an app +func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppVariablesResponse, error) { + request := operations.ReadAppVariablesRequest{ + ID: id, + PageNumber: pageNumber, + PageSize: pageSize, } o := operations.Options{} @@ -1242,7 +1248,7 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/current-state-version", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/variables", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1252,7 +1258,7 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readAppCurrentStateVersion", + OperationID: "readAppVariables", OAuth2Scopes: nil, SecuritySource: nil, } @@ -1275,6 +1281,10 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1370,7 +1380,7 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string } } - res := &operations.ReadAppCurrentStateVersionResponse{ + res := &operations.ReadAppVariablesResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -1386,12 +1396,12 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string return nil, err } - var out components.ReadStateResponse + var out components.ReadVariablesResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ReadStateResponse = &out + res.ReadVariablesResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -1438,12 +1448,11 @@ func (s *DeployServer) ReadAppCurrentStateVersion(ctx context.Context, id string } -// ReadAppVariables - Get all variables of an app -func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppVariablesResponse, error) { - request := operations.ReadAppVariablesRequest{ - ID: id, - PageNumber: pageNumber, - PageSize: pageSize, +// CreateAppVariable - Create variable for an app +func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createVariableRequest components.CreateVariableRequest, opts ...operations.Option) (*operations.CreateAppVariableResponse, error) { + request := operations.CreateAppVariableRequest{ + ID: id, + CreateVariableRequest: createVariableRequest, } o := operations.Options{} @@ -1474,10 +1483,14 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readAppVariables", + OperationID: "createAppVariable", OAuth2Scopes: nil, SecuritySource: nil, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateVariableRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -1490,15 +1503,14 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) } for k, v := range o.SetHeaders { @@ -1596,7 +1608,7 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb } } - res := &operations.ReadAppVariablesResponse{ + res := &operations.CreateAppVariableResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -1604,7 +1616,7 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -1612,12 +1624,12 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb return nil, err } - var out components.ReadVariablesResponse + var out components.CreateVariableResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ReadVariablesResponse = &out + res.CreateVariableResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -1664,11 +1676,11 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumb } -// CreateAppVariable - Create variable for an app -func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createVariableRequest components.CreateVariableRequest, opts ...operations.Option) (*operations.CreateAppVariableResponse, error) { - request := operations.CreateAppVariableRequest{ - ID: id, - CreateVariableRequest: createVariableRequest, +// DeleteAppVariable - Delete a variable from an app +func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variableID string, opts ...operations.Option) (*operations.DeleteAppVariableResponse, error) { + request := operations.DeleteAppVariableRequest{ + ID: id, + VariableID: variableID, } o := operations.Options{} @@ -1689,7 +1701,7 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/variables", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/variables/{variableId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1699,14 +1711,10 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "createAppVariable", + OperationID: "deleteAppVariable", OAuth2Scopes: nil, SecuritySource: nil, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateVariableRequest", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } timeout := o.Timeout if timeout == nil { @@ -1719,15 +1727,12 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV defer cancel() } - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) - } for k, v := range o.SetHeaders { req.Header.Set(k, v) @@ -1824,7 +1829,7 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV } } - res := &operations.CreateAppVariableResponse{ + res := &operations.DeleteAppVariableResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -1832,27 +1837,8 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV } switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out components.CreateVariableResponse - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.CreateVariableResponse = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } + case httpRes.StatusCode == 204: + utils.DrainBody(httpRes) case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -1892,11 +1878,12 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV } -// DeleteAppVariable - Delete a variable from an app -func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variableID string, opts ...operations.Option) (*operations.DeleteAppVariableResponse, error) { - request := operations.DeleteAppVariableRequest{ - ID: id, - VariableID: variableID, +// CreateManifestRaw - Create a new manifest +func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, requestBody any, appID *string, opts ...operations.Option) (*operations.CreateManifestRawResponse, error) { + request := operations.CreateManifestRawRequest{ + Name: name, + AppID: appID, + RequestBody: requestBody, } o := operations.Options{} @@ -1917,7 +1904,7 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/variables/{variableId}", request, nil) + opURL, err := url.JoinPath(baseURL, "/manifests") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1927,10 +1914,14 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "deleteAppVariable", + OperationID: "createManifest_raw", OAuth2Scopes: nil, SecuritySource: nil, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -1943,12 +1934,19 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl defer cancel() } - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } for k, v := range o.SetHeaders { req.Header.Set(k, v) @@ -2045,7 +2043,7 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl } } - res := &operations.DeleteAppVariableResponse{ + res := &operations.CreateManifestRawResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -2053,8 +2051,27 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl } switch { - case httpRes.StatusCode == 204: - utils.DrainBody(httpRes) + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.CreateManifestResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.CreateManifestResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -2094,12 +2111,12 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl } -// ReadAppRuns - Get runs of an app -func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppRunsResponse, error) { - request := operations.ReadAppRunsRequest{ - ID: id, - PageNumber: pageNumber, - PageSize: pageSize, +// CreateManifest - Create a new manifest +func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestBody operations.CreateManifestRequestBody, appID *string, opts ...operations.Option) (*operations.CreateManifestResponse, error) { + request := operations.CreateManifestRequest{ + Name: name, + AppID: appID, + RequestBody: requestBody, } o := operations.Options{} @@ -2120,7 +2137,7 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/runs", request, nil) + opURL, err := url.JoinPath(baseURL, "/manifests") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -2130,10 +2147,14 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readAppRuns", + OperationID: "createManifest", OAuth2Scopes: nil, SecuritySource: nil, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -2146,12 +2167,15 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -2252,7 +2276,7 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i } } - res := &operations.ReadAppRunsResponse{ + res := &operations.CreateManifestResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -2260,7 +2284,7 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -2268,12 +2292,12 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i return nil, err } - var out components.ListRunsResponse + var out components.CreateManifestResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ListRunsResponse = &out + res.CreateManifestResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -2320,12 +2344,12 @@ func (s *DeployServer) ReadAppRuns(ctx context.Context, id string, pageNumber *i } -// ReadAppVersions - Get versions of an app -func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppVersionsResponse, error) { - request := operations.ReadAppVersionsRequest{ - ID: id, +// ListManifests - List manifests in the organization +func (s *DeployServer) ListManifests(ctx context.Context, pageNumber *int64, pageSize *int64, appID *string, opts ...operations.Option) (*operations.ListManifestsResponse, error) { + request := operations.ListManifestsRequest{ PageNumber: pageNumber, PageSize: pageSize, + AppID: appID, } o := operations.Options{} @@ -2346,7 +2370,7 @@ func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumbe } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/versions", request, nil) + opURL, err := url.JoinPath(baseURL, "/manifests") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -2356,7 +2380,7 @@ func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumbe SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readAppVersions", + OperationID: "listManifests", OAuth2Scopes: nil, SecuritySource: nil, } @@ -2478,7 +2502,7 @@ func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumbe } } - res := &operations.ReadAppVersionsResponse{ + res := &operations.ListManifestsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -2494,12 +2518,12 @@ func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumbe return nil, err } - var out components.ListVersionsResponse + var out components.ListManifestsResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ListVersionsResponse = &out + res.ListManifestsResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -2546,17 +2570,18 @@ func (s *DeployServer) ReadAppVersions(ctx context.Context, id string, pageNumbe } -// DeployAppConfigurationRaw - Deploy a new configuration for an app -func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, requestBody any, opts ...operations.Option) (*operations.DeployAppConfigurationRawResponse, error) { - request := operations.DeployAppConfigurationRawRequest{ - ID: id, - RequestBody: requestBody, +// ReadManifest - Read a manifest +func (s *DeployServer) ReadManifest(ctx context.Context, manifestID string, include *string, opts ...operations.Option) (*operations.ReadManifestResponse, error) { + request := operations.ReadManifestRequest{ + ManifestID: manifestID, + Include: include, } o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, operations.SupportedOptionTimeout, + operations.SupportedOptionAcceptHeaderOverride, } for _, opt := range opts { @@ -2571,7 +2596,7 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/deploy", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -2581,14 +2606,10 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "deployAppConfiguration_raw", + OperationID: "readManifest", OAuth2Scopes: nil, SecuritySource: nil, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) - if err != nil { - return nil, err - } timeout := o.Timeout if timeout == nil { @@ -2601,14 +2622,20 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, defer cancel() } - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "application/json") + if o.AcceptHeaderOverride != nil { + req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) + } else { + req.Header.Set("Accept", "application/json;q=1, application/gzip;q=0") + } + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) } for k, v := range o.SetHeaders { @@ -2706,7 +2733,7 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, } } - res := &operations.DeployAppConfigurationRawResponse{ + res := &operations.ReadManifestResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -2714,7 +2741,7 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, } switch { - case httpRes.StatusCode == 202: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -2722,12 +2749,16 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, return nil, err } - var out components.RunResponse + var out components.ManifestResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RunResponse = &out + res.ManifestResponse = &out + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/gzip`): + res.ResponseStream = httpRes.Body + + return res, nil default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -2774,11 +2805,11 @@ func (s *DeployServer) DeployAppConfigurationRaw(ctx context.Context, id string, } -// DeployAppConfiguration - Deploy a new configuration for an app -func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, application components.Application, opts ...operations.Option) (*operations.DeployAppConfigurationResponse, error) { - request := operations.DeployAppConfigurationRequest{ - ID: id, - Application: application, +// UpdateManifest - Update manifest metadata +func (s *DeployServer) UpdateManifest(ctx context.Context, manifestID string, updateManifestRequest components.UpdateManifestRequest, opts ...operations.Option) (*operations.UpdateManifestResponse, error) { + request := operations.UpdateManifestRequest{ + ManifestID: manifestID, + UpdateManifestRequest: updateManifestRequest, } o := operations.Options{} @@ -2799,7 +2830,7 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/deploy", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -2809,11 +2840,11 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "deployAppConfiguration", + OperationID: "updateManifest", OAuth2Scopes: nil, SecuritySource: nil, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Application", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateManifestRequest", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -2829,7 +2860,7 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap defer cancel() } - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } @@ -2934,7 +2965,7 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap } } - res := &operations.DeployAppConfigurationResponse{ + res := &operations.UpdateManifestResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -2942,7 +2973,7 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap } switch { - case httpRes.StatusCode == 202: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -2950,12 +2981,12 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap return nil, err } - var out components.RunResponse + var out components.ManifestResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RunResponse = &out + res.ManifestResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3002,10 +3033,10 @@ func (s *DeployServer) DeployAppConfiguration(ctx context.Context, id string, ap } -// ReadCurrentRun - Get the current run of an app -func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadCurrentRunResponse, error) { - request := operations.ReadCurrentRunRequest{ - ID: id, +// DeleteManifest - Delete a manifest and all its versions +func (s *DeployServer) DeleteManifest(ctx context.Context, manifestID string, opts ...operations.Option) (*operations.DeleteManifestResponse, error) { + request := operations.DeleteManifestRequest{ + ManifestID: manifestID, } o := operations.Options{} @@ -3026,7 +3057,7 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/run", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -3036,7 +3067,7 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readCurrentRun", + OperationID: "deleteManifest", OAuth2Scopes: nil, SecuritySource: nil, } @@ -3052,7 +3083,7 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } @@ -3139,7 +3170,7 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err - } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + } else if utils.MatchStatusCodes([]string{"409", "4XX", "5XX"}, httpRes.StatusCode) { _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err @@ -3154,7 +3185,7 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op } } - res := &operations.ReadCurrentRunResponse{ + res := &operations.DeleteManifestResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -3162,7 +3193,9 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 204: + utils.DrainBody(httpRes) + case httpRes.StatusCode == 409: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -3170,12 +3203,12 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op return nil, err } - var out components.RunResponse + var out apierrors.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RunResponse = &out + return nil, &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3222,17 +3255,17 @@ func (s *DeployServer) ReadCurrentRun(ctx context.Context, id string, opts ...op } -// ReadVersion - Get a specific version -func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadVersionResponse, error) { - request := operations.ReadVersionRequest{ - ID: id, +// PushManifestVersionRaw - Push a new version of a manifest +func (s *DeployServer) PushManifestVersionRaw(ctx context.Context, manifestID string, requestBody any, opts ...operations.Option) (*operations.PushManifestVersionRawResponse, error) { + request := operations.PushManifestVersionRawRequest{ + ManifestID: manifestID, + RequestBody: requestBody, } o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, operations.SupportedOptionTimeout, - operations.SupportedOptionAcceptHeaderOverride, } for _, opt := range opts { @@ -3247,7 +3280,7 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/versions/{id}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}/versions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -3257,10 +3290,14 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readVersion", + OperationID: "pushManifestVersion_raw", OAuth2Scopes: nil, SecuritySource: nil, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -3273,17 +3310,15 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - if o.AcceptHeaderOverride != nil { - req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) - } else { - req.Header.Set("Accept", "application/json;q=1, application/yaml;q=0.7, application/gzip;q=0") - } - + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } for k, v := range o.SetHeaders { req.Header.Set(k, v) @@ -3380,7 +3415,7 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera } } - res := &operations.ReadVersionResponse{ + res := &operations.PushManifestVersionRawResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -3388,7 +3423,7 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -3396,20 +3431,12 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera return nil, err } - var out components.AppVersionResponse + var out components.ManifestVersionResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.AppVersionResponse = &out - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/gzip`): - res.TwoHundredApplicationGzipResponseStream = httpRes.Body - - return res, nil - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/yaml`): - res.TwoHundredApplicationYamlResponseStream = httpRes.Body - - return res, nil + res.ManifestVersionResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3456,10 +3483,11 @@ func (s *DeployServer) ReadVersion(ctx context.Context, id string, opts ...opera } -// ReadRun - Get the run of a version -func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadRunResponse, error) { - request := operations.ReadRunRequest{ - ID: id, +// PushManifestVersion - Push a new version of a manifest +func (s *DeployServer) PushManifestVersion(ctx context.Context, manifestID string, requestBody operations.PushManifestVersionRequestBody, opts ...operations.Option) (*operations.PushManifestVersionResponse, error) { + request := operations.PushManifestVersionRequest{ + ManifestID: manifestID, + RequestBody: requestBody, } o := operations.Options{} @@ -3480,7 +3508,7 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/runs/{id}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}/versions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -3490,10 +3518,14 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readRun", + OperationID: "pushManifestVersion", OAuth2Scopes: nil, SecuritySource: nil, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -3506,12 +3538,15 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } for k, v := range o.SetHeaders { req.Header.Set(k, v) @@ -3608,7 +3643,7 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation } } - res := &operations.ReadRunResponse{ + res := &operations.PushManifestVersionResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -3616,7 +3651,7 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -3624,12 +3659,12 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation return nil, err } - var out components.RunResponse + var out components.ManifestVersionResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.RunResponse = &out + res.ManifestVersionResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3676,10 +3711,12 @@ func (s *DeployServer) ReadRun(ctx context.Context, id string, opts ...operation } -// ReadRunLogs - Get logs of a run by its ID -func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadRunLogsResponse, error) { - request := operations.ReadRunLogsRequest{ - ID: id, +// ListManifestVersions - List versions of a manifest +func (s *DeployServer) ListManifestVersions(ctx context.Context, manifestID string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListManifestVersionsResponse, error) { + request := operations.ListManifestVersionsRequest{ + ManifestID: manifestID, + PageNumber: pageNumber, + PageSize: pageSize, } o := operations.Options{} @@ -3700,7 +3737,7 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/runs/{id}/logs", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}/versions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -3710,7 +3747,7 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readRunLogs", + OperationID: "listManifestVersions", OAuth2Scopes: nil, SecuritySource: nil, } @@ -3733,6 +3770,10 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3828,7 +3869,7 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera } } - res := &operations.ReadRunLogsResponse{ + res := &operations.ListManifestVersionsResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -3844,12 +3885,12 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera return nil, err } - var out components.ReadLogsResponse + var out components.ListManifestVersionsResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ReadLogsResponse = &out + res.ListManifestVersionsResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3896,16 +3937,18 @@ func (s *DeployServer) ReadRunLogs(ctx context.Context, id string, opts ...opera } -// ReadCurrentRunLogs - Get logs of the current run of an app -func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts ...operations.Option) (*operations.ReadCurrentRunLogsResponse, error) { - request := operations.ReadCurrentRunLogsRequest{ - ID: id, +// ReadManifestVersion - Get a specific manifest version with content +func (s *DeployServer) ReadManifestVersion(ctx context.Context, manifestID string, version string, opts ...operations.Option) (*operations.ReadManifestVersionResponse, error) { + request := operations.ReadManifestVersionRequest{ + ManifestID: manifestID, + Version: version, } o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, operations.SupportedOptionTimeout, + operations.SupportedOptionAcceptHeaderOverride, } for _, opt := range opts { @@ -3920,7 +3963,7 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/run/logs", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/manifests/{manifestId}/versions/{version}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -3930,7 +3973,7 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readCurrentRunLogs", + OperationID: "readManifestVersion", OAuth2Scopes: nil, SecuritySource: nil, } @@ -3950,7 +3993,12 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "application/json") + if o.AcceptHeaderOverride != nil { + req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) + } else { + req.Header.Set("Accept", "application/json;q=1, application/x-yaml;q=0") + } + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) for k, v := range o.SetHeaders { @@ -4048,7 +4096,7 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . } } - res := &operations.ReadCurrentRunLogsResponse{ + res := &operations.ReadManifestVersionResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -4064,12 +4112,16 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . return nil, err } - var out components.ReadLogsResponse + var out components.ManifestVersionResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ReadLogsResponse = &out + res.ManifestVersionResponse = &out + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/x-yaml`): + res.ResponseStream = httpRes.Body + + return res, nil default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -4116,18 +4168,17 @@ func (s *DeployServer) ReadCurrentRunLogs(ctx context.Context, id string, opts . } -// ReadCurrentAppVersion - Get the current version of an app -func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, from *operations.From, opts ...operations.Option) (*operations.ReadCurrentAppVersionResponse, error) { - request := operations.ReadCurrentAppVersionRequest{ - ID: id, - From: from, +// CreateDeployment - Create a deployment (triggers a run) +func (s *DeployServer) CreateDeployment(ctx context.Context, createDeploymentRequest components.CreateDeploymentRequest, appID *string, opts ...operations.Option) (*operations.CreateDeploymentResponse, error) { + request := operations.CreateDeploymentRequest{ + AppID: appID, + CreateDeploymentRequest: createDeploymentRequest, } o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, operations.SupportedOptionTimeout, - operations.SupportedOptionAcceptHeaderOverride, } for _, opt := range opts { @@ -4142,7 +4193,7 @@ func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, fro } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/version", request, nil) + opURL, err := url.JoinPath(baseURL, "/deployments") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -4152,7 +4203,698 @@ func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, fro SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "readCurrentAppVersion", + OperationID: "createDeployment", + OAuth2Scopes: nil, + SecuritySource: nil, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateDeploymentRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateDeploymentResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.DeploymentResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DeploymentResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// CreateDeploymentRaw - Create a deployment (triggers a run) +func (s *DeployServer) CreateDeploymentRaw(ctx context.Context, requestBody any, appID *string, opts ...operations.Option) (*operations.CreateDeploymentRawResponse, error) { + request := operations.CreateDeploymentRawRequest{ + AppID: appID, + RequestBody: requestBody, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/deployments") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "createDeployment_raw", + OAuth2Scopes: nil, + SecuritySource: nil, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateDeploymentRawResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.DeploymentResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DeploymentResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListDeployments - List deployments +func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListDeploymentsResponse, error) { + request := operations.ListDeploymentsRequest{ + AppID: appID, + PageNumber: pageNumber, + PageSize: pageSize, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/deployments") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "listDeployments", + OAuth2Scopes: nil, + SecuritySource: nil, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ListDeploymentsResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ListDeploymentsResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ListDeploymentsResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ReadDeployment - Get a single deployment +func (s *DeployServer) ReadDeployment(ctx context.Context, deploymentID string, include []operations.ReadDeploymentInclude, opts ...operations.Option) (*operations.ReadDeploymentResponse, error) { + request := operations.ReadDeploymentRequest{ + DeploymentID: deploymentID, + Include: include, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + operations.SupportedOptionAcceptHeaderOverride, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/deployments/{deploymentId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "readDeployment", OAuth2Scopes: nil, SecuritySource: nil, } @@ -4279,7 +5021,7 @@ func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, fro } } - res := &operations.ReadCurrentAppVersionResponse{ + res := &operations.ReadDeploymentResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -4295,12 +5037,12 @@ func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, fro return nil, err } - var out components.AppVersionResponse + var out components.DeploymentResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.AppVersionResponse = &out + res.DeploymentResponse = &out case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/gzip`): res.TwoHundredApplicationGzipResponseStream = httpRes.Body @@ -4354,3 +5096,223 @@ func (s *DeployServer) ReadCurrentAppVersion(ctx context.Context, id string, fro return res, nil } + +// ReadDeploymentLogs - Get run logs for a deployment +func (s *DeployServer) ReadDeploymentLogs(ctx context.Context, deploymentID string, opts ...operations.Option) (*operations.ReadDeploymentLogsResponse, error) { + request := operations.ReadDeploymentLogsRequest{ + DeploymentID: deploymentID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/deployments/{deploymentId}/logs", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "readDeploymentLogs", + OAuth2Scopes: nil, + SecuritySource: nil, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ReadDeploymentLogsResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ReadLogsResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ReadLogsResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} diff --git a/internal/deployserverclient/docs/models/components/pool.md b/internal/deployserverclient/docs/models/apierrors/error.md similarity index 62% rename from internal/deployserverclient/docs/models/components/pool.md rename to internal/deployserverclient/docs/models/apierrors/error.md index d9dc4914..5450343d 100644 --- a/internal/deployserverclient/docs/models/components/pool.md +++ b/internal/deployserverclient/docs/models/apierrors/error.md @@ -1,9 +1,9 @@ -# Pool +# Error ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `AccountIds` | []`string` | :heavy_minus_sign: | N/A | -| `Query` | map[string]`any` | :heavy_minus_sign: | N/A | \ No newline at end of file +| `ErrorCode` | `string` | :heavy_check_mark: | N/A | +| `ErrorMessage` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/app.md b/internal/deployserverclient/docs/models/components/app.md index a22cba38..579a521c 100644 --- a/internal/deployserverclient/docs/models/components/app.md +++ b/internal/deployserverclient/docs/models/components/app.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | Unique identifier for the app | -| `Name` | `string` | :heavy_check_mark: | Name of the app | -| `CurrentConfigurationVersion` | [*components.ConfigurationVersion](../../models/components/configurationversion.md) | :heavy_minus_sign: | N/A | -| `CurrentRun` | [*components.Run](../../models/components/run.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | Unique identifier for the app | +| `Name` | `string` | :heavy_check_mark: | Name of the app | +| `StackID` | `*string` | :heavy_minus_sign: | Optional existing stack ID claimed by this app | +| `State` | [*components.State](../../models/components/state.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/application.md b/internal/deployserverclient/docs/models/components/application.md deleted file mode 100644 index ff0d6629..00000000 --- a/internal/deployserverclient/docs/models/components/application.md +++ /dev/null @@ -1,12 +0,0 @@ -# Application - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `Ledgers` | [][components.Ledger](../../models/components/ledger.md) | :heavy_minus_sign: | N/A | -| `Payments` | [*components.Payments](../../models/components/payments.md) | :heavy_minus_sign: | N/A | -| `Reconciliation` | [*components.Reconciliation](../../models/components/reconciliation.md) | :heavy_minus_sign: | N/A | -| `Stack` | [components.Stack](../../models/components/stack.md) | :heavy_check_mark: | N/A | -| `Webhooks` | [][components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/appversionresponse.md b/internal/deployserverclient/docs/models/components/appversionresponse.md deleted file mode 100644 index 0d154583..00000000 --- a/internal/deployserverclient/docs/models/components/appversionresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# AppVersionResponse - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Data` | [components.ConfigurationVersion](../../models/components/configurationversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/configurationversion.md b/internal/deployserverclient/docs/models/components/configurationversion.md deleted file mode 100644 index 66bd7ff6..00000000 --- a/internal/deployserverclient/docs/models/components/configurationversion.md +++ /dev/null @@ -1,12 +0,0 @@ -# ConfigurationVersion - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `ID` | `string` | :heavy_check_mark: | Unique identifier for the configuration version | -| `AutoQueueRuns` | `bool` | :heavy_check_mark: | Auto queue runs when a new version is uploaded | -| `Error` | `string` | :heavy_check_mark: | Error code if the version is in an error state | -| `ErrorMessage` | `string` | :heavy_check_mark: | Error message if the version is in an error state | -| `Status` | [components.Status](../../models/components/status.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/connector.md b/internal/deployserverclient/docs/models/components/connector.md deleted file mode 100644 index fce666c8..00000000 --- a/internal/deployserverclient/docs/models/components/connector.md +++ /dev/null @@ -1,11 +0,0 @@ -# Connector - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `Configuration` | map[string]`any` | :heavy_minus_sign: | N/A | -| `Credentials` | map[string]`string` | :heavy_minus_sign: | N/A | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Provider` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createapprequest.md b/internal/deployserverclient/docs/models/components/createapprequest.md index 5bc2c5c9..8d2ae919 100644 --- a/internal/deployserverclient/docs/models/components/createapprequest.md +++ b/internal/deployserverclient/docs/models/components/createapprequest.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `OrganizationID` | `string` | :heavy_check_mark: | ID of the organization to which the app belongs | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Name` | `string` | :heavy_check_mark: | Name of the app | +| `StackID` | `*string` | :heavy_minus_sign: | Optional existing stack ID to claim | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createdeploymentrequest.md b/internal/deployserverclient/docs/models/components/createdeploymentrequest.md new file mode 100644 index 00000000..dc6b0ccc --- /dev/null +++ b/internal/deployserverclient/docs/models/components/createdeploymentrequest.md @@ -0,0 +1,10 @@ +# CreateDeploymentRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `AppID` | `string` | :heavy_check_mark: | ID of the app to deploy to | +| `ManifestID` | `*string` | :heavy_minus_sign: | Manifest catalog ID (for manifest-reference mode) | +| `ManifestVersion` | `*int64` | :heavy_minus_sign: | Manifest version (for manifest-reference mode) | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createmanifestresponse.md b/internal/deployserverclient/docs/models/components/createmanifestresponse.md new file mode 100644 index 00000000..50f24314 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/createmanifestresponse.md @@ -0,0 +1,8 @@ +# CreateManifestResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `Data` | [components.CreateManifestResponseData](../../models/components/createmanifestresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md b/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md new file mode 100644 index 00000000..dd1916f2 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md @@ -0,0 +1,12 @@ +# CreateManifestResponseData + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `AppID` | `*string` | :heavy_minus_sign: | N/A | +| `Version` | `int64` | :heavy_check_mark: | N/A | +| `Name` | `string` | :heavy_check_mark: | N/A | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/deploymentresource.md b/internal/deployserverclient/docs/models/components/deploymentresource.md new file mode 100644 index 00000000..00ee3a59 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/deploymentresource.md @@ -0,0 +1,19 @@ +# DeploymentResource + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `AppID` | `string` | :heavy_check_mark: | N/A | +| `ManifestID` | `*string` | :heavy_minus_sign: | N/A | +| `ManifestVersion` | `*int64` | :heavy_minus_sign: | N/A | +| `HasInlineContent` | `*bool` | :heavy_minus_sign: | N/A | +| `WorkspaceID` | `string` | :heavy_check_mark: | N/A | +| `RunID` | `*string` | :heavy_minus_sign: | N/A | +| `RunStatus` | `string` | :heavy_check_mark: | N/A | +| `ConfigVersionID` | `*string` | :heavy_minus_sign: | N/A | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `State` | [*components.State](../../models/components/state.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/deploymentresponse.md b/internal/deployserverclient/docs/models/components/deploymentresponse.md new file mode 100644 index 00000000..e5a1bb0f --- /dev/null +++ b/internal/deployserverclient/docs/models/components/deploymentresponse.md @@ -0,0 +1,8 @@ +# DeploymentResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `Data` | [components.DeploymentResource](../../models/components/deploymentresource.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/ledger.md b/internal/deployserverclient/docs/models/components/ledger.md deleted file mode 100644 index cc0f331e..00000000 --- a/internal/deployserverclient/docs/models/components/ledger.md +++ /dev/null @@ -1,9 +0,0 @@ -# Ledger - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Schema` | map[string][components.V2SchemaData](../../models/components/v2schemadata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md b/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md new file mode 100644 index 00000000..3154c0e4 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md @@ -0,0 +1,8 @@ +# ListDeploymentsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Data` | [components.ListDeploymentsResponseData](../../models/components/listdeploymentsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md b/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md new file mode 100644 index 00000000..d6d948fc --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md @@ -0,0 +1,13 @@ +# ListDeploymentsResponseData + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | +| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | +| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | +| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | +| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | +| `Items` | [][components.DeploymentResource](../../models/components/deploymentresource.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestsresponse.md b/internal/deployserverclient/docs/models/components/listmanifestsresponse.md new file mode 100644 index 00000000..ffc6e180 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestsresponse.md @@ -0,0 +1,8 @@ +# ListManifestsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Data` | [components.ListManifestsResponseData](../../models/components/listmanifestsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md b/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md new file mode 100644 index 00000000..bdbe0093 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md @@ -0,0 +1,13 @@ +# ListManifestsResponseData + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | +| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | +| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | +| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | +| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | +| `Items` | [][components.Manifest](../../models/components/manifest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md b/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md new file mode 100644 index 00000000..90ffe672 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md @@ -0,0 +1,8 @@ +# ListManifestVersionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `Data` | [components.ListManifestVersionsResponseData](../../models/components/listmanifestversionsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md b/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md new file mode 100644 index 00000000..f5f82a0e --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md @@ -0,0 +1,13 @@ +# ListManifestVersionsResponseData + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | +| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | +| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | +| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | +| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | +| `Items` | [][components.ManifestVersion](../../models/components/manifestversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listrunsresponse.md b/internal/deployserverclient/docs/models/components/listrunsresponse.md deleted file mode 100644 index 8751277e..00000000 --- a/internal/deployserverclient/docs/models/components/listrunsresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# ListRunsResponse - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Data` | [components.ListRunsResponseData](../../models/components/listrunsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listrunsresponsedata.md b/internal/deployserverclient/docs/models/components/listrunsresponsedata.md deleted file mode 100644 index d29d6c4d..00000000 --- a/internal/deployserverclient/docs/models/components/listrunsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListRunsResponseData - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.Run](../../models/components/run.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listversionsresponse.md b/internal/deployserverclient/docs/models/components/listversionsresponse.md deleted file mode 100644 index 5c0505ae..00000000 --- a/internal/deployserverclient/docs/models/components/listversionsresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# ListVersionsResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `Data` | [components.ListVersionsResponseData](../../models/components/listversionsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listversionsresponsedata.md b/internal/deployserverclient/docs/models/components/listversionsresponsedata.md deleted file mode 100644 index 4da3b6ad..00000000 --- a/internal/deployserverclient/docs/models/components/listversionsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListVersionsResponseData - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.ConfigurationVersion](../../models/components/configurationversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/manifest.md b/internal/deployserverclient/docs/models/components/manifest.md new file mode 100644 index 00000000..b0e4e353 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/manifest.md @@ -0,0 +1,13 @@ +# Manifest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | Unique identifier for the manifest | +| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID the manifest is scoped to | +| `Name` | `string` | :heavy_check_mark: | Name of the manifest | +| `LatestVersion` | `int64` | :heavy_check_mark: | Latest version number | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Timestamp when the manifest was created | +| `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Timestamp when the manifest was last updated | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/manifestresponse.md b/internal/deployserverclient/docs/models/components/manifestresponse.md new file mode 100644 index 00000000..30a0ca2d --- /dev/null +++ b/internal/deployserverclient/docs/models/components/manifestresponse.md @@ -0,0 +1,8 @@ +# ManifestResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `Data` | [components.Manifest](../../models/components/manifest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/manifestversion.md b/internal/deployserverclient/docs/models/components/manifestversion.md new file mode 100644 index 00000000..608ea35c --- /dev/null +++ b/internal/deployserverclient/docs/models/components/manifestversion.md @@ -0,0 +1,11 @@ +# ManifestVersion + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `ManifestID` | `string` | :heavy_check_mark: | ID of the manifest this version belongs to | +| `Version` | `int64` | :heavy_check_mark: | Version number | +| `Content` | `*string` | :heavy_minus_sign: | Manifest content (base64-encoded). Null when listing versions, present when reading a specific version. | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Timestamp when the version was created | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/manifestversionresponse.md b/internal/deployserverclient/docs/models/components/manifestversionresponse.md new file mode 100644 index 00000000..fe14fcbd --- /dev/null +++ b/internal/deployserverclient/docs/models/components/manifestversionresponse.md @@ -0,0 +1,8 @@ +# ManifestVersionResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `Data` | [components.ManifestVersion](../../models/components/manifestversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/payments.md b/internal/deployserverclient/docs/models/components/payments.md deleted file mode 100644 index 2f9fcb61..00000000 --- a/internal/deployserverclient/docs/models/components/payments.md +++ /dev/null @@ -1,9 +0,0 @@ -# Payments - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `Connectors` | [][components.Connector](../../models/components/connector.md) | :heavy_minus_sign: | N/A | -| `Pools` | map[string][components.Pool](../../models/components/pool.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/readstateresponse.md b/internal/deployserverclient/docs/models/components/readstateresponse.md deleted file mode 100644 index 9562394d..00000000 --- a/internal/deployserverclient/docs/models/components/readstateresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadStateResponse - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `Data` | [components.State](../../models/components/state.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/reconciliationledger.md b/internal/deployserverclient/docs/models/components/reconciliationledger.md deleted file mode 100644 index 9533b09c..00000000 --- a/internal/deployserverclient/docs/models/components/reconciliationledger.md +++ /dev/null @@ -1,9 +0,0 @@ -# ReconciliationLedger - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Query` | map[string]`any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/reconciliationpolicy.md b/internal/deployserverclient/docs/models/components/reconciliationpolicy.md deleted file mode 100644 index f27b97c3..00000000 --- a/internal/deployserverclient/docs/models/components/reconciliationpolicy.md +++ /dev/null @@ -1,10 +0,0 @@ -# ReconciliationPolicy - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Ledger` | [components.ReconciliationLedger](../../models/components/reconciliationledger.md) | :heavy_check_mark: | N/A | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Pool` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/regionselector.md b/internal/deployserverclient/docs/models/components/regionselector.md deleted file mode 100644 index f139fa74..00000000 --- a/internal/deployserverclient/docs/models/components/regionselector.md +++ /dev/null @@ -1,9 +0,0 @@ -# RegionSelector - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `*string` | :heavy_minus_sign: | N/A | -| `Name` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/run.md b/internal/deployserverclient/docs/models/components/run.md deleted file mode 100644 index b54edaa2..00000000 --- a/internal/deployserverclient/docs/models/components/run.md +++ /dev/null @@ -1,19 +0,0 @@ -# Run - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | Unique identifier for the run | -| `AutoApply` | `bool` | :heavy_check_mark: | Whether the run was auto-applied | -| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Timestamp when the run was created | -| `IsDestroy` | `bool` | :heavy_check_mark: | Whether the run is a destroy operation | -| `HasChanges` | `bool` | :heavy_check_mark: | Whether the run has changes | -| `Message` | `string` | :heavy_check_mark: | Message associated with the run | -| `PlanOnly` | `bool` | :heavy_check_mark: | Whether the run is a plan-only operation | -| `Refresh` | `bool` | :heavy_check_mark: | Whether the run is a refresh operation | -| `RefreshOnly` | `bool` | :heavy_check_mark: | Whether the run is a refresh-only operation | -| `SavePlan` | `bool` | :heavy_check_mark: | Whether the run saves the plan | -| `Status` | `string` | :heavy_check_mark: | Status of the run | -| `ConfigurationVersion` | [*components.ConfigurationVersion](../../models/components/configurationversion.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/runresponse.md b/internal/deployserverclient/docs/models/components/runresponse.md deleted file mode 100644 index cf19aff0..00000000 --- a/internal/deployserverclient/docs/models/components/runresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# RunResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `Data` | [components.Run](../../models/components/run.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/stack.md b/internal/deployserverclient/docs/models/components/stack.md deleted file mode 100644 index eba39fff..00000000 --- a/internal/deployserverclient/docs/models/components/stack.md +++ /dev/null @@ -1,10 +0,0 @@ -# Stack - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Region` | [components.RegionSelector](../../models/components/regionselector.md) | :heavy_check_mark: | N/A | -| `Version` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/status.md b/internal/deployserverclient/docs/models/components/status.md deleted file mode 100644 index 9ae23ca0..00000000 --- a/internal/deployserverclient/docs/models/components/status.md +++ /dev/null @@ -1,23 +0,0 @@ -# Status - -## Example Usage - -```go -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -value := components.StatusArchived -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `StatusArchived` | archived | -| `StatusErrored` | errored | -| `StatusPending` | pending | -| `StatusFetching` | fetching | -| `StatusUploaded` | uploaded | -| `StatusUnknown` | | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/updateapprequest.md b/internal/deployserverclient/docs/models/components/updateapprequest.md index c5cfdb62..61637f46 100644 --- a/internal/deployserverclient/docs/models/components/updateapprequest.md +++ b/internal/deployserverclient/docs/models/components/updateapprequest.md @@ -3,5 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `Name` | `string` | :heavy_check_mark: | Updated name for the app | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/updatemanifestrequest.md b/internal/deployserverclient/docs/models/components/updatemanifestrequest.md new file mode 100644 index 00000000..2df4cefa --- /dev/null +++ b/internal/deployserverclient/docs/models/components/updatemanifestrequest.md @@ -0,0 +1,8 @@ +# UpdateManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | +| `Name` | `string` | :heavy_check_mark: | Updated name for the manifest | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/v2chartsegment.md b/internal/deployserverclient/docs/models/components/v2chartsegment.md deleted file mode 100644 index 7358c3d3..00000000 --- a/internal/deployserverclient/docs/models/components/v2chartsegment.md +++ /dev/null @@ -1,12 +0,0 @@ -# V2ChartSegment - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `DotMetadata` | map[string][components.V2ChartAccountMetadata](../../models/components/v2chartaccountmetadata.md) | :heavy_minus_sign: | N/A | -| `DotPattern` | `*string` | :heavy_minus_sign: | N/A | -| `DotRules` | [*components.V2ChartAccountRules](../../models/components/v2chartaccountrules.md) | :heavy_minus_sign: | N/A | -| `DotSelf` | [*components.DotSelf](../../models/components/dotself.md) | :heavy_minus_sign: | N/A | -| `AdditionalProperties` | map[string]`any` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/v2schemadata.md b/internal/deployserverclient/docs/models/components/v2schemadata.md deleted file mode 100644 index ace0af48..00000000 --- a/internal/deployserverclient/docs/models/components/v2schemadata.md +++ /dev/null @@ -1,9 +0,0 @@ -# V2SchemaData - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `Chart` | map[string][components.V2ChartSegment](../../models/components/v2chartsegment.md) | :heavy_minus_sign: | N/A | -| `Transactions` | map[string][components.V2TransactionTemplate](../../models/components/v2transactiontemplate.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/v2transactiontemplate.md b/internal/deployserverclient/docs/models/components/v2transactiontemplate.md deleted file mode 100644 index a11f6f3b..00000000 --- a/internal/deployserverclient/docs/models/components/v2transactiontemplate.md +++ /dev/null @@ -1,10 +0,0 @@ -# V2TransactionTemplate - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Description` | `*string` | :heavy_minus_sign: | N/A | -| `Runtime` | `*string` | :heavy_minus_sign: | N/A | -| `Script` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/webhook.md b/internal/deployserverclient/docs/models/components/webhook.md deleted file mode 100644 index 32e7fd85..00000000 --- a/internal/deployserverclient/docs/models/components/webhook.md +++ /dev/null @@ -1,11 +0,0 @@ -# Webhook - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Endpoint` | `string` | :heavy_check_mark: | N/A | -| `Events` | []`string` | :heavy_minus_sign: | N/A | -| `Name` | `string` | :heavy_check_mark: | N/A | -| `Secret` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md b/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md new file mode 100644 index 00000000..c91702f1 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md @@ -0,0 +1,9 @@ +# CreateDeploymentRawRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `AppID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | +| `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentappversionresponse.md b/internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md similarity index 57% rename from internal/deployserverclient/docs/models/operations/readcurrentappversionresponse.md rename to internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md index beb7ed13..5a5384b3 100644 --- a/internal/deployserverclient/docs/models/operations/readcurrentappversionresponse.md +++ b/internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md @@ -1,4 +1,4 @@ -# ReadCurrentAppVersionResponse +# CreateDeploymentRawResponse ## Fields @@ -6,7 +6,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `AppVersionResponse` | [*components.AppVersionResponse](../../models/components/appversionresponse.md) | :heavy_minus_sign: | Current app version retrieved successfully | -| `TwoHundredApplicationGzipResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Current app version retrieved successfully | -| `TwoHundredApplicationYamlResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Current app version retrieved successfully | +| `DeploymentResponse` | [*components.DeploymentResponse](../../models/components/deploymentresponse.md) | :heavy_minus_sign: | Deployment created successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md b/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md new file mode 100644 index 00000000..9b672d38 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md @@ -0,0 +1,9 @@ +# CreateDeploymentRequest + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `AppID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | +| `CreateDeploymentRequest` | [components.CreateDeploymentRequest](../../models/components/createdeploymentrequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentresponse.md b/internal/deployserverclient/docs/models/operations/createdeploymentresponse.md new file mode 100644 index 00000000..d6be3430 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createdeploymentresponse.md @@ -0,0 +1,10 @@ +# CreateDeploymentResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `DeploymentResponse` | [*components.DeploymentResponse](../../models/components/deploymentresponse.md) | :heavy_minus_sign: | Deployment created successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md b/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md new file mode 100644 index 00000000..878fcaf0 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md @@ -0,0 +1,10 @@ +# CreateManifestRawRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `Name` | `string` | :heavy_check_mark: | Name for the manifest | +| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | +| `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createmanifestrawresponse.md b/internal/deployserverclient/docs/models/operations/createmanifestrawresponse.md new file mode 100644 index 00000000..3e8b398e --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createmanifestrawresponse.md @@ -0,0 +1,10 @@ +# CreateManifestRawResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `CreateManifestResponse` | [*components.CreateManifestResponse](../../models/components/createmanifestresponse.md) | :heavy_minus_sign: | Manifest created successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createmanifestrequest.md b/internal/deployserverclient/docs/models/operations/createmanifestrequest.md new file mode 100644 index 00000000..fc43bc11 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createmanifestrequest.md @@ -0,0 +1,10 @@ +# CreateManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Name` | `string` | :heavy_check_mark: | Name for the manifest | +| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | +| `RequestBody` | [operations.CreateManifestRequestBody](../../models/operations/createmanifestrequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/v2chartaccountrules.md b/internal/deployserverclient/docs/models/operations/createmanifestrequestbody.md similarity index 71% rename from internal/deployserverclient/docs/models/components/v2chartaccountrules.md rename to internal/deployserverclient/docs/models/operations/createmanifestrequestbody.md index b79d01a9..6089e69c 100644 --- a/internal/deployserverclient/docs/models/components/v2chartaccountrules.md +++ b/internal/deployserverclient/docs/models/operations/createmanifestrequestbody.md @@ -1,4 +1,6 @@ -# V2ChartAccountRules +# CreateManifestRequestBody + +JSON manifest content ## Fields diff --git a/internal/deployserverclient/docs/models/operations/createmanifestresponse.md b/internal/deployserverclient/docs/models/operations/createmanifestresponse.md new file mode 100644 index 00000000..ea064c63 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/createmanifestresponse.md @@ -0,0 +1,10 @@ +# CreateManifestResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `CreateManifestResponse` | [*components.CreateManifestResponse](../../models/components/createmanifestresponse.md) | :heavy_minus_sign: | Manifest created successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readrunlogsrequest.md b/internal/deployserverclient/docs/models/operations/deletemanifestrequest.md similarity index 70% rename from internal/deployserverclient/docs/models/operations/readrunlogsrequest.md rename to internal/deployserverclient/docs/models/operations/deletemanifestrequest.md index 38e600c0..26341ed1 100644 --- a/internal/deployserverclient/docs/models/operations/readrunlogsrequest.md +++ b/internal/deployserverclient/docs/models/operations/deletemanifestrequest.md @@ -1,8 +1,8 @@ -# ReadRunLogsRequest +# DeleteManifestRequest ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| `ManifestID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readrunresponse.md b/internal/deployserverclient/docs/models/operations/deletemanifestresponse.md similarity index 74% rename from internal/deployserverclient/docs/models/operations/readrunresponse.md rename to internal/deployserverclient/docs/models/operations/deletemanifestresponse.md index dda55995..e8a81fae 100644 --- a/internal/deployserverclient/docs/models/operations/readrunresponse.md +++ b/internal/deployserverclient/docs/models/operations/deletemanifestresponse.md @@ -1,4 +1,4 @@ -# ReadRunResponse +# DeleteManifestResponse ## Fields @@ -6,5 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `RunResponse` | [*components.RunResponse](../../models/components/runresponse.md) | :heavy_minus_sign: | Run retrieved successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Manifest is still referenced by deployments | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deployappconfigurationrawresponse.md b/internal/deployserverclient/docs/models/operations/deployappconfigurationrawresponse.md deleted file mode 100644 index 904ecb0a..00000000 --- a/internal/deployserverclient/docs/models/operations/deployappconfigurationrawresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# DeployAppConfigurationRawResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `RunResponse` | [*components.RunResponse](../../models/components/runresponse.md) | :heavy_minus_sign: | App configuration deployed successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deployappconfigurationrequest.md b/internal/deployserverclient/docs/models/operations/deployappconfigurationrequest.md deleted file mode 100644 index ed26f293..00000000 --- a/internal/deployserverclient/docs/models/operations/deployappconfigurationrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# DeployAppConfigurationRequest - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `Application` | [components.Application](../../models/components/application.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deployappconfigurationresponse.md b/internal/deployserverclient/docs/models/operations/deployappconfigurationresponse.md deleted file mode 100644 index 46edd9bc..00000000 --- a/internal/deployserverclient/docs/models/operations/deployappconfigurationresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# DeployAppConfigurationResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `RunResponse` | [*components.RunResponse](../../models/components/runresponse.md) | :heavy_minus_sign: | App configuration deployed successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/from.md b/internal/deployserverclient/docs/models/operations/from.md deleted file mode 100644 index c334a966..00000000 --- a/internal/deployserverclient/docs/models/operations/from.md +++ /dev/null @@ -1,18 +0,0 @@ -# From - -## Example Usage - -```go -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" -) - -value := operations.FromState -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `FromState` | state | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listappsrequest.md b/internal/deployserverclient/docs/models/operations/listappsrequest.md index 3316363e..f78151ca 100644 --- a/internal/deployserverclient/docs/models/operations/listappsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listappsrequest.md @@ -5,6 +5,5 @@ | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `OrganizationID` | `string` | :heavy_check_mark: | N/A | | `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | | `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readapprunsrequest.md b/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md similarity index 80% rename from internal/deployserverclient/docs/models/operations/readapprunsrequest.md rename to internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md index 9dfaf1fe..5fc4d1bb 100644 --- a/internal/deployserverclient/docs/models/operations/readapprunsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md @@ -1,10 +1,10 @@ -# ReadAppRunsRequest +# ListDeploymentsRequest ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | +| `AppID` | `*string` | :heavy_minus_sign: | N/A | | `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | | `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listdeploymentsresponse.md b/internal/deployserverclient/docs/models/operations/listdeploymentsresponse.md new file mode 100644 index 00000000..cc044400 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/listdeploymentsresponse.md @@ -0,0 +1,10 @@ +# ListDeploymentsResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ListDeploymentsResponse` | [*components.ListDeploymentsResponse](../../models/components/listdeploymentsresponse.md) | :heavy_minus_sign: | Deployments retrieved successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md new file mode 100644 index 00000000..ada5ef33 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md @@ -0,0 +1,10 @@ +# ListManifestsRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | +| `AppID` | `*string` | :heavy_minus_sign: | Filter manifests by app ID (includes org-wide manifests as fallback) | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestsresponse.md b/internal/deployserverclient/docs/models/operations/listmanifestsresponse.md new file mode 100644 index 00000000..7bb7f793 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/listmanifestsresponse.md @@ -0,0 +1,10 @@ +# ListManifestsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ListManifestsResponse` | [*components.ListManifestsResponse](../../models/components/listmanifestsresponse.md) | :heavy_minus_sign: | Manifests retrieved successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappversionsrequest.md b/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md similarity index 80% rename from internal/deployserverclient/docs/models/operations/readappversionsrequest.md rename to internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md index 0f9658ff..05fdaa0e 100644 --- a/internal/deployserverclient/docs/models/operations/readappversionsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md @@ -1,10 +1,10 @@ -# ReadAppVersionsRequest +# ListManifestVersionsRequest ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | | `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | | `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestversionsresponse.md b/internal/deployserverclient/docs/models/operations/listmanifestversionsresponse.md new file mode 100644 index 00000000..03497219 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/listmanifestversionsresponse.md @@ -0,0 +1,10 @@ +# ListManifestVersionsResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ListManifestVersionsResponse` | [*components.ListManifestVersionsResponse](../../models/components/listmanifestversionsresponse.md) | :heavy_minus_sign: | Manifest versions retrieved successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deployappconfigurationrawrequest.md b/internal/deployserverclient/docs/models/operations/pushmanifestversionrawrequest.md similarity index 74% rename from internal/deployserverclient/docs/models/operations/deployappconfigurationrawrequest.md rename to internal/deployserverclient/docs/models/operations/pushmanifestversionrawrequest.md index 1fff1b33..a21204cf 100644 --- a/internal/deployserverclient/docs/models/operations/deployappconfigurationrawrequest.md +++ b/internal/deployserverclient/docs/models/operations/pushmanifestversionrawrequest.md @@ -1,9 +1,9 @@ -# DeployAppConfigurationRawRequest +# PushManifestVersionRawRequest ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | | `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/pushmanifestversionrawresponse.md b/internal/deployserverclient/docs/models/operations/pushmanifestversionrawresponse.md new file mode 100644 index 00000000..0985bb7c --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/pushmanifestversionrawresponse.md @@ -0,0 +1,10 @@ +# PushManifestVersionRawResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ManifestVersionResponse` | [*components.ManifestVersionResponse](../../models/components/manifestversionresponse.md) | :heavy_minus_sign: | Manifest version created successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/pushmanifestversionrequest.md b/internal/deployserverclient/docs/models/operations/pushmanifestversionrequest.md new file mode 100644 index 00000000..dd1aab9d --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/pushmanifestversionrequest.md @@ -0,0 +1,9 @@ +# PushManifestVersionRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | +| `RequestBody` | [operations.PushManifestVersionRequestBody](../../models/operations/pushmanifestversionrequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/dotself.md b/internal/deployserverclient/docs/models/operations/pushmanifestversionrequestbody.md similarity index 69% rename from internal/deployserverclient/docs/models/components/dotself.md rename to internal/deployserverclient/docs/models/operations/pushmanifestversionrequestbody.md index c0862a7d..520019e8 100644 --- a/internal/deployserverclient/docs/models/components/dotself.md +++ b/internal/deployserverclient/docs/models/operations/pushmanifestversionrequestbody.md @@ -1,4 +1,6 @@ -# DotSelf +# PushManifestVersionRequestBody + +JSON manifest content ## Fields diff --git a/internal/deployserverclient/docs/models/operations/pushmanifestversionresponse.md b/internal/deployserverclient/docs/models/operations/pushmanifestversionresponse.md new file mode 100644 index 00000000..f1e2e08b --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/pushmanifestversionresponse.md @@ -0,0 +1,10 @@ +# PushManifestVersionResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ManifestVersionResponse` | [*components.ManifestVersionResponse](../../models/components/manifestversionresponse.md) | :heavy_minus_sign: | Manifest version created successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappcurrentstateversionrequest.md b/internal/deployserverclient/docs/models/operations/readappcurrentstateversionrequest.md deleted file mode 100644 index d505e3a1..00000000 --- a/internal/deployserverclient/docs/models/operations/readappcurrentstateversionrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadAppCurrentStateVersionRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappcurrentstateversionresponse.md b/internal/deployserverclient/docs/models/operations/readappcurrentstateversionresponse.md deleted file mode 100644 index f2b7ce5e..00000000 --- a/internal/deployserverclient/docs/models/operations/readappcurrentstateversionresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# ReadAppCurrentStateVersionResponse - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ReadStateResponse` | [*components.ReadStateResponse](../../models/components/readstateresponse.md) | :heavy_minus_sign: | Current state version retrieved successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappinclude.md b/internal/deployserverclient/docs/models/operations/readappinclude.md new file mode 100644 index 00000000..5f20740f --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readappinclude.md @@ -0,0 +1,18 @@ +# ReadAppInclude + +## Example Usage + +```go +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" +) + +value := operations.ReadAppIncludeState +``` + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `ReadAppIncludeState` | state | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readapprequest.md b/internal/deployserverclient/docs/models/operations/readapprequest.md index 7469fa05..86116ae7 100644 --- a/internal/deployserverclient/docs/models/operations/readapprequest.md +++ b/internal/deployserverclient/docs/models/operations/readapprequest.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `Include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the current Terraform workspace state.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappversionsresponse.md b/internal/deployserverclient/docs/models/operations/readappversionsresponse.md deleted file mode 100644 index 6ed33516..00000000 --- a/internal/deployserverclient/docs/models/operations/readappversionsresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# ReadAppVersionsResponse - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ListVersionsResponse` | [*components.ListVersionsResponse](../../models/components/listversionsresponse.md) | :heavy_minus_sign: | App versions retrieved successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentappversionrequest.md b/internal/deployserverclient/docs/models/operations/readcurrentappversionrequest.md deleted file mode 100644 index 21483ef3..00000000 --- a/internal/deployserverclient/docs/models/operations/readcurrentappversionrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# ReadCurrentAppVersionRequest - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `From` | [*operations.From](../../models/operations/from.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentrunlogsrequest.md b/internal/deployserverclient/docs/models/operations/readcurrentrunlogsrequest.md deleted file mode 100644 index db1a51bf..00000000 --- a/internal/deployserverclient/docs/models/operations/readcurrentrunlogsrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadCurrentRunLogsRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentrunrequest.md b/internal/deployserverclient/docs/models/operations/readcurrentrunrequest.md deleted file mode 100644 index 70e92fc2..00000000 --- a/internal/deployserverclient/docs/models/operations/readcurrentrunrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadCurrentRunRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentrunresponse.md b/internal/deployserverclient/docs/models/operations/readcurrentrunresponse.md deleted file mode 100644 index f7baf2fd..00000000 --- a/internal/deployserverclient/docs/models/operations/readcurrentrunresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# ReadCurrentRunResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `RunResponse` | [*components.RunResponse](../../models/components/runresponse.md) | :heavy_minus_sign: | Current run retrieved successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readdeploymentinclude.md b/internal/deployserverclient/docs/models/operations/readdeploymentinclude.md new file mode 100644 index 00000000..9f5f1789 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readdeploymentinclude.md @@ -0,0 +1,18 @@ +# ReadDeploymentInclude + +## Example Usage + +```go +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" +) + +value := operations.ReadDeploymentIncludeState +``` + + +## Values + +| Name | Value | +| ---------------------------- | ---------------------------- | +| `ReadDeploymentIncludeState` | state | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/v2chartaccountmetadata.md b/internal/deployserverclient/docs/models/operations/readdeploymentlogsrequest.md similarity index 69% rename from internal/deployserverclient/docs/models/components/v2chartaccountmetadata.md rename to internal/deployserverclient/docs/models/operations/readdeploymentlogsrequest.md index 2c764179..f028eaba 100644 --- a/internal/deployserverclient/docs/models/components/v2chartaccountmetadata.md +++ b/internal/deployserverclient/docs/models/operations/readdeploymentlogsrequest.md @@ -1,8 +1,8 @@ -# V2ChartAccountMetadata +# ReadDeploymentLogsRequest ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `Default` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file +| `DeploymentID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readrunlogsresponse.md b/internal/deployserverclient/docs/models/operations/readdeploymentlogsresponse.md similarity index 90% rename from internal/deployserverclient/docs/models/operations/readrunlogsresponse.md rename to internal/deployserverclient/docs/models/operations/readdeploymentlogsresponse.md index bfe621a3..1388ac81 100644 --- a/internal/deployserverclient/docs/models/operations/readrunlogsresponse.md +++ b/internal/deployserverclient/docs/models/operations/readdeploymentlogsresponse.md @@ -1,4 +1,4 @@ -# ReadRunLogsResponse +# ReadDeploymentLogsResponse ## Fields @@ -6,5 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ReadLogsResponse` | [*components.ReadLogsResponse](../../models/components/readlogsresponse.md) | :heavy_minus_sign: | Run logs retrieved successfully | +| `ReadLogsResponse` | [*components.ReadLogsResponse](../../models/components/readlogsresponse.md) | :heavy_minus_sign: | Deployment logs retrieved successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md b/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md new file mode 100644 index 00000000..1311e469 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md @@ -0,0 +1,9 @@ +# ReadDeploymentRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `DeploymentID` | `string` | :heavy_check_mark: | N/A | +| `Include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the Terraform state produced by this deployment's run.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readversionresponse.md b/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md similarity index 74% rename from internal/deployserverclient/docs/models/operations/readversionresponse.md rename to internal/deployserverclient/docs/models/operations/readdeploymentresponse.md index af15e4fc..5a248012 100644 --- a/internal/deployserverclient/docs/models/operations/readversionresponse.md +++ b/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md @@ -1,4 +1,4 @@ -# ReadVersionResponse +# ReadDeploymentResponse ## Fields @@ -6,7 +6,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `AppVersionResponse` | [*components.AppVersionResponse](../../models/components/appversionresponse.md) | :heavy_minus_sign: | version retrieved successfully | -| `TwoHundredApplicationGzipResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | version retrieved successfully | -| `TwoHundredApplicationYamlResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | version retrieved successfully | +| `DeploymentResponse` | [*components.DeploymentResponse](../../models/components/deploymentresponse.md) | :heavy_minus_sign: | Deployment retrieved successfully | +| `TwoHundredApplicationGzipResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Deployment retrieved successfully | +| `TwoHundredApplicationYamlResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Deployment retrieved successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readmanifestrequest.md b/internal/deployserverclient/docs/models/operations/readmanifestrequest.md new file mode 100644 index 00000000..d785ed1d --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readmanifestrequest.md @@ -0,0 +1,9 @@ +# ReadManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | +| `Include` | `*string` | :heavy_minus_sign: | Comma-separated includes (e.g. "latest" to embed latest version content) | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readcurrentrunlogsresponse.md b/internal/deployserverclient/docs/models/operations/readmanifestresponse.md similarity index 66% rename from internal/deployserverclient/docs/models/operations/readcurrentrunlogsresponse.md rename to internal/deployserverclient/docs/models/operations/readmanifestresponse.md index 5bd0e6e8..35202fde 100644 --- a/internal/deployserverclient/docs/models/operations/readcurrentrunlogsresponse.md +++ b/internal/deployserverclient/docs/models/operations/readmanifestresponse.md @@ -1,4 +1,4 @@ -# ReadCurrentRunLogsResponse +# ReadManifestResponse ## Fields @@ -6,5 +6,6 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ReadLogsResponse` | [*components.ReadLogsResponse](../../models/components/readlogsresponse.md) | :heavy_minus_sign: | Current run logs retrieved successfully | +| `ManifestResponse` | [*components.ManifestResponse](../../models/components/manifestresponse.md) | :heavy_minus_sign: | Manifest retrieved successfully | +| `ResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Manifest retrieved successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readmanifestversionrequest.md b/internal/deployserverclient/docs/models/operations/readmanifestversionrequest.md new file mode 100644 index 00000000..f917413f --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readmanifestversionrequest.md @@ -0,0 +1,9 @@ +# ReadManifestVersionRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | +| `Version` | `string` | :heavy_check_mark: | Version number or "latest" | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readmanifestversionresponse.md b/internal/deployserverclient/docs/models/operations/readmanifestversionresponse.md new file mode 100644 index 00000000..616ab664 --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/readmanifestversionresponse.md @@ -0,0 +1,11 @@ +# ReadManifestVersionResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `ManifestVersionResponse` | [*components.ManifestVersionResponse](../../models/components/manifestversionresponse.md) | :heavy_minus_sign: | Manifest version retrieved successfully | +| `ResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Manifest version retrieved successfully | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readrunrequest.md b/internal/deployserverclient/docs/models/operations/readrunrequest.md deleted file mode 100644 index 70575144..00000000 --- a/internal/deployserverclient/docs/models/operations/readrunrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadRunRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readversionrequest.md b/internal/deployserverclient/docs/models/operations/readversionrequest.md deleted file mode 100644 index 30c9ea77..00000000 --- a/internal/deployserverclient/docs/models/operations/readversionrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# ReadVersionRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/reconciliation.md b/internal/deployserverclient/docs/models/operations/updatemanifestrequest.md similarity index 56% rename from internal/deployserverclient/docs/models/components/reconciliation.md rename to internal/deployserverclient/docs/models/operations/updatemanifestrequest.md index 2dd49f91..0d35f285 100644 --- a/internal/deployserverclient/docs/models/components/reconciliation.md +++ b/internal/deployserverclient/docs/models/operations/updatemanifestrequest.md @@ -1,8 +1,9 @@ -# Reconciliation +# UpdateManifestRequest ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `Policies` | [][components.ReconciliationPolicy](../../models/components/reconciliationpolicy.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `ManifestID` | `string` | :heavy_check_mark: | N/A | +| `UpdateManifestRequest` | [components.UpdateManifestRequest](../../models/components/updatemanifestrequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readapprunsresponse.md b/internal/deployserverclient/docs/models/operations/updatemanifestresponse.md similarity index 78% rename from internal/deployserverclient/docs/models/operations/readapprunsresponse.md rename to internal/deployserverclient/docs/models/operations/updatemanifestresponse.md index 05a91a03..f8b0e9ef 100644 --- a/internal/deployserverclient/docs/models/operations/readapprunsresponse.md +++ b/internal/deployserverclient/docs/models/operations/updatemanifestresponse.md @@ -1,4 +1,4 @@ -# ReadAppRunsResponse +# UpdateManifestResponse ## Fields @@ -6,5 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `ListRunsResponse` | [*components.ListRunsResponse](../../models/components/listrunsresponse.md) | :heavy_minus_sign: | App runs retrieved successfully | +| `ManifestResponse` | [*components.ManifestResponse](../../models/components/manifestresponse.md) | :heavy_minus_sign: | Manifest updated successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/sdks/deployserver/README.md b/internal/deployserverclient/docs/sdks/deployserver/README.md index a0e239dc..39622fe9 100644 --- a/internal/deployserverclient/docs/sdks/deployserver/README.md +++ b/internal/deployserverclient/docs/sdks/deployserver/README.md @@ -9,20 +9,24 @@ * [UpdateApp](#updateapp) - Update an app * [ReadApp](#readapp) - read app details * [DeleteApp](#deleteapp) - Delete an app -* [ReadAppCurrentStateVersion](#readappcurrentstateversion) - Get the current state version of an app * [ReadAppVariables](#readappvariables) - Get all variables of an app * [CreateAppVariable](#createappvariable) - Create variable for an app * [DeleteAppVariable](#deleteappvariable) - Delete a variable from an app -* [ReadAppRuns](#readappruns) - Get runs of an app -* [ReadAppVersions](#readappversions) - Get versions of an app -* [DeployAppConfigurationRaw](#deployappconfigurationraw) - Deploy a new configuration for an app -* [DeployAppConfiguration](#deployappconfiguration) - Deploy a new configuration for an app -* [ReadCurrentRun](#readcurrentrun) - Get the current run of an app -* [ReadVersion](#readversion) - Get a specific version -* [ReadRun](#readrun) - Get the run of a version -* [ReadRunLogs](#readrunlogs) - Get logs of a run by its ID -* [ReadCurrentRunLogs](#readcurrentrunlogs) - Get logs of the current run of an app -* [ReadCurrentAppVersion](#readcurrentappversion) - Get the current version of an app +* [CreateManifestRaw](#createmanifestraw) - Create a new manifest +* [CreateManifest](#createmanifest) - Create a new manifest +* [ListManifests](#listmanifests) - List manifests in the organization +* [ReadManifest](#readmanifest) - Read a manifest +* [UpdateManifest](#updatemanifest) - Update manifest metadata +* [DeleteManifest](#deletemanifest) - Delete a manifest and all its versions +* [PushManifestVersionRaw](#pushmanifestversionraw) - Push a new version of a manifest +* [PushManifestVersion](#pushmanifestversion) - Push a new version of a manifest +* [ListManifestVersions](#listmanifestversions) - List versions of a manifest +* [ReadManifestVersion](#readmanifestversion) - Get a specific manifest version with content +* [CreateDeployment](#createdeployment) - Create a deployment (triggers a run) +* [CreateDeploymentRaw](#createdeploymentraw) - Create a deployment (triggers a run) +* [ListDeployments](#listdeployments) - List deployments +* [ReadDeployment](#readdeployment) - Get a single deployment +* [ReadDeploymentLogs](#readdeploymentlogs) - Get run logs for a deployment ## ListApps @@ -45,7 +49,7 @@ func main() { s := deployserverclient.New() - res, err := s.ListApps(ctx, "", nil, nil) + res, err := s.ListApps(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -60,7 +64,6 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `organizationID` | `string` | :heavy_check_mark: | N/A | | `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | | `pageSize` | `*int64` | :heavy_minus_sign: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | @@ -98,7 +101,7 @@ func main() { s := deployserverclient.New() res, err := s.CreateApp(ctx, components.CreateAppRequest{ - OrganizationID: "", + Name: "", }) if err != nil { log.Fatal(err) @@ -149,7 +152,9 @@ func main() { s := deployserverclient.New() - res, err := s.UpdateApp(ctx, "", components.UpdateAppRequest{}) + res, err := s.UpdateApp(ctx, "", components.UpdateAppRequest{ + Name: "", + }) if err != nil { log.Fatal(err) } @@ -199,7 +204,7 @@ func main() { s := deployserverclient.New() - res, err := s.ReadApp(ctx, "") + res, err := s.ReadApp(ctx, "", nil) if err != nil { log.Fatal(err) } @@ -211,11 +216,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the current Terraform workspace state.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -276,55 +282,6 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadAppCurrentStateVersion - -Get the current state version of an app - -### Example Usage - - -```go -package main - -import( - "context" - deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" - "log" -) - -func main() { - ctx := context.Background() - - s := deployserverclient.New() - - res, err := s.ReadAppCurrentStateVersion(ctx, "") - if err != nil { - log.Fatal(err) - } - if res.ReadStateResponse != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - -### Response - -**[*operations.ReadAppCurrentStateVersionResponse](../../models/operations/readappcurrentstateversionresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - ## ReadAppVariables Get all variables of an app @@ -483,19 +440,20 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadAppRuns +## CreateManifestRaw -Get runs of an app +Create a new manifest ### Example Usage - + ```go package main import( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "os" "log" ) @@ -504,11 +462,16 @@ func main() { s := deployserverclient.New() - res, err := s.ReadAppRuns(ctx, "", nil, nil) + example, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + res, err := s.CreateManifestRaw(ctx, "", example, nil) if err != nil { log.Fatal(err) } - if res.ListRunsResponse != nil { + if res.CreateManifestResponse != nil { // handle response } } @@ -519,14 +482,167 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | +| `name` | `string` | :heavy_check_mark: | Name for the manifest | +| `requestBody` | `any` | :heavy_check_mark: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadAppRunsResponse](../../models/operations/readapprunsresponse.md), error** +**[*operations.CreateManifestRawResponse](../../models/operations/createmanifestrawresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## CreateManifest + +Create a new manifest + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.CreateManifest(ctx, "", operations.CreateManifestRequestBody{}, nil) + if err != nil { + log.Fatal(err) + } + if res.CreateManifestResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `name` | `string` | :heavy_check_mark: | Name for the manifest | +| `requestBody` | [operations.CreateManifestRequestBody](../../models/operations/createmanifestrequestbody.md) | :heavy_check_mark: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateManifestResponse](../../models/operations/createmanifestresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## ListManifests + +List manifests in the organization + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.ListManifests(ctx, nil, nil, nil) + if err != nil { + log.Fatal(err) + } + if res.ListManifestsResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | Filter manifests by app ID (includes org-wide manifests as fallback) | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ListManifestsResponse](../../models/operations/listmanifestsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## ReadManifest + +Read a manifest + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.ReadManifest(ctx, "", nil) + if err != nil { + log.Fatal(err) + } + if res.ManifestResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `include` | `*string` | :heavy_minus_sign: | Comma-separated includes (e.g. "latest" to embed latest version content) | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ReadManifestResponse](../../models/operations/readmanifestresponse.md), error** ### Errors @@ -534,19 +650,20 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadAppVersions +## UpdateManifest -Get versions of an app +Update manifest metadata ### Example Usage - + ```go package main import( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" ) @@ -555,11 +672,63 @@ func main() { s := deployserverclient.New() - res, err := s.ReadAppVersions(ctx, "", nil, nil) + res, err := s.UpdateManifest(ctx, "", components.UpdateManifestRequest{ + Name: "", + }) if err != nil { log.Fatal(err) } - if res.ListVersionsResponse != nil { + if res.ManifestResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `updateManifestRequest` | [components.UpdateManifestRequest](../../models/components/updatemanifestrequest.md) | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.UpdateManifestResponse](../../models/operations/updatemanifestresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DeleteManifest + +Delete a manifest and all its versions + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.DeleteManifest(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.Error != nil { // handle response } } @@ -570,28 +739,27 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | +| `manifestID` | `string` | :heavy_check_mark: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadAppVersionsResponse](../../models/operations/readappversionsresponse.md), error** +**[*operations.DeleteManifestResponse](../../models/operations/deletemanifestresponse.md), error** ### Errors | Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | +| apierrors.Error | 409 | application/json | | apierrors.APIError | 4XX, 5XX | \*/\* | -## DeployAppConfigurationRaw +## PushManifestVersionRaw -Deploy a new configuration for an app +Push a new version of a manifest ### Example Usage - + ```go package main @@ -612,11 +780,11 @@ func main() { panic(fileErr) } - res, err := s.DeployAppConfigurationRaw(ctx, "", example) + res, err := s.PushManifestVersionRaw(ctx, "", example) if err != nil { log.Fatal(err) } - if res.RunResponse != nil { + if res.ManifestVersionResponse != nil { // handle response } } @@ -627,13 +795,13 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | +| `manifestID` | `string` | :heavy_check_mark: | N/A | | `requestBody` | `any` | :heavy_check_mark: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.DeployAppConfigurationRawResponse](../../models/operations/deployappconfigurationrawresponse.md), error** +**[*operations.PushManifestVersionRawResponse](../../models/operations/pushmanifestversionrawresponse.md), error** ### Errors @@ -641,20 +809,20 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## DeployAppConfiguration +## PushManifestVersion -Deploy a new configuration for an app +Push a new version of a manifest ### Example Usage - + ```go package main import( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" "log" ) @@ -663,16 +831,11 @@ func main() { s := deployserverclient.New() - res, err := s.DeployAppConfiguration(ctx, "", components.Application{ - Stack: components.Stack{ - Name: "", - Region: components.RegionSelector{}, - }, - }) + res, err := s.PushManifestVersion(ctx, "", operations.PushManifestVersionRequestBody{}) if err != nil { log.Fatal(err) } - if res.RunResponse != nil { + if res.ManifestVersionResponse != nil { // handle response } } @@ -680,16 +843,16 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `application` | [components.Application](../../models/components/application.md) | :heavy_check_mark: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `requestBody` | [operations.PushManifestVersionRequestBody](../../models/operations/pushmanifestversionrequestbody.md) | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.DeployAppConfigurationResponse](../../models/operations/deployappconfigurationresponse.md), error** +**[*operations.PushManifestVersionResponse](../../models/operations/pushmanifestversionresponse.md), error** ### Errors @@ -697,13 +860,13 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadCurrentRun +## ListManifestVersions -Get the current run of an app +List versions of a manifest ### Example Usage - + ```go package main @@ -718,11 +881,11 @@ func main() { s := deployserverclient.New() - res, err := s.ReadCurrentRun(ctx, "") + res, err := s.ListManifestVersions(ctx, "", nil, nil) if err != nil { log.Fatal(err) } - if res.RunResponse != nil { + if res.ListManifestVersionsResponse != nil { // handle response } } @@ -733,12 +896,14 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadCurrentRunResponse](../../models/operations/readcurrentrunresponse.md), error** +**[*operations.ListManifestVersionsResponse](../../models/operations/listmanifestversionsresponse.md), error** ### Errors @@ -746,13 +911,13 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadVersion +## ReadManifestVersion -Get a specific version +Get a specific manifest version with content ### Example Usage - + ```go package main @@ -767,11 +932,11 @@ func main() { s := deployserverclient.New() - res, err := s.ReadVersion(ctx, "") + res, err := s.ReadManifestVersion(ctx, "", "") if err != nil { log.Fatal(err) } - if res.AppVersionResponse != nil { + if res.ManifestVersionResponse != nil { // handle response } } @@ -782,12 +947,13 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `version` | `string` | :heavy_check_mark: | Version number or "latest" | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadVersionResponse](../../models/operations/readversionresponse.md), error** +**[*operations.ReadManifestVersionResponse](../../models/operations/readmanifestversionresponse.md), error** ### Errors @@ -795,19 +961,20 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadRun +## CreateDeployment -Get the run of a version +Create a deployment (triggers a run) ### Example Usage - + ```go package main import( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" ) @@ -816,11 +983,13 @@ func main() { s := deployserverclient.New() - res, err := s.ReadRun(ctx, "") + res, err := s.CreateDeployment(ctx, components.CreateDeploymentRequest{ + AppID: "", + }, nil) if err != nil { log.Fatal(err) } - if res.RunResponse != nil { + if res.DeploymentResponse != nil { // handle response } } @@ -828,15 +997,16 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `createDeploymentRequest` | [components.CreateDeploymentRequest](../../models/components/createdeploymentrequest.md) | :heavy_check_mark: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadRunResponse](../../models/operations/readrunresponse.md), error** +**[*operations.CreateDeploymentResponse](../../models/operations/createdeploymentresponse.md), error** ### Errors @@ -844,19 +1014,20 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadRunLogs +## CreateDeploymentRaw -Get logs of a run by its ID +Create a deployment (triggers a run) ### Example Usage - + ```go package main import( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "bytes" "log" ) @@ -865,11 +1036,11 @@ func main() { s := deployserverclient.New() - res, err := s.ReadRunLogs(ctx, "") + res, err := s.CreateDeploymentRaw(ctx, bytes.NewBuffer([]byte("{\"appId\":\"\"}")), nil) if err != nil { log.Fatal(err) } - if res.ReadLogsResponse != nil { + if res.DeploymentResponse != nil { // handle response } } @@ -880,12 +1051,13 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | +| `requestBody` | `any` | :heavy_check_mark: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadRunLogsResponse](../../models/operations/readrunlogsresponse.md), error** +**[*operations.CreateDeploymentRawResponse](../../models/operations/createdeploymentrawresponse.md), error** ### Errors @@ -893,13 +1065,13 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadCurrentRunLogs +## ListDeployments -Get logs of the current run of an app +List deployments ### Example Usage - + ```go package main @@ -914,11 +1086,11 @@ func main() { s := deployserverclient.New() - res, err := s.ReadCurrentRunLogs(ctx, "") + res, err := s.ListDeployments(ctx, nil, nil, nil) if err != nil { log.Fatal(err) } - if res.ReadLogsResponse != nil { + if res.ListDeploymentsResponse != nil { // handle response } } @@ -929,12 +1101,64 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | +| `appID` | `*string` | :heavy_minus_sign: | N/A | +| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadCurrentRunLogsResponse](../../models/operations/readcurrentrunlogsresponse.md), error** +**[*operations.ListDeploymentsResponse](../../models/operations/listdeploymentsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## ReadDeployment + +Get a single deployment + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.ReadDeployment(ctx, "", nil) + if err != nil { + log.Fatal(err) + } + if res.DeploymentResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `deploymentID` | `string` | :heavy_check_mark: | N/A | +| `include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the Terraform state produced by this deployment's run.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ReadDeploymentResponse](../../models/operations/readdeploymentresponse.md), error** ### Errors @@ -942,13 +1166,13 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## ReadCurrentAppVersion +## ReadDeploymentLogs -Get the current version of an app +Get run logs for a deployment ### Example Usage - + ```go package main @@ -963,11 +1187,11 @@ func main() { s := deployserverclient.New() - res, err := s.ReadCurrentAppVersion(ctx, "", nil) + res, err := s.ReadDeploymentLogs(ctx, "") if err != nil { log.Fatal(err) } - if res.AppVersionResponse != nil { + if res.ReadLogsResponse != nil { // handle response } } @@ -978,13 +1202,12 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `from` | [*operations.From](../../models/operations/from.md) | :heavy_minus_sign: | N/A | +| `deploymentID` | `string` | :heavy_check_mark: | N/A | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.ReadCurrentAppVersionResponse](../../models/operations/readcurrentappversionresponse.md), error** +**[*operations.ReadDeploymentLogsResponse](../../models/operations/readdeploymentlogsresponse.md), error** ### Errors diff --git a/internal/deployserverclient/models/apierrors/error.go b/internal/deployserverclient/models/apierrors/error.go new file mode 100644 index 00000000..3216263c --- /dev/null +++ b/internal/deployserverclient/models/apierrors/error.go @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: fa6526d8455d + +package apierrors + +import ( + "encoding/json" +) + +type Error struct { + ErrorCode string `json:"errorCode"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +var _ error = &Error{} + +func (e *Error) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/internal/deployserverclient/models/components/app.go b/internal/deployserverclient/models/components/app.go index f3a2dfe0..5a865c0c 100644 --- a/internal/deployserverclient/models/components/app.go +++ b/internal/deployserverclient/models/components/app.go @@ -7,9 +7,10 @@ type App struct { // Unique identifier for the app ID string `json:"id"` // Name of the app - Name string `json:"name"` - CurrentConfigurationVersion *ConfigurationVersion `json:"currentConfigurationVersion,omitempty"` - CurrentRun *Run `json:"currentRun,omitempty"` + Name string `json:"name"` + // Optional existing stack ID claimed by this app + StackID *string `json:"stackId,omitempty"` + State *State `json:"state,omitempty"` } func (a *App) GetID() string { @@ -26,16 +27,16 @@ func (a *App) GetName() string { return a.Name } -func (a *App) GetCurrentConfigurationVersion() *ConfigurationVersion { +func (a *App) GetStackID() *string { if a == nil { return nil } - return a.CurrentConfigurationVersion + return a.StackID } -func (a *App) GetCurrentRun() *Run { +func (a *App) GetState() *State { if a == nil { return nil } - return a.CurrentRun + return a.State } diff --git a/internal/deployserverclient/models/components/application.go b/internal/deployserverclient/models/components/application.go deleted file mode 100644 index f930a1c1..00000000 --- a/internal/deployserverclient/models/components/application.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 28d697942062 - -package components - -type Application struct { - Ledgers []Ledger `json:"ledgers,omitempty"` - Payments *Payments `json:"payments,omitempty"` - Reconciliation *Reconciliation `json:"reconciliation,omitempty"` - Stack Stack `json:"stack"` - Webhooks []Webhook `json:"webhooks,omitempty"` -} - -func (a *Application) GetLedgers() []Ledger { - if a == nil { - return nil - } - return a.Ledgers -} - -func (a *Application) GetPayments() *Payments { - if a == nil { - return nil - } - return a.Payments -} - -func (a *Application) GetReconciliation() *Reconciliation { - if a == nil { - return nil - } - return a.Reconciliation -} - -func (a *Application) GetStack() Stack { - if a == nil { - return Stack{} - } - return a.Stack -} - -func (a *Application) GetWebhooks() []Webhook { - if a == nil { - return nil - } - return a.Webhooks -} diff --git a/internal/deployserverclient/models/components/appversionresponse.go b/internal/deployserverclient/models/components/appversionresponse.go deleted file mode 100644 index 8f5e9ef5..00000000 --- a/internal/deployserverclient/models/components/appversionresponse.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: be12d8327676 - -package components - -type AppVersionResponse struct { - Data ConfigurationVersion `json:"data"` -} - -func (a *AppVersionResponse) GetData() ConfigurationVersion { - if a == nil { - return ConfigurationVersion{} - } - return a.Data -} diff --git a/internal/deployserverclient/models/components/configurationversion.go b/internal/deployserverclient/models/components/configurationversion.go deleted file mode 100644 index 6656d874..00000000 --- a/internal/deployserverclient/models/components/configurationversion.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: c20a074bc3a9 - -package components - -import ( - "encoding/json" - "fmt" -) - -type Status string - -const ( - StatusArchived Status = "archived" - StatusErrored Status = "errored" - StatusPending Status = "pending" - StatusFetching Status = "fetching" - StatusUploaded Status = "uploaded" - StatusUnknown Status = "" -) - -func (e Status) ToPointer() *Status { - return &e -} -func (e *Status) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "archived": - fallthrough - case "errored": - fallthrough - case "pending": - fallthrough - case "fetching": - fallthrough - case "uploaded": - fallthrough - case "": - *e = Status(v) - return nil - default: - return fmt.Errorf("invalid value for Status: %v", v) - } -} - -type ConfigurationVersion struct { - // Unique identifier for the configuration version - ID string `json:"id"` - // Auto queue runs when a new version is uploaded - AutoQueueRuns bool `json:"autoQueueRuns"` - // Error code if the version is in an error state - Error string `json:"error"` - // Error message if the version is in an error state - ErrorMessage string `json:"errorMessage"` - Status Status `json:"status"` -} - -func (c *ConfigurationVersion) GetID() string { - if c == nil { - return "" - } - return c.ID -} - -func (c *ConfigurationVersion) GetAutoQueueRuns() bool { - if c == nil { - return false - } - return c.AutoQueueRuns -} - -func (c *ConfigurationVersion) GetError() string { - if c == nil { - return "" - } - return c.Error -} - -func (c *ConfigurationVersion) GetErrorMessage() string { - if c == nil { - return "" - } - return c.ErrorMessage -} - -func (c *ConfigurationVersion) GetStatus() Status { - if c == nil { - return Status("") - } - return c.Status -} diff --git a/internal/deployserverclient/models/components/createapprequest.go b/internal/deployserverclient/models/components/createapprequest.go index b79eeb0c..f8efe948 100644 --- a/internal/deployserverclient/models/components/createapprequest.go +++ b/internal/deployserverclient/models/components/createapprequest.go @@ -4,13 +4,22 @@ package components type CreateAppRequest struct { - // ID of the organization to which the app belongs - OrganizationID string `json:"organizationId"` + // Name of the app + Name string `json:"name"` + // Optional existing stack ID to claim + StackID *string `json:"stackId,omitempty"` } -func (c *CreateAppRequest) GetOrganizationID() string { +func (c *CreateAppRequest) GetName() string { if c == nil { return "" } - return c.OrganizationID + return c.Name +} + +func (c *CreateAppRequest) GetStackID() *string { + if c == nil { + return nil + } + return c.StackID } diff --git a/internal/deployserverclient/models/components/createdeploymentrequest.go b/internal/deployserverclient/models/components/createdeploymentrequest.go new file mode 100644 index 00000000..37a6dcb6 --- /dev/null +++ b/internal/deployserverclient/models/components/createdeploymentrequest.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 0f79a4986282 + +package components + +type CreateDeploymentRequest struct { + // ID of the app to deploy to + AppID string `json:"appId"` + // Manifest catalog ID (for manifest-reference mode) + ManifestID *string `json:"manifestId,omitempty"` + // Manifest version (for manifest-reference mode) + ManifestVersion *int64 `json:"manifestVersion,omitempty"` +} + +func (c *CreateDeploymentRequest) GetAppID() string { + if c == nil { + return "" + } + return c.AppID +} + +func (c *CreateDeploymentRequest) GetManifestID() *string { + if c == nil { + return nil + } + return c.ManifestID +} + +func (c *CreateDeploymentRequest) GetManifestVersion() *int64 { + if c == nil { + return nil + } + return c.ManifestVersion +} diff --git a/internal/deployserverclient/models/components/createmanifestresponse.go b/internal/deployserverclient/models/components/createmanifestresponse.go new file mode 100644 index 00000000..4532b178 --- /dev/null +++ b/internal/deployserverclient/models/components/createmanifestresponse.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: d9b2be34c541 + +package components + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" + "time" +) + +type CreateManifestResponseData struct { + ID string `json:"id"` + AppID *string `json:"appId,omitempty"` + Version int64 `json:"version"` + Name string `json:"name"` + CreatedAt time.Time `json:"createdAt"` +} + +func (c CreateManifestResponseData) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateManifestResponseData) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateManifestResponseData) GetID() string { + if c == nil { + return "" + } + return c.ID +} + +func (c *CreateManifestResponseData) GetAppID() *string { + if c == nil { + return nil + } + return c.AppID +} + +func (c *CreateManifestResponseData) GetVersion() int64 { + if c == nil { + return 0 + } + return c.Version +} + +func (c *CreateManifestResponseData) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateManifestResponseData) GetCreatedAt() time.Time { + if c == nil { + return time.Time{} + } + return c.CreatedAt +} + +type CreateManifestResponse struct { + Data CreateManifestResponseData `json:"data"` +} + +func (c *CreateManifestResponse) GetData() CreateManifestResponseData { + if c == nil { + return CreateManifestResponseData{} + } + return c.Data +} diff --git a/internal/deployserverclient/models/components/deploymentresource.go b/internal/deployserverclient/models/components/deploymentresource.go new file mode 100644 index 00000000..d2a95779 --- /dev/null +++ b/internal/deployserverclient/models/components/deploymentresource.go @@ -0,0 +1,119 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: a2fac3219c8a + +package components + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" + "time" +) + +type DeploymentResource struct { + ID string `json:"id"` + AppID string `json:"appId"` + ManifestID *string `json:"manifestId,omitempty"` + ManifestVersion *int64 `json:"manifestVersion,omitempty"` + HasInlineContent *bool `json:"hasInlineContent,omitempty"` + WorkspaceID string `json:"workspaceId"` + RunID *string `json:"runId,omitempty"` + RunStatus string `json:"runStatus"` + ConfigVersionID *string `json:"configVersionId,omitempty"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + State *State `json:"state,omitempty"` +} + +func (d DeploymentResource) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DeploymentResource) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, nil); err != nil { + return err + } + return nil +} + +func (d *DeploymentResource) GetID() string { + if d == nil { + return "" + } + return d.ID +} + +func (d *DeploymentResource) GetAppID() string { + if d == nil { + return "" + } + return d.AppID +} + +func (d *DeploymentResource) GetManifestID() *string { + if d == nil { + return nil + } + return d.ManifestID +} + +func (d *DeploymentResource) GetManifestVersion() *int64 { + if d == nil { + return nil + } + return d.ManifestVersion +} + +func (d *DeploymentResource) GetHasInlineContent() *bool { + if d == nil { + return nil + } + return d.HasInlineContent +} + +func (d *DeploymentResource) GetWorkspaceID() string { + if d == nil { + return "" + } + return d.WorkspaceID +} + +func (d *DeploymentResource) GetRunID() *string { + if d == nil { + return nil + } + return d.RunID +} + +func (d *DeploymentResource) GetRunStatus() string { + if d == nil { + return "" + } + return d.RunStatus +} + +func (d *DeploymentResource) GetConfigVersionID() *string { + if d == nil { + return nil + } + return d.ConfigVersionID +} + +func (d *DeploymentResource) GetCreatedAt() time.Time { + if d == nil { + return time.Time{} + } + return d.CreatedAt +} + +func (d *DeploymentResource) GetUpdatedAt() time.Time { + if d == nil { + return time.Time{} + } + return d.UpdatedAt +} + +func (d *DeploymentResource) GetState() *State { + if d == nil { + return nil + } + return d.State +} diff --git a/internal/deployserverclient/models/components/deploymentresponse.go b/internal/deployserverclient/models/components/deploymentresponse.go new file mode 100644 index 00000000..e3b7e32d --- /dev/null +++ b/internal/deployserverclient/models/components/deploymentresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 38a6c1aca4c2 + +package components + +type DeploymentResponse struct { + Data DeploymentResource `json:"data"` +} + +func (d *DeploymentResponse) GetData() DeploymentResource { + if d == nil { + return DeploymentResource{} + } + return d.Data +} diff --git a/internal/deployserverclient/models/components/dotself.go b/internal/deployserverclient/models/components/dotself.go deleted file mode 100644 index 9df4ab4a..00000000 --- a/internal/deployserverclient/models/components/dotself.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: fa704096d419 - -package components - -type DotSelf struct { -} diff --git a/internal/deployserverclient/models/components/ledger.go b/internal/deployserverclient/models/components/ledger.go deleted file mode 100644 index b5768087..00000000 --- a/internal/deployserverclient/models/components/ledger.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: edabbbad5d02 - -package components - -type Ledger struct { - Name string `json:"name"` - Schema map[string]V2SchemaData `json:"schema,omitempty"` -} - -func (l *Ledger) GetName() string { - if l == nil { - return "" - } - return l.Name -} - -func (l *Ledger) GetSchema() map[string]V2SchemaData { - if l == nil { - return nil - } - return l.Schema -} diff --git a/internal/deployserverclient/models/components/listdeploymentsresponse.go b/internal/deployserverclient/models/components/listdeploymentsresponse.go new file mode 100644 index 00000000..2f8844f1 --- /dev/null +++ b/internal/deployserverclient/models/components/listdeploymentsresponse.go @@ -0,0 +1,71 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 2c3a36f113ed + +package components + +type ListDeploymentsResponseData struct { + // Current page number + CurrentPage *int64 `json:"currentPage,omitempty"` + // Previous page number + PreviousPage *int64 `json:"previousPage,omitempty"` + // Next page number + NextPage *int64 `json:"nextPage,omitempty"` + // Total number of pages + TotalPages *int64 `json:"totalPages,omitempty"` + // Total number of items + TotalCount *int64 `json:"totalCount,omitempty"` + Items []DeploymentResource `json:"items"` +} + +func (l *ListDeploymentsResponseData) GetCurrentPage() *int64 { + if l == nil { + return nil + } + return l.CurrentPage +} + +func (l *ListDeploymentsResponseData) GetPreviousPage() *int64 { + if l == nil { + return nil + } + return l.PreviousPage +} + +func (l *ListDeploymentsResponseData) GetNextPage() *int64 { + if l == nil { + return nil + } + return l.NextPage +} + +func (l *ListDeploymentsResponseData) GetTotalPages() *int64 { + if l == nil { + return nil + } + return l.TotalPages +} + +func (l *ListDeploymentsResponseData) GetTotalCount() *int64 { + if l == nil { + return nil + } + return l.TotalCount +} + +func (l *ListDeploymentsResponseData) GetItems() []DeploymentResource { + if l == nil { + return []DeploymentResource{} + } + return l.Items +} + +type ListDeploymentsResponse struct { + Data ListDeploymentsResponseData `json:"data"` +} + +func (l *ListDeploymentsResponse) GetData() ListDeploymentsResponseData { + if l == nil { + return ListDeploymentsResponseData{} + } + return l.Data +} diff --git a/internal/deployserverclient/models/components/listrunsresponse.go b/internal/deployserverclient/models/components/listmanifestsresponse.go similarity index 50% rename from internal/deployserverclient/models/components/listrunsresponse.go rename to internal/deployserverclient/models/components/listmanifestsresponse.go index 82094286..4c54c4fc 100644 --- a/internal/deployserverclient/models/components/listrunsresponse.go +++ b/internal/deployserverclient/models/components/listmanifestsresponse.go @@ -1,9 +1,9 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 1d784df7fbb5 +// @generated-id: db96081c00d7 package components -type ListRunsResponseData struct { +type ListManifestsResponseData struct { // Current page number CurrentPage *int64 `json:"currentPage,omitempty"` // Previous page number @@ -13,59 +13,59 @@ type ListRunsResponseData struct { // Total number of pages TotalPages *int64 `json:"totalPages,omitempty"` // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []Run `json:"items"` + TotalCount *int64 `json:"totalCount,omitempty"` + Items []Manifest `json:"items"` } -func (l *ListRunsResponseData) GetCurrentPage() *int64 { +func (l *ListManifestsResponseData) GetCurrentPage() *int64 { if l == nil { return nil } return l.CurrentPage } -func (l *ListRunsResponseData) GetPreviousPage() *int64 { +func (l *ListManifestsResponseData) GetPreviousPage() *int64 { if l == nil { return nil } return l.PreviousPage } -func (l *ListRunsResponseData) GetNextPage() *int64 { +func (l *ListManifestsResponseData) GetNextPage() *int64 { if l == nil { return nil } return l.NextPage } -func (l *ListRunsResponseData) GetTotalPages() *int64 { +func (l *ListManifestsResponseData) GetTotalPages() *int64 { if l == nil { return nil } return l.TotalPages } -func (l *ListRunsResponseData) GetTotalCount() *int64 { +func (l *ListManifestsResponseData) GetTotalCount() *int64 { if l == nil { return nil } return l.TotalCount } -func (l *ListRunsResponseData) GetItems() []Run { +func (l *ListManifestsResponseData) GetItems() []Manifest { if l == nil { - return []Run{} + return []Manifest{} } return l.Items } -type ListRunsResponse struct { - Data ListRunsResponseData `json:"data"` +type ListManifestsResponse struct { + Data ListManifestsResponseData `json:"data"` } -func (l *ListRunsResponse) GetData() ListRunsResponseData { +func (l *ListManifestsResponse) GetData() ListManifestsResponseData { if l == nil { - return ListRunsResponseData{} + return ListManifestsResponseData{} } return l.Data } diff --git a/internal/deployserverclient/models/components/listmanifestversionsresponse.go b/internal/deployserverclient/models/components/listmanifestversionsresponse.go new file mode 100644 index 00000000..287c29f3 --- /dev/null +++ b/internal/deployserverclient/models/components/listmanifestversionsresponse.go @@ -0,0 +1,71 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 3e9aea6345f2 + +package components + +type ListManifestVersionsResponseData struct { + // Current page number + CurrentPage *int64 `json:"currentPage,omitempty"` + // Previous page number + PreviousPage *int64 `json:"previousPage,omitempty"` + // Next page number + NextPage *int64 `json:"nextPage,omitempty"` + // Total number of pages + TotalPages *int64 `json:"totalPages,omitempty"` + // Total number of items + TotalCount *int64 `json:"totalCount,omitempty"` + Items []ManifestVersion `json:"items"` +} + +func (l *ListManifestVersionsResponseData) GetCurrentPage() *int64 { + if l == nil { + return nil + } + return l.CurrentPage +} + +func (l *ListManifestVersionsResponseData) GetPreviousPage() *int64 { + if l == nil { + return nil + } + return l.PreviousPage +} + +func (l *ListManifestVersionsResponseData) GetNextPage() *int64 { + if l == nil { + return nil + } + return l.NextPage +} + +func (l *ListManifestVersionsResponseData) GetTotalPages() *int64 { + if l == nil { + return nil + } + return l.TotalPages +} + +func (l *ListManifestVersionsResponseData) GetTotalCount() *int64 { + if l == nil { + return nil + } + return l.TotalCount +} + +func (l *ListManifestVersionsResponseData) GetItems() []ManifestVersion { + if l == nil { + return []ManifestVersion{} + } + return l.Items +} + +type ListManifestVersionsResponse struct { + Data ListManifestVersionsResponseData `json:"data"` +} + +func (l *ListManifestVersionsResponse) GetData() ListManifestVersionsResponseData { + if l == nil { + return ListManifestVersionsResponseData{} + } + return l.Data +} diff --git a/internal/deployserverclient/models/components/listversionsresponse.go b/internal/deployserverclient/models/components/listversionsresponse.go deleted file mode 100644 index db62864a..00000000 --- a/internal/deployserverclient/models/components/listversionsresponse.go +++ /dev/null @@ -1,71 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 4e6592758a04 - -package components - -type ListVersionsResponseData struct { - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []ConfigurationVersion `json:"items"` -} - -func (l *ListVersionsResponseData) GetCurrentPage() *int64 { - if l == nil { - return nil - } - return l.CurrentPage -} - -func (l *ListVersionsResponseData) GetPreviousPage() *int64 { - if l == nil { - return nil - } - return l.PreviousPage -} - -func (l *ListVersionsResponseData) GetNextPage() *int64 { - if l == nil { - return nil - } - return l.NextPage -} - -func (l *ListVersionsResponseData) GetTotalPages() *int64 { - if l == nil { - return nil - } - return l.TotalPages -} - -func (l *ListVersionsResponseData) GetTotalCount() *int64 { - if l == nil { - return nil - } - return l.TotalCount -} - -func (l *ListVersionsResponseData) GetItems() []ConfigurationVersion { - if l == nil { - return []ConfigurationVersion{} - } - return l.Items -} - -type ListVersionsResponse struct { - Data ListVersionsResponseData `json:"data"` -} - -func (l *ListVersionsResponse) GetData() ListVersionsResponseData { - if l == nil { - return ListVersionsResponseData{} - } - return l.Data -} diff --git a/internal/deployserverclient/models/components/manifest.go b/internal/deployserverclient/models/components/manifest.go new file mode 100644 index 00000000..c9cfb7da --- /dev/null +++ b/internal/deployserverclient/models/components/manifest.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: f6810ad982e8 + +package components + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" + "time" +) + +type Manifest struct { + // Unique identifier for the manifest + ID string `json:"id"` + // Optional app ID the manifest is scoped to + AppID *string `json:"appId,omitempty"` + // Name of the manifest + Name string `json:"name"` + // Latest version number + LatestVersion int64 `json:"latestVersion"` + // Timestamp when the manifest was created + CreatedAt time.Time `json:"createdAt"` + // Timestamp when the manifest was last updated + UpdatedAt time.Time `json:"updatedAt"` +} + +func (m Manifest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(m, "", false) +} + +func (m *Manifest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &m, "", false, nil); err != nil { + return err + } + return nil +} + +func (m *Manifest) GetID() string { + if m == nil { + return "" + } + return m.ID +} + +func (m *Manifest) GetAppID() *string { + if m == nil { + return nil + } + return m.AppID +} + +func (m *Manifest) GetName() string { + if m == nil { + return "" + } + return m.Name +} + +func (m *Manifest) GetLatestVersion() int64 { + if m == nil { + return 0 + } + return m.LatestVersion +} + +func (m *Manifest) GetCreatedAt() time.Time { + if m == nil { + return time.Time{} + } + return m.CreatedAt +} + +func (m *Manifest) GetUpdatedAt() time.Time { + if m == nil { + return time.Time{} + } + return m.UpdatedAt +} diff --git a/internal/deployserverclient/models/components/manifestresponse.go b/internal/deployserverclient/models/components/manifestresponse.go new file mode 100644 index 00000000..9e920547 --- /dev/null +++ b/internal/deployserverclient/models/components/manifestresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 6a8226d38ac7 + +package components + +type ManifestResponse struct { + Data Manifest `json:"data"` +} + +func (m *ManifestResponse) GetData() Manifest { + if m == nil { + return Manifest{} + } + return m.Data +} diff --git a/internal/deployserverclient/models/components/manifestversion.go b/internal/deployserverclient/models/components/manifestversion.go new file mode 100644 index 00000000..0344b172 --- /dev/null +++ b/internal/deployserverclient/models/components/manifestversion.go @@ -0,0 +1,59 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: a45a7b58ee06 + +package components + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" + "time" +) + +type ManifestVersion struct { + // ID of the manifest this version belongs to + ManifestID string `json:"manifestId"` + // Version number + Version int64 `json:"version"` + // Manifest content (base64-encoded). Null when listing versions, present when reading a specific version. + Content *string `json:"content,omitempty"` + // Timestamp when the version was created + CreatedAt time.Time `json:"createdAt"` +} + +func (m ManifestVersion) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(m, "", false) +} + +func (m *ManifestVersion) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &m, "", false, nil); err != nil { + return err + } + return nil +} + +func (m *ManifestVersion) GetManifestID() string { + if m == nil { + return "" + } + return m.ManifestID +} + +func (m *ManifestVersion) GetVersion() int64 { + if m == nil { + return 0 + } + return m.Version +} + +func (m *ManifestVersion) GetContent() *string { + if m == nil { + return nil + } + return m.Content +} + +func (m *ManifestVersion) GetCreatedAt() time.Time { + if m == nil { + return time.Time{} + } + return m.CreatedAt +} diff --git a/internal/deployserverclient/models/components/manifestversionresponse.go b/internal/deployserverclient/models/components/manifestversionresponse.go new file mode 100644 index 00000000..80e366ca --- /dev/null +++ b/internal/deployserverclient/models/components/manifestversionresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: b26b78dc49ec + +package components + +type ManifestVersionResponse struct { + Data ManifestVersion `json:"data"` +} + +func (m *ManifestVersionResponse) GetData() ManifestVersion { + if m == nil { + return ManifestVersion{} + } + return m.Data +} diff --git a/internal/deployserverclient/models/components/payments.go b/internal/deployserverclient/models/components/payments.go deleted file mode 100644 index 7d1b67c9..00000000 --- a/internal/deployserverclient/models/components/payments.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 813ef73c5fb1 - -package components - -type Connector struct { - Configuration map[string]any `json:"configuration,omitempty"` - Credentials map[string]string `json:"credentials,omitempty"` - Name string `json:"name"` - Provider string `json:"provider"` -} - -func (c *Connector) GetConfiguration() map[string]any { - if c == nil { - return nil - } - return c.Configuration -} - -func (c *Connector) GetCredentials() map[string]string { - if c == nil { - return nil - } - return c.Credentials -} - -func (c *Connector) GetName() string { - if c == nil { - return "" - } - return c.Name -} - -func (c *Connector) GetProvider() string { - if c == nil { - return "" - } - return c.Provider -} - -type Payments struct { - Connectors []Connector `json:"connectors,omitempty"` - Pools map[string]Pool `json:"pools,omitempty"` -} - -func (p *Payments) GetConnectors() []Connector { - if p == nil { - return nil - } - return p.Connectors -} - -func (p *Payments) GetPools() map[string]Pool { - if p == nil { - return nil - } - return p.Pools -} diff --git a/internal/deployserverclient/models/components/pool.go b/internal/deployserverclient/models/components/pool.go deleted file mode 100644 index 46ae746b..00000000 --- a/internal/deployserverclient/models/components/pool.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 52814f15349a - -package components - -type Pool struct { - AccountIds []string `json:"accountIds,omitempty"` - Query map[string]any `json:"query,omitempty"` -} - -func (p *Pool) GetAccountIds() []string { - if p == nil { - return nil - } - return p.AccountIds -} - -func (p *Pool) GetQuery() map[string]any { - if p == nil { - return nil - } - return p.Query -} diff --git a/internal/deployserverclient/models/components/readstateresponse.go b/internal/deployserverclient/models/components/readstateresponse.go deleted file mode 100644 index 06c746db..00000000 --- a/internal/deployserverclient/models/components/readstateresponse.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: bf78e9f0f87c - -package components - -type ReadStateResponse struct { - Data State `json:"data"` -} - -func (r *ReadStateResponse) GetData() State { - if r == nil { - return State{} - } - return r.Data -} diff --git a/internal/deployserverclient/models/components/reconciliation.go b/internal/deployserverclient/models/components/reconciliation.go deleted file mode 100644 index c14e11f6..00000000 --- a/internal/deployserverclient/models/components/reconciliation.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 93a115f26465 - -package components - -type Reconciliation struct { - Policies []ReconciliationPolicy `json:"policies,omitempty"` -} - -func (r *Reconciliation) GetPolicies() []ReconciliationPolicy { - if r == nil { - return nil - } - return r.Policies -} diff --git a/internal/deployserverclient/models/components/reconciliationledger.go b/internal/deployserverclient/models/components/reconciliationledger.go deleted file mode 100644 index 2d622c1a..00000000 --- a/internal/deployserverclient/models/components/reconciliationledger.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 503c2b3746a0 - -package components - -type ReconciliationLedger struct { - Name string `json:"name"` - Query map[string]any `json:"query"` -} - -func (r *ReconciliationLedger) GetName() string { - if r == nil { - return "" - } - return r.Name -} - -func (r *ReconciliationLedger) GetQuery() map[string]any { - if r == nil { - return nil - } - return r.Query -} diff --git a/internal/deployserverclient/models/components/reconciliationpolicy.go b/internal/deployserverclient/models/components/reconciliationpolicy.go deleted file mode 100644 index b8151f03..00000000 --- a/internal/deployserverclient/models/components/reconciliationpolicy.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 5b45b105ea5c - -package components - -type ReconciliationPolicy struct { - Ledger ReconciliationLedger `json:"ledger"` - Name string `json:"name"` - Pool string `json:"pool"` -} - -func (r *ReconciliationPolicy) GetLedger() ReconciliationLedger { - if r == nil { - return ReconciliationLedger{} - } - return r.Ledger -} - -func (r *ReconciliationPolicy) GetName() string { - if r == nil { - return "" - } - return r.Name -} - -func (r *ReconciliationPolicy) GetPool() string { - if r == nil { - return "" - } - return r.Pool -} diff --git a/internal/deployserverclient/models/components/regionselector.go b/internal/deployserverclient/models/components/regionselector.go deleted file mode 100644 index 063b9bf2..00000000 --- a/internal/deployserverclient/models/components/regionselector.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: f051ec8ea341 - -package components - -type RegionSelector struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -func (r *RegionSelector) GetID() *string { - if r == nil { - return nil - } - return r.ID -} - -func (r *RegionSelector) GetName() *string { - if r == nil { - return nil - } - return r.Name -} diff --git a/internal/deployserverclient/models/components/run.go b/internal/deployserverclient/models/components/run.go deleted file mode 100644 index 8ecf58a5..00000000 --- a/internal/deployserverclient/models/components/run.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: bb212548d46b - -package components - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" - "time" -) - -type Run struct { - // Unique identifier for the run - ID string `json:"id"` - // Whether the run was auto-applied - AutoApply bool `json:"autoApply"` - // Timestamp when the run was created - CreatedAt time.Time `json:"createdAt"` - // Whether the run is a destroy operation - IsDestroy bool `json:"isDestroy"` - // Whether the run has changes - HasChanges bool `json:"hasChanges"` - // Message associated with the run - Message string `json:"message"` - // Whether the run is a plan-only operation - PlanOnly bool `json:"planOnly"` - // Whether the run is a refresh operation - Refresh bool `json:"refresh"` - // Whether the run is a refresh-only operation - RefreshOnly bool `json:"refreshOnly"` - // Whether the run saves the plan - SavePlan bool `json:"savePlan"` - // Status of the run - Status string `json:"status"` - ConfigurationVersion *ConfigurationVersion `json:"configurationVersion,omitempty"` -} - -func (r Run) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) -} - -func (r *Run) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, nil); err != nil { - return err - } - return nil -} - -func (r *Run) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -func (r *Run) GetAutoApply() bool { - if r == nil { - return false - } - return r.AutoApply -} - -func (r *Run) GetCreatedAt() time.Time { - if r == nil { - return time.Time{} - } - return r.CreatedAt -} - -func (r *Run) GetIsDestroy() bool { - if r == nil { - return false - } - return r.IsDestroy -} - -func (r *Run) GetHasChanges() bool { - if r == nil { - return false - } - return r.HasChanges -} - -func (r *Run) GetMessage() string { - if r == nil { - return "" - } - return r.Message -} - -func (r *Run) GetPlanOnly() bool { - if r == nil { - return false - } - return r.PlanOnly -} - -func (r *Run) GetRefresh() bool { - if r == nil { - return false - } - return r.Refresh -} - -func (r *Run) GetRefreshOnly() bool { - if r == nil { - return false - } - return r.RefreshOnly -} - -func (r *Run) GetSavePlan() bool { - if r == nil { - return false - } - return r.SavePlan -} - -func (r *Run) GetStatus() string { - if r == nil { - return "" - } - return r.Status -} - -func (r *Run) GetConfigurationVersion() *ConfigurationVersion { - if r == nil { - return nil - } - return r.ConfigurationVersion -} diff --git a/internal/deployserverclient/models/components/runresponse.go b/internal/deployserverclient/models/components/runresponse.go deleted file mode 100644 index fd89b639..00000000 --- a/internal/deployserverclient/models/components/runresponse.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 37156d4174a5 - -package components - -type RunResponse struct { - Data Run `json:"data"` -} - -func (r *RunResponse) GetData() Run { - if r == nil { - return Run{} - } - return r.Data -} diff --git a/internal/deployserverclient/models/components/stack.go b/internal/deployserverclient/models/components/stack.go deleted file mode 100644 index 002a18db..00000000 --- a/internal/deployserverclient/models/components/stack.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 0cb6ab58393a - -package components - -type Stack struct { - Name string `json:"name"` - Region RegionSelector `json:"region"` - Version *string `json:"version,omitempty"` -} - -func (s *Stack) GetName() string { - if s == nil { - return "" - } - return s.Name -} - -func (s *Stack) GetRegion() RegionSelector { - if s == nil { - return RegionSelector{} - } - return s.Region -} - -func (s *Stack) GetVersion() *string { - if s == nil { - return nil - } - return s.Version -} diff --git a/internal/deployserverclient/models/components/updateapprequest.go b/internal/deployserverclient/models/components/updateapprequest.go index c7a05a2d..7045a1fb 100644 --- a/internal/deployserverclient/models/components/updateapprequest.go +++ b/internal/deployserverclient/models/components/updateapprequest.go @@ -4,4 +4,13 @@ package components type UpdateAppRequest struct { + // Updated name for the app + Name string `json:"name"` +} + +func (u *UpdateAppRequest) GetName() string { + if u == nil { + return "" + } + return u.Name } diff --git a/internal/deployserverclient/models/components/updatemanifestrequest.go b/internal/deployserverclient/models/components/updatemanifestrequest.go new file mode 100644 index 00000000..8cd2a385 --- /dev/null +++ b/internal/deployserverclient/models/components/updatemanifestrequest.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 7b78c92173e3 + +package components + +type UpdateManifestRequest struct { + // Updated name for the manifest + Name string `json:"name"` +} + +func (u *UpdateManifestRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} diff --git a/internal/deployserverclient/models/components/v2chartaccountmetadata.go b/internal/deployserverclient/models/components/v2chartaccountmetadata.go deleted file mode 100644 index 86a7afa2..00000000 --- a/internal/deployserverclient/models/components/v2chartaccountmetadata.go +++ /dev/null @@ -1,18 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 491d4a959c4e - -package components - -type V2ChartAccountMetadata struct { - Default *string `json:"default,omitempty"` -} - -func (v *V2ChartAccountMetadata) GetDefault() *string { - if v == nil { - return nil - } - return v.Default -} - -// #region class-body-v2chartaccountmetadata -// #endregion class-body-v2chartaccountmetadata diff --git a/internal/deployserverclient/models/components/v2chartaccountrules.go b/internal/deployserverclient/models/components/v2chartaccountrules.go deleted file mode 100644 index 76ccec55..00000000 --- a/internal/deployserverclient/models/components/v2chartaccountrules.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: c1d801e21cc5 - -package components - -type V2ChartAccountRules struct { -} - -// #region class-body-v2chartaccountrules -// #endregion class-body-v2chartaccountrules diff --git a/internal/deployserverclient/models/components/v2chartsegment.go b/internal/deployserverclient/models/components/v2chartsegment.go deleted file mode 100644 index 5ea89448..00000000 --- a/internal/deployserverclient/models/components/v2chartsegment.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: d6b9525ac608 - -package components - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" -) - -type V2ChartSegment struct { - DotMetadata map[string]V2ChartAccountMetadata `json:".metadata,omitempty"` - DotPattern *string `json:".pattern,omitempty"` - DotRules *V2ChartAccountRules `json:".rules,omitempty"` - DotSelf *DotSelf `json:".self,omitempty"` - AdditionalProperties map[string]any `additionalProperties:"true" json:"-"` -} - -func (v V2ChartSegment) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(v, "", false) -} - -func (v *V2ChartSegment) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &v, "", false, nil); err != nil { - return err - } - return nil -} - -func (v *V2ChartSegment) GetDotMetadata() map[string]V2ChartAccountMetadata { - if v == nil { - return nil - } - return v.DotMetadata -} - -func (v *V2ChartSegment) GetDotPattern() *string { - if v == nil { - return nil - } - return v.DotPattern -} - -func (v *V2ChartSegment) GetDotRules() *V2ChartAccountRules { - if v == nil { - return nil - } - return v.DotRules -} - -func (v *V2ChartSegment) GetDotSelf() *DotSelf { - if v == nil { - return nil - } - return v.DotSelf -} - -func (v *V2ChartSegment) GetAdditionalProperties() map[string]any { - if v == nil { - return nil - } - return v.AdditionalProperties -} - -// #region class-body-v2chartsegment -// #endregion class-body-v2chartsegment diff --git a/internal/deployserverclient/models/components/v2schemadata.go b/internal/deployserverclient/models/components/v2schemadata.go deleted file mode 100644 index 75680602..00000000 --- a/internal/deployserverclient/models/components/v2schemadata.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: f469d423c0af - -package components - -type V2SchemaData struct { - Chart map[string]V2ChartSegment `json:"chart,omitempty"` - Transactions map[string]V2TransactionTemplate `json:"transactions,omitempty"` -} - -func (v *V2SchemaData) GetChart() map[string]V2ChartSegment { - if v == nil { - return nil - } - return v.Chart -} - -func (v *V2SchemaData) GetTransactions() map[string]V2TransactionTemplate { - if v == nil { - return nil - } - return v.Transactions -} - -// #region class-body-v2schemadata -// #endregion class-body-v2schemadata diff --git a/internal/deployserverclient/models/components/v2transactiontemplate.go b/internal/deployserverclient/models/components/v2transactiontemplate.go deleted file mode 100644 index 7222da99..00000000 --- a/internal/deployserverclient/models/components/v2transactiontemplate.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: d8e0b9428216 - -package components - -type V2TransactionTemplate struct { - Description *string `json:"description,omitempty"` - Runtime *string `json:"runtime,omitempty"` - Script *string `json:"script,omitempty"` -} - -func (v *V2TransactionTemplate) GetDescription() *string { - if v == nil { - return nil - } - return v.Description -} - -func (v *V2TransactionTemplate) GetRuntime() *string { - if v == nil { - return nil - } - return v.Runtime -} - -func (v *V2TransactionTemplate) GetScript() *string { - if v == nil { - return nil - } - return v.Script -} - -// #region class-body-v2transactiontemplate -// #endregion class-body-v2transactiontemplate diff --git a/internal/deployserverclient/models/components/webhook.go b/internal/deployserverclient/models/components/webhook.go deleted file mode 100644 index 7e498959..00000000 --- a/internal/deployserverclient/models/components/webhook.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: d567ec78b7ea - -package components - -type Webhook struct { - Endpoint string `json:"endpoint"` - Events []string `json:"events,omitempty"` - Name string `json:"name"` - Secret *string `json:"secret,omitempty"` -} - -func (w *Webhook) GetEndpoint() string { - if w == nil { - return "" - } - return w.Endpoint -} - -func (w *Webhook) GetEvents() []string { - if w == nil { - return nil - } - return w.Events -} - -func (w *Webhook) GetName() string { - if w == nil { - return "" - } - return w.Name -} - -func (w *Webhook) GetSecret() *string { - if w == nil { - return nil - } - return w.Secret -} diff --git a/internal/deployserverclient/models/operations/createdeployment.go b/internal/deployserverclient/models/operations/createdeployment.go new file mode 100644 index 00000000..65b97e92 --- /dev/null +++ b/internal/deployserverclient/models/operations/createdeployment.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 326b5e3d00e2 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type CreateDeploymentRequest struct { + // App ID (required for inline YAML deploys) + AppID *string `queryParam:"style=form,explode=true,name=appId"` + CreateDeploymentRequest components.CreateDeploymentRequest `request:"mediaType=application/json"` +} + +func (c *CreateDeploymentRequest) GetAppID() *string { + if c == nil { + return nil + } + return c.AppID +} + +func (c *CreateDeploymentRequest) GetCreateDeploymentRequest() components.CreateDeploymentRequest { + if c == nil { + return components.CreateDeploymentRequest{} + } + return c.CreateDeploymentRequest +} + +type CreateDeploymentResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Deployment created successfully + DeploymentResponse *components.DeploymentResponse + // Error + Error *components.Error +} + +func (c *CreateDeploymentResponse) GetHTTPMeta() components.HTTPMetadata { + if c == nil { + return components.HTTPMetadata{} + } + return c.HTTPMeta +} + +func (c *CreateDeploymentResponse) GetDeploymentResponse() *components.DeploymentResponse { + if c == nil { + return nil + } + return c.DeploymentResponse +} + +func (c *CreateDeploymentResponse) GetError() *components.Error { + if c == nil { + return nil + } + return c.Error +} diff --git a/internal/deployserverclient/models/operations/createdeploymentraw.go b/internal/deployserverclient/models/operations/createdeploymentraw.go new file mode 100644 index 00000000..a6896a51 --- /dev/null +++ b/internal/deployserverclient/models/operations/createdeploymentraw.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 413206fce47e + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type CreateDeploymentRawRequest struct { + // App ID (required for inline YAML deploys) + AppID *string `queryParam:"style=form,explode=true,name=appId"` + // This field accepts []byte data or io.Reader implementations, such as *os.File. + RequestBody any `request:"mediaType=application/yaml"` +} + +func (c *CreateDeploymentRawRequest) GetAppID() *string { + if c == nil { + return nil + } + return c.AppID +} + +func (c *CreateDeploymentRawRequest) GetRequestBody() any { + if c == nil { + return nil + } + return c.RequestBody +} + +type CreateDeploymentRawResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Deployment created successfully + DeploymentResponse *components.DeploymentResponse + // Error + Error *components.Error +} + +func (c *CreateDeploymentRawResponse) GetHTTPMeta() components.HTTPMetadata { + if c == nil { + return components.HTTPMetadata{} + } + return c.HTTPMeta +} + +func (c *CreateDeploymentRawResponse) GetDeploymentResponse() *components.DeploymentResponse { + if c == nil { + return nil + } + return c.DeploymentResponse +} + +func (c *CreateDeploymentRawResponse) GetError() *components.Error { + if c == nil { + return nil + } + return c.Error +} diff --git a/internal/deployserverclient/models/operations/createmanifest.go b/internal/deployserverclient/models/operations/createmanifest.go new file mode 100644 index 00000000..99920019 --- /dev/null +++ b/internal/deployserverclient/models/operations/createmanifest.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 7be33bfb9044 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +// CreateManifestRequestBody - JSON manifest content +type CreateManifestRequestBody struct { +} + +type CreateManifestRequest struct { + // Name for the manifest + Name string `queryParam:"style=form,explode=true,name=name"` + // Optional app ID to scope the manifest to a specific app + AppID *string `queryParam:"style=form,explode=true,name=appId"` + RequestBody CreateManifestRequestBody `request:"mediaType=application/json"` +} + +func (c *CreateManifestRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateManifestRequest) GetAppID() *string { + if c == nil { + return nil + } + return c.AppID +} + +func (c *CreateManifestRequest) GetRequestBody() CreateManifestRequestBody { + if c == nil { + return CreateManifestRequestBody{} + } + return c.RequestBody +} + +type CreateManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest created successfully + CreateManifestResponse *components.CreateManifestResponse + // Error + Error *components.Error +} + +func (c *CreateManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if c == nil { + return components.HTTPMetadata{} + } + return c.HTTPMeta +} + +func (c *CreateManifestResponse) GetCreateManifestResponse() *components.CreateManifestResponse { + if c == nil { + return nil + } + return c.CreateManifestResponse +} + +func (c *CreateManifestResponse) GetError() *components.Error { + if c == nil { + return nil + } + return c.Error +} diff --git a/internal/deployserverclient/models/operations/createmanifestraw.go b/internal/deployserverclient/models/operations/createmanifestraw.go new file mode 100644 index 00000000..71aeab2d --- /dev/null +++ b/internal/deployserverclient/models/operations/createmanifestraw.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 15dca3cfa2e6 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type CreateManifestRawRequest struct { + // Name for the manifest + Name string `queryParam:"style=form,explode=true,name=name"` + // Optional app ID to scope the manifest to a specific app + AppID *string `queryParam:"style=form,explode=true,name=appId"` + // This field accepts []byte data or io.Reader implementations, such as *os.File. + RequestBody any `request:"mediaType=application/yaml"` +} + +func (c *CreateManifestRawRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateManifestRawRequest) GetAppID() *string { + if c == nil { + return nil + } + return c.AppID +} + +func (c *CreateManifestRawRequest) GetRequestBody() any { + if c == nil { + return nil + } + return c.RequestBody +} + +type CreateManifestRawResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest created successfully + CreateManifestResponse *components.CreateManifestResponse + // Error + Error *components.Error +} + +func (c *CreateManifestRawResponse) GetHTTPMeta() components.HTTPMetadata { + if c == nil { + return components.HTTPMetadata{} + } + return c.HTTPMeta +} + +func (c *CreateManifestRawResponse) GetCreateManifestResponse() *components.CreateManifestResponse { + if c == nil { + return nil + } + return c.CreateManifestResponse +} + +func (c *CreateManifestRawResponse) GetError() *components.Error { + if c == nil { + return nil + } + return c.Error +} diff --git a/internal/deployserverclient/models/operations/deletemanifest.go b/internal/deployserverclient/models/operations/deletemanifest.go new file mode 100644 index 00000000..06b43a2f --- /dev/null +++ b/internal/deployserverclient/models/operations/deletemanifest.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 74acf540b4e9 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type DeleteManifestRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` +} + +func (d *DeleteManifestRequest) GetManifestID() string { + if d == nil { + return "" + } + return d.ManifestID +} + +type DeleteManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest is still referenced by deployments + Error *components.Error +} + +func (d *DeleteManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if d == nil { + return components.HTTPMetadata{} + } + return d.HTTPMeta +} + +func (d *DeleteManifestResponse) GetError() *components.Error { + if d == nil { + return nil + } + return d.Error +} diff --git a/internal/deployserverclient/models/operations/deployappconfiguration.go b/internal/deployserverclient/models/operations/deployappconfiguration.go deleted file mode 100644 index 35c6066d..00000000 --- a/internal/deployserverclient/models/operations/deployappconfiguration.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 8e90a0308c1e - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type DeployAppConfigurationRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - Application components.Application `request:"mediaType=application/json"` -} - -func (d *DeployAppConfigurationRequest) GetID() string { - if d == nil { - return "" - } - return d.ID -} - -func (d *DeployAppConfigurationRequest) GetApplication() components.Application { - if d == nil { - return components.Application{} - } - return d.Application -} - -type DeployAppConfigurationResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // App configuration deployed successfully - RunResponse *components.RunResponse - // Error - Error *components.Error -} - -func (d *DeployAppConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { - if d == nil { - return components.HTTPMetadata{} - } - return d.HTTPMeta -} - -func (d *DeployAppConfigurationResponse) GetRunResponse() *components.RunResponse { - if d == nil { - return nil - } - return d.RunResponse -} - -func (d *DeployAppConfigurationResponse) GetError() *components.Error { - if d == nil { - return nil - } - return d.Error -} diff --git a/internal/deployserverclient/models/operations/deployappconfigurationraw.go b/internal/deployserverclient/models/operations/deployappconfigurationraw.go deleted file mode 100644 index 4e9796f4..00000000 --- a/internal/deployserverclient/models/operations/deployappconfigurationraw.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: da484da15385 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type DeployAppConfigurationRawRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - // This field accepts []byte data or io.Reader implementations, such as *os.File. - RequestBody any `request:"mediaType=application/yaml"` -} - -func (d *DeployAppConfigurationRawRequest) GetID() string { - if d == nil { - return "" - } - return d.ID -} - -func (d *DeployAppConfigurationRawRequest) GetRequestBody() any { - if d == nil { - return nil - } - return d.RequestBody -} - -type DeployAppConfigurationRawResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // App configuration deployed successfully - RunResponse *components.RunResponse - // Error - Error *components.Error -} - -func (d *DeployAppConfigurationRawResponse) GetHTTPMeta() components.HTTPMetadata { - if d == nil { - return components.HTTPMetadata{} - } - return d.HTTPMeta -} - -func (d *DeployAppConfigurationRawResponse) GetRunResponse() *components.RunResponse { - if d == nil { - return nil - } - return d.RunResponse -} - -func (d *DeployAppConfigurationRawResponse) GetError() *components.Error { - if d == nil { - return nil - } - return d.Error -} diff --git a/internal/deployserverclient/models/operations/listapps.go b/internal/deployserverclient/models/operations/listapps.go index cffd13ec..6f451a51 100644 --- a/internal/deployserverclient/models/operations/listapps.go +++ b/internal/deployserverclient/models/operations/listapps.go @@ -8,16 +8,8 @@ import ( ) type ListAppsRequest struct { - OrganizationID string `queryParam:"style=form,explode=true,name=organizationId"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` -} - -func (l *ListAppsRequest) GetOrganizationID() string { - if l == nil { - return "" - } - return l.OrganizationID + PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` } func (l *ListAppsRequest) GetPageNumber() *int64 { diff --git a/internal/deployserverclient/models/operations/listdeployments.go b/internal/deployserverclient/models/operations/listdeployments.go new file mode 100644 index 00000000..ddae0d51 --- /dev/null +++ b/internal/deployserverclient/models/operations/listdeployments.go @@ -0,0 +1,64 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: d893847d4513 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type ListDeploymentsRequest struct { + AppID *string `queryParam:"style=form,explode=true,name=appId"` + PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` +} + +func (l *ListDeploymentsRequest) GetAppID() *string { + if l == nil { + return nil + } + return l.AppID +} + +func (l *ListDeploymentsRequest) GetPageNumber() *int64 { + if l == nil { + return nil + } + return l.PageNumber +} + +func (l *ListDeploymentsRequest) GetPageSize() *int64 { + if l == nil { + return nil + } + return l.PageSize +} + +type ListDeploymentsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Deployments retrieved successfully + ListDeploymentsResponse *components.ListDeploymentsResponse + // Error + Error *components.Error +} + +func (l *ListDeploymentsResponse) GetHTTPMeta() components.HTTPMetadata { + if l == nil { + return components.HTTPMetadata{} + } + return l.HTTPMeta +} + +func (l *ListDeploymentsResponse) GetListDeploymentsResponse() *components.ListDeploymentsResponse { + if l == nil { + return nil + } + return l.ListDeploymentsResponse +} + +func (l *ListDeploymentsResponse) GetError() *components.Error { + if l == nil { + return nil + } + return l.Error +} diff --git a/internal/deployserverclient/models/operations/listmanifests.go b/internal/deployserverclient/models/operations/listmanifests.go new file mode 100644 index 00000000..6d1c50e7 --- /dev/null +++ b/internal/deployserverclient/models/operations/listmanifests.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: bc6fb185b576 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type ListManifestsRequest struct { + PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Filter manifests by app ID (includes org-wide manifests as fallback) + AppID *string `queryParam:"style=form,explode=true,name=appId"` +} + +func (l *ListManifestsRequest) GetPageNumber() *int64 { + if l == nil { + return nil + } + return l.PageNumber +} + +func (l *ListManifestsRequest) GetPageSize() *int64 { + if l == nil { + return nil + } + return l.PageSize +} + +func (l *ListManifestsRequest) GetAppID() *string { + if l == nil { + return nil + } + return l.AppID +} + +type ListManifestsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifests retrieved successfully + ListManifestsResponse *components.ListManifestsResponse + // Error + Error *components.Error +} + +func (l *ListManifestsResponse) GetHTTPMeta() components.HTTPMetadata { + if l == nil { + return components.HTTPMetadata{} + } + return l.HTTPMeta +} + +func (l *ListManifestsResponse) GetListManifestsResponse() *components.ListManifestsResponse { + if l == nil { + return nil + } + return l.ListManifestsResponse +} + +func (l *ListManifestsResponse) GetError() *components.Error { + if l == nil { + return nil + } + return l.Error +} diff --git a/internal/deployserverclient/models/operations/listmanifestversions.go b/internal/deployserverclient/models/operations/listmanifestversions.go new file mode 100644 index 00000000..f74af98d --- /dev/null +++ b/internal/deployserverclient/models/operations/listmanifestversions.go @@ -0,0 +1,64 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: e8bf8a35a4b6 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type ListManifestVersionsRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` +} + +func (l *ListManifestVersionsRequest) GetManifestID() string { + if l == nil { + return "" + } + return l.ManifestID +} + +func (l *ListManifestVersionsRequest) GetPageNumber() *int64 { + if l == nil { + return nil + } + return l.PageNumber +} + +func (l *ListManifestVersionsRequest) GetPageSize() *int64 { + if l == nil { + return nil + } + return l.PageSize +} + +type ListManifestVersionsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest versions retrieved successfully + ListManifestVersionsResponse *components.ListManifestVersionsResponse + // Error + Error *components.Error +} + +func (l *ListManifestVersionsResponse) GetHTTPMeta() components.HTTPMetadata { + if l == nil { + return components.HTTPMetadata{} + } + return l.HTTPMeta +} + +func (l *ListManifestVersionsResponse) GetListManifestVersionsResponse() *components.ListManifestVersionsResponse { + if l == nil { + return nil + } + return l.ListManifestVersionsResponse +} + +func (l *ListManifestVersionsResponse) GetError() *components.Error { + if l == nil { + return nil + } + return l.Error +} diff --git a/internal/deployserverclient/models/operations/options.go b/internal/deployserverclient/models/operations/options.go index 42fca769..0010ed43 100644 --- a/internal/deployserverclient/models/operations/options.go +++ b/internal/deployserverclient/models/operations/options.go @@ -22,9 +22,10 @@ const ( type AcceptHeaderEnum string const ( - AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" - AcceptHeaderEnumApplicationYaml AcceptHeaderEnum = "application/yaml" - AcceptHeaderEnumApplicationGzip AcceptHeaderEnum = "application/gzip" + AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" + AcceptHeaderEnumApplicationGzip AcceptHeaderEnum = "application/gzip" + AcceptHeaderEnumApplicationXYaml AcceptHeaderEnum = "application/x-yaml" + AcceptHeaderEnumApplicationYaml AcceptHeaderEnum = "application/yaml" ) func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { diff --git a/internal/deployserverclient/models/operations/pushmanifestversion.go b/internal/deployserverclient/models/operations/pushmanifestversion.go new file mode 100644 index 00000000..d8c0578c --- /dev/null +++ b/internal/deployserverclient/models/operations/pushmanifestversion.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 0f7af438ef3a + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +// PushManifestVersionRequestBody - JSON manifest content +type PushManifestVersionRequestBody struct { +} + +type PushManifestVersionRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + RequestBody PushManifestVersionRequestBody `request:"mediaType=application/json"` +} + +func (p *PushManifestVersionRequest) GetManifestID() string { + if p == nil { + return "" + } + return p.ManifestID +} + +func (p *PushManifestVersionRequest) GetRequestBody() PushManifestVersionRequestBody { + if p == nil { + return PushManifestVersionRequestBody{} + } + return p.RequestBody +} + +type PushManifestVersionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest version created successfully + ManifestVersionResponse *components.ManifestVersionResponse + // Error + Error *components.Error +} + +func (p *PushManifestVersionResponse) GetHTTPMeta() components.HTTPMetadata { + if p == nil { + return components.HTTPMetadata{} + } + return p.HTTPMeta +} + +func (p *PushManifestVersionResponse) GetManifestVersionResponse() *components.ManifestVersionResponse { + if p == nil { + return nil + } + return p.ManifestVersionResponse +} + +func (p *PushManifestVersionResponse) GetError() *components.Error { + if p == nil { + return nil + } + return p.Error +} diff --git a/internal/deployserverclient/models/operations/pushmanifestversionraw.go b/internal/deployserverclient/models/operations/pushmanifestversionraw.go new file mode 100644 index 00000000..03411e7c --- /dev/null +++ b/internal/deployserverclient/models/operations/pushmanifestversionraw.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 4d4b476a2bc8 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type PushManifestVersionRawRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + // This field accepts []byte data or io.Reader implementations, such as *os.File. + RequestBody any `request:"mediaType=application/yaml"` +} + +func (p *PushManifestVersionRawRequest) GetManifestID() string { + if p == nil { + return "" + } + return p.ManifestID +} + +func (p *PushManifestVersionRawRequest) GetRequestBody() any { + if p == nil { + return nil + } + return p.RequestBody +} + +type PushManifestVersionRawResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest version created successfully + ManifestVersionResponse *components.ManifestVersionResponse + // Error + Error *components.Error +} + +func (p *PushManifestVersionRawResponse) GetHTTPMeta() components.HTTPMetadata { + if p == nil { + return components.HTTPMetadata{} + } + return p.HTTPMeta +} + +func (p *PushManifestVersionRawResponse) GetManifestVersionResponse() *components.ManifestVersionResponse { + if p == nil { + return nil + } + return p.ManifestVersionResponse +} + +func (p *PushManifestVersionRawResponse) GetError() *components.Error { + if p == nil { + return nil + } + return p.Error +} diff --git a/internal/deployserverclient/models/operations/readapp.go b/internal/deployserverclient/models/operations/readapp.go index c0da89ff..ff16e36f 100644 --- a/internal/deployserverclient/models/operations/readapp.go +++ b/internal/deployserverclient/models/operations/readapp.go @@ -4,11 +4,40 @@ package operations import ( + "encoding/json" + "fmt" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" ) +type ReadAppInclude string + +const ( + ReadAppIncludeState ReadAppInclude = "state" +) + +func (e ReadAppInclude) ToPointer() *ReadAppInclude { + return &e +} +func (e *ReadAppInclude) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "state": + *e = ReadAppInclude(v) + return nil + default: + return fmt.Errorf("invalid value for ReadAppInclude: %v", v) + } +} + type ReadAppRequest struct { ID string `pathParam:"style=simple,explode=false,name=id"` + // Comma-separated list of related resources to include. + // - `state`: Include the current Terraform workspace state. + // + Include []ReadAppInclude `queryParam:"style=form,explode=true,name=include"` } func (r *ReadAppRequest) GetID() string { @@ -18,6 +47,13 @@ func (r *ReadAppRequest) GetID() string { return r.ID } +func (r *ReadAppRequest) GetInclude() []ReadAppInclude { + if r == nil { + return nil + } + return r.Include +} + type ReadAppResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // App details retrieved successfully diff --git a/internal/deployserverclient/models/operations/readappcurrentstateversion.go b/internal/deployserverclient/models/operations/readappcurrentstateversion.go deleted file mode 100644 index 25aa5b88..00000000 --- a/internal/deployserverclient/models/operations/readappcurrentstateversion.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 43c91c9a5fd7 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadAppCurrentStateVersionRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (r *ReadAppCurrentStateVersionRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -type ReadAppCurrentStateVersionResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Current state version retrieved successfully - ReadStateResponse *components.ReadStateResponse - // Error - Error *components.Error -} - -func (r *ReadAppCurrentStateVersionResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadAppCurrentStateVersionResponse) GetReadStateResponse() *components.ReadStateResponse { - if r == nil { - return nil - } - return r.ReadStateResponse -} - -func (r *ReadAppCurrentStateVersionResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readappruns.go b/internal/deployserverclient/models/operations/readappruns.go deleted file mode 100644 index 8f5ff67e..00000000 --- a/internal/deployserverclient/models/operations/readappruns.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: a61642c0d316 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadAppRunsRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` -} - -func (r *ReadAppRunsRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -func (r *ReadAppRunsRequest) GetPageNumber() *int64 { - if r == nil { - return nil - } - return r.PageNumber -} - -func (r *ReadAppRunsRequest) GetPageSize() *int64 { - if r == nil { - return nil - } - return r.PageSize -} - -type ReadAppRunsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // App runs retrieved successfully - ListRunsResponse *components.ListRunsResponse - // Error - Error *components.Error -} - -func (r *ReadAppRunsResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadAppRunsResponse) GetListRunsResponse() *components.ListRunsResponse { - if r == nil { - return nil - } - return r.ListRunsResponse -} - -func (r *ReadAppRunsResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readappversions.go b/internal/deployserverclient/models/operations/readappversions.go deleted file mode 100644 index 5a47d8d1..00000000 --- a/internal/deployserverclient/models/operations/readappversions.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 3be017d24d90 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadAppVersionsRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` -} - -func (r *ReadAppVersionsRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -func (r *ReadAppVersionsRequest) GetPageNumber() *int64 { - if r == nil { - return nil - } - return r.PageNumber -} - -func (r *ReadAppVersionsRequest) GetPageSize() *int64 { - if r == nil { - return nil - } - return r.PageSize -} - -type ReadAppVersionsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // App versions retrieved successfully - ListVersionsResponse *components.ListVersionsResponse - // Error - Error *components.Error -} - -func (r *ReadAppVersionsResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadAppVersionsResponse) GetListVersionsResponse() *components.ListVersionsResponse { - if r == nil { - return nil - } - return r.ListVersionsResponse -} - -func (r *ReadAppVersionsResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readcurrentappversion.go b/internal/deployserverclient/models/operations/readcurrentappversion.go deleted file mode 100644 index 5d01da8e..00000000 --- a/internal/deployserverclient/models/operations/readcurrentappversion.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 2236f4e2f610 - -package operations - -import ( - "encoding/json" - "fmt" - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" - "io" -) - -type From string - -const ( - FromState From = "state" -) - -func (e From) ToPointer() *From { - return &e -} -func (e *From) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "state": - *e = From(v) - return nil - default: - return fmt.Errorf("invalid value for From: %v", v) - } -} - -type ReadCurrentAppVersionRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - From *From `queryParam:"style=form,explode=true,name=from"` -} - -func (r *ReadCurrentAppVersionRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -func (r *ReadCurrentAppVersionRequest) GetFrom() *From { - if r == nil { - return nil - } - return r.From -} - -type ReadCurrentAppVersionResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Current app version retrieved successfully - AppVersionResponse *components.AppVersionResponse - // Current app version retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationGzipResponseStream io.ReadCloser - // Current app version retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationYamlResponseStream io.ReadCloser - // Error - Error *components.Error -} - -func (r *ReadCurrentAppVersionResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadCurrentAppVersionResponse) GetAppVersionResponse() *components.AppVersionResponse { - if r == nil { - return nil - } - return r.AppVersionResponse -} - -func (r *ReadCurrentAppVersionResponse) GetTwoHundredApplicationGzipResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.TwoHundredApplicationGzipResponseStream -} - -func (r *ReadCurrentAppVersionResponse) GetTwoHundredApplicationYamlResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.TwoHundredApplicationYamlResponseStream -} - -func (r *ReadCurrentAppVersionResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readcurrentrun.go b/internal/deployserverclient/models/operations/readcurrentrun.go deleted file mode 100644 index ab1d0c30..00000000 --- a/internal/deployserverclient/models/operations/readcurrentrun.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 617b396abefc - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadCurrentRunRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (r *ReadCurrentRunRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -type ReadCurrentRunResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Current run retrieved successfully - RunResponse *components.RunResponse - // Error - Error *components.Error -} - -func (r *ReadCurrentRunResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadCurrentRunResponse) GetRunResponse() *components.RunResponse { - if r == nil { - return nil - } - return r.RunResponse -} - -func (r *ReadCurrentRunResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readdeployment.go b/internal/deployserverclient/models/operations/readdeployment.go new file mode 100644 index 00000000..d4cd445d --- /dev/null +++ b/internal/deployserverclient/models/operations/readdeployment.go @@ -0,0 +1,105 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: ae784249b40f + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "io" +) + +type ReadDeploymentInclude string + +const ( + ReadDeploymentIncludeState ReadDeploymentInclude = "state" +) + +func (e ReadDeploymentInclude) ToPointer() *ReadDeploymentInclude { + return &e +} +func (e *ReadDeploymentInclude) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "state": + *e = ReadDeploymentInclude(v) + return nil + default: + return fmt.Errorf("invalid value for ReadDeploymentInclude: %v", v) + } +} + +type ReadDeploymentRequest struct { + DeploymentID string `pathParam:"style=simple,explode=false,name=deploymentId"` + // Comma-separated list of related resources to include. + // - `state`: Include the Terraform state produced by this deployment's run. + // + Include []ReadDeploymentInclude `queryParam:"style=form,explode=true,name=include"` +} + +func (r *ReadDeploymentRequest) GetDeploymentID() string { + if r == nil { + return "" + } + return r.DeploymentID +} + +func (r *ReadDeploymentRequest) GetInclude() []ReadDeploymentInclude { + if r == nil { + return nil + } + return r.Include +} + +type ReadDeploymentResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Deployment retrieved successfully + DeploymentResponse *components.DeploymentResponse + // Deployment retrieved successfully + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + TwoHundredApplicationGzipResponseStream io.ReadCloser + // Deployment retrieved successfully + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + TwoHundredApplicationYamlResponseStream io.ReadCloser + // Error + Error *components.Error +} + +func (r *ReadDeploymentResponse) GetHTTPMeta() components.HTTPMetadata { + if r == nil { + return components.HTTPMetadata{} + } + return r.HTTPMeta +} + +func (r *ReadDeploymentResponse) GetDeploymentResponse() *components.DeploymentResponse { + if r == nil { + return nil + } + return r.DeploymentResponse +} + +func (r *ReadDeploymentResponse) GetTwoHundredApplicationGzipResponseStream() io.ReadCloser { + if r == nil { + return nil + } + return r.TwoHundredApplicationGzipResponseStream +} + +func (r *ReadDeploymentResponse) GetTwoHundredApplicationYamlResponseStream() io.ReadCloser { + if r == nil { + return nil + } + return r.TwoHundredApplicationYamlResponseStream +} + +func (r *ReadDeploymentResponse) GetError() *components.Error { + if r == nil { + return nil + } + return r.Error +} diff --git a/internal/deployserverclient/models/operations/readcurrentrunlogs.go b/internal/deployserverclient/models/operations/readdeploymentlogs.go similarity index 52% rename from internal/deployserverclient/models/operations/readcurrentrunlogs.go rename to internal/deployserverclient/models/operations/readdeploymentlogs.go index 7c9fda3f..0ac0a717 100644 --- a/internal/deployserverclient/models/operations/readcurrentrunlogs.go +++ b/internal/deployserverclient/models/operations/readdeploymentlogs.go @@ -1,5 +1,5 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: bde8c9da719b +// @generated-id: b72515ab4199 package operations @@ -7,40 +7,40 @@ import ( "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" ) -type ReadCurrentRunLogsRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` +type ReadDeploymentLogsRequest struct { + DeploymentID string `pathParam:"style=simple,explode=false,name=deploymentId"` } -func (r *ReadCurrentRunLogsRequest) GetID() string { +func (r *ReadDeploymentLogsRequest) GetDeploymentID() string { if r == nil { return "" } - return r.ID + return r.DeploymentID } -type ReadCurrentRunLogsResponse struct { +type ReadDeploymentLogsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` - // Current run logs retrieved successfully + // Deployment logs retrieved successfully ReadLogsResponse *components.ReadLogsResponse // Error Error *components.Error } -func (r *ReadCurrentRunLogsResponse) GetHTTPMeta() components.HTTPMetadata { +func (r *ReadDeploymentLogsResponse) GetHTTPMeta() components.HTTPMetadata { if r == nil { return components.HTTPMetadata{} } return r.HTTPMeta } -func (r *ReadCurrentRunLogsResponse) GetReadLogsResponse() *components.ReadLogsResponse { +func (r *ReadDeploymentLogsResponse) GetReadLogsResponse() *components.ReadLogsResponse { if r == nil { return nil } return r.ReadLogsResponse } -func (r *ReadCurrentRunLogsResponse) GetError() *components.Error { +func (r *ReadDeploymentLogsResponse) GetError() *components.Error { if r == nil { return nil } diff --git a/internal/deployserverclient/models/operations/readmanifest.go b/internal/deployserverclient/models/operations/readmanifest.go new file mode 100644 index 00000000..2beac535 --- /dev/null +++ b/internal/deployserverclient/models/operations/readmanifest.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 1c4b97e4c0d5 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "io" +) + +type ReadManifestRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + // Comma-separated includes (e.g. "latest" to embed latest version content) + Include *string `queryParam:"style=form,explode=true,name=include"` +} + +func (r *ReadManifestRequest) GetManifestID() string { + if r == nil { + return "" + } + return r.ManifestID +} + +func (r *ReadManifestRequest) GetInclude() *string { + if r == nil { + return nil + } + return r.Include +} + +type ReadManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest retrieved successfully + ManifestResponse *components.ManifestResponse + // Manifest retrieved successfully + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser + // Error + Error *components.Error +} + +func (r *ReadManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if r == nil { + return components.HTTPMetadata{} + } + return r.HTTPMeta +} + +func (r *ReadManifestResponse) GetManifestResponse() *components.ManifestResponse { + if r == nil { + return nil + } + return r.ManifestResponse +} + +func (r *ReadManifestResponse) GetResponseStream() io.ReadCloser { + if r == nil { + return nil + } + return r.ResponseStream +} + +func (r *ReadManifestResponse) GetError() *components.Error { + if r == nil { + return nil + } + return r.Error +} diff --git a/internal/deployserverclient/models/operations/readmanifestversion.go b/internal/deployserverclient/models/operations/readmanifestversion.go new file mode 100644 index 00000000..586511fc --- /dev/null +++ b/internal/deployserverclient/models/operations/readmanifestversion.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 998f6b496360 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "io" +) + +type ReadManifestVersionRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + // Version number or "latest" + Version string `pathParam:"style=simple,explode=false,name=version"` +} + +func (r *ReadManifestVersionRequest) GetManifestID() string { + if r == nil { + return "" + } + return r.ManifestID +} + +func (r *ReadManifestVersionRequest) GetVersion() string { + if r == nil { + return "" + } + return r.Version +} + +type ReadManifestVersionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest version retrieved successfully + ManifestVersionResponse *components.ManifestVersionResponse + // Manifest version retrieved successfully + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser + // Error + Error *components.Error +} + +func (r *ReadManifestVersionResponse) GetHTTPMeta() components.HTTPMetadata { + if r == nil { + return components.HTTPMetadata{} + } + return r.HTTPMeta +} + +func (r *ReadManifestVersionResponse) GetManifestVersionResponse() *components.ManifestVersionResponse { + if r == nil { + return nil + } + return r.ManifestVersionResponse +} + +func (r *ReadManifestVersionResponse) GetResponseStream() io.ReadCloser { + if r == nil { + return nil + } + return r.ResponseStream +} + +func (r *ReadManifestVersionResponse) GetError() *components.Error { + if r == nil { + return nil + } + return r.Error +} diff --git a/internal/deployserverclient/models/operations/readrun.go b/internal/deployserverclient/models/operations/readrun.go deleted file mode 100644 index 2970dc1e..00000000 --- a/internal/deployserverclient/models/operations/readrun.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 87911583c9dd - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadRunRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (r *ReadRunRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -type ReadRunResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Run retrieved successfully - RunResponse *components.RunResponse - // Error - Error *components.Error -} - -func (r *ReadRunResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadRunResponse) GetRunResponse() *components.RunResponse { - if r == nil { - return nil - } - return r.RunResponse -} - -func (r *ReadRunResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readrunlogs.go b/internal/deployserverclient/models/operations/readrunlogs.go deleted file mode 100644 index 431dd2ca..00000000 --- a/internal/deployserverclient/models/operations/readrunlogs.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: c2d8dff135c8 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type ReadRunLogsRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (r *ReadRunLogsRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -type ReadRunLogsResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Run logs retrieved successfully - ReadLogsResponse *components.ReadLogsResponse - // Error - Error *components.Error -} - -func (r *ReadRunLogsResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadRunLogsResponse) GetReadLogsResponse() *components.ReadLogsResponse { - if r == nil { - return nil - } - return r.ReadLogsResponse -} - -func (r *ReadRunLogsResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/readversion.go b/internal/deployserverclient/models/operations/readversion.go deleted file mode 100644 index 9dcc7bc3..00000000 --- a/internal/deployserverclient/models/operations/readversion.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: e87f29195fa2 - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" - "io" -) - -type ReadVersionRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` -} - -func (r *ReadVersionRequest) GetID() string { - if r == nil { - return "" - } - return r.ID -} - -type ReadVersionResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // version retrieved successfully - AppVersionResponse *components.AppVersionResponse - // version retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationGzipResponseStream io.ReadCloser - // version retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationYamlResponseStream io.ReadCloser - // Error - Error *components.Error -} - -func (r *ReadVersionResponse) GetHTTPMeta() components.HTTPMetadata { - if r == nil { - return components.HTTPMetadata{} - } - return r.HTTPMeta -} - -func (r *ReadVersionResponse) GetAppVersionResponse() *components.AppVersionResponse { - if r == nil { - return nil - } - return r.AppVersionResponse -} - -func (r *ReadVersionResponse) GetTwoHundredApplicationGzipResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.TwoHundredApplicationGzipResponseStream -} - -func (r *ReadVersionResponse) GetTwoHundredApplicationYamlResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.TwoHundredApplicationYamlResponseStream -} - -func (r *ReadVersionResponse) GetError() *components.Error { - if r == nil { - return nil - } - return r.Error -} diff --git a/internal/deployserverclient/models/operations/updatemanifest.go b/internal/deployserverclient/models/operations/updatemanifest.go new file mode 100644 index 00000000..3b64059f --- /dev/null +++ b/internal/deployserverclient/models/operations/updatemanifest.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 5a5e3776c473 + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type UpdateManifestRequest struct { + ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` + UpdateManifestRequest components.UpdateManifestRequest `request:"mediaType=application/json"` +} + +func (u *UpdateManifestRequest) GetManifestID() string { + if u == nil { + return "" + } + return u.ManifestID +} + +func (u *UpdateManifestRequest) GetUpdateManifestRequest() components.UpdateManifestRequest { + if u == nil { + return components.UpdateManifestRequest{} + } + return u.UpdateManifestRequest +} + +type UpdateManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Manifest updated successfully + ManifestResponse *components.ManifestResponse + // Error + Error *components.Error +} + +func (u *UpdateManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if u == nil { + return components.HTTPMetadata{} + } + return u.HTTPMeta +} + +func (u *UpdateManifestResponse) GetManifestResponse() *components.ManifestResponse { + if u == nil { + return nil + } + return u.ManifestResponse +} + +func (u *UpdateManifestResponse) GetError() *components.Error { + if u == nil { + return nil + } + return u.Error +} diff --git a/openapi/deployserver.yaml b/openapi/deployserver.yaml index 6bcb0d43..e7b862a3 100644 --- a/openapi/deployserver.yaml +++ b/openapi/deployserver.yaml @@ -6,7 +6,7 @@ info: servers: - url: https://deploy.formance.cloud description: Production server -- url: https://deploy-server.staging.formance.cloud +- url: https://deploy.staging.formance.cloud description: Staging server - url: http://localhost:8080 description: Local server @@ -16,11 +16,6 @@ paths: summary: List organization apps operationId: listApps parameters: - - name: organizationId - in: query - required: true - schema: - type: string - name: pageNumber in: query schema: @@ -98,6 +93,18 @@ paths: required: true schema: type: string + - name: include + in: query + required: false + description: | + Comma-separated list of related resources to include. + - `state`: Include the current Terraform workspace state. + schema: + type: array + items: + type: string + enum: + - state responses: '200': description: App details retrieved successfully @@ -129,29 +136,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/current-state-version: - get: - summary: Get the current state version of an app - operationId: readAppCurrentStateVersion - parameters: - - name: id - in: path - required: true - schema: - type: string - responses: - '200': - description: Current state version retrieved successfully - content: - application/json: - schema: - $ref: '#/components/schemas/ReadStateResponse' - default: - description: Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' /apps/{id}/variables: get: summary: Get all variables of an app @@ -235,16 +219,52 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/runs: - get: - summary: Get runs of an app - operationId: readAppRuns + /manifests: + post: + summary: Create a new manifest + operationId: createManifest parameters: - - name: id - in: path + - name: name + in: query required: true schema: type: string + description: Name for the manifest + - name: appId + in: query + required: false + schema: + type: string + description: Optional app ID to scope the manifest to a specific app + requestBody: + required: true + content: + application/yaml: + schema: + type: string + format: binary + description: YAML manifest content + application/json: + schema: + type: object + description: JSON manifest content + responses: + '201': + description: Manifest created successfully + content: + application/json: + schema: + $ref: '#/components/schemas/CreateManifestResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + get: + summary: List manifests in the organization + operationId: listManifests + parameters: - name: pageNumber in: query schema: @@ -253,56 +273,117 @@ paths: in: query schema: type: integer + - name: appId + in: query + required: false + schema: + type: string + description: Filter manifests by app ID (includes org-wide manifests as fallback) responses: '200': - description: App runs retrieved successfully + description: Manifests retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ListRunsResponse' + $ref: '#/components/schemas/ListManifestsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/versions: + /manifests/{manifestId}: get: - summary: Get versions of an app - operationId: readAppVersions + summary: Read a manifest + operationId: readManifest parameters: - - name: id + - name: manifestId in: path required: true schema: type: string - - name: pageNumber + - name: include in: query + required: false schema: - type: integer - - name: pageSize - in: query + type: string + description: Comma-separated includes (e.g. "latest" to embed latest version content) + responses: + '200': + description: Manifest retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/ManifestResponse' + application/gzip: + schema: + type: string + format: binary + description: Transpiled tar.gz of the latest manifest version + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + patch: + summary: Update manifest metadata + operationId: updateManifest + parameters: + - name: manifestId + in: path + required: true schema: - type: integer + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateManifestRequest' responses: '200': - description: App versions retrieved successfully + description: Manifest updated successfully content: application/json: schema: - $ref: '#/components/schemas/ListVersionsResponse' + $ref: '#/components/schemas/ManifestResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/deploy: + delete: + summary: Delete a manifest and all its versions + operationId: deleteManifest + parameters: + - name: manifestId + in: path + required: true + schema: + type: string + responses: + '204': + description: Manifest deleted successfully + '409': + description: Manifest is still referenced by deployments + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /manifests/{manifestId}/versions: post: - summary: Deploy a new configuration for an app - operationId: deployAppConfiguration + summary: Push a new version of a manifest + operationId: pushManifestVersion parameters: - - name: id + - name: manifestId in: path required: true schema: @@ -317,165 +398,171 @@ paths: description: YAML manifest content application/json: schema: - $ref: '#/components/schemas/application' + type: object + description: JSON manifest content responses: - '202': - description: App configuration deployed successfully + '201': + description: Manifest version created successfully content: application/json: schema: - $ref: '#/components/schemas/RunResponse' + $ref: '#/components/schemas/ManifestVersionResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/run: get: - summary: Get the current run of an app - operationId: readCurrentRun + summary: List versions of a manifest + operationId: listManifestVersions parameters: - - name: id + - name: manifestId in: path required: true schema: type: string + - name: pageNumber + in: query + schema: + type: integer + - name: pageSize + in: query + schema: + type: integer responses: '200': - description: Current run retrieved successfully + description: Manifest versions retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/RunResponse' + $ref: '#/components/schemas/ListManifestVersionsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /versions/{id}: + /manifests/{manifestId}/versions/{version}: get: - summary: Get a specific version - operationId: readVersion + summary: Get a specific manifest version with content + operationId: readManifestVersion parameters: - - name: id + - name: manifestId in: path required: true schema: type: string + - name: version + in: path + required: true + description: Version number or "latest" + schema: + type: string - name: accept in: header required: false description: | The desired response format. - - `application/json`: Returns the version metadata in JSON format. - - `application/gzip`: Returns the version as a gzip archive. - - `application/yaml`: Returns the original manifest content. + - `application/json`: Returns the version metadata and content in JSON format. + - `application/x-yaml`: Returns the raw manifest content as YAML. schema: type: string enum: - application/json - - application/gzip - - application/yaml + - application/x-yaml responses: '200': - description: version retrieved successfully + description: Manifest version retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/AppVersionResponse' - application/gzip: - schema: - type: string - format: binary - description: Archive - application/yaml: + $ref: '#/components/schemas/ManifestVersionResponse' + application/x-yaml: schema: type: string format: binary - description: Original manifest content + description: Raw manifest YAML content default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /runs/{id}: - get: - summary: Get the run of a version - operationId: readRun + /deployments: + post: + summary: Create a deployment (triggers a run) + operationId: createDeployment parameters: - - name: id - in: path - required: true + - name: appId + in: query + description: App ID (required for inline YAML deploys) schema: type: string - responses: - '200': - description: Run retrieved successfully - content: - application/json: - schema: - $ref: '#/components/schemas/RunResponse' - default: - description: Error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - /runs/{id}/logs: - get: - summary: Get logs of a run by its ID - operationId: readRunLogs - parameters: - - name: id - in: path + requestBody: required: true - schema: - type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDeploymentRequest' + application/x-yaml: + schema: + type: string + format: binary + description: Inline YAML manifest content (see Application schema) + application/yaml: + schema: + type: string + format: binary + description: Inline YAML manifest content (see Application schema) responses: - '200': - description: Run logs retrieved successfully + '201': + description: Deployment created successfully content: application/json: schema: - $ref: '#/components/schemas/ReadLogsResponse' + $ref: '#/components/schemas/DeploymentResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/run/logs: get: - summary: Get logs of the current run of an app - operationId: readCurrentRunLogs + summary: List deployments + operationId: listDeployments parameters: - - name: id - in: path - required: true + - name: appId + in: query schema: type: string + - name: pageNumber + in: query + schema: + type: integer + - name: pageSize + in: query + schema: + type: integer responses: '200': - description: Current run logs retrieved successfully + description: Deployments retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ReadLogsResponse' + $ref: '#/components/schemas/ListDeploymentsResponse' default: description: Error content: application/json: schema: $ref: '#/components/schemas/Error' - /apps/{id}/version: + /deployments/{deploymentId}: get: - summary: Get the current version of an app - operationId: readCurrentAppVersion + summary: Get a single deployment + operationId: readDeployment parameters: - - name: id + - name: deploymentId in: path required: true schema: @@ -485,39 +572,67 @@ paths: required: false description: | The desired response format. - - `application/json`: Returns the version metadata in JSON format. - - `application/gzip`: Returns the version as a gzip archive. - - `application/yaml`: Returns the original manifest content. + - `application/json`: Returns the deployment metadata in JSON format. + - `application/gzip`: Returns the full configuration version as a gzip archive. + - `application/yaml`: Returns the original application manifest content. schema: type: string enum: - application/json - application/gzip - application/yaml - - name: from + - name: include in: query required: false + description: | + Comma-separated list of related resources to include. + - `state`: Include the Terraform state produced by this deployment's run. schema: - type: string - enum: - - state + type: array + items: + type: string + enum: + - state responses: '200': - description: Current app version retrieved successfully + description: Deployment retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/AppVersionResponse' + $ref: '#/components/schemas/DeploymentResponse' application/gzip: schema: type: string format: binary - description: Archive + description: Configuration version archive application/yaml: schema: type: string format: binary - description: Original manifest content + description: Original application manifest content + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /deployments/{deploymentId}/logs: + get: + summary: Get run logs for a deployment + operationId: readDeploymentLogs + parameters: + - name: deploymentId + in: path + required: true + schema: + type: string + responses: + '200': + description: Deployment logs retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/ReadLogsResponse' default: description: Error content: @@ -526,13 +641,8 @@ paths: $ref: '#/components/schemas/Error' components: schemas: - ReadStateResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/State' + Application: + $ref: '#/components/schemas/application' State: type: object required: @@ -609,14 +719,6 @@ components: totalCount: type: integer description: Total number of items - CreateAppRequest: - type: object - required: - - organizationId - properties: - organizationId: - type: string - description: ID of the organization to which the app belongs ListAppsResponse: type: object required: @@ -640,45 +742,6 @@ components: properties: data: $ref: '#/components/schemas/App' - ListRunsResponse: - type: object - required: - - data - properties: - data: - allOf: - - $ref: '#/components/schemas/PaginationResponse' - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: '#/components/schemas/Run' - ListVersionsResponse: - type: object - required: - - data - properties: - data: - allOf: - - $ref: '#/components/schemas/PaginationResponse' - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: '#/components/schemas/ConfigurationVersion' - AppVersionResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/ConfigurationVersion' App: type: object required: @@ -691,100 +754,30 @@ components: name: type: string description: Name of the app - currentConfigurationVersion: - $ref: '#/components/schemas/ConfigurationVersion' - currentRun: - $ref: '#/components/schemas/Run' - RunResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/Run' - Run: + stackId: + type: string + description: Optional existing stack ID claimed by this app + state: + $ref: '#/components/schemas/State' + CreateAppRequest: type: object required: - - id - - status - - autoApply - - createdAt - - isDestroy - - hasChanges - - message - - planOnly - - refresh - - refreshOnly - - savePlan + - name properties: - id: - type: string - description: Unique identifier for the run - autoApply: - type: boolean - description: Whether the run was auto-applied - createdAt: - type: string - format: date-time - description: Timestamp when the run was created - isDestroy: - type: boolean - description: Whether the run is a destroy operation - hasChanges: - type: boolean - description: Whether the run has changes - message: + name: type: string - description: Message associated with the run - planOnly: - type: boolean - description: Whether the run is a plan-only operation - refresh: - type: boolean - description: Whether the run is a refresh operation - refreshOnly: - type: boolean - description: Whether the run is a refresh-only operation - savePlan: - type: boolean - description: Whether the run saves the plan - status: + description: Name of the app + stackId: type: string - description: Status of the run - configurationVersion: - $ref: '#/components/schemas/ConfigurationVersion' - ConfigurationVersion: + description: Optional existing stack ID to claim + UpdateAppRequest: type: object required: - - id - - status - - autoQueueRuns - - error - - errorMessage + - name properties: - id: - type: string - description: Unique identifier for the configuration version - autoQueueRuns: - type: boolean - description: Auto queue runs when a new version is uploaded - error: - type: string - description: Error code if the version is in an error state - errorMessage: - type: string - description: Error message if the version is in an error state - status: + name: type: string - enum: - - archived - - errored - - pending - - fetching - - uploaded - - '' - UpdateAppRequest: - type: object + description: Updated name for the app ReadVariablesResponse: type: object required: @@ -842,6 +835,207 @@ components: id: type: string description: Unique identifier for the variable + Manifest: + type: object + required: + - id + - name + - latestVersion + - createdAt + - updatedAt + properties: + id: + type: string + description: Unique identifier for the manifest + appId: + type: string + description: Optional app ID the manifest is scoped to + name: + type: string + description: Name of the manifest + latestVersion: + type: integer + description: Latest version number + createdAt: + type: string + format: date-time + description: Timestamp when the manifest was created + updatedAt: + type: string + format: date-time + description: Timestamp when the manifest was last updated + ManifestVersion: + type: object + required: + - manifestId + - version + - createdAt + properties: + manifestId: + type: string + description: ID of the manifest this version belongs to + version: + type: integer + description: Version number + content: + type: string + format: byte + description: Manifest content (base64-encoded). Null when listing versions, present when reading a specific version. + createdAt: + type: string + format: date-time + description: Timestamp when the version was created + CreateManifestResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - version + - name + - createdAt + properties: + id: + type: string + appId: + type: string + version: + type: integer + name: + type: string + createdAt: + type: string + format: date-time + ManifestResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/Manifest' + ManifestVersionResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/ManifestVersion' + ListManifestsResponse: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/PaginationResponse' + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: '#/components/schemas/Manifest' + ListManifestVersionsResponse: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/PaginationResponse' + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: '#/components/schemas/ManifestVersion' + DeploymentResource: + type: object + required: + - id + - appId + - workspaceId + - runStatus + - createdAt + - updatedAt + properties: + id: + type: string + appId: + type: string + manifestId: + type: string + manifestVersion: + type: integer + hasInlineContent: + type: boolean + workspaceId: + type: string + runId: + type: string + runStatus: + type: string + configVersionId: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + state: + $ref: '#/components/schemas/State' + CreateDeploymentRequest: + type: object + required: + - appId + properties: + appId: + type: string + description: ID of the app to deploy to + manifestId: + type: string + description: Manifest catalog ID (for manifest-reference mode) + manifestVersion: + type: integer + description: Manifest version (for manifest-reference mode) + DeploymentResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/DeploymentResource' + ListDeploymentsResponse: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/PaginationResponse' + - type: object + required: + - items + properties: + items: + type: array + items: + $ref: '#/components/schemas/DeploymentResource' + UpdateManifestRequest: + type: object + required: + - name + properties: + name: + type: string + description: Updated name for the manifest Error: type: object properties: @@ -878,6 +1072,33 @@ components: .self: $ref: '#/components/schemas/DotSelf' type: object + V2QueryTemplateVar: + properties: + default: {} + type: + type: string + type: object + V2QueryTemplate: + properties: + body: + additionalProperties: {} + type: object + description: + type: + - 'null' + - string + params: + additionalProperties: {} + type: object + resource: + type: + - 'null' + - string + vars: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplateVar' + type: object + type: object V2TransactionTemplate: properties: description: @@ -901,6 +1122,10 @@ components: type: - object - 'null' + queries: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplate' + type: object transactions: additionalProperties: $ref: '#/components/schemas/V2TransactionTemplate' @@ -1174,6 +1399,33 @@ components: .self: $ref: '#/components/schemas/DotSelf' type: object + V2QueryTemplate: + properties: + body: + additionalProperties: {} + type: object + description: + type: + - 'null' + - string + params: + additionalProperties: {} + type: object + resource: + type: + - 'null' + - string + vars: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplateVar' + type: object + type: object + V2QueryTemplateVar: + properties: + default: {} + type: + type: string + type: object V2SchemaData: properties: chart: @@ -1182,6 +1434,10 @@ components: type: - object - 'null' + queries: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplate' + type: object transactions: additionalProperties: $ref: '#/components/schemas/V2TransactionTemplate' From 13552a54e9fbec7b3145310cbe44c62d5aa3d1aa Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Mon, 4 May 2026 16:18:03 +0200 Subject: [PATCH 2/5] feat(cloud): add app/deployment archive downloads, render deployment state, soft-delete via develop SDK - Add `fctl cloud app deployments download --id [--format yaml|gzip] [--out file]` (yaml streams to stdout by default; gzip requires --out) - Add `fctl cloud app manifests download --id --out file` for the tar.gz archive - Render `state.stack.*` in `deployments show` when --include-state is passed - Refresh deploy-server OpenAPI spec from terraform-hcp-proxy develop and regenerate SDK - Wire new soft-delete flow on `apps delete`: surface destroyDeploymentId, add --wait Co-Authored-By: Claude Opus 4.7 (1M context) --- cmd/cloud/apps/delete.go | 28 ++++- cmd/cloud/apps/deployments/create.go | 30 ++--- cmd/cloud/apps/deployments/download.go | 104 ++++++++++++++++++ cmd/cloud/apps/deployments/list.go | 4 +- cmd/cloud/apps/deployments/root.go | 1 + cmd/cloud/apps/deployments/show.go | 30 ++++- cmd/cloud/apps/manifests/download.go | 78 +++++++++++++ cmd/cloud/apps/manifests/root.go | 1 + cmd/cloud/apps/manifests/versions/show.go | 16 ++- cmd/cloud/apps/root.go | 1 + .../deployserverclient/.speakeasy/gen.lock | 57 ++++++---- internal/deployserverclient/deployserver.go | 39 ++++++- .../models/components/deleteappresponse.md | 8 ++ .../models/components/deploymentresource.md | 6 +- .../models/operations/deleteapprequest.md | 7 +- .../models/operations/deleteappresponse.md | 9 +- .../docs/sdks/deployserver/README.md | 26 +++-- .../models/components/deleteappresponse.go | 20 ++++ .../models/components/deploymentresource.go | 52 ++------- .../models/operations/deleteapp.go | 35 ++++++ openapi/deployserver.yaml | 55 +++++++-- pkg/clients.go | 7 +- pkg/flags.go | 3 + 23 files changed, 492 insertions(+), 125 deletions(-) create mode 100644 cmd/cloud/apps/deployments/download.go create mode 100644 cmd/cloud/apps/manifests/download.go create mode 100644 internal/deployserverclient/docs/models/components/deleteappresponse.md create mode 100644 internal/deployserverclient/models/components/deleteappresponse.go diff --git a/cmd/cloud/apps/delete.go b/cmd/cloud/apps/delete.go index a622b71a..209f8fb8 100644 --- a/cmd/cloud/apps/delete.go +++ b/cmd/cloud/apps/delete.go @@ -10,7 +10,9 @@ import ( ) type Delete struct { - ID string + ID string `json:"id"` + DestroyDeploymentID *string `json:"destroyDeploymentId,omitempty"` + Waited bool `json:"waited"` } type DeleteCtrl struct { @@ -31,8 +33,9 @@ func NewDeleteCtrl() *DeleteCtrl { func NewDelete() *cobra.Command { return fctl.NewCommand("delete", - fctl.WithShortDescription("Delete an app"), + fctl.WithShortDescription("Soft-delete an app and enqueue a destroy deployment"), fctl.WithStringFlag("id", "", "App ID"), + fctl.WithBoolFlag("wait", false, "Block until the destroy deployment reaches a terminal status"), fctl.WithController(NewDeleteCtrl()), ) } @@ -61,17 +64,34 @@ func (c *DeleteCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er if id == "" { return nil, fmt.Errorf("id is required") } - _, err = apiClient.DeleteApp(cmd.Context(), id) + + wait := fctl.GetBool(cmd, "wait") + resp, err := apiClient.DeleteApp(cmd.Context(), id, &wait) if err != nil { return nil, err } c.store.ID = id + c.store.Waited = wait + if resp.DeleteAppResponse != nil { + c.store.DestroyDeploymentID = resp.DeleteAppResponse.DestroyDeploymentID + } return c, nil } func (c *DeleteCtrl) Render(cmd *cobra.Command, args []string) error { - pterm.Success.Println("App deleted", c.store.ID) + switch { + case c.store.DestroyDeploymentID != nil && *c.store.DestroyDeploymentID != "": + if c.store.Waited { + pterm.Success.Printfln("App %s deleted (destroy deployment %s reached terminal status)", + c.store.ID, *c.store.DestroyDeploymentID) + } else { + pterm.Success.Printfln("App %s soft-deleted; destroy deployment %s enqueued (poll with `fctl cloud app deployments show --id %s`)", + c.store.ID, *c.store.DestroyDeploymentID, *c.store.DestroyDeploymentID) + } + default: + pterm.Success.Printfln("App %s deleted (no destroy deployment was needed)", c.store.ID) + } return nil } diff --git a/cmd/cloud/apps/deployments/create.go b/cmd/cloud/apps/deployments/create.go index 06f0b0cc..1249170a 100644 --- a/cmd/cloud/apps/deployments/create.go +++ b/cmd/cloud/apps/deployments/create.go @@ -3,8 +3,6 @@ package deployments import ( "fmt" "io" - "os" - "path/filepath" "time" "github.com/pterm/pterm" @@ -42,7 +40,8 @@ func NewCreate() *cobra.Command { return fctl.NewCommand("create", fctl.WithShortDescription("Create a deployment (deploy an app)"), fctl.WithStringFlag("app-id", "", "App ID"), - fctl.WithStringFlag("path", "", "Path to the manifest file"), + fctl.WithStringFlag("manifest-id", "", "Manifest ID to deploy"), + fctl.WithIntFlag("manifest-version", 0, "Manifest version to deploy (omit or 0 for latest)"), fctl.WithBoolFlag("wait", true, "Wait for the deployment to complete"), fctl.WithController(NewCreateCtrl()), ) @@ -72,17 +71,22 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er if appID == "" { return nil, fmt.Errorf("app-id is required") } - path := fctl.GetString(cmd, "path") - if path == "" { - return nil, fmt.Errorf("path is required") + manifestID := fctl.GetString(cmd, "manifest-id") + if manifestID == "" { + return nil, fmt.Errorf("manifest-id is required") } - data, err := os.ReadFile(filepath.Clean(path)) - if err != nil { - return nil, err + + req := components.CreateDeploymentRequest{ + AppID: appID, + ManifestID: &manifestID, + } + if v := fctl.GetInt(cmd, "manifest-version"); v > 0 { + version := int64(v) + req.ManifestVersion = &version } cmd.SilenceUsage = true - deployment, err := apiClient.CreateDeploymentRaw(cmd.Context(), data, &appID) + deployment, err := apiClient.CreateDeployment(cmd.Context(), req, &appID) if err != nil { return nil, err } @@ -147,8 +151,8 @@ func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { } c.store.DeploymentResource = &r.DeploymentResponse.Data - spinner.UpdateText(fmt.Sprintf("Deployment status: %s", r.DeploymentResponse.Data.RunStatus)) - switch r.DeploymentResponse.Data.RunStatus { + spinner.UpdateText(fmt.Sprintf("Deployment status: %s", r.DeploymentResponse.Data.Status)) + switch r.DeploymentResponse.Data.Status { case "applied": spinner.UpdateText("Deployment completed successfully") return nil @@ -172,7 +176,7 @@ func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { } func (c *CreateCtrl) Render(cmd *cobra.Command, args []string) error { - if c.store.DeploymentResource.RunStatus == "errored" { + if c.store.DeploymentResource.Status == "errored" { if len(c.store.logs) > 0 { if err := printer.RenderLogs(cmd.ErrOrStderr(), c.store.logs); err != nil { return err diff --git a/cmd/cloud/apps/deployments/download.go b/cmd/cloud/apps/deployments/download.go new file mode 100644 index 00000000..768029c2 --- /dev/null +++ b/cmd/cloud/apps/deployments/download.go @@ -0,0 +1,104 @@ +package deployments + +import ( + "fmt" + "io" + "os" + + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func NewDownload() *cobra.Command { + return fctl.NewCommand("download", + fctl.WithShortDescription("Download a deployment's resolved manifest (yaml) or full configuration archive (gzip)"), + fctl.WithStringFlag("id", "", "Deployment ID"), + fctl.WithStringFlag("format", "yaml", "Response format: yaml | gzip"), + fctl.WithStringFlag("out", "", "Output file path (required for gzip; defaults to stdout for yaml)"), + fctl.WithRunE(runDeploymentDownload), + ) +} + +func runDeploymentDownload(cmd *cobra.Command, _ []string) error { + id := fctl.GetString(cmd, "id") + if id == "" { + return fmt.Errorf("id is required") + } + + format := fctl.GetString(cmd, "format") + out := fctl.GetString(cmd, "out") + + var accept operations.AcceptHeaderEnum + switch format { + case "yaml": + accept = operations.AcceptHeaderEnumApplicationYaml + case "gzip": + accept = operations.AcceptHeaderEnumApplicationGzip + if out == "" { + return fmt.Errorf("--out is required when --format=gzip (binary content cannot be written to a TTY)") + } + default: + return fmt.Errorf("invalid --format %q (expected: yaml | gzip)", format) + } + + cmd.SilenceUsage = true + + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return err + } + + resp, err := apiClient.ReadDeployment( + cmd.Context(), + id, + nil, + operations.WithAcceptHeaderOverride(accept), + ) + if err != nil { + return err + } + + var stream io.ReadCloser + switch accept { + case operations.AcceptHeaderEnumApplicationYaml: + stream = resp.TwoHundredApplicationYamlResponseStream + case operations.AcceptHeaderEnumApplicationGzip: + stream = resp.TwoHundredApplicationGzipResponseStream + } + if stream == nil { + return fmt.Errorf("server returned no %s payload for deployment %s", accept, id) + } + defer stream.Close() + + if out == "" { + if _, err := io.Copy(cmd.OutOrStdout(), stream); err != nil { + return fmt.Errorf("write deployment payload: %w", err) + } + return nil + } + + f, err := os.Create(out) // #nosec G304 -- user-specified output path on a CLI flag + if err != nil { + return fmt.Errorf("create output file: %w", err) + } + defer func() { _ = f.Close() }() + + if _, err := io.Copy(f, stream); err != nil { + return fmt.Errorf("write deployment payload: %w", err) + } + return f.Close() +} diff --git a/cmd/cloud/apps/deployments/list.go b/cmd/cloud/apps/deployments/list.go index bd6e99c3..11a86529 100644 --- a/cmd/cloud/apps/deployments/list.go +++ b/cmd/cloud/apps/deployments/list.go @@ -88,14 +88,14 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { data := [][]string{ - {"ID", "App ID", "Run Status", "Manifest ID", "Created At"}, + {"ID", "App ID", "Status", "Manifest ID", "Created At"}, } for _, d := range c.store.Items { data = append(data, []string{ d.ID, d.AppID, - d.RunStatus, + d.Status, func() string { if d.ManifestID != nil { return *d.ManifestID diff --git a/cmd/cloud/apps/deployments/root.go b/cmd/cloud/apps/deployments/root.go index 7fe1fa99..26b1a37a 100644 --- a/cmd/cloud/apps/deployments/root.go +++ b/cmd/cloud/apps/deployments/root.go @@ -15,6 +15,7 @@ func NewCommand() *cobra.Command { NewList(), NewShow(), NewLogs(), + NewDownload(), ), ) } diff --git a/cmd/cloud/apps/deployments/show.go b/cmd/cloud/apps/deployments/show.go index 8c200a51..57f028d3 100644 --- a/cmd/cloud/apps/deployments/show.go +++ b/cmd/cloud/apps/deployments/show.go @@ -2,6 +2,7 @@ package deployments import ( "fmt" + "sort" "github.com/pterm/pterm" "github.com/spf13/cobra" @@ -88,7 +89,7 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { items := []pterm.BulletListItem{ {Level: 0, Text: fmt.Sprintf("ID: %s", c.store.ID)}, {Level: 0, Text: fmt.Sprintf("App ID: %s", c.store.AppID)}, - {Level: 0, Text: fmt.Sprintf("Run Status: %s", c.store.RunStatus)}, + {Level: 0, Text: fmt.Sprintf("Status: %s", c.store.Status)}, {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.CreatedAt)}, {Level: 0, Text: fmt.Sprintf("Updated At: %s", c.store.UpdatedAt)}, } @@ -99,8 +100,10 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { if c.store.ManifestVersion != nil { items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Manifest Version: %d", *c.store.ManifestVersion)}) } - if c.store.RunID != nil { - items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Run ID: %s", *c.store.RunID)}) + + if c.store.State != nil && len(c.store.State.Stack) > 0 { + items = append(items, pterm.BulletListItem{Level: 0, Text: "State"}) + items = append(items, renderStackItems(c.store.State.Stack)...) } if err := pterm. @@ -113,3 +116,24 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { return nil } + +func renderStackItems(stack map[string]any) []pterm.BulletListItem { + keys := make([]string, 0, len(stack)) + for k := range stack { + keys = append(keys, k) + } + sort.Strings(keys) + + items := make([]pterm.BulletListItem, 0, len(stack)) + for _, k := range keys { + v := stack[k] + if v == nil { + continue + } + items = append(items, pterm.BulletListItem{ + Level: 1, + Text: fmt.Sprintf("%s: %v", k, v), + }) + } + return items +} diff --git a/cmd/cloud/apps/manifests/download.go b/cmd/cloud/apps/manifests/download.go new file mode 100644 index 00000000..14f23ef9 --- /dev/null +++ b/cmd/cloud/apps/manifests/download.go @@ -0,0 +1,78 @@ +package manifests + +import ( + "fmt" + "io" + "os" + + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func NewDownload() *cobra.Command { + return fctl.NewCommand("download", + fctl.WithShortDescription("Download a manifest's transpiled tar.gz archive of its latest version"), + fctl.WithStringFlag("id", "", "Manifest ID"), + fctl.WithStringFlag("out", "", "Output file path (required: gzip is binary)"), + fctl.WithRunE(runManifestDownload), + ) +} + +func runManifestDownload(cmd *cobra.Command, _ []string) error { + id := fctl.GetString(cmd, "id") + if id == "" { + return fmt.Errorf("id is required") + } + + out := fctl.GetString(cmd, "out") + if out == "" { + return fmt.Errorf("--out is required (gzip is binary and cannot be written to a TTY)") + } + + cmd.SilenceUsage = true + + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return err + } + + resp, err := apiClient.ReadManifest( + cmd.Context(), + id, + nil, + operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationGzip), + ) + if err != nil { + return err + } + + if resp.ResponseStream == nil { + return fmt.Errorf("server returned no gzip payload for manifest %s", id) + } + defer resp.ResponseStream.Close() + + f, err := os.Create(out) // #nosec G304 -- user-specified output path on a CLI flag + if err != nil { + return fmt.Errorf("create output file: %w", err) + } + defer func() { _ = f.Close() }() + + if _, err := io.Copy(f, resp.ResponseStream); err != nil { + return fmt.Errorf("write manifest archive: %w", err) + } + return f.Close() +} diff --git a/cmd/cloud/apps/manifests/root.go b/cmd/cloud/apps/manifests/root.go index db9a1c7e..1f70d504 100644 --- a/cmd/cloud/apps/manifests/root.go +++ b/cmd/cloud/apps/manifests/root.go @@ -17,6 +17,7 @@ func NewCommand() *cobra.Command { NewCreate(), NewDelete(), NewUpdate(), + NewDownload(), versions.NewCommand(), ), ) diff --git a/cmd/cloud/apps/manifests/versions/show.go b/cmd/cloud/apps/manifests/versions/show.go index 75553abb..2ac45b20 100644 --- a/cmd/cloud/apps/manifests/versions/show.go +++ b/cmd/cloud/apps/manifests/versions/show.go @@ -1,6 +1,7 @@ package versions import ( + "encoding/base64" "fmt" "strconv" @@ -88,10 +89,6 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { {Level: 0, Text: fmt.Sprintf("Created At: %s", c.store.CreatedAt)}, } - if c.store.Content != nil { - items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("Content: %s", *c.store.Content)}) - } - if err := pterm. DefaultBulletList. WithItems(items). @@ -100,5 +97,16 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { return err } + if c.store.Content != nil { + pterm.DefaultSection.WithWriter(cmd.OutOrStdout()).Println("Content") + + decoded, err := base64.StdEncoding.DecodeString(*c.store.Content) + if err != nil { + fmt.Fprintln(cmd.OutOrStdout(), *c.store.Content) + } else { + fmt.Fprintln(cmd.OutOrStdout(), string(decoded)) + } + } + return nil } diff --git a/cmd/cloud/apps/root.go b/cmd/cloud/apps/root.go index 7bc1c024..8f876007 100644 --- a/cmd/cloud/apps/root.go +++ b/cmd/cloud/apps/root.go @@ -16,6 +16,7 @@ func NewCommand() *cobra.Command { fctl.WithShortDescription("Manage app manifests"), fctl.WithPersistentBoolFlag("experimental", false, "Enable experimental commands"), fctl.WithPersistentStringFlag(fctl.FrameworkURIFlag, "https://deploy.formance.cloud", "Framework URI"), + fctl.WithPersistentStringFlag(fctl.DeployAppAliasFlag, fctl.DefaultDeployAppAlias, "Membership application alias used to authenticate against the deploy server"), fctl.WithPersistentPreRunE(func(cmd *cobra.Command, args []string) error { ok, err := cmd.Flags().GetBool("experimental") if err != nil { diff --git a/internal/deployserverclient/.speakeasy/gen.lock b/internal/deployserverclient/.speakeasy/gen.lock index dc96fbb0..c23cca6f 100644 --- a/internal/deployserverclient/.speakeasy/gen.lock +++ b/internal/deployserverclient/.speakeasy/gen.lock @@ -1,20 +1,21 @@ lockVersion: 2.0.0 id: 12df0dd4-09cf-49f5-8116-53c77b28ba01 management: - docChecksum: ee21a5f5456f3f2188ed953ae3ef8494 + docChecksum: 143dfa4acb9785b74b550011f4c1da66 docVersion: 0.1.0 speakeasyVersion: 1.759.2 generationVersion: 2.869.23 releaseVersion: 0.1.0 configChecksum: 0445386bbafa86450656df7324d2976d persistentEdits: - generation_id: 8a99ae7c-50e5-4e11-89b3-0ab5a6df74f8 - pristine_commit_hash: 8672d65ed91534e68c9ae2097ed5580ce6563cc6 - pristine_tree_hash: 8f8f663a8535667ebc4ef9fb30ad2d251692af17 + generation_id: ffe6b23c-2b66-48b8-a7f1-ad0bfdac9218 + pristine_commit_hash: 9d81e90272bdd5524de6b87c60b08fd69f105a40 + pristine_tree_hash: e020e62ca1fe23f2ae36ecd406ba8d1728bef1d1 features: go: acceptHeaders: 2.81.2 additionalDependencies: 0.1.0 + constsAndDefaults: 0.1.14 core: 3.13.40 defaultEnabledRetries: 0.2.0 devContainers: 2.90.0 @@ -51,8 +52,8 @@ trackedFiles: pristine_git_object: eb58123de9ffa74878d22ed28cc871ffefdc7ca6 deployserver.go: id: 4e88cb1c88d3 - last_write_checksum: sha1:8ecfff0bcfc8fefda875b20771a042dfd9197117 - pristine_git_object: 6f3c1ca2ca0244de5a45cf670edc59ba799d9292 + last_write_checksum: sha1:9d817385a0c4b8d5f0c3ad5a55bc936222c23c29 + pristine_git_object: 1a690fd578589f399706ef911e5d129b00deeb95 docs/models/apierrors/error.md: id: 7c6e7719d689 last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b @@ -89,10 +90,14 @@ trackedFiles: id: 77cc5c4876b1 last_write_checksum: sha1:6f884cdcec2003eaa5bf016cc521b269869a0628 pristine_git_object: 82ba7c122ddd49378c9e1880cde26477645bb5ae + docs/models/components/deleteappresponse.md: + id: f57e1423f086 + last_write_checksum: sha1:7e55b75abfc7d75c181f5712f19696bba389dbbc + pristine_git_object: 0d8b766a83b8979e46cd756ef04bb06821f92e2f docs/models/components/deploymentresource.md: id: cdd39d4f1853 - last_write_checksum: sha1:24d0d8ea7c4713a56c5002266ed310a5dbe48ea4 - pristine_git_object: 00ee3a59b7610b57f98608e6d0871101bfb17020 + last_write_checksum: sha1:a41756777d1668bcfa7059800ae31b9b1972ecec + pristine_git_object: 4bf3d77b919ee372715c9a8ad9ed93be1eeade72 docs/models/components/deploymentresponse.md: id: 30bd20db7b83 last_write_checksum: sha1:5a7aab41fc5ad3264cc5ecc0a7a4e32d5fd3b2e3 @@ -243,12 +248,12 @@ trackedFiles: pristine_git_object: ea064c638fde2204a9e737ad9cb60f93390fe312 docs/models/operations/deleteapprequest.md: id: 2514a7504692 - last_write_checksum: sha1:6cb69f5042032d8061fa797e849c73f8945fe8ca - pristine_git_object: 316a4d8dd4455343e4551aecfc3deb24f8f80dcb + last_write_checksum: sha1:67156c64d8b1f95a5d59d8cf8bcab03ea82a423c + pristine_git_object: 63b4b8ba5e61e302f3b4a340752b7eb529257a65 docs/models/operations/deleteappresponse.md: id: e16e7da4c1e7 - last_write_checksum: sha1:27ad8ba2d9831e1ee63c2bc391225189ee55be88 - pristine_git_object: 5363fdba467d79ec2878085f05a04b9606522471 + last_write_checksum: sha1:bc431ecccceaf41b362bbaccda94309ddce19a49 + pristine_git_object: 41ecd5c7e2d96668e50cd25dbcb3bbd45bbf58b3 docs/models/operations/deleteappvariablerequest.md: id: 43f868ba1805 last_write_checksum: sha1:1cdd03262fe383836802771ed64728f8a2992a0a @@ -395,8 +400,8 @@ trackedFiles: pristine_git_object: f8b0e9ef7ee64c5c8ade8601fac272aa7909171e docs/sdks/deployserver/README.md: id: 7bbb48696892 - last_write_checksum: sha1:2fc61dfc531da7caffa63b543e3dd171e155cd0b - pristine_git_object: 39622fe94581bd8457e8936673fe0744004f4514 + last_write_checksum: sha1:0ec0b0b059daa30bd46433a8560dd1799c0778da + pristine_git_object: c1f3a0749b4e3a0fae4e2f97f9d22de8961e6cca go.mod: id: c47645c391ad last_write_checksum: sha1:ccfac949478bd60fae3010350a17ef6c9e8580bf @@ -497,10 +502,14 @@ trackedFiles: id: 00d4e6ccb333 last_write_checksum: sha1:5ebf70f308832820ee08a1e7085a783eab30424b pristine_git_object: 8486f09e0ef6802ab6c10d0d0e2d0f2642166964 + models/components/deleteappresponse.go: + id: 0868463bc266 + last_write_checksum: sha1:2ad3379899c1656abc7825ce3f4c5f9b036577b4 + pristine_git_object: 4d77c78bc89cf176ec99686845a78ddc8fb5ca09 models/components/deploymentresource.go: id: 07bccccda991 - last_write_checksum: sha1:f5754ea3eda1d1b9a98e5e12a1fe85a52a8a6fff - pristine_git_object: d2a95779065a5c6c53bd8958d66b3d523e658424 + last_write_checksum: sha1:136b0d400ed8449c2f2262aae284c64cff09dec1 + pristine_git_object: eae7f8194e8ba50afe273f2887f7d7ea65c32c7b models/components/deploymentresponse.go: id: cec4476a3fd8 last_write_checksum: sha1:3873e3a69107cbb82efbb1ea5f8a0fa5d3f6ac53 @@ -603,8 +612,8 @@ trackedFiles: pristine_git_object: 71aeab2d315ef7db71bfa5b302bf822cb3547cf4 models/operations/deleteapp.go: id: 16ffc0588ffa - last_write_checksum: sha1:ad8037d95b7d56984167b1e03b0ec31ce82765b8 - pristine_git_object: ebfdb3190b0740fdc5b0f967af0a432b402e86b4 + last_write_checksum: sha1:fc3736ab52cf7e9c24a38f157288d76665d6b897 + pristine_git_object: c6a72d8bc198551bb8e709d2c703ae4e9b943559 models/operations/deleteappvariable.go: id: a1a35df253e4 last_write_checksum: sha1:e7adcc4d853d2866a7559bf5f0c08d533e0debd8 @@ -746,9 +755,13 @@ examples: parameters: path: id: "" + query: + wait: false responses: default: application/json: {"errorCode": ""} + "202": + application/json: {} readAppCurrentStateVersion: speakeasy-default-read-app-current-state-version: parameters: @@ -1011,7 +1024,7 @@ examples: application/json: {"appId": ""} responses: "201": - application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} + application/json: {"data": {"id": "", "appId": "", "status": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} default: application/json: {"errorCode": ""} speakeasy-default-create-deployment-raw: @@ -1019,14 +1032,14 @@ examples: application/yaml: "x-file: example.file" responses: "201": - application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} + application/json: {"data": {"id": "", "appId": "", "status": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} default: application/json: {"errorCode": ""} listDeployments: speakeasy-default-list-deployments: responses: "200": - application/json: {"data": {"items": [{"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2025-10-03T23:17:35.491Z", "updatedAt": "2024-05-13T18:10:51.662Z"}]}} + application/json: {"data": {"items": [{"id": "", "appId": "", "status": "", "createdAt": "2025-10-03T23:17:35.491Z", "updatedAt": "2024-05-13T18:10:51.662Z"}]}} default: application/json: {"errorCode": ""} readDeployment: @@ -1036,7 +1049,7 @@ examples: deploymentId: "" responses: "200": - application/json: {"data": {"id": "", "appId": "", "workspaceId": "", "runStatus": "", "createdAt": "2025-06-20T10:16:58.267Z", "updatedAt": "2025-04-30T01:36:03.827Z"}} + application/json: {"data": {"id": "", "appId": "", "status": "", "createdAt": "2025-06-20T10:16:58.267Z", "updatedAt": "2025-04-30T01:36:03.827Z"}} application/gzip: "x-file: example.file" application/yaml: "x-file: example.file" default: diff --git a/internal/deployserverclient/deployserver.go b/internal/deployserverclient/deployserver.go index 6f3c1ca2..1a690fd5 100644 --- a/internal/deployserverclient/deployserver.go +++ b/internal/deployserverclient/deployserver.go @@ -1022,9 +1022,19 @@ func (s *DeployServer) ReadApp(ctx context.Context, id string, include []operati } // DeleteApp - Delete an app -func (s *DeployServer) DeleteApp(ctx context.Context, id string, opts ...operations.Option) (*operations.DeleteAppResponse, error) { +// Soft-deletes the app immediately and enqueues a destroy deployment to +// clean up any terraform-managed resources on Formance Cloud. The app +// becomes invisible to all subsequent reads. The destroy runs through +// the normal worker pipeline; the app row is hard-deleted by the worker +// once the destroy reaches a terminal status. +// +// By default this returns 202 Accepted as soon as the destroy is +// enqueued (or 202 with no body if no destroy was needed). Pass +// `?wait=true` to block until the destroy reaches a terminal status. +func (s *DeployServer) DeleteApp(ctx context.Context, id string, wait *bool, opts ...operations.Option) (*operations.DeleteAppResponse, error) { request := operations.DeleteAppRequest{ - ID: id, + ID: id, + Wait: wait, } o := operations.Options{} @@ -1078,6 +1088,10 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, opts ...operati req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1181,6 +1195,27 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, opts ...operati } switch { + case httpRes.StatusCode == 202: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.DeleteAppResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DeleteAppResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 204: utils.DrainBody(httpRes) case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: diff --git a/internal/deployserverclient/docs/models/components/deleteappresponse.md b/internal/deployserverclient/docs/models/components/deleteappresponse.md new file mode 100644 index 00000000..0d8b766a --- /dev/null +++ b/internal/deployserverclient/docs/models/components/deleteappresponse.md @@ -0,0 +1,8 @@ +# DeleteAppResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DestroyDeploymentID` | `*string` | :heavy_minus_sign: | ID of the destroy deployment enqueued to clean up the app's
resources. Empty when no destroy was needed (e.g. no prior
applied deployment). Use `GET /deployments/{id}` to poll its
status.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/deploymentresource.md b/internal/deployserverclient/docs/models/components/deploymentresource.md index 00ee3a59..4bf3d77b 100644 --- a/internal/deployserverclient/docs/models/components/deploymentresource.md +++ b/internal/deployserverclient/docs/models/components/deploymentresource.md @@ -9,11 +9,7 @@ | `AppID` | `string` | :heavy_check_mark: | N/A | | `ManifestID` | `*string` | :heavy_minus_sign: | N/A | | `ManifestVersion` | `*int64` | :heavy_minus_sign: | N/A | -| `HasInlineContent` | `*bool` | :heavy_minus_sign: | N/A | -| `WorkspaceID` | `string` | :heavy_check_mark: | N/A | -| `RunID` | `*string` | :heavy_minus_sign: | N/A | -| `RunStatus` | `string` | :heavy_check_mark: | N/A | -| `ConfigVersionID` | `*string` | :heavy_minus_sign: | N/A | +| `Status` | `string` | :heavy_check_mark: | N/A | | `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | | `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | | `State` | [*components.State](../../models/components/state.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deleteapprequest.md b/internal/deployserverclient/docs/models/operations/deleteapprequest.md index 316a4d8d..63b4b8ba 100644 --- a/internal/deployserverclient/docs/models/operations/deleteapprequest.md +++ b/internal/deployserverclient/docs/models/operations/deleteapprequest.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `Wait` | `*bool` | :heavy_minus_sign: | When `true`, the call blocks until the destroy deployment reaches a
terminal status. Default `false` (returns 202 Accepted).
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/deleteappresponse.md b/internal/deployserverclient/docs/models/operations/deleteappresponse.md index 5363fdba..41ecd5c7 100644 --- a/internal/deployserverclient/docs/models/operations/deleteappresponse.md +++ b/internal/deployserverclient/docs/models/operations/deleteappresponse.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `DeleteAppResponse` | [*components.DeleteAppResponse](../../models/components/deleteappresponse.md) | :heavy_minus_sign: | Soft-delete accepted. Cleanup runs asynchronously. The
`Location` header points at the destroy deployment if one was
enqueued.
| +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/sdks/deployserver/README.md b/internal/deployserverclient/docs/sdks/deployserver/README.md index 39622fe9..c1f3a074 100644 --- a/internal/deployserverclient/docs/sdks/deployserver/README.md +++ b/internal/deployserverclient/docs/sdks/deployserver/README.md @@ -235,7 +235,16 @@ func main() { ## DeleteApp -Delete an app +Soft-deletes the app immediately and enqueues a destroy deployment to +clean up any terraform-managed resources on Formance Cloud. The app +becomes invisible to all subsequent reads. The destroy runs through +the normal worker pipeline; the app row is hard-deleted by the worker +once the destroy reaches a terminal status. + +By default this returns 202 Accepted as soon as the destroy is +enqueued (or 202 with no body if no destroy was needed). Pass +`?wait=true` to block until the destroy reaches a terminal status. + ### Example Usage @@ -254,11 +263,11 @@ func main() { s := deployserverclient.New() - res, err := s.DeleteApp(ctx, "") + res, err := s.DeleteApp(ctx, "", deployserverclient.Pointer(false)) if err != nil { log.Fatal(err) } - if res.Error != nil { + if res.DeleteAppResponse != nil { // handle response } } @@ -266,11 +275,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `wait` | `*bool` | :heavy_minus_sign: | When `true`, the call blocks until the destroy deployment reaches a
terminal status. Default `false` (returns 202 Accepted).
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response diff --git a/internal/deployserverclient/models/components/deleteappresponse.go b/internal/deployserverclient/models/components/deleteappresponse.go new file mode 100644 index 00000000..4d77c78b --- /dev/null +++ b/internal/deployserverclient/models/components/deleteappresponse.go @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: de6e097ab360 + +package components + +type DeleteAppResponse struct { + // ID of the destroy deployment enqueued to clean up the app's + // resources. Empty when no destroy was needed (e.g. no prior + // applied deployment). Use `GET /deployments/{id}` to poll its + // status. + // + DestroyDeploymentID *string `json:"destroyDeploymentId,omitempty"` +} + +func (d *DeleteAppResponse) GetDestroyDeploymentID() *string { + if d == nil { + return nil + } + return d.DestroyDeploymentID +} diff --git a/internal/deployserverclient/models/components/deploymentresource.go b/internal/deployserverclient/models/components/deploymentresource.go index d2a95779..eae7f819 100644 --- a/internal/deployserverclient/models/components/deploymentresource.go +++ b/internal/deployserverclient/models/components/deploymentresource.go @@ -9,18 +9,14 @@ import ( ) type DeploymentResource struct { - ID string `json:"id"` - AppID string `json:"appId"` - ManifestID *string `json:"manifestId,omitempty"` - ManifestVersion *int64 `json:"manifestVersion,omitempty"` - HasInlineContent *bool `json:"hasInlineContent,omitempty"` - WorkspaceID string `json:"workspaceId"` - RunID *string `json:"runId,omitempty"` - RunStatus string `json:"runStatus"` - ConfigVersionID *string `json:"configVersionId,omitempty"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - State *State `json:"state,omitempty"` + ID string `json:"id"` + AppID string `json:"appId"` + ManifestID *string `json:"manifestId,omitempty"` + ManifestVersion *int64 `json:"manifestVersion,omitempty"` + Status string `json:"status"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + State *State `json:"state,omitempty"` } func (d DeploymentResource) MarshalJSON() ([]byte, error) { @@ -62,39 +58,11 @@ func (d *DeploymentResource) GetManifestVersion() *int64 { return d.ManifestVersion } -func (d *DeploymentResource) GetHasInlineContent() *bool { - if d == nil { - return nil - } - return d.HasInlineContent -} - -func (d *DeploymentResource) GetWorkspaceID() string { - if d == nil { - return "" - } - return d.WorkspaceID -} - -func (d *DeploymentResource) GetRunID() *string { - if d == nil { - return nil - } - return d.RunID -} - -func (d *DeploymentResource) GetRunStatus() string { +func (d *DeploymentResource) GetStatus() string { if d == nil { return "" } - return d.RunStatus -} - -func (d *DeploymentResource) GetConfigVersionID() *string { - if d == nil { - return nil - } - return d.ConfigVersionID + return d.Status } func (d *DeploymentResource) GetCreatedAt() time.Time { diff --git a/internal/deployserverclient/models/operations/deleteapp.go b/internal/deployserverclient/models/operations/deleteapp.go index ebfdb319..c6a72d8b 100644 --- a/internal/deployserverclient/models/operations/deleteapp.go +++ b/internal/deployserverclient/models/operations/deleteapp.go @@ -4,11 +4,27 @@ package operations import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/internal/utils" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" ) type DeleteAppRequest struct { ID string `pathParam:"style=simple,explode=false,name=id"` + // When `true`, the call blocks until the destroy deployment reaches a + // terminal status. Default `false` (returns 202 Accepted). + // + Wait *bool `default:"false" queryParam:"style=form,explode=true,name=wait"` +} + +func (d DeleteAppRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DeleteAppRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, nil); err != nil { + return err + } + return nil } func (d *DeleteAppRequest) GetID() string { @@ -18,8 +34,20 @@ func (d *DeleteAppRequest) GetID() string { return d.ID } +func (d *DeleteAppRequest) GetWait() *bool { + if d == nil { + return nil + } + return d.Wait +} + type DeleteAppResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` + // Soft-delete accepted. Cleanup runs asynchronously. The + // `Location` header points at the destroy deployment if one was + // enqueued. + // + DeleteAppResponse *components.DeleteAppResponse // Error Error *components.Error } @@ -31,6 +59,13 @@ func (d *DeleteAppResponse) GetHTTPMeta() components.HTTPMetadata { return d.HTTPMeta } +func (d *DeleteAppResponse) GetDeleteAppResponse() *components.DeleteAppResponse { + if d == nil { + return nil + } + return d.DeleteAppResponse +} + func (d *DeleteAppResponse) GetError() *components.Error { if d == nil { return nil diff --git a/openapi/deployserver.yaml b/openapi/deployserver.yaml index e7b862a3..62894f67 100644 --- a/openapi/deployserver.yaml +++ b/openapi/deployserver.yaml @@ -120,6 +120,16 @@ paths: $ref: '#/components/schemas/Error' delete: summary: Delete an app + description: | + Soft-deletes the app immediately and enqueues a destroy deployment to + clean up any terraform-managed resources on Formance Cloud. The app + becomes invisible to all subsequent reads. The destroy runs through + the normal worker pipeline; the app row is hard-deleted by the worker + once the destroy reaches a terminal status. + + By default this returns 202 Accepted as soon as the destroy is + enqueued (or 202 with no body if no destroy was needed). Pass + `?wait=true` to block until the destroy reaches a terminal status. operationId: deleteApp parameters: - name: id @@ -127,9 +137,29 @@ paths: required: true schema: type: string + - name: wait + in: query + required: false + description: | + When `true`, the call blocks until the destroy deployment reaches a + terminal status. Default `false` (returns 202 Accepted). + schema: + type: boolean + default: false responses: + '202': + description: | + Soft-delete accepted. Cleanup runs asynchronously. The + `Location` header points at the destroy deployment if one was + enqueued. + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppResponse' '204': - description: App details retrieved successfully + description: | + Returned when `wait=true` and the destroy reached a terminal + status successfully (or when no destroy was needed at all). default: description: Error content: @@ -652,6 +682,16 @@ components: type: object description: The stack details from the Terraform state additionalProperties: true + DeleteAppResponse: + type: object + properties: + destroyDeploymentId: + type: string + description: | + ID of the destroy deployment enqueued to clean up the app's + resources. Empty when no destroy was needed (e.g. no prior + applied deployment). Use `GET /deployments/{id}` to poll its + status. ReadManifestResponse: type: object required: @@ -960,8 +1000,7 @@ components: required: - id - appId - - workspaceId - - runStatus + - status - createdAt - updatedAt properties: @@ -973,15 +1012,7 @@ components: type: string manifestVersion: type: integer - hasInlineContent: - type: boolean - workspaceId: - type: string - runId: - type: string - runStatus: - type: string - configVersionId: + status: type: string createdAt: type: string diff --git a/pkg/clients.go b/pkg/clients.go index ded49c47..a7f1a798 100644 --- a/pkg/clients.go +++ b/pkg/clients.go @@ -577,6 +577,11 @@ func NewAppDeployClient( organizationID string, ) (*deployserverclient.DeployServer, error) { + appAlias := GetString(cmd, DeployAppAliasFlag) + if appAlias == "" { + appAlias = DefaultDeployAppAlias + } + appToken, err := EnsureAppAccess( cmd, relyingParty, @@ -584,7 +589,7 @@ func NewAppDeployClient( profileName, profile, organizationID, - "deploy", + appAlias, []string{ "apps:Read", "apps:Write", diff --git a/pkg/flags.go b/pkg/flags.go index f476b13c..0df9d65a 100644 --- a/pkg/flags.go +++ b/pkg/flags.go @@ -22,8 +22,11 @@ const ( StackFlag = "stack" OrganizationFlag = "organization" FrameworkURIFlag = "framework-uri" + DeployAppAliasFlag = "deploy-app-alias" ) +const DefaultDeployAppAlias = "deploy" + func GetBool(cmd *cobra.Command, flagName string) bool { v, err := cmd.Flags().GetBool(flagName) if err != nil { From 53c1175c02da971f4974cc12a0db5d1e79ded08c Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Fri, 8 May 2026 10:14:34 +0200 Subject: [PATCH 3/5] feat(cloud): make manifests org-wide, add app/manifest binding, harden deployment wait - Drop app-id scoping on manifests; add bind-manifest/unbind-manifest commands on apps - Show app's current manifest with divergence (undeployed/synced/behind/rebound) on `apps show` - Require manifest-version on `deployments create` and add --wait-timeout with exponential backoff polling - Regenerate deploy server SDK from updated OpenAPI (attach/detach manifest, App.currentManifest) - Add unit tests for new bind/unbind/show/create/delete/push paths Co-Authored-By: Claude Opus 4.7 (1M context) --- cmd/cloud/apps/bind_manifest.go | 80 ++ cmd/cloud/apps/bind_manifest_test.go | 49 ++ cmd/cloud/apps/deployments/create.go | 73 +- cmd/cloud/apps/deployments/create_test.go | 38 + cmd/cloud/apps/manifests/create.go | 14 +- cmd/cloud/apps/manifests/create_test.go | 43 + cmd/cloud/apps/manifests/delete.go | 2 +- cmd/cloud/apps/manifests/delete_test.go | 26 + cmd/cloud/apps/manifests/list.go | 15 +- cmd/cloud/apps/manifests/show.go | 4 - cmd/cloud/apps/manifests/versions/push.go | 4 +- .../apps/manifests/versions/push_test.go | 30 + cmd/cloud/apps/root.go | 2 + cmd/cloud/apps/show.go | 53 ++ cmd/cloud/apps/show_test.go | 149 ++++ cmd/cloud/apps/unbind_manifest.go | 69 ++ go.mod | 2 +- .../deployserverclient/.speakeasy/gen.lock | 166 ++-- internal/deployserverclient/README.md | 22 +- internal/deployserverclient/deployserver.go | 692 +++++++++------ .../docs/models/components/app.md | 14 +- .../models/components/appcurrentmanifest.md | 16 + .../components/appmanifestdivergence.md | 15 + .../components/attachmanifestrequest.md | 8 + .../components/createdeploymentrequest.md | 10 +- .../components/createmanifestresponsedata.md | 1 - .../docs/models/components/kind.md | 27 + .../docs/models/components/manifest.md | 1 - .../operations/attachappmanifestrequest.md | 9 + .../operations/attachappmanifestresponse.md | 9 + .../operations/createdeploymentrawrequest.md | 9 - .../operations/createdeploymentrawresponse.md | 10 - .../operations/createdeploymentrequest.md | 9 - .../operations/createmanifestrawrequest.md | 9 +- .../operations/createmanifestrequest.md | 1 - .../operations/detachappmanifestrequest.md | 8 + .../operations/detachappmanifestresponse.md | 9 + .../models/operations/listmanifestsrequest.md | 9 +- .../docs/sdks/deployserver/README.md | 187 +++-- .../models/components/app.go | 23 +- .../models/components/appcurrentmanifest.go | 48 ++ .../components/appmanifestdivergence.go | 90 ++ .../components/attachmanifestrequest.go | 16 + .../components/createdeploymentrequest.go | 16 +- .../components/createmanifestresponse.go | 8 - .../models/components/manifest.go | 9 - .../models/operations/attachappmanifest.go | 47 ++ .../models/operations/createdeployment.go | 20 - .../models/operations/createdeploymentraw.go | 58 -- .../models/operations/createmanifest.go | 11 +- .../models/operations/createmanifestraw.go | 9 - .../models/operations/detachappmanifest.go | 39 + .../models/operations/listmanifests.go | 9 - openapi/deployserver.yaml | 786 +++++------------- openapi/schemas/application.json | 350 ++++++++ 55 files changed, 2249 insertions(+), 1184 deletions(-) create mode 100644 cmd/cloud/apps/bind_manifest.go create mode 100644 cmd/cloud/apps/bind_manifest_test.go create mode 100644 cmd/cloud/apps/deployments/create_test.go create mode 100644 cmd/cloud/apps/manifests/create_test.go create mode 100644 cmd/cloud/apps/manifests/delete_test.go create mode 100644 cmd/cloud/apps/manifests/versions/push_test.go create mode 100644 cmd/cloud/apps/show_test.go create mode 100644 cmd/cloud/apps/unbind_manifest.go create mode 100644 internal/deployserverclient/docs/models/components/appcurrentmanifest.md create mode 100644 internal/deployserverclient/docs/models/components/appmanifestdivergence.md create mode 100644 internal/deployserverclient/docs/models/components/attachmanifestrequest.md create mode 100644 internal/deployserverclient/docs/models/components/kind.md create mode 100644 internal/deployserverclient/docs/models/operations/attachappmanifestrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/attachappmanifestresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md delete mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md delete mode 100644 internal/deployserverclient/docs/models/operations/createdeploymentrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/detachappmanifestrequest.md create mode 100644 internal/deployserverclient/docs/models/operations/detachappmanifestresponse.md create mode 100644 internal/deployserverclient/models/components/appcurrentmanifest.go create mode 100644 internal/deployserverclient/models/components/appmanifestdivergence.go create mode 100644 internal/deployserverclient/models/components/attachmanifestrequest.go create mode 100644 internal/deployserverclient/models/operations/attachappmanifest.go delete mode 100644 internal/deployserverclient/models/operations/createdeploymentraw.go create mode 100644 internal/deployserverclient/models/operations/detachappmanifest.go create mode 100644 openapi/schemas/application.json diff --git a/cmd/cloud/apps/bind_manifest.go b/cmd/cloud/apps/bind_manifest.go new file mode 100644 index 00000000..d415bdb8 --- /dev/null +++ b/cmd/cloud/apps/bind_manifest.go @@ -0,0 +1,80 @@ +package apps + +import ( + "fmt" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type BindManifest struct { + AppID string `json:"appId"` + ManifestID string `json:"manifestId"` +} + +type BindManifestCtrl struct { + store *BindManifest +} + +var _ fctl.Controller[*BindManifest] = (*BindManifestCtrl)(nil) + +func NewBindManifestCtrl() *BindManifestCtrl { + return &BindManifestCtrl{store: &BindManifest{}} +} + +func NewBindManifest() *cobra.Command { + return fctl.NewCommand("bind-manifest", + fctl.WithShortDescription("Bind a manifest to an app"), + fctl.WithStringFlag("app-id", "", "App ID"), + fctl.WithStringFlag("manifest-id", "", "Manifest ID to bind"), + fctl.WithController(NewBindManifestCtrl()), + ) +} + +func (c *BindManifestCtrl) GetStore() *BindManifest { return c.store } + +func (c *BindManifestCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + appID := fctl.GetString(cmd, "app-id") + if appID == "" { + return nil, fmt.Errorf("app-id is required") + } + manifestID := fctl.GetString(cmd, "manifest-id") + if manifestID == "" { + return nil, fmt.Errorf("manifest-id is required") + } + + if _, err := apiClient.AttachAppManifest(cmd.Context(), appID, components.AttachManifestRequest{ + ManifestID: manifestID, + }); err != nil { + return nil, err + } + + c.store.AppID = appID + c.store.ManifestID = manifestID + return c, nil +} + +func (c *BindManifestCtrl) Render(_ *cobra.Command, _ []string) error { + pterm.Success.Printfln("Manifest %s bound to app %s", c.store.ManifestID, c.store.AppID) + return nil +} diff --git a/cmd/cloud/apps/bind_manifest_test.go b/cmd/cloud/apps/bind_manifest_test.go new file mode 100644 index 00000000..740ca1e3 --- /dev/null +++ b/cmd/cloud/apps/bind_manifest_test.go @@ -0,0 +1,49 @@ +package apps + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func TestBindManifest_JSONOutput_LowercaseKeys(t *testing.T) { + store := &BindManifest{ + AppID: "app-abc", + ManifestID: "mnf-xyz", + } + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok) + require.Equal(t, "app-abc", data["appId"]) + require.Equal(t, "mnf-xyz", data["manifestId"]) + + for _, capitalized := range []string{"AppID", "ManifestID"} { + _, present := data[capitalized] + require.False(t, present, "must not surface Go-cased key %q", capitalized) + } +} + +func TestUnbindManifest_JSONOutput_LowercaseKeys(t *testing.T) { + store := &UnbindManifest{AppID: "app-abc"} + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok) + require.Equal(t, "app-abc", data["appId"]) + _, capitalized := data["AppID"] + require.False(t, capitalized) +} diff --git a/cmd/cloud/apps/deployments/create.go b/cmd/cloud/apps/deployments/create.go index 1249170a..635671b9 100644 --- a/cmd/cloud/apps/deployments/create.go +++ b/cmd/cloud/apps/deployments/create.go @@ -1,6 +1,7 @@ package deployments import ( + "context" "fmt" "io" "time" @@ -15,6 +16,18 @@ import ( fctl "github.com/formancehq/fctl/v3/pkg" ) +// Deployment status values polled by the wait loop. Mirrors the strings the +// deploy server emits — keep this list in sync with the server's status enum +// (terraform-hcp-proxy `internal/storage/models/deployment.go`). The server +// does not yet expose these as a typed enum in the OpenAPI spec; lift this +// block once it does so a rename produces a compile error instead of a +// silent polling deadlock. +const ( + statusApplied = "applied" + statusPlannedAndFinished = "planned_and_finished" + statusErrored = "errored" +) + type Create struct { *components.DeploymentResource logs []components.Log @@ -41,8 +54,9 @@ func NewCreate() *cobra.Command { fctl.WithShortDescription("Create a deployment (deploy an app)"), fctl.WithStringFlag("app-id", "", "App ID"), fctl.WithStringFlag("manifest-id", "", "Manifest ID to deploy"), - fctl.WithIntFlag("manifest-version", 0, "Manifest version to deploy (omit or 0 for latest)"), + fctl.WithIntFlag("manifest-version", 0, "Manifest version to deploy (required, >= 1)"), fctl.WithBoolFlag("wait", true, "Wait for the deployment to complete"), + fctl.WithStringFlag("wait-timeout", "30m", "Max duration to wait for the deployment when --wait is set"), fctl.WithController(NewCreateCtrl()), ) } @@ -75,18 +89,19 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, er if manifestID == "" { return nil, fmt.Errorf("manifest-id is required") } + manifestVersion := fctl.GetInt(cmd, "manifest-version") + if manifestVersion <= 0 { + return nil, fmt.Errorf("manifest-version is required (>= 1)") + } req := components.CreateDeploymentRequest{ - AppID: appID, - ManifestID: &manifestID, - } - if v := fctl.GetInt(cmd, "manifest-version"); v > 0 { - version := int64(v) - req.ManifestVersion = &version + AppID: appID, + ManifestID: manifestID, + ManifestVersion: int64(manifestVersion), } cmd.SilenceUsage = true - deployment, err := apiClient.CreateDeployment(cmd.Context(), req, &appID) + deployment, err := apiClient.CreateDeployment(cmd.Context(), req) if err != nil { return nil, err } @@ -138,14 +153,38 @@ func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { _ = spinner.Stop() }() + timeout := 30 * time.Minute + if v := fctl.GetString(cmd, "wait-timeout"); v != "" { + parsed, err := time.ParseDuration(v) + if err != nil { + return fmt.Errorf("invalid --wait-timeout: %w", err) + } + timeout = parsed + } + ctx, cancel := context.WithTimeout(cmd.Context(), timeout) + defer cancel() + waitFor := 0 * time.Second for { select { - case <-cmd.Context().Done(): - return cmd.Context().Err() + case <-ctx.Done(): + if ctx.Err() == context.DeadlineExceeded { + return fmt.Errorf("timed out after %s waiting for deployment %s (last status: %s)", + timeout, c.store.ID, c.store.DeploymentResource.Status) + } + return ctx.Err() case <-time.After(waitFor): - waitFor = 2 * time.Second - r, err := apiClient.ReadDeployment(cmd.Context(), c.store.ID, nil) + // Backoff: 2s, 4s, 8s capped at 15s. A long-running terraform + // apply doesn't need sub-second polling. + if waitFor == 0 { + waitFor = 2 * time.Second + } else if waitFor < 15*time.Second { + waitFor *= 2 + if waitFor > 15*time.Second { + waitFor = 15 * time.Second + } + } + r, err := apiClient.ReadDeployment(ctx, c.store.ID, nil) if err != nil { return err } @@ -153,14 +192,14 @@ func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { spinner.UpdateText(fmt.Sprintf("Deployment status: %s", r.DeploymentResponse.Data.Status)) switch r.DeploymentResponse.Data.Status { - case "applied": + case statusApplied: spinner.UpdateText("Deployment completed successfully") return nil - case "planned_and_finished": + case statusPlannedAndFinished: spinner.UpdateText("Deployment completed successfully, no changes to apply") return nil - case "errored": - l, err := apiClient.ReadDeploymentLogs(cmd.Context(), c.store.ID) + case statusErrored: + l, err := apiClient.ReadDeploymentLogs(ctx, c.store.ID) if err != nil { return err } @@ -176,7 +215,7 @@ func (c *CreateCtrl) waitDeploymentCompletion(cmd *cobra.Command) error { } func (c *CreateCtrl) Render(cmd *cobra.Command, args []string) error { - if c.store.DeploymentResource.Status == "errored" { + if c.store.DeploymentResource.Status == statusErrored { if len(c.store.logs) > 0 { if err := printer.RenderLogs(cmd.ErrOrStderr(), c.store.logs); err != nil { return err diff --git a/cmd/cloud/apps/deployments/create_test.go b/cmd/cloud/apps/deployments/create_test.go new file mode 100644 index 00000000..129869b4 --- /dev/null +++ b/cmd/cloud/apps/deployments/create_test.go @@ -0,0 +1,38 @@ +package deployments + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +// TestNewCreate_RequiredFlags asserts the cobra command exposes the flags +// required by the new {appId, manifestId, manifestVersion} payload shape. +// Until d063441 landed on the server, the deploy endpoint accepted inline +// YAML and an optional manifest version. The new shape requires a +// manifest version >= 1 — the validation happens at Run() time, but the +// flag must at least exist on the command tree. +func TestNewCreate_RequiredFlags(t *testing.T) { + cmd := NewCreate() + for _, name := range []string{"app-id", "manifest-id", "manifest-version", "wait", "wait-timeout"} { + require.NotNil(t, cmd.Flags().Lookup(name), "flag %q must be defined", name) + } +} + +func TestNewCreate_WaitTimeoutDefault(t *testing.T) { + cmd := NewCreate() + f := cmd.Flags().Lookup("wait-timeout") + require.NotNil(t, f) + require.Equal(t, "30m", f.DefValue, + "a sensible default keeps the previous unbounded-poll behaviour from coming back") +} + +// Status constants must stay in sync with the server's deployment status +// enum (terraform-hcp-proxy `internal/storage/models/deployment.go`). +// Renaming any of these on the server without lifting the constants here +// would silently break the wait loop — these assertions are the canary. +func TestStatusConstants(t *testing.T) { + require.Equal(t, "applied", statusApplied) + require.Equal(t, "planned_and_finished", statusPlannedAndFinished) + require.Equal(t, "errored", statusErrored) +} diff --git a/cmd/cloud/apps/manifests/create.go b/cmd/cloud/apps/manifests/create.go index bf458144..a5ccab16 100644 --- a/cmd/cloud/apps/manifests/create.go +++ b/cmd/cloud/apps/manifests/create.go @@ -12,9 +12,9 @@ import ( ) type Create struct { - ID string - Name string - Version int64 + ID string `json:"id"` + Name string `json:"name"` + Version int64 `json:"version"` } type CreateCtrl struct { @@ -37,7 +37,6 @@ func NewCreate() *cobra.Command { return fctl.NewCommand("create", fctl.WithShortDescription("Create a new manifest"), fctl.WithStringFlag("name", "", "Manifest name"), - fctl.WithStringFlag("app-id", "", "Optional app ID to scope the manifest"), fctl.WithStringFlag("path", "", "Path to YAML manifest file"), fctl.WithController(NewCreateCtrl()), ) @@ -79,12 +78,7 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error return nil, err } - var appID *string - if id := fctl.GetString(cmd, "app-id"); id != "" { - appID = &id - } - - resp, err := apiClient.CreateManifestRaw(cmd.Context(), name, data, appID) + resp, err := apiClient.CreateManifestRaw(cmd.Context(), name, data) if err != nil { return nil, err } diff --git a/cmd/cloud/apps/manifests/create_test.go b/cmd/cloud/apps/manifests/create_test.go new file mode 100644 index 00000000..0bfa61fb --- /dev/null +++ b/cmd/cloud/apps/manifests/create_test.go @@ -0,0 +1,43 @@ +package manifests + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +// TestCreate_JSONOutput_LowercaseKeys verifies the Create store serializes +// to JSON with lowercase, idiomatic keys (`id`, `name`, `version`) under +// `data`. Without explicit json tags Go marshals exported fields as-is +// (Go-cased), which would produce `{"data":{"ID":..., "Name":..., "Version":...}}` +// and break any consumer (script, dashboard) reading `.data.id`. The +// provision-example-apps.sh script tripped on this exact bug. +func TestCreate_JSONOutput_LowercaseKeys(t *testing.T) { + store := &Create{ + ID: "mnf-abc123", + Name: "my-manifest", + Version: 1, + } + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok, "data should be an object") + + require.Equal(t, "mnf-abc123", data["id"], "expected lowercase 'id' key") + require.Equal(t, "my-manifest", data["name"], "expected lowercase 'name' key") + require.EqualValues(t, 1, data["version"], "expected lowercase 'version' key") + + // Negative: capital aliases must NOT exist (would indicate missing tags). + for _, capitalized := range []string{"ID", "Name", "Version"} { + _, ok := data[capitalized] + require.False(t, ok, "JSON output should not contain Go-cased key %q", capitalized) + } +} diff --git a/cmd/cloud/apps/manifests/delete.go b/cmd/cloud/apps/manifests/delete.go index 74c9f812..dda23735 100644 --- a/cmd/cloud/apps/manifests/delete.go +++ b/cmd/cloud/apps/manifests/delete.go @@ -10,7 +10,7 @@ import ( ) type Delete struct { - ID string + ID string `json:"id"` } type DeleteCtrl struct { diff --git a/cmd/cloud/apps/manifests/delete_test.go b/cmd/cloud/apps/manifests/delete_test.go new file mode 100644 index 00000000..a1e2c865 --- /dev/null +++ b/cmd/cloud/apps/manifests/delete_test.go @@ -0,0 +1,26 @@ +package manifests + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func TestDelete_JSONOutput_LowercaseKeys(t *testing.T) { + store := &Delete{ID: "mnf-abc123"} + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok) + require.Equal(t, "mnf-abc123", data["id"]) + _, capitalized := data["ID"] + require.False(t, capitalized) +} diff --git a/cmd/cloud/apps/manifests/list.go b/cmd/cloud/apps/manifests/list.go index fe5c1a65..0cd20184 100644 --- a/cmd/cloud/apps/manifests/list.go +++ b/cmd/cloud/apps/manifests/list.go @@ -39,7 +39,6 @@ func NewList() *cobra.Command { return fctl.NewCommand("list", fctl.WithAliases("ls"), fctl.WithShortDescription("List manifests"), - fctl.WithStringFlag("app-id", "", "Filter by app ID"), fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), fctl.WithController(NewListCtrl()), @@ -67,16 +66,10 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) return nil, err } - var appID *string - if id := fctl.GetString(cmd, "app-id"); id != "" { - appID = &id - } - manifests, err := apiClient.ListManifests( cmd.Context(), pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size"))), - appID, ) if err != nil { return nil, err @@ -89,19 +82,13 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { data := [][]string{ - {"ID", "Name", "App ID", "Latest Version", "Created At"}, + {"ID", "Name", "Latest Version", "Created At"}, } for _, m := range c.store.Items { data = append(data, []string{ m.ID, m.Name, - func() string { - if m.AppID != nil { - return *m.AppID - } - return "org-wide" - }(), strconv.FormatInt(m.LatestVersion, 10), fmt.Sprint(m.CreatedAt), }) diff --git a/cmd/cloud/apps/manifests/show.go b/cmd/cloud/apps/manifests/show.go index f1d89ce0..f382b984 100644 --- a/cmd/cloud/apps/manifests/show.go +++ b/cmd/cloud/apps/manifests/show.go @@ -86,10 +86,6 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, _ []string) error { {Level: 0, Text: fmt.Sprintf("Updated At: %s", c.store.UpdatedAt)}, } - if c.store.AppID != nil { - items = append(items, pterm.BulletListItem{Level: 0, Text: fmt.Sprintf("App ID: %s", *c.store.AppID)}) - } - if err := pterm. DefaultBulletList. WithItems(items). diff --git a/cmd/cloud/apps/manifests/versions/push.go b/cmd/cloud/apps/manifests/versions/push.go index 0d9cbbbb..2838d8bb 100644 --- a/cmd/cloud/apps/manifests/versions/push.go +++ b/cmd/cloud/apps/manifests/versions/push.go @@ -12,8 +12,8 @@ import ( ) type Push struct { - ManifestID string - Version int64 + ManifestID string `json:"manifestId"` + Version int64 `json:"version"` } type PushCtrl struct { diff --git a/cmd/cloud/apps/manifests/versions/push_test.go b/cmd/cloud/apps/manifests/versions/push_test.go new file mode 100644 index 00000000..66522b16 --- /dev/null +++ b/cmd/cloud/apps/manifests/versions/push_test.go @@ -0,0 +1,30 @@ +package versions + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func TestPush_JSONOutput_LowercaseKeys(t *testing.T) { + store := &Push{ManifestID: "mnf-abc", Version: 4} + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok) + require.Equal(t, "mnf-abc", data["manifestId"]) + require.EqualValues(t, 4, data["version"]) + + for _, capitalized := range []string{"ManifestID", "Version"} { + _, present := data[capitalized] + require.False(t, present, "must not surface Go-cased key %q", capitalized) + } +} diff --git a/cmd/cloud/apps/root.go b/cmd/cloud/apps/root.go index 8f876007..b98403f9 100644 --- a/cmd/cloud/apps/root.go +++ b/cmd/cloud/apps/root.go @@ -35,6 +35,8 @@ func NewCommand() *cobra.Command { NewCreate(), NewDelete(), NewShow(), + NewBindManifest(), + NewUnbindManifest(), deployments.NewCommand(), manifests.NewCommand(), variables.NewCommand(), diff --git a/cmd/cloud/apps/show.go b/cmd/cloud/apps/show.go index 65523320..510df228 100644 --- a/cmd/cloud/apps/show.go +++ b/cmd/cloud/apps/show.go @@ -14,6 +14,21 @@ import ( fctl "github.com/formancehq/fctl/v3/pkg" ) +func divergenceHint(k components.Kind) string { + switch k { + case components.KindUndeployed: + return "manifest bound but no successful deployment yet" + case components.KindSynced: + return "deployed (manifestId, version) matches the bound manifest's latest version" + case components.KindBehind: + return "deployed manifest matches the bound manifest but on an older version" + case components.KindRebound: + return "the app was rebound; deployed manifest is a different manifest" + default: + return "" + } +} + type Show struct { components.App } @@ -119,6 +134,44 @@ func (c *ShowCtrl) Render(cmd *cobra.Command, args []string) error { return err } + if cm := c.store.App.CurrentManifest; cm != nil { + pterm.DefaultSection.Println("Manifest") + manifestItems := []pterm.BulletListItem{ + {Level: 0, Text: fmt.Sprintf("ID: %s", cm.ID)}, + {Level: 0, Text: fmt.Sprintf("Name: %s", cm.Name)}, + {Level: 0, Text: fmt.Sprintf("Latest Version: %d", cm.LatestVersion)}, + } + if d := cm.Divergence; d != nil { + manifestItems = append(manifestItems, pterm.BulletListItem{ + Level: 0, + Text: fmt.Sprintf("Status: %s — %s", d.Kind, divergenceHint(d.Kind)), + }) + if d.DeployedManifestID != nil { + manifestItems = append(manifestItems, pterm.BulletListItem{ + Level: 1, + Text: fmt.Sprintf("Deployed manifest: %s", *d.DeployedManifestID), + }) + } + if d.DeployedVersion != nil { + manifestItems = append(manifestItems, pterm.BulletListItem{ + Level: 1, + Text: fmt.Sprintf("Deployed version: %d", *d.DeployedVersion), + }) + } + manifestItems = append(manifestItems, pterm.BulletListItem{ + Level: 1, + Text: fmt.Sprintf("Latest version: %d", d.LatestVersion), + }) + } + if err := pterm. + DefaultBulletList. + WithItems(manifestItems). + WithWriter(cmd.OutOrStdout()). + Render(); err != nil { + return err + } + } + if c.store.App.State != nil && c.store.App.State.Stack != nil { pterm.DefaultSection.Println("State") diff --git a/cmd/cloud/apps/show_test.go b/cmd/cloud/apps/show_test.go new file mode 100644 index 00000000..64d682d4 --- /dev/null +++ b/cmd/cloud/apps/show_test.go @@ -0,0 +1,149 @@ +package apps + +import ( + "bytes" + "encoding/json" + "strings" + "testing" + + "github.com/spf13/cobra" + "github.com/stretchr/testify/require" + + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +func TestShow_JSONOutput_PreservesSDKShape(t *testing.T) { + stackID := "stk-abc" + deployedManifestID := "mnf-old" + deployedVersion := int64(1) + + store := &Show{ + App: components.App{ + ID: "app-abc", + Name: "my-app", + StackID: &stackID, + CurrentManifest: &components.AppCurrentManifest{ + ID: "mnf-new", + Name: "my-manifest", + LatestVersion: 3, + Divergence: &components.AppManifestDivergence{ + Kind: components.KindRebound, + DeployedManifestID: &deployedManifestID, + DeployedVersion: &deployedVersion, + LatestVersion: 3, + }, + }, + }, + } + + out, err := json.Marshal(fctl.ExportedData{Data: store}) + require.NoError(t, err) + + var raw map[string]any + require.NoError(t, json.Unmarshal(out, &raw)) + + data, ok := raw["data"].(map[string]any) + require.True(t, ok) + require.Equal(t, "app-abc", data["id"]) + require.Equal(t, "stk-abc", data["stackId"]) + + cm, ok := data["currentManifest"].(map[string]any) + require.True(t, ok, "currentManifest must be present and named lowercase") + require.Equal(t, "mnf-new", cm["id"]) + require.EqualValues(t, 3, cm["latestVersion"]) + + div, ok := cm["divergence"].(map[string]any) + require.True(t, ok, "divergence must be present") + require.Equal(t, "rebound", div["kind"]) + require.Equal(t, "mnf-old", div["deployedManifestId"]) + require.EqualValues(t, 1, div["deployedVersion"]) +} + +func TestShow_PlainRender_IncludesDivergenceSection(t *testing.T) { + deployedManifestID := "mnf-old" + deployedVersion := int64(1) + + c := NewShowCtrl() + c.store.App = components.App{ + ID: "app-abc", + Name: "my-app", + CurrentManifest: &components.AppCurrentManifest{ + ID: "mnf-new", + Name: "my-manifest", + LatestVersion: 3, + Divergence: &components.AppManifestDivergence{ + Kind: components.KindBehind, + DeployedManifestID: &deployedManifestID, + DeployedVersion: &deployedVersion, + LatestVersion: 3, + }, + }, + } + + cmd := &cobra.Command{} + buf := &bytes.Buffer{} + cmd.SetOut(buf) + + require.NoError(t, c.Render(cmd, nil)) + + // pterm.DefaultSection writes to os.Stdout directly; only the bullet + // list goes through cmd.Out. So we assert on bullet content, not the + // section header. + got := stripANSI(buf.String()) + require.Contains(t, got, "ID: mnf-new", "should print bound manifest id") + require.Contains(t, got, "Name: my-manifest", "should print bound manifest name") + require.Contains(t, got, "Latest Version: 3", "should print latest version of bound manifest") + require.Contains(t, got, "behind", "should print divergence kind") + require.Contains(t, got, "Deployed manifest: mnf-old") + require.Contains(t, got, "Deployed version: 1") + require.Contains(t, got, "Latest version: 3") +} + +func TestShow_PlainRender_OmitsDivergenceWhenAbsent(t *testing.T) { + c := NewShowCtrl() + c.store.App = components.App{ID: "app-abc", Name: "my-app"} + + cmd := &cobra.Command{} + buf := &bytes.Buffer{} + cmd.SetOut(buf) + + require.NoError(t, c.Render(cmd, nil)) + + got := stripANSI(buf.String()) + require.NotContains(t, got, "rebound") + require.NotContains(t, got, "Deployed manifest") +} + +func TestDivergenceHint_CoversAllKinds(t *testing.T) { + for _, k := range []components.Kind{ + components.KindUndeployed, + components.KindSynced, + components.KindBehind, + components.KindRebound, + } { + require.NotEmpty(t, divergenceHint(k), "missing hint for kind %q", k) + } + require.Empty(t, divergenceHint(components.Kind("unknown"))) +} + +// stripANSI removes pterm color/escape sequences so assertions can match on +// the raw text content without coupling to terminal formatting. +func stripANSI(s string) string { + var b strings.Builder + inEsc := false + for _, r := range s { + switch { + case r == 0x1b: + inEsc = true + case inEsc && (r == 'm' || r == 'K' || r == 'A' || r == 'B' || r == 'C' || r == 'D'): + inEsc = false + case inEsc: + // swallow CSI body + default: + b.WriteRune(r) + } + } + return b.String() +} diff --git a/cmd/cloud/apps/unbind_manifest.go b/cmd/cloud/apps/unbind_manifest.go new file mode 100644 index 00000000..7607e5eb --- /dev/null +++ b/cmd/cloud/apps/unbind_manifest.go @@ -0,0 +1,69 @@ +package apps + +import ( + "fmt" + + "github.com/pterm/pterm" + "github.com/spf13/cobra" + + fctl "github.com/formancehq/fctl/v3/pkg" +) + +type UnbindManifest struct { + AppID string `json:"appId"` +} + +type UnbindManifestCtrl struct { + store *UnbindManifest +} + +var _ fctl.Controller[*UnbindManifest] = (*UnbindManifestCtrl)(nil) + +func NewUnbindManifestCtrl() *UnbindManifestCtrl { + return &UnbindManifestCtrl{store: &UnbindManifest{}} +} + +func NewUnbindManifest() *cobra.Command { + return fctl.NewCommand("unbind-manifest", + fctl.WithShortDescription("Unbind the manifest from an app"), + fctl.WithStringFlag("app-id", "", "App ID"), + fctl.WithController(NewUnbindManifestCtrl()), + ) +} + +func (c *UnbindManifestCtrl) GetStore() *UnbindManifest { return c.store } + +func (c *UnbindManifestCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) { + _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) + if err != nil { + return nil, err + } + + _, apiClient, err := fctl.NewAppDeployClientFromFlags( + cmd, + relyingParty, + fctl.NewPTermDialog(), + profileName, + *profile, + ) + if err != nil { + return nil, err + } + + appID := fctl.GetString(cmd, "app-id") + if appID == "" { + return nil, fmt.Errorf("app-id is required") + } + + if _, err := apiClient.DetachAppManifest(cmd.Context(), appID); err != nil { + return nil, err + } + + c.store.AppID = appID + return c, nil +} + +func (c *UnbindManifestCtrl) Render(_ *cobra.Command, _ []string) error { + pterm.Success.Printfln("Manifest unbound from app %s", c.store.AppID) + return nil +} diff --git a/go.mod b/go.mod index 2b0f11bc..5846a83e 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/pterm/pterm v0.12.83 github.com/segmentio/ksuid v1.0.4 github.com/spf13/cobra v1.10.2 + github.com/stretchr/testify v1.11.1 github.com/zitadel/oidc/v2 v2.12.2 golang.org/x/mod v0.35.0 golang.org/x/oauth2 v0.36.0 @@ -72,7 +73,6 @@ require ( github.com/sergi/go-diff v1.4.0 // indirect github.com/sirupsen/logrus v1.9.4 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect github.com/uptrace/bun v1.2.18 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.3.2 // indirect diff --git a/internal/deployserverclient/.speakeasy/gen.lock b/internal/deployserverclient/.speakeasy/gen.lock index c23cca6f..7bb1b6e5 100644 --- a/internal/deployserverclient/.speakeasy/gen.lock +++ b/internal/deployserverclient/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 12df0dd4-09cf-49f5-8116-53c77b28ba01 management: - docChecksum: 143dfa4acb9785b74b550011f4c1da66 + docChecksum: a3e3bbccd6bb25e0e6c77304fef8065f docVersion: 0.1.0 speakeasyVersion: 1.759.2 generationVersion: 2.869.23 releaseVersion: 0.1.0 configChecksum: 0445386bbafa86450656df7324d2976d persistentEdits: - generation_id: ffe6b23c-2b66-48b8-a7f1-ad0bfdac9218 - pristine_commit_hash: 9d81e90272bdd5524de6b87c60b08fd69f105a40 - pristine_tree_hash: e020e62ca1fe23f2ae36ecd406ba8d1728bef1d1 + generation_id: bf8cc126-19fa-4e3a-8743-a7bc4d5088e6 + pristine_commit_hash: 7b9613abe4adebce9fdf320e5102fc907299c866 + pristine_tree_hash: f97130af909b1ee3ae391ca4ca2a4543207f3618 features: go: acceptHeaders: 2.81.2 @@ -52,36 +52,48 @@ trackedFiles: pristine_git_object: eb58123de9ffa74878d22ed28cc871ffefdc7ca6 deployserver.go: id: 4e88cb1c88d3 - last_write_checksum: sha1:9d817385a0c4b8d5f0c3ad5a55bc936222c23c29 - pristine_git_object: 1a690fd578589f399706ef911e5d129b00deeb95 + last_write_checksum: sha1:f4ea2be99e3159d8370a1275127654eb63d55141 + pristine_git_object: 14a08ff96e87051a30a0abb91f6e316dbe501ae1 docs/models/apierrors/error.md: id: 7c6e7719d689 last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b pristine_git_object: 5450343d4870b85f53cb47ab9190928cf72fb86f docs/models/components/app.md: id: a31b0d7743a7 - last_write_checksum: sha1:247e676731d167fc1e4153bb383c48fcb356582d - pristine_git_object: 579a521cb8e58906bc5c96f80d87e2456d77c43b + last_write_checksum: sha1:002bd53acd9a8208b9aedb5e6ae368fbc8c8851f + pristine_git_object: c77eac6a3543a43397427958811562bf754f65fc + docs/models/components/appcurrentmanifest.md: + id: 2dd2ef03f47d + last_write_checksum: sha1:59effaf340c7928d5de891115eed2d5fd9a292af + pristine_git_object: 8d2c8375985e46c50c132fad56f699f663f60736 + docs/models/components/appmanifestdivergence.md: + id: a0580427f5bb + last_write_checksum: sha1:afe31b7e636c6293e67149addf9062b140e6d7c2 + pristine_git_object: 92ae72e8ef09024eb6d1175e07fb8107a563602a docs/models/components/appresponse.md: id: d91756763bd8 last_write_checksum: sha1:bc1cb4578672a35de623e2c851eb3cd7ac1ef282 pristine_git_object: 4b41a7e872fa8e853f9b1121498b03f2c9ff7484 + docs/models/components/attachmanifestrequest.md: + id: cb3dfde05df4 + last_write_checksum: sha1:2a6c296c5ebb62b3ceee718540389ff4e0229ac4 + pristine_git_object: b1ecb225ac6534877f822476b25b56d539234523 docs/models/components/createapprequest.md: id: f64ccea218c9 last_write_checksum: sha1:8281f54cb47b92d3af4f645c6029dd2941ea7572 pristine_git_object: 8d2ae919f0a7e732719ebf8ed5b29c959c68a54b docs/models/components/createdeploymentrequest.md: id: f4fbf8bda1d8 - last_write_checksum: sha1:26fa217edfdff939738d3f03c714a2886772dc5d - pristine_git_object: dc6b0ccc3ad1e46668af053d52a0f30a09c0c4f6 + last_write_checksum: sha1:676927d3710e088975778a88a91cb14d534e2453 + pristine_git_object: 03f669ebc8fbefa0a3d544e4ec3d4daca2c828ad docs/models/components/createmanifestresponse.md: id: 2a7b75671c99 last_write_checksum: sha1:e4ca70d53026357309f5fda874e961576469dd27 pristine_git_object: 50f2431438296e07de096d4bea3c2dc01d1a5ffe docs/models/components/createmanifestresponsedata.md: id: bf8a9aa0fb9d - last_write_checksum: sha1:2d487d881c37e3f1d3cb2b0b3d8dd2370bfc3f68 - pristine_git_object: dd1916f2dcb20050e33f11acfee12ba898728bc1 + last_write_checksum: sha1:d0f852a312d5c2a6bd7c4517fe52d581e1a90547 + pristine_git_object: d67abd5dd29f7da960eace60783078a79e84735b docs/models/components/createvariablerequest.md: id: 1656d1204270 last_write_checksum: sha1:650be824e43882247b0beb008425e05b8182f946 @@ -114,6 +126,10 @@ trackedFiles: id: 728948c70168 last_write_checksum: sha1:7c40945dac218ce5e5e11e7c907d27a3ea14c417 pristine_git_object: df1fdd59f3c85e4ba70573ff7954b12ac1d33d08 + docs/models/components/kind.md: + id: 72cd1832e8b4 + last_write_checksum: sha1:e6a4325929adae5d5be88ccaa35a2fdb6b50bb38 + pristine_git_object: 983f988a4d90a4549a108b3f8852e39af4447cfe docs/models/components/listappsresponse.md: id: e0c61f1197fc last_write_checksum: sha1:913aa9678e2c21b99e8623583272fbde0e36325d @@ -152,8 +168,8 @@ trackedFiles: pristine_git_object: 79e08b9c5265af867fa20da18fcdfdf66565238a docs/models/components/manifest.md: id: ab82543dfdb2 - last_write_checksum: sha1:0b0d14cedff0503de24c660fe099b2697f0f02b2 - pristine_git_object: b0e4e353d0778117fb718aa579fd1befdae712fd + last_write_checksum: sha1:4d67f726b6ade8e4aa1882b7881076d1dc7b063d + pristine_git_object: 407cb57380e88a7dc6eda8458d3227847bfaa880 docs/models/components/manifestresponse.md: id: 7599449e468c last_write_checksum: sha1:80cd053266a1bfea9c64302b2bc5aafdbd2b7ea2 @@ -198,6 +214,14 @@ trackedFiles: id: 41fd2f11ae57 last_write_checksum: sha1:33a510fe028f18cde19f69ada0334cddfdf263a1 pristine_git_object: e6528690bf3b5e499bccc351abb0657dc36f7b35 + docs/models/operations/attachappmanifestrequest.md: + id: accaf996506a + last_write_checksum: sha1:e0fa8acf1f13cca121733c69619da7ecf6e00611 + pristine_git_object: 9a803bad8e5ea48b6f6ab281ff6ab182cd44f3cd + docs/models/operations/attachappmanifestresponse.md: + id: 60fe275da864 + last_write_checksum: sha1:545bf3c1ccba5638f97fc59967750e54ae3d85a5 + pristine_git_object: 58ad5c5b9c63d7332f56b467e26199517bccefce docs/models/operations/createappresponse.md: id: 06821c964f8b last_write_checksum: sha1:357317e66e4b7703f26de3777fc0e3438b520cf6 @@ -210,34 +234,22 @@ trackedFiles: id: c22ab459449d last_write_checksum: sha1:2997e3902e9b95ad72de1a228b189e7e4256801c pristine_git_object: 07452bcd2cc549c56e03ecc0d7cb3331351df8f9 - docs/models/operations/createdeploymentrawrequest.md: - id: ea63ae5dcab0 - last_write_checksum: sha1:1aeec59fe968426fa62c5bba7504c025fe9fb60a - pristine_git_object: c91702f162d2d8ba5438d853b923cbb2f7e5959c - docs/models/operations/createdeploymentrawresponse.md: - id: 2c6b707f9b1b - last_write_checksum: sha1:c6f967696062f9b699a0383ba5dcb150e6f4e521 - pristine_git_object: 5a5384b33004ea72c8730fc81b35d9e626ae7bc0 - docs/models/operations/createdeploymentrequest.md: - id: 79e21a5a08cb - last_write_checksum: sha1:afd41fd8b45a8a9ea975034b3bf77ce05ce21aa3 - pristine_git_object: 9b672d38d606232006ca85cf62a2b1cf7481eaa2 docs/models/operations/createdeploymentresponse.md: id: 0ca0d30ebb83 last_write_checksum: sha1:02db410d2fb68c69402305bc027eab8144a2652a pristine_git_object: d6be343012c94546e5b4c47fe8a3820c0b71a52a docs/models/operations/createmanifestrawrequest.md: id: 9c0f7a9c45fc - last_write_checksum: sha1:eb0d79a298a2f0ce9ea151d142eb541ac985233a - pristine_git_object: 878fcaf0ee9878454ccda3bdcf8cb240c591e541 + last_write_checksum: sha1:732932b84bc2d28c88611a5d7ed9381cebeaa2f2 + pristine_git_object: dc7c3123dab32b7844747a39751fa55d43ed89fc docs/models/operations/createmanifestrawresponse.md: id: 9f74a7d48f44 last_write_checksum: sha1:f19aecd730aa1dd6c522ef982d39767ee80014d0 pristine_git_object: 3e8b398ef51b79f60250ec70fea3fcd418fa90fd docs/models/operations/createmanifestrequest.md: id: 00ac20b869e1 - last_write_checksum: sha1:641b55f717306cb3b6dc43ebe466f53fd31effe2 - pristine_git_object: fc43bc11ea647ca0a25b407d1a301a0e0794c872 + last_write_checksum: sha1:2e580919ecea521706c39ee6ce9aae20adb7f5f9 + pristine_git_object: 319e78b7389b1fe271cf69793eb1c49ef82cfabf docs/models/operations/createmanifestrequestbody.md: id: be4690911b9f last_write_checksum: sha1:a28556106cd526daf14d0784468bd8deefca9c40 @@ -270,6 +282,14 @@ trackedFiles: id: 7b9e8dfc4e3e last_write_checksum: sha1:aec0c2e4f2c0be4ebedd4a65d1ae968b9fb4f753 pristine_git_object: e8a81fae4aab84de1a75fff7223f70da5d88c2d9 + docs/models/operations/detachappmanifestrequest.md: + id: da916e1cfe7c + last_write_checksum: sha1:87897e24e0e18511163a5fb3594b795f16e54d57 + pristine_git_object: d11d0dba181909c1e06c00f4e1b2e32a5b592ba9 + docs/models/operations/detachappmanifestresponse.md: + id: eb6aafbf031b + last_write_checksum: sha1:6c93f0e8f124c89d0d547e20bc157302362f0a78 + pristine_git_object: fbbd1f5af2d20d35ab0340f38e562d06e7535de5 docs/models/operations/listappsrequest.md: id: 5efe8d3cde07 last_write_checksum: sha1:738a4635f906b469db0206d6c997bce005b4009d @@ -288,8 +308,8 @@ trackedFiles: pristine_git_object: cc0444002ab9aa126d0cb3dc0eba3c4484128915 docs/models/operations/listmanifestsrequest.md: id: 62d8ae59d357 - last_write_checksum: sha1:ad0b1936f3d53a037837b293a3f162ec372d5a5c - pristine_git_object: ada5ef33d29878328aadb6546feb91c000199129 + last_write_checksum: sha1:6fb6351c9c7454e6725bef3cec628c36b6cc400b + pristine_git_object: 1c953fe5073e6f85bb3c98c0dca92b34115e338f docs/models/operations/listmanifestsresponse.md: id: 44929c2f905b last_write_checksum: sha1:c6302e89d1e353c091cde1af1e9c2dabb23565c1 @@ -400,8 +420,8 @@ trackedFiles: pristine_git_object: f8b0e9ef7ee64c5c8ade8601fac272aa7909171e docs/sdks/deployserver/README.md: id: 7bbb48696892 - last_write_checksum: sha1:0ec0b0b059daa30bd46433a8560dd1799c0778da - pristine_git_object: c1f3a0749b4e3a0fae4e2f97f9d22de8961e6cca + last_write_checksum: sha1:bdbdcdf579be8f2d770ee992847b49b7f59cf51a + pristine_git_object: 5c60de63553f34704fd0b3268523d33d5e084320 go.mod: id: c47645c391ad last_write_checksum: sha1:ccfac949478bd60fae3010350a17ef6c9e8580bf @@ -476,24 +496,36 @@ trackedFiles: pristine_git_object: 3216263c45c4b5e21766a1f164f0c0a94e1ca931 models/components/app.go: id: 9c69c824fb8f - last_write_checksum: sha1:5c99247965bdac4495e994af300d8c15a65242a1 - pristine_git_object: 5a865c0c71ea8511f07395ff527f33915b62624a + last_write_checksum: sha1:19773356001a79743a8aaa9c42fcfc9e283763cb + pristine_git_object: c56bdf01391c69b0faeac68369ed73192c7c2ff6 + models/components/appcurrentmanifest.go: + id: 8052b72ab148 + last_write_checksum: sha1:886ddb12506c04280fe6a959e701be6dbd0190d9 + pristine_git_object: e7de2cd99ecf7a2c3451a510da437df6284366bc + models/components/appmanifestdivergence.go: + id: f3524b0e65be + last_write_checksum: sha1:6820083fcaa959ea751921818eb136fb78401bc6 + pristine_git_object: c9e0e72241330906811efd220382e376424ab2ce models/components/appresponse.go: id: b25e95988f98 last_write_checksum: sha1:1bfd097001d33ab7ee59f46af273f580d59d1c58 pristine_git_object: 33edf7fbf66a033955dd4f47651babc06bb5426e + models/components/attachmanifestrequest.go: + id: 2175c8772b17 + last_write_checksum: sha1:f32d443b94b064b6ffe062b31e15175b9e88039b + pristine_git_object: 5cab118b3eaae9365d6aa54a3c59795298d1af6f models/components/createapprequest.go: id: 0af34a35e29f last_write_checksum: sha1:40d84c521b00da93908a60a88a094512e2e41518 pristine_git_object: f8efe94841634e24768fea038a35454ac212c0b9 models/components/createdeploymentrequest.go: id: 22e94762a36e - last_write_checksum: sha1:b448c0624d8bc3f86f9aac036a0139b2ef86f667 - pristine_git_object: 37a6dcb6058a1fcfbbfd9191c00717d4b8532dde + last_write_checksum: sha1:0ee39822c8c00037ef6b5dc67a942cd021b667c1 + pristine_git_object: 9b4eaf86f0894bae0c59ec8ab1e0e5a649704373 models/components/createmanifestresponse.go: id: 8a09822d66c1 - last_write_checksum: sha1:f883a1731f0716e265a7ed30378cae56dee637d3 - pristine_git_object: 4532b178146d96fc897d246eff45d623ac098558 + last_write_checksum: sha1:52c7e80eea20d14ce2184f9889183929915080d4 + pristine_git_object: 921bf611877505dd88e6aa308cc6b9797c6d735b models/components/createvariablerequest.go: id: 488ed9ed73b4 last_write_checksum: sha1:6dad11fecda3f9df54a90dc5bda33496c7ee5904 @@ -544,8 +576,8 @@ trackedFiles: pristine_git_object: 014faaf92105efcd6b6f480bbeeaa978cd0f7523 models/components/manifest.go: id: dc929f032587 - last_write_checksum: sha1:3465024c145021a69cc1d2736ce4cb0d5cd68b11 - pristine_git_object: c9cfb7da0d06841c061e2a66d1d6e3337232b132 + last_write_checksum: sha1:71633d7a4eeb86321447026ea3c0d19c81cbdbcb + pristine_git_object: 5057e76370454b97d069e8facc3c5ae2c10a7cdf models/components/manifestresponse.go: id: 826d316fa365 last_write_checksum: sha1:3772dc6ac0335e105bb5c2c3cb798e7aec4e5869 @@ -586,6 +618,10 @@ trackedFiles: id: c47e6d6b22e2 last_write_checksum: sha1:f18eaccc07eb9c59c6ac2b573d680b09115ec673 pristine_git_object: 9ca7263b061adcb74269a1b7e1738febe66142dc + models/operations/attachappmanifest.go: + id: 1b3eab4170c4 + last_write_checksum: sha1:b608954727c46e4af9e438e30b82a3b17733dda6 + pristine_git_object: 5833ba6a813271ecc395ee3fd5b76d353b122df2 models/operations/createapp.go: id: 5854dfd707b5 last_write_checksum: sha1:662f38efed6fcd5a485f124d983815d71c5b0aae @@ -596,20 +632,16 @@ trackedFiles: pristine_git_object: 6e6b587c8a8a6f6381df8bd34c06a9fd11d7578f models/operations/createdeployment.go: id: fc879f2c4bd0 - last_write_checksum: sha1:f567f56ff899fc417b32428f3426a3d1f967c421 - pristine_git_object: 65b97e927ff9245e7d3658e07a9ed7579fd29ad5 - models/operations/createdeploymentraw.go: - id: e1dd7c0d9c16 - last_write_checksum: sha1:5798b6f99bf37e6914c92fc48b9dd36f52edcc99 - pristine_git_object: a6896a5109ca246182479739664240ec6be66ab2 + last_write_checksum: sha1:c8fdc9478563ada2a8a538ffcd1a4b7cd1b50272 + pristine_git_object: 03c8cee8787f64dccddca03e2ca5c161e3129ab7 models/operations/createmanifest.go: id: a6767be7cb3c - last_write_checksum: sha1:40dc3cec8e7e4659d81742b00339774d64a23e1a - pristine_git_object: 99920019b3e7b2a9bfd3244fed6b4bfb949acc55 + last_write_checksum: sha1:c67f6b38302c9aff1cfa32bbbb57d20114399365 + pristine_git_object: 8640b8525cf083f6d0415389ba5eb195ca989229 models/operations/createmanifestraw.go: id: 1cb46a50dbc7 - last_write_checksum: sha1:62922e788543039e5bf4eb523bde95048030ae58 - pristine_git_object: 71aeab2d315ef7db71bfa5b302bf822cb3547cf4 + last_write_checksum: sha1:28f1ad690efe6b573e63a5bc6a8ba08c8f04e6cb + pristine_git_object: 8aad3fd7619ce9d7cc93f75cc6eb022be9416426 models/operations/deleteapp.go: id: 16ffc0588ffa last_write_checksum: sha1:fc3736ab52cf7e9c24a38f157288d76665d6b897 @@ -622,6 +654,10 @@ trackedFiles: id: a9e05f283389 last_write_checksum: sha1:d9b5b22243bad0bb985c474d9e666147ec8554e2 pristine_git_object: 06b43a2ff341f3eef670d9e1981915fab88b3613 + models/operations/detachappmanifest.go: + id: 83007b2db814 + last_write_checksum: sha1:26a49783675474a6f4de06ce9b8dddea7c480099 + pristine_git_object: dfa94ca5125eeae7e5aed22535f33ff0359e694a models/operations/listapps.go: id: 73fbcbeab28f last_write_checksum: sha1:696ecf1b2b8144ec3aeb4c0925af9c290b9b1e4d @@ -632,8 +668,8 @@ trackedFiles: pristine_git_object: ddae0d51f91006ce1a38a3f234517d60d3d257a7 models/operations/listmanifests.go: id: c8df7087082a - last_write_checksum: sha1:dd606342315736473b0133d54dfb39586c06cb54 - pristine_git_object: 6d1c50e7c1500c75e90d220d8fde9848deaaca52 + last_write_checksum: sha1:79a1bb7736bf026f68b4e9eeaa57e2c8f1de049d + pristine_git_object: 7200ea57119778a3f965b443b7f467e215ff45f7 models/operations/listmanifestversions.go: id: c3d6a0006b82 last_write_checksum: sha1:b53891beadf5d0b6d6dd46ea3b0075b4b9807302 @@ -1021,7 +1057,7 @@ examples: createDeployment: speakeasy-default-create-deployment: requestBody: - application/json: {"appId": ""} + application/json: {"appId": "", "manifestId": "", "manifestVersion": 5649} responses: "201": application/json: {"data": {"id": "", "appId": "", "status": "", "createdAt": "2024-01-07T04:35:31.471Z", "updatedAt": "2025-12-16T01:27:14.812Z"}} @@ -1064,5 +1100,25 @@ examples: application/json: {} default: application/json: {"errorCode": ""} + attachAppManifest: + speakeasy-default-attach-app-manifest: + parameters: + path: + id: "" + requestBody: + application/json: {"manifestId": ""} + responses: + "400": + application/json: {"errorCode": ""} + default: + application/json: {"errorCode": ""} + detachAppManifest: + speakeasy-default-detach-app-manifest: + parameters: + path: + id: "" + responses: + default: + application/json: {"errorCode": ""} examplesVersion: 1.0.2 generatedTests: {} diff --git a/internal/deployserverclient/README.md b/internal/deployserverclient/README.md index 5b0daa58..9c4c58e3 100644 --- a/internal/deployserverclient/README.md +++ b/internal/deployserverclient/README.md @@ -90,6 +90,8 @@ func main() { * [UpdateApp](docs/sdks/deployserver/README.md#updateapp) - Update an app * [ReadApp](docs/sdks/deployserver/README.md#readapp) - read app details * [DeleteApp](docs/sdks/deployserver/README.md#deleteapp) - Delete an app +* [AttachAppManifest](docs/sdks/deployserver/README.md#attachappmanifest) - Bind an app to a manifest +* [DetachAppManifest](docs/sdks/deployserver/README.md#detachappmanifest) - Unbind an app from its manifest * [ReadAppVariables](docs/sdks/deployserver/README.md#readappvariables) - Get all variables of an app * [CreateAppVariable](docs/sdks/deployserver/README.md#createappvariable) - Create variable for an app * [DeleteAppVariable](docs/sdks/deployserver/README.md#deleteappvariable) - Delete a variable from an app @@ -104,7 +106,6 @@ func main() { * [ListManifestVersions](docs/sdks/deployserver/README.md#listmanifestversions) - List versions of a manifest * [ReadManifestVersion](docs/sdks/deployserver/README.md#readmanifestversion) - Get a specific manifest version with content * [CreateDeployment](docs/sdks/deployserver/README.md#createdeployment) - Create a deployment (triggers a run) -* [CreateDeploymentRaw](docs/sdks/deployserver/README.md#createdeploymentraw) - Create a deployment (triggers a run) * [ListDeployments](docs/sdks/deployserver/README.md#listdeployments) - List deployments * [ReadDeployment](docs/sdks/deployserver/README.md#readdeployment) - Get a single deployment * [ReadDeploymentLogs](docs/sdks/deployserver/README.md#readdeploymentlogs) - Get run logs for a deployment @@ -202,11 +203,11 @@ Handling errors in this SDK should largely match your expectations. All operatio By Default, an API error will return `apierrors.APIError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. -For example, the `DeleteManifest` function may return the following errors: +For example, the `AttachAppManifest` function may return the following errors: | Error Type | Status Code | Content Type | | ------------------ | ----------- | ---------------- | -| apierrors.Error | 409 | application/json | +| apierrors.Error | 400, 404 | application/json | | apierrors.APIError | 4XX, 5XX | \*/\* | ### Example @@ -219,6 +220,7 @@ import ( "errors" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/apierrors" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" ) @@ -227,7 +229,9 @@ func main() { s := deployserverclient.New() - res, err := s.DeleteManifest(ctx, "") + res, err := s.AttachAppManifest(ctx, "", components.AttachManifestRequest{ + ManifestID: "", + }) if err != nil { var e *apierrors.Error @@ -254,11 +258,11 @@ func main() { You can override the default server globally using the `WithServerIndex(serverIndex int)` option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: -| # | Server | Description | -| --- | --------------------------------------- | ----------------- | -| 0 | `https://deploy.formance.cloud` | Production server | -| 1 | `https://deploy.staging.formance.cloud` | Staging server | -| 2 | `http://localhost:8080` | Local server | +| # | Server | Description | +| --- | ---------------------------------------------- | ----------------- | +| 0 | `https://deploy.formance.cloud` | Production server | +| 1 | `https://deploy-server.staging.formance.cloud` | Staging server | +| 2 | `http://localhost:8080` | Local server | #### Example diff --git a/internal/deployserverclient/deployserver.go b/internal/deployserverclient/deployserver.go index 1a690fd5..14a08ff9 100644 --- a/internal/deployserverclient/deployserver.go +++ b/internal/deployserverclient/deployserver.go @@ -26,7 +26,7 @@ var ServerList = []string{ // Production server "https://deploy.formance.cloud", // Staging server - "https://deploy.staging.formance.cloud", + "https://deploy-server.staging.formance.cloud", // Local server "http://localhost:8080", } @@ -1257,6 +1257,442 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, wait *bool, opt } +// AttachAppManifest - Bind an app to a manifest +// Updates the app's `manifest_id` pointer. Idempotent — re-binding to the +// same id is a no-op; rebinding to a different id moves the pointer. +func (s *DeployServer) AttachAppManifest(ctx context.Context, id string, attachManifestRequest components.AttachManifestRequest, opts ...operations.Option) (*operations.AttachAppManifestResponse, error) { + request := operations.AttachAppManifestRequest{ + ID: id, + AttachManifestRequest: attachManifestRequest, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/manifest", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "attachAppManifest", + OAuth2Scopes: nil, + SecuritySource: nil, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "AttachManifestRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.AttachAppManifestResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 204: + utils.DrainBody(httpRes) + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// DetachAppManifest - Unbind an app from its manifest +// Clears the app's `manifest_id` pointer. Idempotent. +func (s *DeployServer) DetachAppManifest(ctx context.Context, id string, opts ...operations.Option) (*operations.DetachAppManifestResponse, error) { + request := operations.DetachAppManifestRequest{ + ID: id, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/apps/{id}/manifest", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "detachAppManifest", + OAuth2Scopes: nil, + SecuritySource: nil, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DetachAppManifestResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 204: + utils.DrainBody(httpRes) + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + // ReadAppVariables - Get all variables of an app func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppVariablesResponse, error) { request := operations.ReadAppVariablesRequest{ @@ -1914,10 +2350,9 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl } // CreateManifestRaw - Create a new manifest -func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, requestBody any, appID *string, opts ...operations.Option) (*operations.CreateManifestRawResponse, error) { +func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, requestBody any, opts ...operations.Option) (*operations.CreateManifestRawResponse, error) { request := operations.CreateManifestRawRequest{ Name: name, - AppID: appID, RequestBody: requestBody, } @@ -2147,10 +2582,9 @@ func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, reque } // CreateManifest - Create a new manifest -func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestBody operations.CreateManifestRequestBody, appID *string, opts ...operations.Option) (*operations.CreateManifestResponse, error) { +func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestBody operations.CreateManifestRequestBody, opts ...operations.Option) (*operations.CreateManifestResponse, error) { request := operations.CreateManifestRequest{ Name: name, - AppID: appID, RequestBody: requestBody, } @@ -2380,11 +2814,10 @@ func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestB } // ListManifests - List manifests in the organization -func (s *DeployServer) ListManifests(ctx context.Context, pageNumber *int64, pageSize *int64, appID *string, opts ...operations.Option) (*operations.ListManifestsResponse, error) { +func (s *DeployServer) ListManifests(ctx context.Context, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListManifestsResponse, error) { request := operations.ListManifestsRequest{ PageNumber: pageNumber, PageSize: pageSize, - AppID: appID, } o := operations.Options{} @@ -4204,12 +4637,7 @@ func (s *DeployServer) ReadManifestVersion(ctx context.Context, manifestID strin } // CreateDeployment - Create a deployment (triggers a run) -func (s *DeployServer) CreateDeployment(ctx context.Context, createDeploymentRequest components.CreateDeploymentRequest, appID *string, opts ...operations.Option) (*operations.CreateDeploymentResponse, error) { - request := operations.CreateDeploymentRequest{ - AppID: appID, - CreateDeploymentRequest: createDeploymentRequest, - } - +func (s *DeployServer) CreateDeployment(ctx context.Context, request components.CreateDeploymentRequest, opts ...operations.Option) (*operations.CreateDeploymentResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -4242,7 +4670,7 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, createDeploymentReq OAuth2Scopes: nil, SecuritySource: nil, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateDeploymentRequest", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } @@ -4268,10 +4696,6 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, createDeploymentReq req.Header.Set("Content-Type", reqContentType) } - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -4435,238 +4859,6 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, createDeploymentReq } -// CreateDeploymentRaw - Create a deployment (triggers a run) -func (s *DeployServer) CreateDeploymentRaw(ctx context.Context, requestBody any, appID *string, opts ...operations.Option) (*operations.CreateDeploymentRawResponse, error) { - request := operations.CreateDeploymentRawRequest{ - AppID: appID, - RequestBody: requestBody, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - var baseURL string - if o.ServerURL == nil { - baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - } else { - baseURL = *o.ServerURL - } - opURL, err := url.JoinPath(baseURL, "/deployments") - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - hookCtx := hooks.HookContext{ - SDK: s, - SDKConfiguration: s.sdkConfiguration, - BaseURL: baseURL, - Context: ctx, - OperationID: "createDeployment_raw", - OAuth2Scopes: nil, - SecuritySource: nil, - } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) - if err != nil { - return nil, err - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) - } - - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - for k, v := range o.SetHeaders { - req.Header.Set(k, v) - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig != nil { - retryConfig = globalRetryConfig - } - } - - var httpRes *http.Response - if retryConfig != nil { - httpRes, err = utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", - }, - }, func() (*http.Response, error) { - if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { - copyBody, err := req.GetBody() - - if err != nil { - return nil, err - } - - req.Body = copyBody - } - - req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { - return nil, err - } - - return nil, retry.Permanent(err) - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - - if err != nil { - return nil, err - } else { - httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } else { - req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err = s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } - - res := &operations.CreateDeploymentRawResponse{ - HTTPMeta: components.HTTPMetadata{ - Request: req, - Response: httpRes, - }, - } - - switch { - case httpRes.StatusCode == 201: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out components.DeploymentResponse - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.DeploymentResponse = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out components.Error - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.Error = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - } - - return res, nil - -} - // ListDeployments - List deployments func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListDeploymentsResponse, error) { request := operations.ListDeploymentsRequest{ diff --git a/internal/deployserverclient/docs/models/components/app.md b/internal/deployserverclient/docs/models/components/app.md index 579a521c..c77eac6a 100644 --- a/internal/deployserverclient/docs/models/components/app.md +++ b/internal/deployserverclient/docs/models/components/app.md @@ -3,9 +3,11 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | Unique identifier for the app | -| `Name` | `string` | :heavy_check_mark: | Name of the app | -| `StackID` | `*string` | :heavy_minus_sign: | Optional existing stack ID claimed by this app | -| `State` | [*components.State](../../models/components/state.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | Unique identifier for the app | +| `Name` | `string` | :heavy_check_mark: | Name of the app | +| `StackID` | `*string` | :heavy_minus_sign: | Optional existing stack ID claimed by this app | +| `StackRegionID` | `*string` | :heavy_minus_sign: | Stack region ID (set when the app's stack lives in a specific region) | +| `State` | [*components.State](../../models/components/state.md) | :heavy_minus_sign: | N/A | +| `CurrentManifest` | [*components.AppCurrentManifest](../../models/components/appcurrentmanifest.md) | :heavy_minus_sign: | The manifest the app is currently bound to (apps.manifest_id), with
catalog metadata and divergence vs the most recent applied deployment.
Populated by GET /apps/{id} when a manifest is bound.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/appcurrentmanifest.md b/internal/deployserverclient/docs/models/components/appcurrentmanifest.md new file mode 100644 index 00000000..8d2c8375 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/appcurrentmanifest.md @@ -0,0 +1,16 @@ +# AppCurrentManifest + +The manifest the app is currently bound to (apps.manifest_id), with +catalog metadata and divergence vs the most recent applied deployment. +Populated by GET /apps/{id} when a manifest is bound. + + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | ID of the manifest the app is bound to | +| `Name` | `string` | :heavy_check_mark: | Name of the bound manifest | +| `LatestVersion` | `int64` | :heavy_check_mark: | Latest version available in the manifest's lineage | +| `Divergence` | [*components.AppManifestDivergence](../../models/components/appmanifestdivergence.md) | :heavy_minus_sign: | Relationship between the app's bound manifest and what's currently
deployed (last `applied` deployment, ignoring destroys).
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/appmanifestdivergence.md b/internal/deployserverclient/docs/models/components/appmanifestdivergence.md new file mode 100644 index 00000000..92ae72e8 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/appmanifestdivergence.md @@ -0,0 +1,15 @@ +# AppManifestDivergence + +Relationship between the app's bound manifest and what's currently +deployed (last `applied` deployment, ignoring destroys). + + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Kind` | [components.Kind](../../models/components/kind.md) | :heavy_check_mark: | - `undeployed`: the app has a manifest bound but no successful deployment yet.
- `synced`: deployed (manifestId, version) matches the bound manifest's latest version.
- `behind`: deployed manifest matches the bound manifest but on an older version.
- `rebound`: the app was rebound; deployed manifest is a different manifest.
| +| `DeployedManifestID` | `*string` | :heavy_minus_sign: | ID of the manifest reflected in the most recent applied deployment | +| `DeployedVersion` | `*int64` | :heavy_minus_sign: | Version reflected in the most recent applied deployment | +| `LatestVersion` | `int64` | :heavy_check_mark: | Latest version available in the bound manifest's lineage | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/attachmanifestrequest.md b/internal/deployserverclient/docs/models/components/attachmanifestrequest.md new file mode 100644 index 00000000..b1ecb225 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/attachmanifestrequest.md @@ -0,0 +1,8 @@ +# AttachManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | +| `ManifestID` | `string` | :heavy_check_mark: | ID of the manifest to bind to the app | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createdeploymentrequest.md b/internal/deployserverclient/docs/models/components/createdeploymentrequest.md index dc6b0ccc..03f669eb 100644 --- a/internal/deployserverclient/docs/models/components/createdeploymentrequest.md +++ b/internal/deployserverclient/docs/models/components/createdeploymentrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | -| `AppID` | `string` | :heavy_check_mark: | ID of the app to deploy to | -| `ManifestID` | `*string` | :heavy_minus_sign: | Manifest catalog ID (for manifest-reference mode) | -| `ManifestVersion` | `*int64` | :heavy_minus_sign: | Manifest version (for manifest-reference mode) | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `AppID` | `string` | :heavy_check_mark: | ID of the app to deploy to | +| `ManifestID` | `string` | :heavy_check_mark: | Manifest catalog ID | +| `ManifestVersion` | `int64` | :heavy_check_mark: | Manifest version | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md b/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md index dd1916f2..d67abd5d 100644 --- a/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md +++ b/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md @@ -6,7 +6,6 @@ | Field | Type | Required | Description | | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | | `ID` | `string` | :heavy_check_mark: | N/A | -| `AppID` | `*string` | :heavy_minus_sign: | N/A | | `Version` | `int64` | :heavy_check_mark: | N/A | | `Name` | `string` | :heavy_check_mark: | N/A | | `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/kind.md b/internal/deployserverclient/docs/models/components/kind.md new file mode 100644 index 00000000..983f988a --- /dev/null +++ b/internal/deployserverclient/docs/models/components/kind.md @@ -0,0 +1,27 @@ +# Kind + +- `undeployed`: the app has a manifest bound but no successful deployment yet. +- `synced`: deployed (manifestId, version) matches the bound manifest's latest version. +- `behind`: deployed manifest matches the bound manifest but on an older version. +- `rebound`: the app was rebound; deployed manifest is a different manifest. + + +## Example Usage + +```go +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +value := components.KindUndeployed +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `KindUndeployed` | undeployed | +| `KindSynced` | synced | +| `KindBehind` | behind | +| `KindRebound` | rebound | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/manifest.md b/internal/deployserverclient/docs/models/components/manifest.md index b0e4e353..407cb573 100644 --- a/internal/deployserverclient/docs/models/components/manifest.md +++ b/internal/deployserverclient/docs/models/components/manifest.md @@ -6,7 +6,6 @@ | Field | Type | Required | Description | | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | | `ID` | `string` | :heavy_check_mark: | Unique identifier for the manifest | -| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID the manifest is scoped to | | `Name` | `string` | :heavy_check_mark: | Name of the manifest | | `LatestVersion` | `int64` | :heavy_check_mark: | Latest version number | | `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Timestamp when the manifest was created | diff --git a/internal/deployserverclient/docs/models/operations/attachappmanifestrequest.md b/internal/deployserverclient/docs/models/operations/attachappmanifestrequest.md new file mode 100644 index 00000000..9a803bad --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/attachappmanifestrequest.md @@ -0,0 +1,9 @@ +# AttachAppManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `AttachManifestRequest` | [components.AttachManifestRequest](../../models/components/attachmanifestrequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/attachappmanifestresponse.md b/internal/deployserverclient/docs/models/operations/attachappmanifestresponse.md new file mode 100644 index 00000000..58ad5c5b --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/attachappmanifestresponse.md @@ -0,0 +1,9 @@ +# AttachAppManifestResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | manifestId missing or empty | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md b/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md deleted file mode 100644 index c91702f1..00000000 --- a/internal/deployserverclient/docs/models/operations/createdeploymentrawrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# CreateDeploymentRawRequest - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| `AppID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | -| `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md b/internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md deleted file mode 100644 index 5a5384b3..00000000 --- a/internal/deployserverclient/docs/models/operations/createdeploymentrawresponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# CreateDeploymentRawResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `DeploymentResponse` | [*components.DeploymentResponse](../../models/components/deploymentresponse.md) | :heavy_minus_sign: | Deployment created successfully | -| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md b/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md deleted file mode 100644 index 9b672d38..00000000 --- a/internal/deployserverclient/docs/models/operations/createdeploymentrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# CreateDeploymentRequest - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `AppID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | -| `CreateDeploymentRequest` | [components.CreateDeploymentRequest](../../models/components/createdeploymentrequest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md b/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md index 878fcaf0..dc7c3123 100644 --- a/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md +++ b/internal/deployserverclient/docs/models/operations/createmanifestrawrequest.md @@ -3,8 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `Name` | `string` | :heavy_check_mark: | Name for the manifest | -| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | -| `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | +| `Name` | `string` | :heavy_check_mark: | Name for the manifest | +| `RequestBody` | `any` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/createmanifestrequest.md b/internal/deployserverclient/docs/models/operations/createmanifestrequest.md index fc43bc11..319e78b7 100644 --- a/internal/deployserverclient/docs/models/operations/createmanifestrequest.md +++ b/internal/deployserverclient/docs/models/operations/createmanifestrequest.md @@ -6,5 +6,4 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `Name` | `string` | :heavy_check_mark: | Name for the manifest | -| `AppID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | | `RequestBody` | [operations.CreateManifestRequestBody](../../models/operations/createmanifestrequestbody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/detachappmanifestrequest.md b/internal/deployserverclient/docs/models/operations/detachappmanifestrequest.md new file mode 100644 index 00000000..d11d0dba --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/detachappmanifestrequest.md @@ -0,0 +1,8 @@ +# DetachAppManifestRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/detachappmanifestresponse.md b/internal/deployserverclient/docs/models/operations/detachappmanifestresponse.md new file mode 100644 index 00000000..fbbd1f5a --- /dev/null +++ b/internal/deployserverclient/docs/models/operations/detachappmanifestresponse.md @@ -0,0 +1,9 @@ +# DetachAppManifestResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md index ada5ef33..1c953fe5 100644 --- a/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md @@ -3,8 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `AppID` | `*string` | :heavy_minus_sign: | Filter manifests by app ID (includes org-wide manifests as fallback) | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/sdks/deployserver/README.md b/internal/deployserverclient/docs/sdks/deployserver/README.md index c1f3a074..5c60de63 100644 --- a/internal/deployserverclient/docs/sdks/deployserver/README.md +++ b/internal/deployserverclient/docs/sdks/deployserver/README.md @@ -9,6 +9,8 @@ * [UpdateApp](#updateapp) - Update an app * [ReadApp](#readapp) - read app details * [DeleteApp](#deleteapp) - Delete an app +* [AttachAppManifest](#attachappmanifest) - Bind an app to a manifest +* [DetachAppManifest](#detachappmanifest) - Unbind an app from its manifest * [ReadAppVariables](#readappvariables) - Get all variables of an app * [CreateAppVariable](#createappvariable) - Create variable for an app * [DeleteAppVariable](#deleteappvariable) - Delete a variable from an app @@ -23,7 +25,6 @@ * [ListManifestVersions](#listmanifestversions) - List versions of a manifest * [ReadManifestVersion](#readmanifestversion) - Get a specific manifest version with content * [CreateDeployment](#createdeployment) - Create a deployment (triggers a run) -* [CreateDeploymentRaw](#createdeploymentraw) - Create a deployment (triggers a run) * [ListDeployments](#listdeployments) - List deployments * [ReadDeployment](#readdeployment) - Get a single deployment * [ReadDeploymentLogs](#readdeploymentlogs) - Get run logs for a deployment @@ -292,6 +293,111 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | +## AttachAppManifest + +Updates the app's `manifest_id` pointer. Idempotent — re-binding to the +same id is a no-op; rebinding to a different id moves the pointer. + + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.AttachAppManifest(ctx, "", components.AttachManifestRequest{ + ManifestID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Error != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `attachManifestRequest` | [components.AttachManifestRequest](../../models/components/attachmanifestrequest.md) | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.AttachAppManifestResponse](../../models/operations/attachappmanifestresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.Error | 400, 404 | application/json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## DetachAppManifest + +Clears the app's `manifest_id` pointer. Idempotent. + +### Example Usage + + +```go +package main + +import( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New() + + res, err := s.DetachAppManifest(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.Error != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.DetachAppManifestResponse](../../models/operations/detachappmanifestresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| apierrors.APIError | 4XX, 5XX | \*/\* | + ## ReadAppVariables Get all variables of an app @@ -477,7 +583,7 @@ func main() { panic(fileErr) } - res, err := s.CreateManifestRaw(ctx, "", example, nil) + res, err := s.CreateManifestRaw(ctx, "", example) if err != nil { log.Fatal(err) } @@ -494,7 +600,6 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `name` | `string` | :heavy_check_mark: | Name for the manifest | | `requestBody` | `any` | :heavy_check_mark: | N/A | -| `appID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -529,7 +634,7 @@ func main() { s := deployserverclient.New() - res, err := s.CreateManifest(ctx, "", operations.CreateManifestRequestBody{}, nil) + res, err := s.CreateManifest(ctx, "", operations.CreateManifestRequestBody{}) if err != nil { log.Fatal(err) } @@ -546,7 +651,6 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `name` | `string` | :heavy_check_mark: | Name for the manifest | | `requestBody` | [operations.CreateManifestRequestBody](../../models/operations/createmanifestrequestbody.md) | :heavy_check_mark: | N/A | -| `appID` | `*string` | :heavy_minus_sign: | Optional app ID to scope the manifest to a specific app | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -580,7 +684,7 @@ func main() { s := deployserverclient.New() - res, err := s.ListManifests(ctx, nil, nil, nil) + res, err := s.ListManifests(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -592,13 +696,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `appID` | `*string` | :heavy_minus_sign: | Filter manifests by app ID (includes org-wide manifests as fallback) | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -995,7 +1098,9 @@ func main() { res, err := s.CreateDeployment(ctx, components.CreateDeploymentRequest{ AppID: "", - }, nil) + ManifestID: "", + ManifestVersion: 5649, + }) if err != nil { log.Fatal(err) } @@ -1010,8 +1115,7 @@ func main() { | Parameter | Type | Required | Description | | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `createDeploymentRequest` | [components.CreateDeploymentRequest](../../models/components/createdeploymentrequest.md) | :heavy_check_mark: | N/A | -| `appID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | +| `request` | [components.CreateDeploymentRequest](../../models/components/createdeploymentrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -1024,57 +1128,6 @@ func main() { | ------------------ | ------------------ | ------------------ | | apierrors.APIError | 4XX, 5XX | \*/\* | -## CreateDeploymentRaw - -Create a deployment (triggers a run) - -### Example Usage - - -```go -package main - -import( - "context" - deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" - "bytes" - "log" -) - -func main() { - ctx := context.Background() - - s := deployserverclient.New() - - res, err := s.CreateDeploymentRaw(ctx, bytes.NewBuffer([]byte("{\"appId\":\"\"}")), nil) - if err != nil { - log.Fatal(err) - } - if res.DeploymentResponse != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `requestBody` | `any` | :heavy_check_mark: | N/A | -| `appID` | `*string` | :heavy_minus_sign: | App ID (required for inline YAML deploys) | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - -### Response - -**[*operations.CreateDeploymentRawResponse](../../models/operations/createdeploymentrawresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| apierrors.APIError | 4XX, 5XX | \*/\* | - ## ListDeployments List deployments diff --git a/internal/deployserverclient/models/components/app.go b/internal/deployserverclient/models/components/app.go index 5a865c0c..c56bdf01 100644 --- a/internal/deployserverclient/models/components/app.go +++ b/internal/deployserverclient/models/components/app.go @@ -10,7 +10,14 @@ type App struct { Name string `json:"name"` // Optional existing stack ID claimed by this app StackID *string `json:"stackId,omitempty"` - State *State `json:"state,omitempty"` + // Stack region ID (set when the app's stack lives in a specific region) + StackRegionID *string `json:"stackRegionId,omitempty"` + State *State `json:"state,omitempty"` + // The manifest the app is currently bound to (apps.manifest_id), with + // catalog metadata and divergence vs the most recent applied deployment. + // Populated by GET /apps/{id} when a manifest is bound. + // + CurrentManifest *AppCurrentManifest `json:"currentManifest,omitempty"` } func (a *App) GetID() string { @@ -34,9 +41,23 @@ func (a *App) GetStackID() *string { return a.StackID } +func (a *App) GetStackRegionID() *string { + if a == nil { + return nil + } + return a.StackRegionID +} + func (a *App) GetState() *State { if a == nil { return nil } return a.State } + +func (a *App) GetCurrentManifest() *AppCurrentManifest { + if a == nil { + return nil + } + return a.CurrentManifest +} diff --git a/internal/deployserverclient/models/components/appcurrentmanifest.go b/internal/deployserverclient/models/components/appcurrentmanifest.go new file mode 100644 index 00000000..e7de2cd9 --- /dev/null +++ b/internal/deployserverclient/models/components/appcurrentmanifest.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 196f8c8444aa + +package components + +// AppCurrentManifest - The manifest the app is currently bound to (apps.manifest_id), with +// catalog metadata and divergence vs the most recent applied deployment. +// Populated by GET /apps/{id} when a manifest is bound. +type AppCurrentManifest struct { + // ID of the manifest the app is bound to + ID string `json:"id"` + // Name of the bound manifest + Name string `json:"name"` + // Latest version available in the manifest's lineage + LatestVersion int64 `json:"latestVersion"` + // Relationship between the app's bound manifest and what's currently + // deployed (last `applied` deployment, ignoring destroys). + // + Divergence *AppManifestDivergence `json:"divergence,omitempty"` +} + +func (a *AppCurrentManifest) GetID() string { + if a == nil { + return "" + } + return a.ID +} + +func (a *AppCurrentManifest) GetName() string { + if a == nil { + return "" + } + return a.Name +} + +func (a *AppCurrentManifest) GetLatestVersion() int64 { + if a == nil { + return 0 + } + return a.LatestVersion +} + +func (a *AppCurrentManifest) GetDivergence() *AppManifestDivergence { + if a == nil { + return nil + } + return a.Divergence +} diff --git a/internal/deployserverclient/models/components/appmanifestdivergence.go b/internal/deployserverclient/models/components/appmanifestdivergence.go new file mode 100644 index 00000000..c9e0e722 --- /dev/null +++ b/internal/deployserverclient/models/components/appmanifestdivergence.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 9210c43db58e + +package components + +import ( + "encoding/json" + "fmt" +) + +// Kind - - `undeployed`: the app has a manifest bound but no successful deployment yet. +// - `synced`: deployed (manifestId, version) matches the bound manifest's latest version. +// - `behind`: deployed manifest matches the bound manifest but on an older version. +// - `rebound`: the app was rebound; deployed manifest is a different manifest. +type Kind string + +const ( + KindUndeployed Kind = "undeployed" + KindSynced Kind = "synced" + KindBehind Kind = "behind" + KindRebound Kind = "rebound" +) + +func (e Kind) ToPointer() *Kind { + return &e +} +func (e *Kind) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "undeployed": + fallthrough + case "synced": + fallthrough + case "behind": + fallthrough + case "rebound": + *e = Kind(v) + return nil + default: + return fmt.Errorf("invalid value for Kind: %v", v) + } +} + +// AppManifestDivergence - Relationship between the app's bound manifest and what's currently +// deployed (last `applied` deployment, ignoring destroys). +type AppManifestDivergence struct { + // - `undeployed`: the app has a manifest bound but no successful deployment yet. + // - `synced`: deployed (manifestId, version) matches the bound manifest's latest version. + // - `behind`: deployed manifest matches the bound manifest but on an older version. + // - `rebound`: the app was rebound; deployed manifest is a different manifest. + // + Kind Kind `json:"kind"` + // ID of the manifest reflected in the most recent applied deployment + DeployedManifestID *string `json:"deployedManifestId,omitempty"` + // Version reflected in the most recent applied deployment + DeployedVersion *int64 `json:"deployedVersion,omitempty"` + // Latest version available in the bound manifest's lineage + LatestVersion int64 `json:"latestVersion"` +} + +func (a *AppManifestDivergence) GetKind() Kind { + if a == nil { + return Kind("") + } + return a.Kind +} + +func (a *AppManifestDivergence) GetDeployedManifestID() *string { + if a == nil { + return nil + } + return a.DeployedManifestID +} + +func (a *AppManifestDivergence) GetDeployedVersion() *int64 { + if a == nil { + return nil + } + return a.DeployedVersion +} + +func (a *AppManifestDivergence) GetLatestVersion() int64 { + if a == nil { + return 0 + } + return a.LatestVersion +} diff --git a/internal/deployserverclient/models/components/attachmanifestrequest.go b/internal/deployserverclient/models/components/attachmanifestrequest.go new file mode 100644 index 00000000..5cab118b --- /dev/null +++ b/internal/deployserverclient/models/components/attachmanifestrequest.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: b536df2de3fc + +package components + +type AttachManifestRequest struct { + // ID of the manifest to bind to the app + ManifestID string `json:"manifestId"` +} + +func (a *AttachManifestRequest) GetManifestID() string { + if a == nil { + return "" + } + return a.ManifestID +} diff --git a/internal/deployserverclient/models/components/createdeploymentrequest.go b/internal/deployserverclient/models/components/createdeploymentrequest.go index 37a6dcb6..9b4eaf86 100644 --- a/internal/deployserverclient/models/components/createdeploymentrequest.go +++ b/internal/deployserverclient/models/components/createdeploymentrequest.go @@ -6,10 +6,10 @@ package components type CreateDeploymentRequest struct { // ID of the app to deploy to AppID string `json:"appId"` - // Manifest catalog ID (for manifest-reference mode) - ManifestID *string `json:"manifestId,omitempty"` - // Manifest version (for manifest-reference mode) - ManifestVersion *int64 `json:"manifestVersion,omitempty"` + // Manifest catalog ID + ManifestID string `json:"manifestId"` + // Manifest version + ManifestVersion int64 `json:"manifestVersion"` } func (c *CreateDeploymentRequest) GetAppID() string { @@ -19,16 +19,16 @@ func (c *CreateDeploymentRequest) GetAppID() string { return c.AppID } -func (c *CreateDeploymentRequest) GetManifestID() *string { +func (c *CreateDeploymentRequest) GetManifestID() string { if c == nil { - return nil + return "" } return c.ManifestID } -func (c *CreateDeploymentRequest) GetManifestVersion() *int64 { +func (c *CreateDeploymentRequest) GetManifestVersion() int64 { if c == nil { - return nil + return 0 } return c.ManifestVersion } diff --git a/internal/deployserverclient/models/components/createmanifestresponse.go b/internal/deployserverclient/models/components/createmanifestresponse.go index 4532b178..921bf611 100644 --- a/internal/deployserverclient/models/components/createmanifestresponse.go +++ b/internal/deployserverclient/models/components/createmanifestresponse.go @@ -10,7 +10,6 @@ import ( type CreateManifestResponseData struct { ID string `json:"id"` - AppID *string `json:"appId,omitempty"` Version int64 `json:"version"` Name string `json:"name"` CreatedAt time.Time `json:"createdAt"` @@ -34,13 +33,6 @@ func (c *CreateManifestResponseData) GetID() string { return c.ID } -func (c *CreateManifestResponseData) GetAppID() *string { - if c == nil { - return nil - } - return c.AppID -} - func (c *CreateManifestResponseData) GetVersion() int64 { if c == nil { return 0 diff --git a/internal/deployserverclient/models/components/manifest.go b/internal/deployserverclient/models/components/manifest.go index c9cfb7da..5057e763 100644 --- a/internal/deployserverclient/models/components/manifest.go +++ b/internal/deployserverclient/models/components/manifest.go @@ -11,8 +11,6 @@ import ( type Manifest struct { // Unique identifier for the manifest ID string `json:"id"` - // Optional app ID the manifest is scoped to - AppID *string `json:"appId,omitempty"` // Name of the manifest Name string `json:"name"` // Latest version number @@ -41,13 +39,6 @@ func (m *Manifest) GetID() string { return m.ID } -func (m *Manifest) GetAppID() *string { - if m == nil { - return nil - } - return m.AppID -} - func (m *Manifest) GetName() string { if m == nil { return "" diff --git a/internal/deployserverclient/models/operations/attachappmanifest.go b/internal/deployserverclient/models/operations/attachappmanifest.go new file mode 100644 index 00000000..5833ba6a --- /dev/null +++ b/internal/deployserverclient/models/operations/attachappmanifest.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 857d985e78ef + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type AttachAppManifestRequest struct { + ID string `pathParam:"style=simple,explode=false,name=id"` + AttachManifestRequest components.AttachManifestRequest `request:"mediaType=application/json"` +} + +func (a *AttachAppManifestRequest) GetID() string { + if a == nil { + return "" + } + return a.ID +} + +func (a *AttachAppManifestRequest) GetAttachManifestRequest() components.AttachManifestRequest { + if a == nil { + return components.AttachManifestRequest{} + } + return a.AttachManifestRequest +} + +type AttachAppManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // manifestId missing or empty + Error *components.Error +} + +func (a *AttachAppManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if a == nil { + return components.HTTPMetadata{} + } + return a.HTTPMeta +} + +func (a *AttachAppManifestResponse) GetError() *components.Error { + if a == nil { + return nil + } + return a.Error +} diff --git a/internal/deployserverclient/models/operations/createdeployment.go b/internal/deployserverclient/models/operations/createdeployment.go index 65b97e92..03c8cee8 100644 --- a/internal/deployserverclient/models/operations/createdeployment.go +++ b/internal/deployserverclient/models/operations/createdeployment.go @@ -7,26 +7,6 @@ import ( "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" ) -type CreateDeploymentRequest struct { - // App ID (required for inline YAML deploys) - AppID *string `queryParam:"style=form,explode=true,name=appId"` - CreateDeploymentRequest components.CreateDeploymentRequest `request:"mediaType=application/json"` -} - -func (c *CreateDeploymentRequest) GetAppID() *string { - if c == nil { - return nil - } - return c.AppID -} - -func (c *CreateDeploymentRequest) GetCreateDeploymentRequest() components.CreateDeploymentRequest { - if c == nil { - return components.CreateDeploymentRequest{} - } - return c.CreateDeploymentRequest -} - type CreateDeploymentResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Deployment created successfully diff --git a/internal/deployserverclient/models/operations/createdeploymentraw.go b/internal/deployserverclient/models/operations/createdeploymentraw.go deleted file mode 100644 index a6896a51..00000000 --- a/internal/deployserverclient/models/operations/createdeploymentraw.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. -// @generated-id: 413206fce47e - -package operations - -import ( - "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" -) - -type CreateDeploymentRawRequest struct { - // App ID (required for inline YAML deploys) - AppID *string `queryParam:"style=form,explode=true,name=appId"` - // This field accepts []byte data or io.Reader implementations, such as *os.File. - RequestBody any `request:"mediaType=application/yaml"` -} - -func (c *CreateDeploymentRawRequest) GetAppID() *string { - if c == nil { - return nil - } - return c.AppID -} - -func (c *CreateDeploymentRawRequest) GetRequestBody() any { - if c == nil { - return nil - } - return c.RequestBody -} - -type CreateDeploymentRawResponse struct { - HTTPMeta components.HTTPMetadata `json:"-"` - // Deployment created successfully - DeploymentResponse *components.DeploymentResponse - // Error - Error *components.Error -} - -func (c *CreateDeploymentRawResponse) GetHTTPMeta() components.HTTPMetadata { - if c == nil { - return components.HTTPMetadata{} - } - return c.HTTPMeta -} - -func (c *CreateDeploymentRawResponse) GetDeploymentResponse() *components.DeploymentResponse { - if c == nil { - return nil - } - return c.DeploymentResponse -} - -func (c *CreateDeploymentRawResponse) GetError() *components.Error { - if c == nil { - return nil - } - return c.Error -} diff --git a/internal/deployserverclient/models/operations/createmanifest.go b/internal/deployserverclient/models/operations/createmanifest.go index 99920019..8640b852 100644 --- a/internal/deployserverclient/models/operations/createmanifest.go +++ b/internal/deployserverclient/models/operations/createmanifest.go @@ -13,9 +13,7 @@ type CreateManifestRequestBody struct { type CreateManifestRequest struct { // Name for the manifest - Name string `queryParam:"style=form,explode=true,name=name"` - // Optional app ID to scope the manifest to a specific app - AppID *string `queryParam:"style=form,explode=true,name=appId"` + Name string `queryParam:"style=form,explode=true,name=name"` RequestBody CreateManifestRequestBody `request:"mediaType=application/json"` } @@ -26,13 +24,6 @@ func (c *CreateManifestRequest) GetName() string { return c.Name } -func (c *CreateManifestRequest) GetAppID() *string { - if c == nil { - return nil - } - return c.AppID -} - func (c *CreateManifestRequest) GetRequestBody() CreateManifestRequestBody { if c == nil { return CreateManifestRequestBody{} diff --git a/internal/deployserverclient/models/operations/createmanifestraw.go b/internal/deployserverclient/models/operations/createmanifestraw.go index 71aeab2d..8aad3fd7 100644 --- a/internal/deployserverclient/models/operations/createmanifestraw.go +++ b/internal/deployserverclient/models/operations/createmanifestraw.go @@ -10,8 +10,6 @@ import ( type CreateManifestRawRequest struct { // Name for the manifest Name string `queryParam:"style=form,explode=true,name=name"` - // Optional app ID to scope the manifest to a specific app - AppID *string `queryParam:"style=form,explode=true,name=appId"` // This field accepts []byte data or io.Reader implementations, such as *os.File. RequestBody any `request:"mediaType=application/yaml"` } @@ -23,13 +21,6 @@ func (c *CreateManifestRawRequest) GetName() string { return c.Name } -func (c *CreateManifestRawRequest) GetAppID() *string { - if c == nil { - return nil - } - return c.AppID -} - func (c *CreateManifestRawRequest) GetRequestBody() any { if c == nil { return nil diff --git a/internal/deployserverclient/models/operations/detachappmanifest.go b/internal/deployserverclient/models/operations/detachappmanifest.go new file mode 100644 index 00000000..dfa94ca5 --- /dev/null +++ b/internal/deployserverclient/models/operations/detachappmanifest.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: 3b7d438b6e4b + +package operations + +import ( + "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" +) + +type DetachAppManifestRequest struct { + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (d *DetachAppManifestRequest) GetID() string { + if d == nil { + return "" + } + return d.ID +} + +type DetachAppManifestResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Error + Error *components.Error +} + +func (d *DetachAppManifestResponse) GetHTTPMeta() components.HTTPMetadata { + if d == nil { + return components.HTTPMetadata{} + } + return d.HTTPMeta +} + +func (d *DetachAppManifestResponse) GetError() *components.Error { + if d == nil { + return nil + } + return d.Error +} diff --git a/internal/deployserverclient/models/operations/listmanifests.go b/internal/deployserverclient/models/operations/listmanifests.go index 6d1c50e7..7200ea57 100644 --- a/internal/deployserverclient/models/operations/listmanifests.go +++ b/internal/deployserverclient/models/operations/listmanifests.go @@ -10,8 +10,6 @@ import ( type ListManifestsRequest struct { PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` - // Filter manifests by app ID (includes org-wide manifests as fallback) - AppID *string `queryParam:"style=form,explode=true,name=appId"` } func (l *ListManifestsRequest) GetPageNumber() *int64 { @@ -28,13 +26,6 @@ func (l *ListManifestsRequest) GetPageSize() *int64 { return l.PageSize } -func (l *ListManifestsRequest) GetAppID() *string { - if l == nil { - return nil - } - return l.AppID -} - type ListManifestsResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Manifests retrieved successfully diff --git a/openapi/deployserver.yaml b/openapi/deployserver.yaml index 62894f67..b7c1ba2a 100644 --- a/openapi/deployserver.yaml +++ b/openapi/deployserver.yaml @@ -2,11 +2,11 @@ openapi: 3.1.0 info: title: Terraform HCP Proxy API contact: {} - version: 0.1.0 + version: "0.1.0" servers: - url: https://deploy.formance.cloud description: Production server -- url: https://deploy.staging.formance.cloud +- url: https://deploy-server.staging.formance.cloud description: Staging server - url: http://localhost:8080 description: Local server @@ -25,18 +25,18 @@ paths: schema: type: integer responses: - '200': + "200": description: Apps retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ListAppsResponse' + $ref: "#/components/schemas/ListAppsResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" post: summary: Create a new app operationId: createApp @@ -45,20 +45,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CreateAppRequest' + $ref: "#/components/schemas/CreateAppRequest" responses: - '201': + "201": description: App created successfully content: application/json: schema: - $ref: '#/components/schemas/AppResponse' + $ref: "#/components/schemas/AppResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /apps/{id}: put: summary: Update an app @@ -74,16 +74,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdateAppRequest' + $ref: "#/components/schemas/UpdateAppRequest" responses: - '204': + "204": description: App updated successfully default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" get: summary: read app details operationId: readApp @@ -106,18 +106,18 @@ paths: enum: - state responses: - '200': + "200": description: App details retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/AppResponse' + $ref: "#/components/schemas/AppResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" delete: summary: Delete an app description: | @@ -147,7 +147,7 @@ paths: type: boolean default: false responses: - '202': + "202": description: | Soft-delete accepted. Cleanup runs asynchronously. The `Location` header points at the destroy deployment if one was @@ -155,8 +155,8 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DeleteAppResponse' - '204': + $ref: "#/components/schemas/DeleteAppResponse" + "204": description: | Returned when `wait=true` and the destroy reached a terminal status successfully (or when no destroy was needed at all). @@ -165,7 +165,66 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" + /apps/{id}/manifest: + put: + summary: Bind an app to a manifest + operationId: attachAppManifest + description: | + Updates the app's `manifest_id` pointer. Idempotent — re-binding to the + same id is a no-op; rebinding to a different id moves the pointer. + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AttachManifestRequest" + responses: + "204": + description: App bound to manifest + "400": + description: manifestId missing or empty + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + "404": + description: Manifest not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + delete: + summary: Unbind an app from its manifest + operationId: detachAppManifest + description: Clears the app's `manifest_id` pointer. Idempotent. + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "204": + description: App unbound from manifest + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" /apps/{id}/variables: get: summary: Get all variables of an app @@ -185,18 +244,18 @@ paths: schema: type: integer responses: - '200': + "200": description: App variables retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ReadVariablesResponse' + $ref: "#/components/schemas/ReadVariablesResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" post: summary: Create variable for an app operationId: createAppVariable @@ -211,20 +270,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CreateVariableRequest' + $ref: "#/components/schemas/CreateVariableRequest" responses: - '201': + "201": description: Variable created successfully content: application/json: schema: - $ref: '#/components/schemas/CreateVariableResponse' + $ref: "#/components/schemas/CreateVariableResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /apps/{id}/variables/{variableId}: delete: summary: Delete a variable from an app @@ -241,14 +300,14 @@ paths: schema: type: string responses: - '204': + "204": description: Variable deleted successfully default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /manifests: post: summary: Create a new manifest @@ -260,12 +319,6 @@ paths: schema: type: string description: Name for the manifest - - name: appId - in: query - required: false - schema: - type: string - description: Optional app ID to scope the manifest to a specific app requestBody: required: true content: @@ -279,18 +332,18 @@ paths: type: object description: JSON manifest content responses: - '201': + "201": description: Manifest created successfully content: application/json: schema: - $ref: '#/components/schemas/CreateManifestResponse' + $ref: "#/components/schemas/CreateManifestResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" get: summary: List manifests in the organization operationId: listManifests @@ -303,25 +356,19 @@ paths: in: query schema: type: integer - - name: appId - in: query - required: false - schema: - type: string - description: Filter manifests by app ID (includes org-wide manifests as fallback) responses: - '200': + "200": description: Manifests retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ListManifestsResponse' + $ref: "#/components/schemas/ListManifestsResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /manifests/{manifestId}: get: summary: Read a manifest @@ -339,12 +386,12 @@ paths: type: string description: Comma-separated includes (e.g. "latest" to embed latest version content) responses: - '200': + "200": description: Manifest retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ManifestResponse' + $ref: "#/components/schemas/ManifestResponse" application/gzip: schema: type: string @@ -355,7 +402,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" patch: summary: Update manifest metadata operationId: updateManifest @@ -370,20 +417,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdateManifestRequest' + $ref: "#/components/schemas/UpdateManifestRequest" responses: - '200': + "200": description: Manifest updated successfully content: application/json: schema: - $ref: '#/components/schemas/ManifestResponse' + $ref: "#/components/schemas/ManifestResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" delete: summary: Delete a manifest and all its versions operationId: deleteManifest @@ -394,20 +441,20 @@ paths: schema: type: string responses: - '204': + "204": description: Manifest deleted successfully - '409': + "409": description: Manifest is still referenced by deployments content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /manifests/{manifestId}/versions: post: summary: Push a new version of a manifest @@ -431,18 +478,18 @@ paths: type: object description: JSON manifest content responses: - '201': + "201": description: Manifest version created successfully content: application/json: schema: - $ref: '#/components/schemas/ManifestVersionResponse' + $ref: "#/components/schemas/ManifestVersionResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" get: summary: List versions of a manifest operationId: listManifestVersions @@ -461,18 +508,18 @@ paths: schema: type: integer responses: - '200': + "200": description: Manifest versions retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ListManifestVersionsResponse' + $ref: "#/components/schemas/ListManifestVersionsResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /manifests/{manifestId}/versions/{version}: get: summary: Get a specific manifest version with content @@ -502,12 +549,12 @@ paths: - application/json - application/x-yaml responses: - '200': + "200": description: Manifest version retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ManifestVersionResponse' + $ref: "#/components/schemas/ManifestVersionResponse" application/x-yaml: schema: type: string @@ -518,46 +565,30 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /deployments: post: summary: Create a deployment (triggers a run) operationId: createDeployment - parameters: - - name: appId - in: query - description: App ID (required for inline YAML deploys) - schema: - type: string requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/CreateDeploymentRequest' - application/x-yaml: - schema: - type: string - format: binary - description: Inline YAML manifest content (see Application schema) - application/yaml: - schema: - type: string - format: binary - description: Inline YAML manifest content (see Application schema) + $ref: "#/components/schemas/CreateDeploymentRequest" responses: - '201': + "201": description: Deployment created successfully content: application/json: schema: - $ref: '#/components/schemas/DeploymentResponse' + $ref: "#/components/schemas/DeploymentResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" get: summary: List deployments operationId: listDeployments @@ -575,18 +606,18 @@ paths: schema: type: integer responses: - '200': + "200": description: Deployments retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ListDeploymentsResponse' + $ref: "#/components/schemas/ListDeploymentsResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /deployments/{deploymentId}: get: summary: Get a single deployment @@ -624,12 +655,12 @@ paths: enum: - state responses: - '200': + "200": description: Deployment retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/DeploymentResponse' + $ref: "#/components/schemas/DeploymentResponse" application/gzip: schema: type: string @@ -645,7 +676,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" /deployments/{deploymentId}/logs: get: summary: Get run logs for a deployment @@ -657,22 +688,22 @@ paths: schema: type: string responses: - '200': + "200": description: Deployment logs retrieved successfully content: application/json: schema: - $ref: '#/components/schemas/ReadLogsResponse' + $ref: "#/components/schemas/ReadLogsResponse" default: description: Error content: application/json: schema: - $ref: '#/components/schemas/Error' + $ref: "#/components/schemas/Error" components: schemas: Application: - $ref: '#/components/schemas/application' + $ref: "./schemas/application.json" State: type: object required: @@ -707,7 +738,7 @@ components: data: type: array items: - $ref: '#/components/schemas/Log' + $ref: "#/components/schemas/Log" Log: type: object required: @@ -766,7 +797,7 @@ components: properties: data: allOf: - - $ref: '#/components/schemas/PaginationResponse' + - $ref: "#/components/schemas/PaginationResponse" - type: object required: - items @@ -774,14 +805,14 @@ components: items: type: array items: - $ref: '#/components/schemas/App' + $ref: "#/components/schemas/App" AppResponse: type: object required: - data properties: data: - $ref: '#/components/schemas/App' + $ref: "#/components/schemas/App" App: type: object required: @@ -797,8 +828,73 @@ components: stackId: type: string description: Optional existing stack ID claimed by this app + stackRegionId: + type: string + description: Stack region ID (set when the app's stack lives in a specific region) state: - $ref: '#/components/schemas/State' + $ref: "#/components/schemas/State" + currentManifest: + $ref: "#/components/schemas/AppCurrentManifest" + AppCurrentManifest: + type: object + description: | + The manifest the app is currently bound to (apps.manifest_id), with + catalog metadata and divergence vs the most recent applied deployment. + Populated by GET /apps/{id} when a manifest is bound. + required: + - id + - name + - latestVersion + properties: + id: + type: string + description: ID of the manifest the app is bound to + name: + type: string + description: Name of the bound manifest + latestVersion: + type: integer + description: Latest version available in the manifest's lineage + divergence: + $ref: "#/components/schemas/AppManifestDivergence" + AppManifestDivergence: + type: object + description: | + Relationship between the app's bound manifest and what's currently + deployed (last `applied` deployment, ignoring destroys). + required: + - kind + - latestVersion + properties: + kind: + type: string + enum: + - undeployed + - synced + - behind + - rebound + description: | + - `undeployed`: the app has a manifest bound but no successful deployment yet. + - `synced`: deployed (manifestId, version) matches the bound manifest's latest version. + - `behind`: deployed manifest matches the bound manifest but on an older version. + - `rebound`: the app was rebound; deployed manifest is a different manifest. + deployedManifestId: + type: string + description: ID of the manifest reflected in the most recent applied deployment + deployedVersion: + type: integer + description: Version reflected in the most recent applied deployment + latestVersion: + type: integer + description: Latest version available in the bound manifest's lineage + AttachManifestRequest: + type: object + required: + - manifestId + properties: + manifestId: + type: string + description: ID of the manifest to bind to the app CreateAppRequest: type: object required: @@ -830,22 +926,22 @@ components: items: type: array items: - $ref: '#/components/schemas/Variable' - - $ref: '#/components/schemas/PaginationResponse' + $ref: "#/components/schemas/Variable" + - $ref: "#/components/schemas/PaginationResponse" CreateVariableRequest: type: object required: - variable properties: variable: - $ref: '#/components/schemas/VariableData' + $ref: "#/components/schemas/VariableData" CreateVariableResponse: type: object required: - data properties: data: - $ref: '#/components/schemas/Variable' + $ref: "#/components/schemas/Variable" VariableData: type: object required: @@ -867,7 +963,7 @@ components: description: Whether the variable is sensitive Variable: allOf: - - $ref: '#/components/schemas/VariableData' + - $ref: "#/components/schemas/VariableData" - type: object required: - id @@ -887,9 +983,6 @@ components: id: type: string description: Unique identifier for the manifest - appId: - type: string - description: Optional app ID the manifest is scoped to name: type: string description: Name of the manifest @@ -940,8 +1033,6 @@ components: properties: id: type: string - appId: - type: string version: type: integer name: @@ -955,14 +1046,14 @@ components: - data properties: data: - $ref: '#/components/schemas/Manifest' + $ref: "#/components/schemas/Manifest" ManifestVersionResponse: type: object required: - data properties: data: - $ref: '#/components/schemas/ManifestVersion' + $ref: "#/components/schemas/ManifestVersion" ListManifestsResponse: type: object required: @@ -970,7 +1061,7 @@ components: properties: data: allOf: - - $ref: '#/components/schemas/PaginationResponse' + - $ref: "#/components/schemas/PaginationResponse" - type: object required: - items @@ -978,7 +1069,7 @@ components: items: type: array items: - $ref: '#/components/schemas/Manifest' + $ref: "#/components/schemas/Manifest" ListManifestVersionsResponse: type: object required: @@ -986,7 +1077,7 @@ components: properties: data: allOf: - - $ref: '#/components/schemas/PaginationResponse' + - $ref: "#/components/schemas/PaginationResponse" - type: object required: - items @@ -994,7 +1085,7 @@ components: items: type: array items: - $ref: '#/components/schemas/ManifestVersion' + $ref: "#/components/schemas/ManifestVersion" DeploymentResource: type: object required: @@ -1021,28 +1112,30 @@ components: type: string format: date-time state: - $ref: '#/components/schemas/State' + $ref: "#/components/schemas/State" CreateDeploymentRequest: type: object required: - appId + - manifestId + - manifestVersion properties: appId: type: string description: ID of the app to deploy to manifestId: type: string - description: Manifest catalog ID (for manifest-reference mode) + description: Manifest catalog ID manifestVersion: type: integer - description: Manifest version (for manifest-reference mode) + description: Manifest version DeploymentResponse: type: object required: - data properties: data: - $ref: '#/components/schemas/DeploymentResource' + $ref: "#/components/schemas/DeploymentResource" ListDeploymentsResponse: type: object required: @@ -1050,7 +1143,7 @@ components: properties: data: allOf: - - $ref: '#/components/schemas/PaginationResponse' + - $ref: "#/components/schemas/PaginationResponse" - type: object required: - items @@ -1058,7 +1151,7 @@ components: items: type: array items: - $ref: '#/components/schemas/DeploymentResource' + $ref: "#/components/schemas/DeploymentResource" UpdateManifestRequest: type: object required: @@ -1076,450 +1169,3 @@ components: type: string required: - errorCode - V2ChartAccountMetadata: - properties: - default: - type: - - 'null' - - string - type: object - V2ChartAccountRules: - type: object - DotSelf: - type: object - V2ChartSegment: - additionalProperties: true - properties: - .metadata: - additionalProperties: - $ref: '#/components/schemas/V2ChartAccountMetadata' - type: object - .pattern: - type: - - 'null' - - string - .rules: - $ref: '#/components/schemas/V2ChartAccountRules' - .self: - $ref: '#/components/schemas/DotSelf' - type: object - V2QueryTemplateVar: - properties: - default: {} - type: - type: string - type: object - V2QueryTemplate: - properties: - body: - additionalProperties: {} - type: object - description: - type: - - 'null' - - string - params: - additionalProperties: {} - type: object - resource: - type: - - 'null' - - string - vars: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplateVar' - type: object - type: object - V2TransactionTemplate: - properties: - description: - type: - - 'null' - - string - runtime: - type: - - 'null' - - string - script: - type: - - 'null' - - string - type: object - V2SchemaData: - properties: - chart: - additionalProperties: - $ref: '#/components/schemas/V2ChartSegment' - type: - - object - - 'null' - queries: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplate' - type: object - transactions: - additionalProperties: - $ref: '#/components/schemas/V2TransactionTemplate' - type: object - type: object - Ledger: - required: - - name - properties: - name: - type: string - schema: - additionalProperties: - $ref: '#/components/schemas/V2SchemaData' - type: - - object - - 'null' - type: object - Pool: - properties: - accountIds: - items: - type: string - type: array - query: - additionalProperties: {} - type: object - type: object - ReconciliationLedger: - required: - - name - - query - properties: - name: - type: string - query: - additionalProperties: {} - type: - - object - - 'null' - type: object - ReconciliationPolicy: - required: - - name - - ledger - - pool - properties: - ledger: - $ref: '#/components/schemas/ReconciliationLedger' - name: - type: string - pool: - type: string - type: object - RegionSelector: - properties: - id: - type: string - name: - type: string - type: object - Webhook: - required: - - name - - endpoint - properties: - endpoint: - type: string - events: - items: - type: string - type: array - name: - type: string - secret: - type: string - type: object - Ledgers: - items: - $ref: '#/components/schemas/Ledger' - type: - - 'null' - - array - Payments: - properties: - connectors: - items: - required: - - name - - provider - properties: - configuration: - additionalProperties: {} - type: object - credentials: - additionalProperties: - type: string - type: object - name: - type: string - provider: - type: string - type: object - type: array - pools: - additionalProperties: - $ref: '#/components/schemas/Pool' - type: object - type: object - Reconciliation: - properties: - policies: - items: - $ref: '#/components/schemas/ReconciliationPolicy' - type: array - type: object - Stack: - required: - - name - - region - properties: - name: - type: string - region: - $ref: '#/components/schemas/RegionSelector' - version: - type: string - type: object - Webhooks: - items: - $ref: '#/components/schemas/Webhook' - type: - - 'null' - - array - application: - $schema: http://json-schema.org/draft-04/schema - required: - - stack - definitions: - DotSelf: - type: object - Ledger: - required: - - name - properties: - name: - type: string - schema: - additionalProperties: - $ref: '#/components/schemas/V2SchemaData' - type: - - object - - 'null' - type: object - Ledgers: - items: - $ref: '#/components/schemas/Ledger' - type: - - 'null' - - array - Payments: - properties: - connectors: - items: - required: - - name - - provider - properties: - configuration: - additionalProperties: {} - type: object - credentials: - additionalProperties: - type: string - type: object - name: - type: string - provider: - type: string - type: object - type: array - pools: - additionalProperties: - $ref: '#/components/schemas/Pool' - type: object - type: object - Pool: - properties: - accountIds: - items: - type: string - type: array - query: - additionalProperties: {} - type: object - type: object - Reconciliation: - properties: - policies: - items: - $ref: '#/components/schemas/ReconciliationPolicy' - type: array - type: object - ReconciliationLedger: - required: - - name - - query - properties: - name: - type: string - query: - additionalProperties: {} - type: - - object - - 'null' - type: object - ReconciliationPolicy: - required: - - name - - ledger - - pool - properties: - ledger: - $ref: '#/components/schemas/ReconciliationLedger' - name: - type: string - pool: - type: string - type: object - RegionSelector: - properties: - id: - type: string - name: - type: string - type: object - Stack: - required: - - name - - region - properties: - name: - type: string - region: - $ref: '#/components/schemas/RegionSelector' - version: - type: string - type: object - V2ChartAccountMetadata: - properties: - default: - type: - - 'null' - - string - type: object - V2ChartAccountRules: - type: object - V2ChartSegment: - additionalProperties: true - properties: - .metadata: - additionalProperties: - $ref: '#/components/schemas/V2ChartAccountMetadata' - type: object - .pattern: - type: - - 'null' - - string - .rules: - $ref: '#/components/schemas/V2ChartAccountRules' - .self: - $ref: '#/components/schemas/DotSelf' - type: object - V2QueryTemplate: - properties: - body: - additionalProperties: {} - type: object - description: - type: - - 'null' - - string - params: - additionalProperties: {} - type: object - resource: - type: - - 'null' - - string - vars: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplateVar' - type: object - type: object - V2QueryTemplateVar: - properties: - default: {} - type: - type: string - type: object - V2SchemaData: - properties: - chart: - additionalProperties: - $ref: '#/components/schemas/V2ChartSegment' - type: - - object - - 'null' - queries: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplate' - type: object - transactions: - additionalProperties: - $ref: '#/components/schemas/V2TransactionTemplate' - type: object - type: object - V2TransactionTemplate: - properties: - description: - type: - - 'null' - - string - runtime: - type: - - 'null' - - string - script: - type: - - 'null' - - string - type: object - Webhook: - required: - - name - - endpoint - properties: - endpoint: - type: string - events: - items: - type: string - type: array - name: - type: string - secret: - type: string - type: object - Webhooks: - items: - $ref: '#/components/schemas/Webhook' - type: - - 'null' - - array - properties: - ledgers: - $ref: '#/components/schemas/Ledgers' - payments: - $ref: '#/components/schemas/Payments' - reconciliation: - $ref: '#/components/schemas/Reconciliation' - stack: - $ref: '#/components/schemas/Stack' - webhooks: - $ref: '#/components/schemas/Webhooks' - type: object diff --git a/openapi/schemas/application.json b/openapi/schemas/application.json new file mode 100644 index 00000000..23f9b078 --- /dev/null +++ b/openapi/schemas/application.json @@ -0,0 +1,350 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema", + "required": [ + "stack" + ], + "definitions": { + "DotSelf": { + "type": "object" + }, + "Ledger": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "schema": { + "additionalProperties": { + "$ref": "#/definitions/V2SchemaData" + }, + "type": [ + "object", + "null" + ] + } + }, + "type": "object" + }, + "Ledgers": { + "items": { + "$ref": "#/definitions/Ledger" + }, + "type": [ + "null", + "array" + ] + }, + "Payments": { + "properties": { + "connectors": { + "items": { + "required": [ + "name", + "provider" + ], + "properties": { + "configuration": { + "additionalProperties": {}, + "type": "object" + }, + "credentials": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "provider": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, + "pools": { + "additionalProperties": { + "$ref": "#/definitions/Pool" + }, + "type": "object" + } + }, + "type": "object" + }, + "Pool": { + "properties": { + "accountIds": { + "items": { + "type": "string" + }, + "type": "array" + }, + "query": { + "additionalProperties": {}, + "type": "object" + } + }, + "type": "object" + }, + "Reconciliation": { + "properties": { + "policies": { + "items": { + "$ref": "#/definitions/ReconciliationPolicy" + }, + "type": "array" + } + }, + "type": "object" + }, + "ReconciliationLedger": { + "required": [ + "name", + "query" + ], + "properties": { + "name": { + "type": "string" + }, + "query": { + "additionalProperties": {}, + "type": [ + "object", + "null" + ] + } + }, + "type": "object" + }, + "ReconciliationPolicy": { + "required": [ + "name", + "ledger", + "pool" + ], + "properties": { + "ledger": { + "$ref": "#/definitions/ReconciliationLedger" + }, + "name": { + "type": "string" + }, + "pool": { + "type": "string" + } + }, + "type": "object" + }, + "RegionSelector": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "Stack": { + "required": [ + "name", + "region" + ], + "properties": { + "name": { + "type": "string" + }, + "region": { + "$ref": "#/definitions/RegionSelector" + }, + "version": { + "type": "string" + } + }, + "type": "object" + }, + "V2ChartAccountMetadata": { + "properties": { + "default": { + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "V2ChartAccountRules": { + "type": "object" + }, + "V2ChartSegment": { + "additionalProperties": true, + "properties": { + ".metadata": { + "additionalProperties": { + "$ref": "#/definitions/V2ChartAccountMetadata" + }, + "type": "object" + }, + ".pattern": { + "type": [ + "null", + "string" + ] + }, + ".rules": { + "$ref": "#/definitions/V2ChartAccountRules" + }, + ".self": { + "$ref": "#/definitions/DotSelf" + } + }, + "type": "object" + }, + "V2QueryTemplate": { + "properties": { + "body": { + "additionalProperties": {}, + "type": "object" + }, + "description": { + "type": [ + "null", + "string" + ] + }, + "params": { + "additionalProperties": {}, + "type": "object" + }, + "resource": { + "type": [ + "null", + "string" + ] + }, + "vars": { + "additionalProperties": { + "$ref": "#/definitions/V2QueryTemplateVar" + }, + "type": "object" + } + }, + "type": "object" + }, + "V2QueryTemplateVar": { + "properties": { + "default": {}, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "V2SchemaData": { + "properties": { + "chart": { + "additionalProperties": { + "$ref": "#/definitions/V2ChartSegment" + }, + "type": [ + "object", + "null" + ] + }, + "queries": { + "additionalProperties": { + "$ref": "#/definitions/V2QueryTemplate" + }, + "type": "object" + }, + "transactions": { + "additionalProperties": { + "$ref": "#/definitions/V2TransactionTemplate" + }, + "type": "object" + } + }, + "type": "object" + }, + "V2TransactionTemplate": { + "properties": { + "description": { + "type": [ + "null", + "string" + ] + }, + "runtime": { + "type": [ + "null", + "string" + ] + }, + "script": { + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "Webhook": { + "required": [ + "name", + "endpoint" + ], + "properties": { + "endpoint": { + "type": "string" + }, + "events": { + "items": { + "type": "string" + }, + "type": "array" + }, + "name": { + "type": "string" + }, + "secret": { + "type": "string" + } + }, + "type": "object" + }, + "Webhooks": { + "items": { + "$ref": "#/definitions/Webhook" + }, + "type": [ + "null", + "array" + ] + } + }, + "properties": { + "ledgers": { + "$ref": "#/definitions/Ledgers" + }, + "payments": { + "$ref": "#/definitions/Payments" + }, + "reconciliation": { + "$ref": "#/definitions/Reconciliation" + }, + "stack": { + "$ref": "#/definitions/Stack" + }, + "webhooks": { + "$ref": "#/definitions/Webhooks" + } + }, + "type": "object" +} \ No newline at end of file From e717d89c048a0edf66b334d11089c7418512211c Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Mon, 11 May 2026 16:44:16 +0200 Subject: [PATCH 4/5] fix(cloud): sync deploy-server SDK with cursor pagination + simplified variables Regenerate the deploy-server SDK against the current terraform-hcp-proxy spec. List endpoints (apps, manifests, manifest-versions, deployments, variables) now return cursor-paginated envelopes (pageSize + opaque next/previous tokens) instead of the legacy page/items model, and Variable drops the per-row sensitive flag in favor of unconditional server-side redaction. Update the affected list commands to embed *ResponseCursor, swap --page (int) for --cursor (string), and walk .Data instead of .Items. Drop the dead --sensitive and --category flags from `apps variables create`. Without this, fctl silently deserialized empty list responses (the zero-value Data field), making name lookups always miss and triggering unique-constraint errors on subsequent creates. Co-Authored-By: Claude Opus 4.7 (1M context) --- cmd/cloud/apps/deployments/list.go | 17 +- cmd/cloud/apps/list.go | 23 +- cmd/cloud/apps/manifests/list.go | 17 +- cmd/cloud/apps/manifests/versions/list.go | 17 +- cmd/cloud/apps/variables/create.go | 10 +- cmd/cloud/apps/variables/list.go | 29 +- .../deployserverclient/.speakeasy/gen.lock | 186 +-- .../deployserverclient/.speakeasy/gen.yaml | 2 +- .../.speakeasy/workflow.lock | 10 +- internal/deployserverclient/deployserver.go | 36 +- .../components/createmanifestresponse.md | 6 +- ...{createmanifestresponsedata.md => data.md} | 2 +- .../models/components/listappsresponse.md | 6 +- .../components/listappsresponsecursor.md | 18 + .../models/components/listappsresponsedata.md | 13 - .../components/listdeploymentsresponse.md | 6 +- .../listdeploymentsresponsecursor.md | 18 + .../components/listdeploymentsresponsedata.md | 13 - .../components/listmanifestsresponse.md | 6 +- .../components/listmanifestsresponsecursor.md | 18 + .../components/listmanifestsresponsedata.md | 13 - .../listmanifestversionsresponse.md | 6 +- .../listmanifestversionsresponsecursor.md | 18 + .../listmanifestversionsresponsedata.md | 13 - .../components/readvariablesresponse.md | 6 +- .../components/readvariablesresponsecursor.md | 18 + .../components/readvariablesresponsedata.md | 13 - .../docs/models/components/variable.md | 13 +- .../docs/models/components/variabledata.md | 11 +- .../docs/models/operations/listappsrequest.md | 8 +- .../operations/listdeploymentsrequest.md | 10 +- .../models/operations/listmanifestsrequest.md | 8 +- .../operations/listmanifestversionsrequest.md | 10 +- .../operations/readappvariablesrequest.md | 10 +- .../docs/sdks/deployserver/README.md | 67 +- .../components/createmanifestresponse.go | 40 +- .../models/components/listappsresponse.go | 63 +- .../components/listdeploymentsresponse.go | 63 +- .../components/listmanifestsresponse.go | 63 +- .../listmanifestversionsresponse.go | 63 +- .../components/readvariablesresponse.go | 65 +- .../models/components/variable.go | 19 +- .../models/components/variabledata.go | 19 +- .../models/operations/listapps.go | 20 +- .../models/operations/listdeployments.go | 22 +- .../models/operations/listmanifests.go | 20 +- .../models/operations/listmanifestversions.go | 20 +- .../models/operations/readappvariables.go | 22 +- openapi/deployserver.yaml | 1311 +++++++++++------ 49 files changed, 1492 insertions(+), 995 deletions(-) rename internal/deployserverclient/docs/models/components/{createmanifestresponsedata.md => data.md} (97%) create mode 100644 internal/deployserverclient/docs/models/components/listappsresponsecursor.md delete mode 100644 internal/deployserverclient/docs/models/components/listappsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/listdeploymentsresponsecursor.md delete mode 100644 internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestsresponsecursor.md delete mode 100644 internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/listmanifestversionsresponsecursor.md delete mode 100644 internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md create mode 100644 internal/deployserverclient/docs/models/components/readvariablesresponsecursor.md delete mode 100644 internal/deployserverclient/docs/models/components/readvariablesresponsedata.md diff --git a/cmd/cloud/apps/deployments/list.go b/cmd/cloud/apps/deployments/list.go index 11a86529..ebee4e45 100644 --- a/cmd/cloud/apps/deployments/list.go +++ b/cmd/cloud/apps/deployments/list.go @@ -13,7 +13,7 @@ import ( ) type List struct { - components.ListDeploymentsResponseData + components.ListDeploymentsResponseCursor } type ListCtrl struct { @@ -24,7 +24,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListDeploymentsResponseData: components.ListDeploymentsResponseData{}, + ListDeploymentsResponseCursor: components.ListDeploymentsResponseCursor{}, } } @@ -39,8 +39,8 @@ func NewList() *cobra.Command { fctl.WithAliases("ls"), fctl.WithShortDescription("List deployments"), fctl.WithStringFlag("app-id", "", "Filter by app ID"), - fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithStringFlag("cursor", "", "Opaque cursor token for the next page"), fctl.WithController(NewListCtrl()), ) } @@ -71,17 +71,22 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) appID = &id } + var cursor *string + if v := fctl.GetString(cmd, "cursor"); v != "" { + cursor = &v + } + deployments, err := apiClient.ListDeployments( cmd.Context(), appID, - pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + cursor, ) if err != nil { return nil, err } - c.store.ListDeploymentsResponseData = deployments.ListDeploymentsResponse.Data + c.store.ListDeploymentsResponseCursor = deployments.ListDeploymentsResponse.Cursor return c, nil } @@ -91,7 +96,7 @@ func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { {"ID", "App ID", "Status", "Manifest ID", "Created At"}, } - for _, d := range c.store.Items { + for _, d := range c.store.Data { data = append(data, []string{ d.ID, d.AppID, diff --git a/cmd/cloud/apps/list.go b/cmd/cloud/apps/list.go index b41012fb..b15e38e7 100644 --- a/cmd/cloud/apps/list.go +++ b/cmd/cloud/apps/list.go @@ -11,7 +11,7 @@ import ( ) type List struct { - components.ListAppsResponseData + components.ListAppsResponseCursor } type ListCtrl struct { @@ -22,7 +22,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListAppsResponseData: components.ListAppsResponseData{}, + ListAppsResponseCursor: components.ListAppsResponseCursor{}, } } @@ -35,8 +35,8 @@ func NewListCtrl() *ListCtrl { func NewList() *cobra.Command { return fctl.NewCommand("list", fctl.WithAliases("ls"), - fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithStringFlag("cursor", "", "Opaque cursor token for the next page"), fctl.WithShortDescription("List apps"), fctl.WithController(NewListCtrl()), ) @@ -53,9 +53,6 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) return nil, err } - pageSize := fctl.GetInt(cmd, "page-size") - page := fctl.GetInt(cmd, "page") - _, apiClient, err := fctl.NewAppDeployClientFromFlags( cmd, relyingParty, @@ -66,16 +63,22 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) if err != nil { return nil, err } + + var cursor *string + if v := fctl.GetString(cmd, "cursor"); v != "" { + cursor = &v + } + apps, err := apiClient.ListApps( cmd.Context(), - pointer.For(int64(page)), - pointer.For(int64(pageSize)), + pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + cursor, ) if err != nil { return nil, err } - c.store.ListAppsResponseData = apps.ListAppsResponse.Data + c.store.ListAppsResponseCursor = apps.ListAppsResponse.Cursor return c, nil } @@ -85,7 +88,7 @@ func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { {"Name", "ID", "Stack ID"}, } - for _, w := range c.store.Items { + for _, w := range c.store.Data { data = append(data, []string{ w.Name, w.ID, diff --git a/cmd/cloud/apps/manifests/list.go b/cmd/cloud/apps/manifests/list.go index 0cd20184..2aa0b7cd 100644 --- a/cmd/cloud/apps/manifests/list.go +++ b/cmd/cloud/apps/manifests/list.go @@ -14,7 +14,7 @@ import ( ) type List struct { - components.ListManifestsResponseData + components.ListManifestsResponseCursor } type ListCtrl struct { @@ -25,7 +25,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListManifestsResponseData: components.ListManifestsResponseData{}, + ListManifestsResponseCursor: components.ListManifestsResponseCursor{}, } } @@ -39,8 +39,8 @@ func NewList() *cobra.Command { return fctl.NewCommand("list", fctl.WithAliases("ls"), fctl.WithShortDescription("List manifests"), - fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithStringFlag("cursor", "", "Opaque cursor token for the next page"), fctl.WithController(NewListCtrl()), ) } @@ -66,16 +66,21 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) return nil, err } + var cursor *string + if v := fctl.GetString(cmd, "cursor"); v != "" { + cursor = &v + } + manifests, err := apiClient.ListManifests( cmd.Context(), - pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + cursor, ) if err != nil { return nil, err } - c.store.ListManifestsResponseData = manifests.ListManifestsResponse.Data + c.store.ListManifestsResponseCursor = manifests.ListManifestsResponse.Cursor return c, nil } @@ -85,7 +90,7 @@ func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { {"ID", "Name", "Latest Version", "Created At"}, } - for _, m := range c.store.Items { + for _, m := range c.store.Data { data = append(data, []string{ m.ID, m.Name, diff --git a/cmd/cloud/apps/manifests/versions/list.go b/cmd/cloud/apps/manifests/versions/list.go index 4e046e81..fa1108dc 100644 --- a/cmd/cloud/apps/manifests/versions/list.go +++ b/cmd/cloud/apps/manifests/versions/list.go @@ -14,7 +14,7 @@ import ( ) type List struct { - components.ListManifestVersionsResponseData + components.ListManifestVersionsResponseCursor } type ListCtrl struct { @@ -25,7 +25,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ListManifestVersionsResponseData: components.ListManifestVersionsResponseData{}, + ListManifestVersionsResponseCursor: components.ListManifestVersionsResponseCursor{}, } } @@ -40,8 +40,8 @@ func NewList() *cobra.Command { fctl.WithAliases("ls"), fctl.WithShortDescription("List manifest versions"), fctl.WithStringFlag("manifest-id", "", "Manifest ID"), - fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithStringFlag("cursor", "", "Opaque cursor token for the next page"), fctl.WithController(NewListCtrl()), ) } @@ -72,17 +72,22 @@ func (c *ListCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error) return nil, fmt.Errorf("manifest-id is required") } + var cursor *string + if v := fctl.GetString(cmd, "cursor"); v != "" { + cursor = &v + } + versions, err := apiClient.ListManifestVersions( cmd.Context(), manifestID, - pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + cursor, ) if err != nil { return nil, err } - c.store.ListManifestVersionsResponseData = versions.ListManifestVersionsResponse.Data + c.store.ListManifestVersionsResponseCursor = versions.ListManifestVersionsResponse.Cursor return c, nil } @@ -92,7 +97,7 @@ func (c *ListCtrl) Render(cmd *cobra.Command, _ []string) error { {"Manifest ID", "Version", "Created At"}, } - for _, v := range c.store.Items { + for _, v := range c.store.Data { data = append(data, []string{ v.ManifestID, strconv.FormatInt(v.Version, 10), diff --git a/cmd/cloud/apps/variables/create.go b/cmd/cloud/apps/variables/create.go index 33f7bf62..90f81213 100644 --- a/cmd/cloud/apps/variables/create.go +++ b/cmd/cloud/apps/variables/create.go @@ -40,8 +40,6 @@ func NewCreate() *cobra.Command { fctl.WithStringFlag("key", "", "Variable key"), fctl.WithStringFlag("value", "", "Variable value"), fctl.WithStringFlag("description", "", "Variable description"), - fctl.WithBoolFlag("sensitive", true, "Mark the variable as sensitive"), - fctl.WithStringFlag("category", "", "Variable category (env or terraform)"), fctl.WithController(NewCreateCtrl()), ) } @@ -71,7 +69,6 @@ func (c *CreateCtrl) Run(cmd *cobra.Command, _ []string) (fctl.Renderable, error Key: fctl.GetString(cmd, "key"), Value: fctl.GetString(cmd, "value"), Description: func() *string { s := fctl.GetString(cmd, "description"); return &s }(), - Sensitive: fctl.GetBool(cmd, "sensitive"), }, }) if err != nil { @@ -89,12 +86,7 @@ func (c *CreateCtrl) Render(cmd *cobra.Command, args []string) error { items := []pterm.BulletListItem{ {Level: 0, Text: fmt.Sprintf("ID: %s", c.store.Variable.ID)}, {Level: 0, Text: fmt.Sprintf("Key: %s", c.store.Variable.Key)}, - {Level: 0, Text: fmt.Sprintf("Value: %s", func() string { - if c.store.Variable.Sensitive { - return "****" - } - return c.store.Variable.Value - }())}, + {Level: 0, Text: fmt.Sprintf("Value: %s", c.store.Variable.Value)}, {Level: 0, Text: fmt.Sprintf("Description: %s", func() string { if c.store.Variable.Description == nil { return "N/A" diff --git a/cmd/cloud/apps/variables/list.go b/cmd/cloud/apps/variables/list.go index fecc1f37..01afe831 100644 --- a/cmd/cloud/apps/variables/list.go +++ b/cmd/cloud/apps/variables/list.go @@ -13,7 +13,7 @@ import ( ) type List struct { - components.ReadVariablesResponseData + components.ReadVariablesResponseCursor } type ListCtrl struct { @@ -24,7 +24,7 @@ var _ fctl.Controller[*List] = (*ListCtrl)(nil) func newDefaultStore() *List { return &List{ - ReadVariablesResponseData: components.ReadVariablesResponseData{}, + ReadVariablesResponseCursor: components.ReadVariablesResponseCursor{}, } } @@ -39,8 +39,8 @@ func NewList() *cobra.Command { fctl.WithAliases("ls"), fctl.WithShortDescription("List variables for an app"), fctl.WithStringFlag("id", "", "App ID"), - fctl.WithIntFlag("page", 1, "Page number"), fctl.WithIntFlag("page-size", 100, "Page size"), + fctl.WithStringFlag("cursor", "", "Opaque cursor token for the next page"), fctl.WithController(NewListCtrl()), ) } @@ -70,12 +70,22 @@ func (c *ListCtrl) Run(cmd *cobra.Command, args []string) (fctl.Renderable, erro return nil, fmt.Errorf("id is required") } - vars, err := apiClient.ReadAppVariables(cmd.Context(), id, pointer.For(int64(fctl.GetInt(cmd, "page"))), pointer.For(int64(fctl.GetInt(cmd, "page-size")))) + var cursor *string + if v := fctl.GetString(cmd, "cursor"); v != "" { + cursor = &v + } + + vars, err := apiClient.ReadAppVariables( + cmd.Context(), + id, + pointer.For(int64(fctl.GetInt(cmd, "page-size"))), + cursor, + ) if err != nil { return nil, err } - c.store.ReadVariablesResponseData = vars.ReadVariablesResponse.Data + c.store.ReadVariablesResponseCursor = vars.ReadVariablesResponse.Cursor return c, nil } @@ -85,16 +95,11 @@ func (c *ListCtrl) Render(cmd *cobra.Command, args []string) error { {"Id", "Key", "Value", "Description"}, } - for _, variable := range c.store.ReadVariablesResponseData.Items { + for _, variable := range c.store.Data { data = append(data, []string{ variable.ID, variable.Key, - func() string { - if variable.Sensitive { - return "****" - } - return variable.Value - }(), + variable.Value, func() string { if variable.Description == nil { return "" diff --git a/internal/deployserverclient/.speakeasy/gen.lock b/internal/deployserverclient/.speakeasy/gen.lock index 7bb1b6e5..2498b838 100644 --- a/internal/deployserverclient/.speakeasy/gen.lock +++ b/internal/deployserverclient/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 12df0dd4-09cf-49f5-8116-53c77b28ba01 management: - docChecksum: a3e3bbccd6bb25e0e6c77304fef8065f + docChecksum: 03e55b5f1af06ab89d7637b7bbd6a95d docVersion: 0.1.0 speakeasyVersion: 1.759.2 generationVersion: 2.869.23 - releaseVersion: 0.1.0 - configChecksum: 0445386bbafa86450656df7324d2976d + releaseVersion: 0.1.1 + configChecksum: 65bf761ed2e45c2edc12016a208c0bb8 persistentEdits: - generation_id: bf8cc126-19fa-4e3a-8743-a7bc4d5088e6 - pristine_commit_hash: 7b9613abe4adebce9fdf320e5102fc907299c866 - pristine_tree_hash: f97130af909b1ee3ae391ca4ca2a4543207f3618 + generation_id: e34fb87d-98de-4a8b-b896-e954f67f3e4e + pristine_commit_hash: 4e14ecbb38b7c5b3c54dda495b29079c9e1dad4d + pristine_tree_hash: 5a945dfe489196205cc74342a44ac1ec194c384d features: go: acceptHeaders: 2.81.2 @@ -52,8 +52,8 @@ trackedFiles: pristine_git_object: eb58123de9ffa74878d22ed28cc871ffefdc7ca6 deployserver.go: id: 4e88cb1c88d3 - last_write_checksum: sha1:f4ea2be99e3159d8370a1275127654eb63d55141 - pristine_git_object: 14a08ff96e87051a30a0abb91f6e316dbe501ae1 + last_write_checksum: sha1:3915fd8d8301b50ef037e71298b1dbe335d5470f + pristine_git_object: 87df35a3300bd5f61600296d60d756e0c6e616e3 docs/models/apierrors/error.md: id: 7c6e7719d689 last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b @@ -88,12 +88,8 @@ trackedFiles: pristine_git_object: 03f669ebc8fbefa0a3d544e4ec3d4daca2c828ad docs/models/components/createmanifestresponse.md: id: 2a7b75671c99 - last_write_checksum: sha1:e4ca70d53026357309f5fda874e961576469dd27 - pristine_git_object: 50f2431438296e07de096d4bea3c2dc01d1a5ffe - docs/models/components/createmanifestresponsedata.md: - id: bf8a9aa0fb9d - last_write_checksum: sha1:d0f852a312d5c2a6bd7c4517fe52d581e1a90547 - pristine_git_object: d67abd5dd29f7da960eace60783078a79e84735b + last_write_checksum: sha1:1d8e04b9cf3d114a7663311c9f167ff750a130bb + pristine_git_object: c686febb6d115bc4c25f8727ed39b6d75eb18fb6 docs/models/components/createvariablerequest.md: id: 1656d1204270 last_write_checksum: sha1:650be824e43882247b0beb008425e05b8182f946 @@ -102,6 +98,10 @@ trackedFiles: id: 77cc5c4876b1 last_write_checksum: sha1:6f884cdcec2003eaa5bf016cc521b269869a0628 pristine_git_object: 82ba7c122ddd49378c9e1880cde26477645bb5ae + docs/models/components/data.md: + id: 3f89c52c2b17 + last_write_checksum: sha1:e578e08fe6a5e194a0292de6f85a28c328774c52 + pristine_git_object: f17677259850f82838a1bd8112b6c42f6fec5deb docs/models/components/deleteappresponse.md: id: f57e1423f086 last_write_checksum: sha1:7e55b75abfc7d75c181f5712f19696bba389dbbc @@ -132,36 +132,36 @@ trackedFiles: pristine_git_object: 983f988a4d90a4549a108b3f8852e39af4447cfe docs/models/components/listappsresponse.md: id: e0c61f1197fc - last_write_checksum: sha1:913aa9678e2c21b99e8623583272fbde0e36325d - pristine_git_object: 60800496ea21b54d93baf476e7be18db3d702608 - docs/models/components/listappsresponsedata.md: - id: d692cd2a8694 - last_write_checksum: sha1:f78fc9143a13813cd301a43b30cac5ac1bad5095 - pristine_git_object: 8a07dd0a615eb99b8df520e59dea77b5e263989d + last_write_checksum: sha1:6a0d42593e1c1ecf470c3ed54dca3273f4a210b6 + pristine_git_object: 99147c1aed8ae0711c2c68230aa21934460e2888 + docs/models/components/listappsresponsecursor.md: + id: 6bc6b6706743 + last_write_checksum: sha1:ce39f99729035c93417553c89025f974d69cac26 + pristine_git_object: 93de14540768e09f9bee9a114f80b5ff78f9ef7b docs/models/components/listdeploymentsresponse.md: id: bd1553c8e405 - last_write_checksum: sha1:28fe41b599a6ebf838dfaf6cdad28065c0e0f616 - pristine_git_object: 3154c0e458cc5e706ffa555cb6a848bcdf9bc819 - docs/models/components/listdeploymentsresponsedata.md: - id: 1fbcb1bf6082 - last_write_checksum: sha1:4b4d7528205c4c21f81229c48dc1a509497b6940 - pristine_git_object: d6d948fca91298ecdd890f8173857cef9eed3659 + last_write_checksum: sha1:fe988a5676822ca0550ec89afdc02c32ab867252 + pristine_git_object: 2ce25a3965f00243b4af688c24a3c4acf21b68a9 + docs/models/components/listdeploymentsresponsecursor.md: + id: 72a23d339d69 + last_write_checksum: sha1:fbc76ed2adafb8ae4f140f558f0ed1d9365c3f89 + pristine_git_object: 2baeeaa9e59e018cae19f3e683c5a938c1eaddab docs/models/components/listmanifestsresponse.md: id: e34a1d20941d - last_write_checksum: sha1:05642b5f46cde4a1b8965d97c49f749b07fc9970 - pristine_git_object: ffc6e180d9b95ef9e7c707118b20b0974ed77a12 - docs/models/components/listmanifestsresponsedata.md: - id: 6f25d9ec5a2d - last_write_checksum: sha1:86f2d4b9cf24490d97ed0075e97a5d31b460f5cc - pristine_git_object: bdbe00930aa49fd8e9d11e4091a916d91e87cc52 + last_write_checksum: sha1:9b080300659d61a4927c24d10824c823f3c32e25 + pristine_git_object: 74d925c603f701c322d13f61da8bac323fbfda61 + docs/models/components/listmanifestsresponsecursor.md: + id: 1c38804b29ff + last_write_checksum: sha1:9c5ccbc84020bab1fa2bdb5243d88a218bfb142e + pristine_git_object: 1c70dee747ef15947f1e33ff8acf6089470f5060 docs/models/components/listmanifestversionsresponse.md: id: b038781da9cd - last_write_checksum: sha1:fdf5ac17cc4c67db490542b19739e57d1955f6ad - pristine_git_object: 90ffe672e4ef660c75ae3e01d26d07cda18b8a9f - docs/models/components/listmanifestversionsresponsedata.md: - id: d76d1e1a29cb - last_write_checksum: sha1:707d98c3872db195d4c2f2c9b41b4a70e4041104 - pristine_git_object: f5f82a0eeb8ccfbd86e0a782fcf4f653fca3547b + last_write_checksum: sha1:b3307e20a493086cdee8fa6c93f02c1182bc96dd + pristine_git_object: cdfc28ea12871d16b7795ce8c9ec6ea1f7aa81d5 + docs/models/components/listmanifestversionsresponsecursor.md: + id: fb3a70cef30c + last_write_checksum: sha1:2fb9f2d85a37294b80c7fdeefaf42f16cb0f99b4 + pristine_git_object: 3f829a1ddada5fe4626b51a0f0996ba0affe69ce docs/models/components/log.md: id: e1037d748e03 last_write_checksum: sha1:dad2f73e07553382b0ee972eebdb04229160e357 @@ -188,12 +188,12 @@ trackedFiles: pristine_git_object: 01c385db354d9b90ea38b029551a3bbe27ba6415 docs/models/components/readvariablesresponse.md: id: 9f63356b6b86 - last_write_checksum: sha1:c67b43d758ecd9e97bd4340a2ca74cebded4dd87 - pristine_git_object: dca4b95b3909ea793fc2b288c69e57171bda4224 - docs/models/components/readvariablesresponsedata.md: - id: 40c212b90527 - last_write_checksum: sha1:9a6983e9988c7be9bd5a855648c1562e9f154e0b - pristine_git_object: a8e3d430bcfa588e9f4969e8a8f1ffd24a320a10 + last_write_checksum: sha1:026fa015644e4bd39562870e963228d7d107da4e + pristine_git_object: 56f1ad49a3904e5588b917c40103f53cb67a0f7e + docs/models/components/readvariablesresponsecursor.md: + id: c616d7701ed2 + last_write_checksum: sha1:d2e6762d758029e501287c6c1b5bbacea874faa3 + pristine_git_object: cc317df08105c5c792ff8f3cd67b5bb1f485bf51 docs/models/components/state.md: id: 441de3ea6229 last_write_checksum: sha1:0ee3cca8c7a402fc1aa36f5e3f8f75d277acc38c @@ -208,12 +208,12 @@ trackedFiles: pristine_git_object: 2df4cefaf6f3c0196b30afce2d6e1b54f58ea3c8 docs/models/components/variable.md: id: 106f069148a0 - last_write_checksum: sha1:d276aea6e652e1f698b6e21029c0fc0d98874e83 - pristine_git_object: 6fc3df29f3b82591684ed73e4c26c5d0b5c89304 + last_write_checksum: sha1:de4bd21c2646d76e8b1038a16f0d9f6bfa5d6173 + pristine_git_object: 3f697c8284a53ec8c399d5523bf6ccabf68d40c8 docs/models/components/variabledata.md: id: 41fd2f11ae57 - last_write_checksum: sha1:33a510fe028f18cde19f69ada0334cddfdf263a1 - pristine_git_object: e6528690bf3b5e499bccc351abb0657dc36f7b35 + last_write_checksum: sha1:3bee0384908c2d2164659d7f4a4b803c0c65cf43 + pristine_git_object: 42c414ca2c7efc9262ce82ee3bc8950191300beb docs/models/operations/attachappmanifestrequest.md: id: accaf996506a last_write_checksum: sha1:e0fa8acf1f13cca121733c69619da7ecf6e00611 @@ -292,32 +292,32 @@ trackedFiles: pristine_git_object: fbbd1f5af2d20d35ab0340f38e562d06e7535de5 docs/models/operations/listappsrequest.md: id: 5efe8d3cde07 - last_write_checksum: sha1:738a4635f906b469db0206d6c997bce005b4009d - pristine_git_object: f78151ca352e2a9685b3a0ba260a722151ec07b3 + last_write_checksum: sha1:49ea7178bb417c38ef42fff76eadaf3b7c6196af + pristine_git_object: 11c97674a4850750238e4289aa0123be54e62e41 docs/models/operations/listappsresponse.md: id: 2c4aaa805a52 last_write_checksum: sha1:54f047b67d567b402899316ba8dc2bae26889df4 pristine_git_object: 4da0499356a0ebed5078ddfcfb4d5541fb92b223 docs/models/operations/listdeploymentsrequest.md: id: 854523666c28 - last_write_checksum: sha1:915f97aeace5bc98f63d3694b0f59c055aa1a0d2 - pristine_git_object: 5fc4d1bbc310678e94dbb68ba59938000544c068 + last_write_checksum: sha1:2c10dfce2cef861a1f47529ecfcfef2a0f6705c7 + pristine_git_object: 2ee05d5a47d284e7b92a7f5461535d6443667497 docs/models/operations/listdeploymentsresponse.md: id: b3b1e4f8a3b8 last_write_checksum: sha1:cfcd3928517093a37efd9602f83e8f7020a69599 pristine_git_object: cc0444002ab9aa126d0cb3dc0eba3c4484128915 docs/models/operations/listmanifestsrequest.md: id: 62d8ae59d357 - last_write_checksum: sha1:6fb6351c9c7454e6725bef3cec628c36b6cc400b - pristine_git_object: 1c953fe5073e6f85bb3c98c0dca92b34115e338f + last_write_checksum: sha1:3b0bfaa2615048d562d456c5a68b1e8421a97126 + pristine_git_object: 115e9ccbd785dd20b080b0de6c4d50f5b8452c08 docs/models/operations/listmanifestsresponse.md: id: 44929c2f905b last_write_checksum: sha1:c6302e89d1e353c091cde1af1e9c2dabb23565c1 pristine_git_object: 7bb7f793707b0d54e26d1747901606391fb28594 docs/models/operations/listmanifestversionsrequest.md: id: 533cb7d27434 - last_write_checksum: sha1:a0f5f971d0ea9a3dab0e30023bf8ff9075481356 - pristine_git_object: 05fdaa0e8522c10b2f3af35e63c18b6b39952fcc + last_write_checksum: sha1:c204e7d33a6d5a69ea2a02fe0a3ffac4c49cb8fb + pristine_git_object: 7200d26c456ccd8efdb814af8f6c4853281d26c8 docs/models/operations/listmanifestversionsresponse.md: id: dc6be6e3c23d last_write_checksum: sha1:d6a291ff40460b4d23cf3a7f68f5c2fb564db1ca @@ -360,8 +360,8 @@ trackedFiles: pristine_git_object: b82b6c789db1b0f67fd3770e7d9c8c8b0ff4d41f docs/models/operations/readappvariablesrequest.md: id: da8db5c99ce3 - last_write_checksum: sha1:97fa68ea5d6123afe24cb000390c8c062ac9fb24 - pristine_git_object: 997f2a80d7aff419cd28e0b40c9fe53696dd43e5 + last_write_checksum: sha1:766d739b4937a12f7a7000a5642fc70bc56ca823 + pristine_git_object: 369da6d9afadac57f1464c55735b4bc37ece2644 docs/models/operations/readappvariablesresponse.md: id: cd4942c5e28a last_write_checksum: sha1:3a9135c3914273ff65e2771e62c72eb0d2702d4a @@ -420,8 +420,8 @@ trackedFiles: pristine_git_object: f8b0e9ef7ee64c5c8ade8601fac272aa7909171e docs/sdks/deployserver/README.md: id: 7bbb48696892 - last_write_checksum: sha1:bdbdcdf579be8f2d770ee992847b49b7f59cf51a - pristine_git_object: 5c60de63553f34704fd0b3268523d33d5e084320 + last_write_checksum: sha1:db4ed7cc26f7f1337e2d618117309907cb743934 + pristine_git_object: e6cdb3630042dc5eac726db319ca6ade53e3ee38 go.mod: id: c47645c391ad last_write_checksum: sha1:ccfac949478bd60fae3010350a17ef6c9e8580bf @@ -524,8 +524,8 @@ trackedFiles: pristine_git_object: 9b4eaf86f0894bae0c59ec8ab1e0e5a649704373 models/components/createmanifestresponse.go: id: 8a09822d66c1 - last_write_checksum: sha1:52c7e80eea20d14ce2184f9889183929915080d4 - pristine_git_object: 921bf611877505dd88e6aa308cc6b9797c6d735b + last_write_checksum: sha1:8e149a11b813c92ff2bba317811620710212b73c + pristine_git_object: 4b428503db65fec8cab6373f85846d706290af18 models/components/createvariablerequest.go: id: 488ed9ed73b4 last_write_checksum: sha1:6dad11fecda3f9df54a90dc5bda33496c7ee5904 @@ -556,20 +556,20 @@ trackedFiles: pristine_git_object: 49b58c940ad027f8d35deb3d19a3f3ba60176296 models/components/listappsresponse.go: id: be17d7d20579 - last_write_checksum: sha1:a5cdc883a1b98de7a257180c85edf40eee182832 - pristine_git_object: d91d6e67015ebe40d2d954db984479c2a8957e40 + last_write_checksum: sha1:c8bb7e6297ff5f98a24d11a4c9d6f6e675f761b1 + pristine_git_object: b8eb4b25a70be893ef001bab31edbcea8f76a0b9 models/components/listdeploymentsresponse.go: id: c81969fa6fd8 - last_write_checksum: sha1:cddfefe4782b7a6824d0e132f4f11d979d595671 - pristine_git_object: 2f8844f16dd202fe745bb6ae649361e2ac2cbd8f + last_write_checksum: sha1:7f06de75b63c0bf64f6b8f3ae2a8fc5bc7377a7f + pristine_git_object: e6a145155b7c09fe9bc7673c7442ca5958803f0b models/components/listmanifestsresponse.go: id: 8ed2ba8f477d - last_write_checksum: sha1:067bc89e626dcba06625e221e24ea1cf21bd9d7c - pristine_git_object: 4c54c4fc4a971effc6960213e549f03958e6d224 + last_write_checksum: sha1:cdedc173f1a1e1b78fd80bfaa543972fd92acd4e + pristine_git_object: 2911e50d8636088d2ec723eefe60d3e6b0d15a3b models/components/listmanifestversionsresponse.go: id: a74974d4f433 - last_write_checksum: sha1:f519a05edaf19584adbd60ca3aae4ca5c46b43e4 - pristine_git_object: 287c29f3b5e490035182b930ddc3f015d37f1f5c + last_write_checksum: sha1:3ca1a53dd15f4a29113cfb40ea3e4172dcb03547 + pristine_git_object: 6d02f172080fe8850c0ee12fb742387e54c84838 models/components/log.go: id: "076958063552" last_write_checksum: sha1:08f93eab2190052f9affb791dbc491700485388a @@ -596,8 +596,8 @@ trackedFiles: pristine_git_object: f2d84592e4c2946e92abf391eb06ac2b96015e88 models/components/readvariablesresponse.go: id: 4b628607f38f - last_write_checksum: sha1:50bba846aa0abff0cb644aa6ed9b740100682056 - pristine_git_object: f9f233b9b95f0afdaed6dd01a365a53d08592beb + last_write_checksum: sha1:6cc3d29087b54bfc47bd5646b81892b0fee333ec + pristine_git_object: c707e31ef6e66e4dc88bc89d753d4bb528ae90d3 models/components/state.go: id: cb569493a6e4 last_write_checksum: sha1:2960474737e42f46e1f67bcec0a98270babbeaaf @@ -612,12 +612,12 @@ trackedFiles: pristine_git_object: 8cd2a3858debf89dd5f196c2e7b9750f612f743f models/components/variable.go: id: 37684cf48fa4 - last_write_checksum: sha1:716bdab940d9e74422327c676089410b483b134b - pristine_git_object: 839f2ea73f0755547ba0b11174f7263e98ba0b87 + last_write_checksum: sha1:9ce7b2c7c01aca7fd5c98eca565bac207df545dc + pristine_git_object: b0a97d2aff52f8d3699740708cac0ca873d2884b models/components/variabledata.go: id: c47e6d6b22e2 - last_write_checksum: sha1:f18eaccc07eb9c59c6ac2b573d680b09115ec673 - pristine_git_object: 9ca7263b061adcb74269a1b7e1738febe66142dc + last_write_checksum: sha1:0fb69cbceb89a1528bf9ad2168bb6045ebcc8f58 + pristine_git_object: b1cfac06d51033bfc683bf8f720d08bd6a8418e2 models/operations/attachappmanifest.go: id: 1b3eab4170c4 last_write_checksum: sha1:b608954727c46e4af9e438e30b82a3b17733dda6 @@ -660,20 +660,20 @@ trackedFiles: pristine_git_object: dfa94ca5125eeae7e5aed22535f33ff0359e694a models/operations/listapps.go: id: 73fbcbeab28f - last_write_checksum: sha1:696ecf1b2b8144ec3aeb4c0925af9c290b9b1e4d - pristine_git_object: 6f451a515eb38f89905d35ce884df8a117cd26a7 + last_write_checksum: sha1:2affae7cd897b025cf1865449c9d6abe32e3c452 + pristine_git_object: 35573e662a5a59a07076f0fe7929a76bec02c17a models/operations/listdeployments.go: id: 0241618e0c69 - last_write_checksum: sha1:d7b19282703c1464cb5b05c4280ea0d42f0f56d6 - pristine_git_object: ddae0d51f91006ce1a38a3f234517d60d3d257a7 + last_write_checksum: sha1:de2fc1094e438ec56519207846856c4c9cba8d09 + pristine_git_object: 6c51c65b2209681869a451c5260a7a29385d75e7 models/operations/listmanifests.go: id: c8df7087082a - last_write_checksum: sha1:79a1bb7736bf026f68b4e9eeaa57e2c8f1de049d - pristine_git_object: 7200ea57119778a3f965b443b7f467e215ff45f7 + last_write_checksum: sha1:05da46939ab67ddb81b5ce1ef87ae6836a2ab15e + pristine_git_object: fb5f4953f26ec4aeb74839bcb8674b88f93c0ef4 models/operations/listmanifestversions.go: id: c3d6a0006b82 - last_write_checksum: sha1:b53891beadf5d0b6d6dd46ea3b0075b4b9807302 - pristine_git_object: f74af98d7294c0720cd2cc4f77cd09940026fb01 + last_write_checksum: sha1:fb9346db18b793a25baf81b45a2abb26b2a9de88 + pristine_git_object: 383a02ecd2db96c47e7691af304ca63386b551b9 models/operations/options.go: id: d20dd4db9865 last_write_checksum: sha1:a48cf400249fe4cec80746623cbbd6831141c0f2 @@ -692,8 +692,8 @@ trackedFiles: pristine_git_object: ff16e36f0a7c3d5e1ec8615c8f74d3cafcf48e6d models/operations/readappvariables.go: id: 3c029298a72b - last_write_checksum: sha1:42b249b334f33657dd22a96047018ed05094490d - pristine_git_object: f642a034afb0cef123f3eeba201c9aad7134907c + last_write_checksum: sha1:2ebe235e100ef10034b5f8579dea0126c4e9e9a9 + pristine_git_object: b273ef6b05ce4df4d48877c6546b07b202d019a3 models/operations/readdeployment.go: id: 91ac6c44d1bd last_write_checksum: sha1:34ef44770f6ad1eb358ceb0ccafaed564f81c1b7 @@ -754,7 +754,7 @@ examples: organizationId: "" responses: "200": - application/json: {"data": {"items": []}} + application/json: {"cursor": {"hasMore": true, "data": [{"id": "", "name": ""}]}} default: application/json: {"errorCode": ""} createApp: @@ -815,7 +815,7 @@ examples: id: "" responses: "200": - application/json: {"data": {}} + application/json: {"cursor": {"hasMore": true, "data": []}} default: application/json: {"errorCode": ""} createAppVariable: @@ -824,10 +824,10 @@ examples: path: id: "" requestBody: - application/json: {"variable": {"key": "", "value": "", "sensitive": false}} + application/json: {"variable": {"key": "", "value": ""}} responses: "201": - application/json: {"data": {"key": "", "value": "", "sensitive": false, "id": ""}} + application/json: {"data": {"key": "", "value": "", "id": ""}} default: application/json: {"errorCode": ""} deleteAppVariable: @@ -973,7 +973,7 @@ examples: speakeasy-default-list-manifests: responses: "200": - application/json: {"data": {"items": []}} + application/json: {"cursor": {"hasMore": true, "data": []}} default: application/json: {"errorCode": ""} readManifest: @@ -1039,7 +1039,7 @@ examples: manifestId: "" responses: "200": - application/json: {"data": {"items": [{"manifestId": "", "version": 473763, "createdAt": "2026-09-04T02:17:14.806Z"}]}} + application/json: {"cursor": {"hasMore": false, "data": []}} default: application/json: {"errorCode": ""} readManifestVersion: @@ -1075,7 +1075,7 @@ examples: speakeasy-default-list-deployments: responses: "200": - application/json: {"data": {"items": [{"id": "", "appId": "", "status": "", "createdAt": "2025-10-03T23:17:35.491Z", "updatedAt": "2024-05-13T18:10:51.662Z"}]}} + application/json: {"cursor": {"hasMore": false, "data": [{"id": "", "appId": "", "status": "", "createdAt": "2024-05-13T18:10:51.662Z", "updatedAt": "2025-08-14T19:55:10.264Z"}]}} default: application/json: {"errorCode": ""} readDeployment: diff --git a/internal/deployserverclient/.speakeasy/gen.yaml b/internal/deployserverclient/.speakeasy/gen.yaml index 7d3c6936..9fb731ae 100644 --- a/internal/deployserverclient/.speakeasy/gen.yaml +++ b/internal/deployserverclient/.speakeasy/gen.yaml @@ -35,7 +35,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false go: - version: 0.1.0 + version: 0.1.1 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: DeployServerError diff --git a/internal/deployserverclient/.speakeasy/workflow.lock b/internal/deployserverclient/.speakeasy/workflow.lock index 9b6bbe8b..3c517955 100644 --- a/internal/deployserverclient/.speakeasy/workflow.lock +++ b/internal/deployserverclient/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.759.2 sources: Terraform HCP Proxy API: sourceNamespace: terraform-hcp-proxy-api - sourceRevisionDigest: sha256:f1072e1d4779b29c3be4e72982341411266fed31ce03461435dcce2de61e7faa - sourceBlobDigest: sha256:ffb69b5915493dcf88f1cfc2cf27aae70e5cf54be911d2d5636a1d305a77bf69 + sourceRevisionDigest: sha256:d54ede8b0d8f74daea2fc161cf13846dd4a7084f96941f68356d8307bfa92186 + sourceBlobDigest: sha256:8564cde40781c471d4f17f1781a0c92fcf0ddc26ca20fbb3a2cc2a39d0c22f70 tags: - latest - 0.1.0 @@ -11,8 +11,10 @@ targets: deploy-server: source: Terraform HCP Proxy API sourceNamespace: terraform-hcp-proxy-api - sourceRevisionDigest: sha256:f1072e1d4779b29c3be4e72982341411266fed31ce03461435dcce2de61e7faa - sourceBlobDigest: sha256:ffb69b5915493dcf88f1cfc2cf27aae70e5cf54be911d2d5636a1d305a77bf69 + sourceRevisionDigest: sha256:d54ede8b0d8f74daea2fc161cf13846dd4a7084f96941f68356d8307bfa92186 + sourceBlobDigest: sha256:8564cde40781c471d4f17f1781a0c92fcf0ddc26ca20fbb3a2cc2a39d0c22f70 + codeSamplesNamespace: terraform-hcp-proxy-api-go-code-samples + codeSamplesRevisionDigest: sha256:2008838684af30cac9f85a2e65e7a8ae14b310789d819f87e6d9c8e2988a40d2 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.759.2 diff --git a/internal/deployserverclient/deployserver.go b/internal/deployserverclient/deployserver.go index 14a08ff9..87df35a3 100644 --- a/internal/deployserverclient/deployserver.go +++ b/internal/deployserverclient/deployserver.go @@ -118,9 +118,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *DeployServer { sdk := &DeployServer{ - SDKVersion: "0.1.0", + SDKVersion: "0.1.1", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.1.0 2.869.23 0.1.0 github.com/formancehq/fctl/internal/deployserverclient/v3", + UserAgent: "speakeasy-sdk/go 0.1.1 2.869.23 0.1.0 github.com/formancehq/fctl/internal/deployserverclient/v3", ServerList: ServerList, }, hooks: hooks.New(), @@ -140,10 +140,10 @@ func New(opts ...SDKOption) *DeployServer { } // ListApps - List organization apps -func (s *DeployServer) ListApps(ctx context.Context, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListAppsResponse, error) { +func (s *DeployServer) ListApps(ctx context.Context, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.ListAppsResponse, error) { request := operations.ListAppsRequest{ - PageNumber: pageNumber, - PageSize: pageSize, + PageSize: pageSize, + Cursor: cursor, } o := operations.Options{} @@ -1694,11 +1694,11 @@ func (s *DeployServer) DetachAppManifest(ctx context.Context, id string, opts .. } // ReadAppVariables - Get all variables of an app -func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ReadAppVariablesResponse, error) { +func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.ReadAppVariablesResponse, error) { request := operations.ReadAppVariablesRequest{ - ID: id, - PageNumber: pageNumber, - PageSize: pageSize, + ID: id, + PageSize: pageSize, + Cursor: cursor, } o := operations.Options{} @@ -2814,10 +2814,10 @@ func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestB } // ListManifests - List manifests in the organization -func (s *DeployServer) ListManifests(ctx context.Context, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListManifestsResponse, error) { +func (s *DeployServer) ListManifests(ctx context.Context, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.ListManifestsResponse, error) { request := operations.ListManifestsRequest{ - PageNumber: pageNumber, - PageSize: pageSize, + PageSize: pageSize, + Cursor: cursor, } o := operations.Options{} @@ -4180,11 +4180,11 @@ func (s *DeployServer) PushManifestVersion(ctx context.Context, manifestID strin } // ListManifestVersions - List versions of a manifest -func (s *DeployServer) ListManifestVersions(ctx context.Context, manifestID string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListManifestVersionsResponse, error) { +func (s *DeployServer) ListManifestVersions(ctx context.Context, manifestID string, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.ListManifestVersionsResponse, error) { request := operations.ListManifestVersionsRequest{ ManifestID: manifestID, - PageNumber: pageNumber, PageSize: pageSize, + Cursor: cursor, } o := operations.Options{} @@ -4860,11 +4860,11 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, request components. } // ListDeployments - List deployments -func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageNumber *int64, pageSize *int64, opts ...operations.Option) (*operations.ListDeploymentsResponse, error) { +func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.ListDeploymentsResponse, error) { request := operations.ListDeploymentsRequest{ - AppID: appID, - PageNumber: pageNumber, - PageSize: pageSize, + AppID: appID, + PageSize: pageSize, + Cursor: cursor, } o := operations.Options{} diff --git a/internal/deployserverclient/docs/models/components/createmanifestresponse.md b/internal/deployserverclient/docs/models/components/createmanifestresponse.md index 50f24314..c686febb 100644 --- a/internal/deployserverclient/docs/models/components/createmanifestresponse.md +++ b/internal/deployserverclient/docs/models/components/createmanifestresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `Data` | [components.CreateManifestResponseData](../../models/components/createmanifestresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `Data` | [components.Data](../../models/components/data.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md b/internal/deployserverclient/docs/models/components/data.md similarity index 97% rename from internal/deployserverclient/docs/models/components/createmanifestresponsedata.md rename to internal/deployserverclient/docs/models/components/data.md index d67abd5d..f1767725 100644 --- a/internal/deployserverclient/docs/models/components/createmanifestresponsedata.md +++ b/internal/deployserverclient/docs/models/components/data.md @@ -1,4 +1,4 @@ -# CreateManifestResponseData +# Data ## Fields diff --git a/internal/deployserverclient/docs/models/components/listappsresponse.md b/internal/deployserverclient/docs/models/components/listappsresponse.md index 60800496..99147c1a 100644 --- a/internal/deployserverclient/docs/models/components/listappsresponse.md +++ b/internal/deployserverclient/docs/models/components/listappsresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Data` | [components.ListAppsResponseData](../../models/components/listappsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Cursor` | [components.ListAppsResponseCursor](../../models/components/listappsresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listappsresponsecursor.md b/internal/deployserverclient/docs/models/components/listappsresponsecursor.md new file mode 100644 index 00000000..93de1454 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listappsresponsecursor.md @@ -0,0 +1,18 @@ +# ListAppsResponseCursor + +Cursor pagination envelope. `next` and `previous` are opaque tokens +produced by the server; pass them back as `?cursor=` to fetch the +adjacent page. `hasMore` is `true` when more results exist after the +current page. `pageSize` echoes the page size used for this page. + + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Number of items requested for this page | +| `HasMore` | `bool` | :heavy_check_mark: | True when more results exist after this page | +| `Previous` | `*string` | :heavy_minus_sign: | Opaque cursor token for the previous page (empty when none) | +| `Next` | `*string` | :heavy_minus_sign: | Opaque cursor token for the next page (empty when none) | +| `Data` | [][components.App](../../models/components/app.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listappsresponsedata.md b/internal/deployserverclient/docs/models/components/listappsresponsedata.md deleted file mode 100644 index 8a07dd0a..00000000 --- a/internal/deployserverclient/docs/models/components/listappsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListAppsResponseData - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.App](../../models/components/app.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md b/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md index 3154c0e4..2ce25a39 100644 --- a/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md +++ b/internal/deployserverclient/docs/models/components/listdeploymentsresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `Data` | [components.ListDeploymentsResponseData](../../models/components/listdeploymentsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Cursor` | [components.ListDeploymentsResponseCursor](../../models/components/listdeploymentsresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listdeploymentsresponsecursor.md b/internal/deployserverclient/docs/models/components/listdeploymentsresponsecursor.md new file mode 100644 index 00000000..2baeeaa9 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listdeploymentsresponsecursor.md @@ -0,0 +1,18 @@ +# ListDeploymentsResponseCursor + +Cursor pagination envelope. `next` and `previous` are opaque tokens +produced by the server; pass them back as `?cursor=` to fetch the +adjacent page. `hasMore` is `true` when more results exist after the +current page. `pageSize` echoes the page size used for this page. + + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Number of items requested for this page | +| `HasMore` | `bool` | :heavy_check_mark: | True when more results exist after this page | +| `Previous` | `*string` | :heavy_minus_sign: | Opaque cursor token for the previous page (empty when none) | +| `Next` | `*string` | :heavy_minus_sign: | Opaque cursor token for the next page (empty when none) | +| `Data` | [][components.DeploymentResource](../../models/components/deploymentresource.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md b/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md deleted file mode 100644 index d6d948fc..00000000 --- a/internal/deployserverclient/docs/models/components/listdeploymentsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListDeploymentsResponseData - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.DeploymentResource](../../models/components/deploymentresource.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestsresponse.md b/internal/deployserverclient/docs/models/components/listmanifestsresponse.md index ffc6e180..74d925c6 100644 --- a/internal/deployserverclient/docs/models/components/listmanifestsresponse.md +++ b/internal/deployserverclient/docs/models/components/listmanifestsresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `Data` | [components.ListManifestsResponseData](../../models/components/listmanifestsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Cursor` | [components.ListManifestsResponseCursor](../../models/components/listmanifestsresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestsresponsecursor.md b/internal/deployserverclient/docs/models/components/listmanifestsresponsecursor.md new file mode 100644 index 00000000..1c70dee7 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestsresponsecursor.md @@ -0,0 +1,18 @@ +# ListManifestsResponseCursor + +Cursor pagination envelope. `next` and `previous` are opaque tokens +produced by the server; pass them back as `?cursor=` to fetch the +adjacent page. `hasMore` is `true` when more results exist after the +current page. `pageSize` echoes the page size used for this page. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `PageSize` | `*int64` | :heavy_minus_sign: | Number of items requested for this page | +| `HasMore` | `bool` | :heavy_check_mark: | True when more results exist after this page | +| `Previous` | `*string` | :heavy_minus_sign: | Opaque cursor token for the previous page (empty when none) | +| `Next` | `*string` | :heavy_minus_sign: | Opaque cursor token for the next page (empty when none) | +| `Data` | [][components.Manifest](../../models/components/manifest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md b/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md deleted file mode 100644 index bdbe0093..00000000 --- a/internal/deployserverclient/docs/models/components/listmanifestsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListManifestsResponseData - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.Manifest](../../models/components/manifest.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md b/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md index 90ffe672..cdfc28ea 100644 --- a/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md +++ b/internal/deployserverclient/docs/models/components/listmanifestversionsresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `Data` | [components.ListManifestVersionsResponseData](../../models/components/listmanifestversionsresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Cursor` | [components.ListManifestVersionsResponseCursor](../../models/components/listmanifestversionsresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestversionsresponsecursor.md b/internal/deployserverclient/docs/models/components/listmanifestversionsresponsecursor.md new file mode 100644 index 00000000..3f829a1d --- /dev/null +++ b/internal/deployserverclient/docs/models/components/listmanifestversionsresponsecursor.md @@ -0,0 +1,18 @@ +# ListManifestVersionsResponseCursor + +Cursor pagination envelope. `next` and `previous` are opaque tokens +produced by the server; pass them back as `?cursor=` to fetch the +adjacent page. `hasMore` is `true` when more results exist after the +current page. `pageSize` echoes the page size used for this page. + + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Number of items requested for this page | +| `HasMore` | `bool` | :heavy_check_mark: | True when more results exist after this page | +| `Previous` | `*string` | :heavy_minus_sign: | Opaque cursor token for the previous page (empty when none) | +| `Next` | `*string` | :heavy_minus_sign: | Opaque cursor token for the next page (empty when none) | +| `Data` | [][components.ManifestVersion](../../models/components/manifestversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md b/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md deleted file mode 100644 index f5f82a0e..00000000 --- a/internal/deployserverclient/docs/models/components/listmanifestversionsresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ListManifestVersionsResponseData - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | -| `Items` | [][components.ManifestVersion](../../models/components/manifestversion.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/readvariablesresponse.md b/internal/deployserverclient/docs/models/components/readvariablesresponse.md index dca4b95b..56f1ad49 100644 --- a/internal/deployserverclient/docs/models/components/readvariablesresponse.md +++ b/internal/deployserverclient/docs/models/components/readvariablesresponse.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `Data` | [components.ReadVariablesResponseData](../../models/components/readvariablesresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Cursor` | [components.ReadVariablesResponseCursor](../../models/components/readvariablesresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/readvariablesresponsecursor.md b/internal/deployserverclient/docs/models/components/readvariablesresponsecursor.md new file mode 100644 index 00000000..cc317df0 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/readvariablesresponsecursor.md @@ -0,0 +1,18 @@ +# ReadVariablesResponseCursor + +Cursor pagination envelope. `next` and `previous` are opaque tokens +produced by the server; pass them back as `?cursor=` to fetch the +adjacent page. `hasMore` is `true` when more results exist after the +current page. `pageSize` echoes the page size used for this page. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `PageSize` | `*int64` | :heavy_minus_sign: | Number of items requested for this page | +| `HasMore` | `bool` | :heavy_check_mark: | True when more results exist after this page | +| `Previous` | `*string` | :heavy_minus_sign: | Opaque cursor token for the previous page (empty when none) | +| `Next` | `*string` | :heavy_minus_sign: | Opaque cursor token for the next page (empty when none) | +| `Data` | [][components.Variable](../../models/components/variable.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/readvariablesresponsedata.md b/internal/deployserverclient/docs/models/components/readvariablesresponsedata.md deleted file mode 100644 index a8e3d430..00000000 --- a/internal/deployserverclient/docs/models/components/readvariablesresponsedata.md +++ /dev/null @@ -1,13 +0,0 @@ -# ReadVariablesResponseData - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `Items` | [][components.Variable](../../models/components/variable.md) | :heavy_minus_sign: | N/A | -| `CurrentPage` | `*int64` | :heavy_minus_sign: | Current page number | -| `PreviousPage` | `*int64` | :heavy_minus_sign: | Previous page number | -| `NextPage` | `*int64` | :heavy_minus_sign: | Next page number | -| `TotalPages` | `*int64` | :heavy_minus_sign: | Total number of pages | -| `TotalCount` | `*int64` | :heavy_minus_sign: | Total number of items | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/variable.md b/internal/deployserverclient/docs/models/components/variable.md index 6fc3df29..3f697c82 100644 --- a/internal/deployserverclient/docs/models/components/variable.md +++ b/internal/deployserverclient/docs/models/components/variable.md @@ -3,10 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | -| `Key` | `string` | :heavy_check_mark: | Key of the variable | -| `Value` | `string` | :heavy_check_mark: | Value of the variable | -| `Description` | `*string` | :heavy_minus_sign: | Description of the variable | -| `Sensitive` | `bool` | :heavy_check_mark: | Whether the variable is sensitive | -| `ID` | `string` | :heavy_check_mark: | Unique identifier for the variable | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Key` | `string` | :heavy_check_mark: | Snake-case identifier (case-insensitive at the API boundary,
normalized to lowercase on storage to match `var.` in the
generated HCL). Either `MONEYCORP_API_KEY` or
`moneycorp_api_key` is accepted.
| +| `Value` | `string` | :heavy_check_mark: | Value of the variable. Always treated as sensitive: `value` is
redacted (`REDACTED`) on every read endpoint.
| +| `Description` | `*string` | :heavy_minus_sign: | Description of the variable | +| `ID` | `string` | :heavy_check_mark: | Unique identifier for the variable | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/variabledata.md b/internal/deployserverclient/docs/models/components/variabledata.md index e6528690..42c414ca 100644 --- a/internal/deployserverclient/docs/models/components/variabledata.md +++ b/internal/deployserverclient/docs/models/components/variabledata.md @@ -3,9 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | -| `Key` | `string` | :heavy_check_mark: | Key of the variable | -| `Value` | `string` | :heavy_check_mark: | Value of the variable | -| `Description` | `*string` | :heavy_minus_sign: | Description of the variable | -| `Sensitive` | `bool` | :heavy_check_mark: | Whether the variable is sensitive | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Key` | `string` | :heavy_check_mark: | Snake-case identifier (case-insensitive at the API boundary,
normalized to lowercase on storage to match `var.` in the
generated HCL). Either `MONEYCORP_API_KEY` or
`moneycorp_api_key` is accepted.
| +| `Value` | `string` | :heavy_check_mark: | Value of the variable. Always treated as sensitive: `value` is
redacted (`REDACTED`) on every read endpoint.
| +| `Description` | `*string` | :heavy_minus_sign: | Description of the variable | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listappsrequest.md b/internal/deployserverclient/docs/models/operations/listappsrequest.md index f78151ca..11c97674 100644 --- a/internal/deployserverclient/docs/models/operations/listappsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listappsrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md b/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md index 5fc4d1bb..2ee05d5a 100644 --- a/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listdeploymentsrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `AppID` | `*string` | :heavy_minus_sign: | N/A | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AppID` | `*string` | :heavy_minus_sign: | N/A | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md index 1c953fe5..115e9ccb 100644 --- a/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listmanifestsrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md b/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md index 05fdaa0e..7200d26c 100644 --- a/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md +++ b/internal/deployserverclient/docs/models/operations/listmanifestversionsrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ManifestID` | `string` | :heavy_check_mark: | N/A | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ManifestID` | `string` | :heavy_check_mark: | N/A | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readappvariablesrequest.md b/internal/deployserverclient/docs/models/operations/readappvariablesrequest.md index 997f2a80..369da6d9 100644 --- a/internal/deployserverclient/docs/models/operations/readappvariablesrequest.md +++ b/internal/deployserverclient/docs/models/operations/readappvariablesrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `PageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `PageSize` | `*int64` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/sdks/deployserver/README.md b/internal/deployserverclient/docs/sdks/deployserver/README.md index 5c60de63..e6cdb363 100644 --- a/internal/deployserverclient/docs/sdks/deployserver/README.md +++ b/internal/deployserverclient/docs/sdks/deployserver/README.md @@ -62,12 +62,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -431,13 +431,13 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -475,7 +475,6 @@ func main() { Variable: components.VariableData{ Key: "", Value: "", - Sensitive: false, }, }) if err != nil { @@ -696,12 +695,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -1006,13 +1005,13 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `manifestID` | `string` | :heavy_check_mark: | N/A | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `manifestID` | `string` | :heavy_check_mark: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -1161,13 +1160,13 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `appID` | `*string` | :heavy_minus_sign: | N/A | -| `pageNumber` | `*int64` | :heavy_minus_sign: | N/A | -| `pageSize` | `*int64` | :heavy_minus_sign: | N/A | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `appID` | `*string` | :heavy_minus_sign: | N/A | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of items to return on the first page. Capped at 100;
ignored when `cursor` is supplied (subsequent pages reuse the page
size baked into the cursor token). Defaults to 100.
| +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination token returned in `cursor.next` / `cursor.previous`
on the previous page. Pass it back unchanged to fetch the adjacent
page. Mutually exclusive with `pageSize` after the first request.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response diff --git a/internal/deployserverclient/models/components/createmanifestresponse.go b/internal/deployserverclient/models/components/createmanifestresponse.go index 921bf611..4b428503 100644 --- a/internal/deployserverclient/models/components/createmanifestresponse.go +++ b/internal/deployserverclient/models/components/createmanifestresponse.go @@ -8,59 +8,59 @@ import ( "time" ) -type CreateManifestResponseData struct { +type Data struct { ID string `json:"id"` Version int64 `json:"version"` Name string `json:"name"` CreatedAt time.Time `json:"createdAt"` } -func (c CreateManifestResponseData) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) +func (d Data) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) } -func (c *CreateManifestResponseData) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { +func (d *Data) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, nil); err != nil { return err } return nil } -func (c *CreateManifestResponseData) GetID() string { - if c == nil { +func (d *Data) GetID() string { + if d == nil { return "" } - return c.ID + return d.ID } -func (c *CreateManifestResponseData) GetVersion() int64 { - if c == nil { +func (d *Data) GetVersion() int64 { + if d == nil { return 0 } - return c.Version + return d.Version } -func (c *CreateManifestResponseData) GetName() string { - if c == nil { +func (d *Data) GetName() string { + if d == nil { return "" } - return c.Name + return d.Name } -func (c *CreateManifestResponseData) GetCreatedAt() time.Time { - if c == nil { +func (d *Data) GetCreatedAt() time.Time { + if d == nil { return time.Time{} } - return c.CreatedAt + return d.CreatedAt } type CreateManifestResponse struct { - Data CreateManifestResponseData `json:"data"` + Data Data `json:"data"` } -func (c *CreateManifestResponse) GetData() CreateManifestResponseData { +func (c *CreateManifestResponse) GetData() Data { if c == nil { - return CreateManifestResponseData{} + return Data{} } return c.Data } diff --git a/internal/deployserverclient/models/components/listappsresponse.go b/internal/deployserverclient/models/components/listappsresponse.go index d91d6e67..b8eb4b25 100644 --- a/internal/deployserverclient/models/components/listappsresponse.go +++ b/internal/deployserverclient/models/components/listappsresponse.go @@ -3,69 +3,64 @@ package components -type ListAppsResponseData struct { - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []App `json:"items"` +// ListAppsResponseCursor - Cursor pagination envelope. `next` and `previous` are opaque tokens +// produced by the server; pass them back as `?cursor=` to fetch the +// adjacent page. `hasMore` is `true` when more results exist after the +// current page. `pageSize` echoes the page size used for this page. +type ListAppsResponseCursor struct { + // Number of items requested for this page + PageSize *int64 `json:"pageSize,omitempty"` + // True when more results exist after this page + HasMore bool `json:"hasMore"` + // Opaque cursor token for the previous page (empty when none) + Previous *string `json:"previous,omitempty"` + // Opaque cursor token for the next page (empty when none) + Next *string `json:"next,omitempty"` + Data []App `json:"data"` } -func (l *ListAppsResponseData) GetCurrentPage() *int64 { +func (l *ListAppsResponseCursor) GetPageSize() *int64 { if l == nil { return nil } - return l.CurrentPage + return l.PageSize } -func (l *ListAppsResponseData) GetPreviousPage() *int64 { +func (l *ListAppsResponseCursor) GetHasMore() bool { if l == nil { - return nil - } - return l.PreviousPage -} - -func (l *ListAppsResponseData) GetNextPage() *int64 { - if l == nil { - return nil + return false } - return l.NextPage + return l.HasMore } -func (l *ListAppsResponseData) GetTotalPages() *int64 { +func (l *ListAppsResponseCursor) GetPrevious() *string { if l == nil { return nil } - return l.TotalPages + return l.Previous } -func (l *ListAppsResponseData) GetTotalCount() *int64 { +func (l *ListAppsResponseCursor) GetNext() *string { if l == nil { return nil } - return l.TotalCount + return l.Next } -func (l *ListAppsResponseData) GetItems() []App { +func (l *ListAppsResponseCursor) GetData() []App { if l == nil { return []App{} } - return l.Items + return l.Data } type ListAppsResponse struct { - Data ListAppsResponseData `json:"data"` + Cursor ListAppsResponseCursor `json:"cursor"` } -func (l *ListAppsResponse) GetData() ListAppsResponseData { +func (l *ListAppsResponse) GetCursor() ListAppsResponseCursor { if l == nil { - return ListAppsResponseData{} + return ListAppsResponseCursor{} } - return l.Data + return l.Cursor } diff --git a/internal/deployserverclient/models/components/listdeploymentsresponse.go b/internal/deployserverclient/models/components/listdeploymentsresponse.go index 2f8844f1..e6a14515 100644 --- a/internal/deployserverclient/models/components/listdeploymentsresponse.go +++ b/internal/deployserverclient/models/components/listdeploymentsresponse.go @@ -3,69 +3,64 @@ package components -type ListDeploymentsResponseData struct { - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []DeploymentResource `json:"items"` +// ListDeploymentsResponseCursor - Cursor pagination envelope. `next` and `previous` are opaque tokens +// produced by the server; pass them back as `?cursor=` to fetch the +// adjacent page. `hasMore` is `true` when more results exist after the +// current page. `pageSize` echoes the page size used for this page. +type ListDeploymentsResponseCursor struct { + // Number of items requested for this page + PageSize *int64 `json:"pageSize,omitempty"` + // True when more results exist after this page + HasMore bool `json:"hasMore"` + // Opaque cursor token for the previous page (empty when none) + Previous *string `json:"previous,omitempty"` + // Opaque cursor token for the next page (empty when none) + Next *string `json:"next,omitempty"` + Data []DeploymentResource `json:"data"` } -func (l *ListDeploymentsResponseData) GetCurrentPage() *int64 { +func (l *ListDeploymentsResponseCursor) GetPageSize() *int64 { if l == nil { return nil } - return l.CurrentPage + return l.PageSize } -func (l *ListDeploymentsResponseData) GetPreviousPage() *int64 { +func (l *ListDeploymentsResponseCursor) GetHasMore() bool { if l == nil { - return nil - } - return l.PreviousPage -} - -func (l *ListDeploymentsResponseData) GetNextPage() *int64 { - if l == nil { - return nil + return false } - return l.NextPage + return l.HasMore } -func (l *ListDeploymentsResponseData) GetTotalPages() *int64 { +func (l *ListDeploymentsResponseCursor) GetPrevious() *string { if l == nil { return nil } - return l.TotalPages + return l.Previous } -func (l *ListDeploymentsResponseData) GetTotalCount() *int64 { +func (l *ListDeploymentsResponseCursor) GetNext() *string { if l == nil { return nil } - return l.TotalCount + return l.Next } -func (l *ListDeploymentsResponseData) GetItems() []DeploymentResource { +func (l *ListDeploymentsResponseCursor) GetData() []DeploymentResource { if l == nil { return []DeploymentResource{} } - return l.Items + return l.Data } type ListDeploymentsResponse struct { - Data ListDeploymentsResponseData `json:"data"` + Cursor ListDeploymentsResponseCursor `json:"cursor"` } -func (l *ListDeploymentsResponse) GetData() ListDeploymentsResponseData { +func (l *ListDeploymentsResponse) GetCursor() ListDeploymentsResponseCursor { if l == nil { - return ListDeploymentsResponseData{} + return ListDeploymentsResponseCursor{} } - return l.Data + return l.Cursor } diff --git a/internal/deployserverclient/models/components/listmanifestsresponse.go b/internal/deployserverclient/models/components/listmanifestsresponse.go index 4c54c4fc..2911e50d 100644 --- a/internal/deployserverclient/models/components/listmanifestsresponse.go +++ b/internal/deployserverclient/models/components/listmanifestsresponse.go @@ -3,69 +3,64 @@ package components -type ListManifestsResponseData struct { - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []Manifest `json:"items"` +// ListManifestsResponseCursor - Cursor pagination envelope. `next` and `previous` are opaque tokens +// produced by the server; pass them back as `?cursor=` to fetch the +// adjacent page. `hasMore` is `true` when more results exist after the +// current page. `pageSize` echoes the page size used for this page. +type ListManifestsResponseCursor struct { + // Number of items requested for this page + PageSize *int64 `json:"pageSize,omitempty"` + // True when more results exist after this page + HasMore bool `json:"hasMore"` + // Opaque cursor token for the previous page (empty when none) + Previous *string `json:"previous,omitempty"` + // Opaque cursor token for the next page (empty when none) + Next *string `json:"next,omitempty"` + Data []Manifest `json:"data"` } -func (l *ListManifestsResponseData) GetCurrentPage() *int64 { +func (l *ListManifestsResponseCursor) GetPageSize() *int64 { if l == nil { return nil } - return l.CurrentPage + return l.PageSize } -func (l *ListManifestsResponseData) GetPreviousPage() *int64 { +func (l *ListManifestsResponseCursor) GetHasMore() bool { if l == nil { - return nil - } - return l.PreviousPage -} - -func (l *ListManifestsResponseData) GetNextPage() *int64 { - if l == nil { - return nil + return false } - return l.NextPage + return l.HasMore } -func (l *ListManifestsResponseData) GetTotalPages() *int64 { +func (l *ListManifestsResponseCursor) GetPrevious() *string { if l == nil { return nil } - return l.TotalPages + return l.Previous } -func (l *ListManifestsResponseData) GetTotalCount() *int64 { +func (l *ListManifestsResponseCursor) GetNext() *string { if l == nil { return nil } - return l.TotalCount + return l.Next } -func (l *ListManifestsResponseData) GetItems() []Manifest { +func (l *ListManifestsResponseCursor) GetData() []Manifest { if l == nil { return []Manifest{} } - return l.Items + return l.Data } type ListManifestsResponse struct { - Data ListManifestsResponseData `json:"data"` + Cursor ListManifestsResponseCursor `json:"cursor"` } -func (l *ListManifestsResponse) GetData() ListManifestsResponseData { +func (l *ListManifestsResponse) GetCursor() ListManifestsResponseCursor { if l == nil { - return ListManifestsResponseData{} + return ListManifestsResponseCursor{} } - return l.Data + return l.Cursor } diff --git a/internal/deployserverclient/models/components/listmanifestversionsresponse.go b/internal/deployserverclient/models/components/listmanifestversionsresponse.go index 287c29f3..6d02f172 100644 --- a/internal/deployserverclient/models/components/listmanifestversionsresponse.go +++ b/internal/deployserverclient/models/components/listmanifestversionsresponse.go @@ -3,69 +3,64 @@ package components -type ListManifestVersionsResponseData struct { - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` - Items []ManifestVersion `json:"items"` +// ListManifestVersionsResponseCursor - Cursor pagination envelope. `next` and `previous` are opaque tokens +// produced by the server; pass them back as `?cursor=` to fetch the +// adjacent page. `hasMore` is `true` when more results exist after the +// current page. `pageSize` echoes the page size used for this page. +type ListManifestVersionsResponseCursor struct { + // Number of items requested for this page + PageSize *int64 `json:"pageSize,omitempty"` + // True when more results exist after this page + HasMore bool `json:"hasMore"` + // Opaque cursor token for the previous page (empty when none) + Previous *string `json:"previous,omitempty"` + // Opaque cursor token for the next page (empty when none) + Next *string `json:"next,omitempty"` + Data []ManifestVersion `json:"data"` } -func (l *ListManifestVersionsResponseData) GetCurrentPage() *int64 { +func (l *ListManifestVersionsResponseCursor) GetPageSize() *int64 { if l == nil { return nil } - return l.CurrentPage + return l.PageSize } -func (l *ListManifestVersionsResponseData) GetPreviousPage() *int64 { +func (l *ListManifestVersionsResponseCursor) GetHasMore() bool { if l == nil { - return nil - } - return l.PreviousPage -} - -func (l *ListManifestVersionsResponseData) GetNextPage() *int64 { - if l == nil { - return nil + return false } - return l.NextPage + return l.HasMore } -func (l *ListManifestVersionsResponseData) GetTotalPages() *int64 { +func (l *ListManifestVersionsResponseCursor) GetPrevious() *string { if l == nil { return nil } - return l.TotalPages + return l.Previous } -func (l *ListManifestVersionsResponseData) GetTotalCount() *int64 { +func (l *ListManifestVersionsResponseCursor) GetNext() *string { if l == nil { return nil } - return l.TotalCount + return l.Next } -func (l *ListManifestVersionsResponseData) GetItems() []ManifestVersion { +func (l *ListManifestVersionsResponseCursor) GetData() []ManifestVersion { if l == nil { return []ManifestVersion{} } - return l.Items + return l.Data } type ListManifestVersionsResponse struct { - Data ListManifestVersionsResponseData `json:"data"` + Cursor ListManifestVersionsResponseCursor `json:"cursor"` } -func (l *ListManifestVersionsResponse) GetData() ListManifestVersionsResponseData { +func (l *ListManifestVersionsResponse) GetCursor() ListManifestVersionsResponseCursor { if l == nil { - return ListManifestVersionsResponseData{} + return ListManifestVersionsResponseCursor{} } - return l.Data + return l.Cursor } diff --git a/internal/deployserverclient/models/components/readvariablesresponse.go b/internal/deployserverclient/models/components/readvariablesresponse.go index f9f233b9..c707e31e 100644 --- a/internal/deployserverclient/models/components/readvariablesresponse.go +++ b/internal/deployserverclient/models/components/readvariablesresponse.go @@ -3,69 +3,64 @@ package components -type ReadVariablesResponseData struct { - Items []Variable `json:"items,omitempty"` - // Current page number - CurrentPage *int64 `json:"currentPage,omitempty"` - // Previous page number - PreviousPage *int64 `json:"previousPage,omitempty"` - // Next page number - NextPage *int64 `json:"nextPage,omitempty"` - // Total number of pages - TotalPages *int64 `json:"totalPages,omitempty"` - // Total number of items - TotalCount *int64 `json:"totalCount,omitempty"` +// ReadVariablesResponseCursor - Cursor pagination envelope. `next` and `previous` are opaque tokens +// produced by the server; pass them back as `?cursor=` to fetch the +// adjacent page. `hasMore` is `true` when more results exist after the +// current page. `pageSize` echoes the page size used for this page. +type ReadVariablesResponseCursor struct { + // Number of items requested for this page + PageSize *int64 `json:"pageSize,omitempty"` + // True when more results exist after this page + HasMore bool `json:"hasMore"` + // Opaque cursor token for the previous page (empty when none) + Previous *string `json:"previous,omitempty"` + // Opaque cursor token for the next page (empty when none) + Next *string `json:"next,omitempty"` + Data []Variable `json:"data"` } -func (r *ReadVariablesResponseData) GetItems() []Variable { +func (r *ReadVariablesResponseCursor) GetPageSize() *int64 { if r == nil { return nil } - return r.Items + return r.PageSize } -func (r *ReadVariablesResponseData) GetCurrentPage() *int64 { +func (r *ReadVariablesResponseCursor) GetHasMore() bool { if r == nil { - return nil + return false } - return r.CurrentPage + return r.HasMore } -func (r *ReadVariablesResponseData) GetPreviousPage() *int64 { +func (r *ReadVariablesResponseCursor) GetPrevious() *string { if r == nil { return nil } - return r.PreviousPage + return r.Previous } -func (r *ReadVariablesResponseData) GetNextPage() *int64 { +func (r *ReadVariablesResponseCursor) GetNext() *string { if r == nil { return nil } - return r.NextPage + return r.Next } -func (r *ReadVariablesResponseData) GetTotalPages() *int64 { +func (r *ReadVariablesResponseCursor) GetData() []Variable { if r == nil { - return nil + return []Variable{} } - return r.TotalPages -} - -func (r *ReadVariablesResponseData) GetTotalCount() *int64 { - if r == nil { - return nil - } - return r.TotalCount + return r.Data } type ReadVariablesResponse struct { - Data ReadVariablesResponseData `json:"data"` + Cursor ReadVariablesResponseCursor `json:"cursor"` } -func (r *ReadVariablesResponse) GetData() ReadVariablesResponseData { +func (r *ReadVariablesResponse) GetCursor() ReadVariablesResponseCursor { if r == nil { - return ReadVariablesResponseData{} + return ReadVariablesResponseCursor{} } - return r.Data + return r.Cursor } diff --git a/internal/deployserverclient/models/components/variable.go b/internal/deployserverclient/models/components/variable.go index 839f2ea7..b0a97d2a 100644 --- a/internal/deployserverclient/models/components/variable.go +++ b/internal/deployserverclient/models/components/variable.go @@ -4,14 +4,18 @@ package components type Variable struct { - // Key of the variable + // Snake-case identifier (case-insensitive at the API boundary, + // normalized to lowercase on storage to match `var.` in the + // generated HCL). Either `MONEYCORP_API_KEY` or + // `moneycorp_api_key` is accepted. + // Key string `json:"key"` - // Value of the variable + // Value of the variable. Always treated as sensitive: `value` is + // redacted (`REDACTED`) on every read endpoint. + // Value string `json:"value"` // Description of the variable Description *string `json:"description,omitempty"` - // Whether the variable is sensitive - Sensitive bool `json:"sensitive"` // Unique identifier for the variable ID string `json:"id"` } @@ -37,13 +41,6 @@ func (v *Variable) GetDescription() *string { return v.Description } -func (v *Variable) GetSensitive() bool { - if v == nil { - return false - } - return v.Sensitive -} - func (v *Variable) GetID() string { if v == nil { return "" diff --git a/internal/deployserverclient/models/components/variabledata.go b/internal/deployserverclient/models/components/variabledata.go index 9ca7263b..b1cfac06 100644 --- a/internal/deployserverclient/models/components/variabledata.go +++ b/internal/deployserverclient/models/components/variabledata.go @@ -4,14 +4,18 @@ package components type VariableData struct { - // Key of the variable + // Snake-case identifier (case-insensitive at the API boundary, + // normalized to lowercase on storage to match `var.` in the + // generated HCL). Either `MONEYCORP_API_KEY` or + // `moneycorp_api_key` is accepted. + // Key string `json:"key"` - // Value of the variable + // Value of the variable. Always treated as sensitive: `value` is + // redacted (`REDACTED`) on every read endpoint. + // Value string `json:"value"` // Description of the variable Description *string `json:"description,omitempty"` - // Whether the variable is sensitive - Sensitive bool `json:"sensitive"` } func (v *VariableData) GetKey() string { @@ -34,10 +38,3 @@ func (v *VariableData) GetDescription() *string { } return v.Description } - -func (v *VariableData) GetSensitive() bool { - if v == nil { - return false - } - return v.Sensitive -} diff --git a/internal/deployserverclient/models/operations/listapps.go b/internal/deployserverclient/models/operations/listapps.go index 6f451a51..35573e66 100644 --- a/internal/deployserverclient/models/operations/listapps.go +++ b/internal/deployserverclient/models/operations/listapps.go @@ -8,22 +8,30 @@ import ( ) type ListAppsRequest struct { - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Maximum number of items to return on the first page. Capped at 100; + // ignored when `cursor` is supplied (subsequent pages reuse the page + // size baked into the cursor token). Defaults to 100. + // + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Opaque pagination token returned in `cursor.next` / `cursor.previous` + // on the previous page. Pass it back unchanged to fetch the adjacent + // page. Mutually exclusive with `pageSize` after the first request. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` } -func (l *ListAppsRequest) GetPageNumber() *int64 { +func (l *ListAppsRequest) GetPageSize() *int64 { if l == nil { return nil } - return l.PageNumber + return l.PageSize } -func (l *ListAppsRequest) GetPageSize() *int64 { +func (l *ListAppsRequest) GetCursor() *string { if l == nil { return nil } - return l.PageSize + return l.Cursor } type ListAppsResponse struct { diff --git a/internal/deployserverclient/models/operations/listdeployments.go b/internal/deployserverclient/models/operations/listdeployments.go index ddae0d51..6c51c65b 100644 --- a/internal/deployserverclient/models/operations/listdeployments.go +++ b/internal/deployserverclient/models/operations/listdeployments.go @@ -8,9 +8,17 @@ import ( ) type ListDeploymentsRequest struct { - AppID *string `queryParam:"style=form,explode=true,name=appId"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + AppID *string `queryParam:"style=form,explode=true,name=appId"` + // Maximum number of items to return on the first page. Capped at 100; + // ignored when `cursor` is supplied (subsequent pages reuse the page + // size baked into the cursor token). Defaults to 100. + // + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Opaque pagination token returned in `cursor.next` / `cursor.previous` + // on the previous page. Pass it back unchanged to fetch the adjacent + // page. Mutually exclusive with `pageSize` after the first request. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` } func (l *ListDeploymentsRequest) GetAppID() *string { @@ -20,18 +28,18 @@ func (l *ListDeploymentsRequest) GetAppID() *string { return l.AppID } -func (l *ListDeploymentsRequest) GetPageNumber() *int64 { +func (l *ListDeploymentsRequest) GetPageSize() *int64 { if l == nil { return nil } - return l.PageNumber + return l.PageSize } -func (l *ListDeploymentsRequest) GetPageSize() *int64 { +func (l *ListDeploymentsRequest) GetCursor() *string { if l == nil { return nil } - return l.PageSize + return l.Cursor } type ListDeploymentsResponse struct { diff --git a/internal/deployserverclient/models/operations/listmanifests.go b/internal/deployserverclient/models/operations/listmanifests.go index 7200ea57..fb5f4953 100644 --- a/internal/deployserverclient/models/operations/listmanifests.go +++ b/internal/deployserverclient/models/operations/listmanifests.go @@ -8,22 +8,30 @@ import ( ) type ListManifestsRequest struct { - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Maximum number of items to return on the first page. Capped at 100; + // ignored when `cursor` is supplied (subsequent pages reuse the page + // size baked into the cursor token). Defaults to 100. + // + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Opaque pagination token returned in `cursor.next` / `cursor.previous` + // on the previous page. Pass it back unchanged to fetch the adjacent + // page. Mutually exclusive with `pageSize` after the first request. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` } -func (l *ListManifestsRequest) GetPageNumber() *int64 { +func (l *ListManifestsRequest) GetPageSize() *int64 { if l == nil { return nil } - return l.PageNumber + return l.PageSize } -func (l *ListManifestsRequest) GetPageSize() *int64 { +func (l *ListManifestsRequest) GetCursor() *string { if l == nil { return nil } - return l.PageSize + return l.Cursor } type ListManifestsResponse struct { diff --git a/internal/deployserverclient/models/operations/listmanifestversions.go b/internal/deployserverclient/models/operations/listmanifestversions.go index f74af98d..383a02ec 100644 --- a/internal/deployserverclient/models/operations/listmanifestversions.go +++ b/internal/deployserverclient/models/operations/listmanifestversions.go @@ -9,8 +9,16 @@ import ( type ListManifestVersionsRequest struct { ManifestID string `pathParam:"style=simple,explode=false,name=manifestId"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Maximum number of items to return on the first page. Capped at 100; + // ignored when `cursor` is supplied (subsequent pages reuse the page + // size baked into the cursor token). Defaults to 100. + // + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Opaque pagination token returned in `cursor.next` / `cursor.previous` + // on the previous page. Pass it back unchanged to fetch the adjacent + // page. Mutually exclusive with `pageSize` after the first request. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` } func (l *ListManifestVersionsRequest) GetManifestID() string { @@ -20,18 +28,18 @@ func (l *ListManifestVersionsRequest) GetManifestID() string { return l.ManifestID } -func (l *ListManifestVersionsRequest) GetPageNumber() *int64 { +func (l *ListManifestVersionsRequest) GetPageSize() *int64 { if l == nil { return nil } - return l.PageNumber + return l.PageSize } -func (l *ListManifestVersionsRequest) GetPageSize() *int64 { +func (l *ListManifestVersionsRequest) GetCursor() *string { if l == nil { return nil } - return l.PageSize + return l.Cursor } type ListManifestVersionsResponse struct { diff --git a/internal/deployserverclient/models/operations/readappvariables.go b/internal/deployserverclient/models/operations/readappvariables.go index f642a034..b273ef6b 100644 --- a/internal/deployserverclient/models/operations/readappvariables.go +++ b/internal/deployserverclient/models/operations/readappvariables.go @@ -8,9 +8,17 @@ import ( ) type ReadAppVariablesRequest struct { - ID string `pathParam:"style=simple,explode=false,name=id"` - PageNumber *int64 `queryParam:"style=form,explode=true,name=pageNumber"` - PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + ID string `pathParam:"style=simple,explode=false,name=id"` + // Maximum number of items to return on the first page. Capped at 100; + // ignored when `cursor` is supplied (subsequent pages reuse the page + // size baked into the cursor token). Defaults to 100. + // + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Opaque pagination token returned in `cursor.next` / `cursor.previous` + // on the previous page. Pass it back unchanged to fetch the adjacent + // page. Mutually exclusive with `pageSize` after the first request. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` } func (r *ReadAppVariablesRequest) GetID() string { @@ -20,18 +28,18 @@ func (r *ReadAppVariablesRequest) GetID() string { return r.ID } -func (r *ReadAppVariablesRequest) GetPageNumber() *int64 { +func (r *ReadAppVariablesRequest) GetPageSize() *int64 { if r == nil { return nil } - return r.PageNumber + return r.PageSize } -func (r *ReadAppVariablesRequest) GetPageSize() *int64 { +func (r *ReadAppVariablesRequest) GetCursor() *string { if r == nil { return nil } - return r.PageSize + return r.Cursor } type ReadAppVariablesResponse struct { diff --git a/openapi/deployserver.yaml b/openapi/deployserver.yaml index b7c1ba2a..d4bef3d3 100644 --- a/openapi/deployserver.yaml +++ b/openapi/deployserver.yaml @@ -2,41 +2,35 @@ openapi: 3.1.0 info: title: Terraform HCP Proxy API contact: {} - version: "0.1.0" + version: 0.1.0 servers: -- url: https://deploy.formance.cloud - description: Production server -- url: https://deploy-server.staging.formance.cloud - description: Staging server -- url: http://localhost:8080 - description: Local server + - url: https://deploy.formance.cloud + description: Production server + - url: https://deploy-server.staging.formance.cloud + description: Staging server + - url: http://localhost:8080 + description: Local server paths: /apps: get: summary: List organization apps operationId: listApps parameters: - - name: pageNumber - in: query - schema: - type: integer - - name: pageSize - in: query - schema: - type: integer + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': description: Apps retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ListAppsResponse" + $ref: '#/components/schemas/ListAppsResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create a new app operationId: createApp @@ -45,79 +39,79 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/CreateAppRequest" + $ref: '#/components/schemas/CreateAppRequest' responses: - "201": + '201': description: App created successfully content: application/json: schema: - $ref: "#/components/schemas/AppResponse" + $ref: '#/components/schemas/AppResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /apps/{id}: put: summary: Update an app operationId: updateApp parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/UpdateAppRequest" + $ref: '#/components/schemas/UpdateAppRequest' responses: - "204": + '204': description: App updated successfully default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' get: summary: read app details operationId: readApp parameters: - - name: id - in: path - required: true - schema: - type: string - - name: include - in: query - required: false - description: | - Comma-separated list of related resources to include. - - `state`: Include the current Terraform workspace state. - schema: - type: array - items: + - name: id + in: path + required: true + schema: type: string - enum: - - state + - name: include + in: query + required: false + description: | + Comma-separated list of related resources to include. + - `state`: Include the current Terraform workspace state. + schema: + type: array + items: + type: string + enum: + - state responses: - "200": + '200': description: App details retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/AppResponse" + $ref: '#/components/schemas/AppResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' delete: summary: Delete an app description: | @@ -132,22 +126,22 @@ paths: `?wait=true` to block until the destroy reaches a terminal status. operationId: deleteApp parameters: - - name: id - in: path - required: true - schema: - type: string - - name: wait - in: query - required: false - description: | - When `true`, the call blocks until the destroy deployment reaches a - terminal status. Default `false` (returns 202 Accepted). - schema: - type: boolean - default: false + - name: id + in: path + required: true + schema: + type: string + - name: wait + in: query + required: false + description: | + When `true`, the call blocks until the destroy deployment reaches a + terminal status. Default `false` (returns 202 Accepted). + schema: + type: boolean + default: false responses: - "202": + '202': description: | Soft-delete accepted. Cleanup runs asynchronously. The `Location` header points at the destroy deployment if one was @@ -155,8 +149,8 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/DeleteAppResponse" - "204": + $ref: '#/components/schemas/DeleteAppResponse' + '204': description: | Returned when `wait=true` and the destroy reached a terminal status successfully (or when no destroy was needed at all). @@ -165,7 +159,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /apps/{id}/manifest: put: summary: Bind an app to a manifest @@ -174,151 +168,145 @@ paths: Updates the app's `manifest_id` pointer. Idempotent — re-binding to the same id is a no-op; rebinding to a different id moves the pointer. parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/AttachManifestRequest" + $ref: '#/components/schemas/AttachManifestRequest' responses: - "204": + '204': description: App bound to manifest - "400": + '400': description: manifestId missing or empty content: application/json: schema: - $ref: "#/components/schemas/Error" - "404": + $ref: '#/components/schemas/Error' + '404': description: Manifest not found content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' delete: summary: Unbind an app from its manifest operationId: detachAppManifest description: Clears the app's `manifest_id` pointer. Idempotent. parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string responses: - "204": + '204': description: App unbound from manifest default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /apps/{id}/variables: get: summary: Get all variables of an app operationId: readAppVariables parameters: - - name: id - in: path - required: true - schema: - type: string - - name: pageNumber - in: query - schema: - type: integer - - name: pageSize - in: query - schema: - type: integer + - name: id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': description: App variables retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ReadVariablesResponse" + $ref: '#/components/schemas/ReadVariablesResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create variable for an app operationId: createAppVariable parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/CreateVariableRequest" + $ref: '#/components/schemas/CreateVariableRequest' responses: - "201": + '201': description: Variable created successfully content: application/json: schema: - $ref: "#/components/schemas/CreateVariableResponse" + $ref: '#/components/schemas/CreateVariableResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /apps/{id}/variables/{variableId}: delete: summary: Delete a variable from an app operationId: deleteAppVariable parameters: - - name: id - in: path - required: true - schema: - type: string - - name: variableId - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string + - name: variableId + in: path + required: true + schema: + type: string responses: - "204": + '204': description: Variable deleted successfully default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /manifests: post: summary: Create a new manifest operationId: createManifest parameters: - - name: name - in: query - required: true - schema: - type: string - description: Name for the manifest + - name: name + in: query + required: true + schema: + type: string + description: Name for the manifest requestBody: required: true content: @@ -332,66 +320,60 @@ paths: type: object description: JSON manifest content responses: - "201": + '201': description: Manifest created successfully content: application/json: schema: - $ref: "#/components/schemas/CreateManifestResponse" + $ref: '#/components/schemas/CreateManifestResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' get: summary: List manifests in the organization operationId: listManifests parameters: - - name: pageNumber - in: query - schema: - type: integer - - name: pageSize - in: query - schema: - type: integer + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': description: Manifests retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ListManifestsResponse" + $ref: '#/components/schemas/ListManifestsResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /manifests/{manifestId}: get: summary: Read a manifest operationId: readManifest parameters: - - name: manifestId - in: path - required: true - schema: - type: string - - name: include - in: query - required: false - schema: - type: string - description: Comma-separated includes (e.g. "latest" to embed latest version content) + - name: manifestId + in: path + required: true + schema: + type: string + - name: include + in: query + required: false + schema: + type: string + description: Comma-separated includes (e.g. "latest" to embed latest version content) responses: - "200": + '200': description: Manifest retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ManifestResponse" + $ref: '#/components/schemas/ManifestResponse' application/gzip: schema: type: string @@ -402,69 +384,69 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' patch: summary: Update manifest metadata operationId: updateManifest parameters: - - name: manifestId - in: path - required: true - schema: - type: string + - name: manifestId + in: path + required: true + schema: + type: string requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/UpdateManifestRequest" + $ref: '#/components/schemas/UpdateManifestRequest' responses: - "200": + '200': description: Manifest updated successfully content: application/json: schema: - $ref: "#/components/schemas/ManifestResponse" + $ref: '#/components/schemas/ManifestResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' delete: summary: Delete a manifest and all its versions operationId: deleteManifest parameters: - - name: manifestId - in: path - required: true - schema: - type: string + - name: manifestId + in: path + required: true + schema: + type: string responses: - "204": + '204': description: Manifest deleted successfully - "409": + '409': description: Manifest is still referenced by deployments content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /manifests/{manifestId}/versions: post: summary: Push a new version of a manifest operationId: pushManifestVersion parameters: - - name: manifestId - in: path - required: true - schema: - type: string + - name: manifestId + in: path + required: true + schema: + type: string requestBody: required: true content: @@ -478,83 +460,77 @@ paths: type: object description: JSON manifest content responses: - "201": + '201': description: Manifest version created successfully content: application/json: schema: - $ref: "#/components/schemas/ManifestVersionResponse" + $ref: '#/components/schemas/ManifestVersionResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' get: summary: List versions of a manifest operationId: listManifestVersions parameters: - - name: manifestId - in: path - required: true - schema: - type: string - - name: pageNumber - in: query - schema: - type: integer - - name: pageSize - in: query - schema: - type: integer + - name: manifestId + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': description: Manifest versions retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ListManifestVersionsResponse" + $ref: '#/components/schemas/ListManifestVersionsResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /manifests/{manifestId}/versions/{version}: get: summary: Get a specific manifest version with content operationId: readManifestVersion parameters: - - name: manifestId - in: path - required: true - schema: - type: string - - name: version - in: path - required: true - description: Version number or "latest" - schema: - type: string - - name: accept - in: header - required: false - description: | - The desired response format. - - `application/json`: Returns the version metadata and content in JSON format. - - `application/x-yaml`: Returns the raw manifest content as YAML. - schema: - type: string - enum: - - application/json - - application/x-yaml + - name: manifestId + in: path + required: true + schema: + type: string + - name: version + in: path + required: true + description: Version number or "latest" + schema: + type: string + - name: accept + in: header + required: false + description: | + The desired response format. + - `application/json`: Returns the version metadata and content in JSON format. + - `application/x-yaml`: Returns the raw manifest content as YAML. + schema: + type: string + enum: + - application/json + - application/x-yaml responses: - "200": + '200': description: Manifest version retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ManifestVersionResponse" + $ref: '#/components/schemas/ManifestVersionResponse' application/x-yaml: schema: type: string @@ -565,7 +541,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /deployments: post: summary: Create a deployment (triggers a run) @@ -575,92 +551,86 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/CreateDeploymentRequest" + $ref: '#/components/schemas/CreateDeploymentRequest' responses: - "201": + '201': description: Deployment created successfully content: application/json: schema: - $ref: "#/components/schemas/DeploymentResponse" + $ref: '#/components/schemas/DeploymentResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' get: summary: List deployments operationId: listDeployments parameters: - - name: appId - in: query - schema: - type: string - - name: pageNumber - in: query - schema: - type: integer - - name: pageSize - in: query - schema: - type: integer + - name: appId + in: query + schema: + type: string + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': description: Deployments retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ListDeploymentsResponse" + $ref: '#/components/schemas/ListDeploymentsResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /deployments/{deploymentId}: get: summary: Get a single deployment operationId: readDeployment parameters: - - name: deploymentId - in: path - required: true - schema: - type: string - - name: accept - in: header - required: false - description: | - The desired response format. - - `application/json`: Returns the deployment metadata in JSON format. - - `application/gzip`: Returns the full configuration version as a gzip archive. - - `application/yaml`: Returns the original application manifest content. - schema: - type: string - enum: - - application/json - - application/gzip - - application/yaml - - name: include - in: query - required: false - description: | - Comma-separated list of related resources to include. - - `state`: Include the Terraform state produced by this deployment's run. - schema: - type: array - items: + - name: deploymentId + in: path + required: true + schema: + type: string + - name: accept + in: header + required: false + description: | + The desired response format. + - `application/json`: Returns the deployment metadata in JSON format. + - `application/gzip`: Returns the full configuration version as a gzip archive. + - `application/yaml`: Returns the original application manifest content. + schema: type: string enum: - - state + - application/json + - application/gzip + - application/yaml + - name: include + in: query + required: false + description: | + Comma-separated list of related resources to include. + - `state`: Include the Terraform state produced by this deployment's run. + schema: + type: array + items: + type: string + enum: + - state responses: - "200": + '200': description: Deployment retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/DeploymentResponse" + $ref: '#/components/schemas/DeploymentResponse' application/gzip: schema: type: string @@ -676,38 +646,61 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /deployments/{deploymentId}/logs: get: summary: Get run logs for a deployment operationId: readDeploymentLogs parameters: - - name: deploymentId - in: path - required: true - schema: - type: string + - name: deploymentId + in: path + required: true + schema: + type: string responses: - "200": + '200': description: Deployment logs retrieved successfully content: application/json: schema: - $ref: "#/components/schemas/ReadLogsResponse" + $ref: '#/components/schemas/ReadLogsResponse' default: description: Error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' components: + parameters: + PageSize: + name: pageSize + in: query + required: false + description: | + Maximum number of items to return on the first page. Capped at 100; + ignored when `cursor` is supplied (subsequent pages reuse the page + size baked into the cursor token). Defaults to 100. + schema: + type: integer + minimum: 1 + maximum: 100 + Cursor: + name: cursor + in: query + required: false + description: | + Opaque pagination token returned in `cursor.next` / `cursor.previous` + on the previous page. Pass it back unchanged to fetch the adjacent + page. Mutually exclusive with `pageSize` after the first request. + schema: + type: string schemas: Application: - $ref: "./schemas/application.json" + $ref: '#/components/schemas/application' State: type: object required: - - stack + - stack properties: stack: type: object @@ -726,7 +719,7 @@ components: ReadManifestResponse: type: object required: - - data + - data properties: data: type: string @@ -738,13 +731,13 @@ components: data: type: array items: - $ref: "#/components/schemas/Log" + $ref: '#/components/schemas/Log' Log: type: object required: - - message - - timestamp - - module + - message + - timestamp + - module properties: message: type: string @@ -760,9 +753,9 @@ components: type: object description: Detailed log message required: - - severity - - detail - - summary + - severity + - detail + - summary properties: severity: type: string @@ -772,52 +765,57 @@ components: summary: type: string description: Brief summary of the log message - PaginationResponse: + Cursor: type: object + description: | + Cursor pagination envelope. `next` and `previous` are opaque tokens + produced by the server; pass them back as `?cursor=` to fetch the + adjacent page. `hasMore` is `true` when more results exist after the + current page. `pageSize` echoes the page size used for this page. + required: + - hasMore + - data properties: - currentPage: - type: integer - description: Current page number - previousPage: + pageSize: type: integer - description: Previous page number - nextPage: - type: integer - description: Next page number - totalPages: - type: integer - description: Total number of pages - totalCount: - type: integer - description: Total number of items + description: Number of items requested for this page + hasMore: + type: boolean + description: True when more results exist after this page + previous: + type: string + description: Opaque cursor token for the previous page (empty when none) + next: + type: string + description: Opaque cursor token for the next page (empty when none) ListAppsResponse: type: object required: - - data + - cursor properties: - data: + cursor: allOf: - - $ref: "#/components/schemas/PaginationResponse" - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: "#/components/schemas/App" + - $ref: '#/components/schemas/Cursor' + - type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/App' AppResponse: type: object required: - - data + - data properties: data: - $ref: "#/components/schemas/App" + $ref: '#/components/schemas/App' App: type: object required: - - id - - name + - id + - name properties: id: type: string @@ -832,9 +830,9 @@ components: type: string description: Stack region ID (set when the app's stack lives in a specific region) state: - $ref: "#/components/schemas/State" + $ref: '#/components/schemas/State' currentManifest: - $ref: "#/components/schemas/AppCurrentManifest" + $ref: '#/components/schemas/AppCurrentManifest' AppCurrentManifest: type: object description: | @@ -842,9 +840,9 @@ components: catalog metadata and divergence vs the most recent applied deployment. Populated by GET /apps/{id} when a manifest is bound. required: - - id - - name - - latestVersion + - id + - name + - latestVersion properties: id: type: string @@ -856,23 +854,23 @@ components: type: integer description: Latest version available in the manifest's lineage divergence: - $ref: "#/components/schemas/AppManifestDivergence" + $ref: '#/components/schemas/AppManifestDivergence' AppManifestDivergence: type: object description: | Relationship between the app's bound manifest and what's currently deployed (last `applied` deployment, ignoring destroys). required: - - kind - - latestVersion + - kind + - latestVersion properties: kind: type: string enum: - - undeployed - - synced - - behind - - rebound + - undeployed + - synced + - behind + - rebound description: | - `undeployed`: the app has a manifest bound but no successful deployment yet. - `synced`: deployed (manifestId, version) matches the bound manifest's latest version. @@ -890,7 +888,7 @@ components: AttachManifestRequest: type: object required: - - manifestId + - manifestId properties: manifestId: type: string @@ -898,7 +896,7 @@ components: CreateAppRequest: type: object required: - - name + - name properties: name: type: string @@ -909,7 +907,7 @@ components: UpdateAppRequest: type: object required: - - name + - name properties: name: type: string @@ -917,68 +915,72 @@ components: ReadVariablesResponse: type: object required: - - data + - cursor properties: - data: + cursor: allOf: - - type: object - properties: - items: - type: array - items: - $ref: "#/components/schemas/Variable" - - $ref: "#/components/schemas/PaginationResponse" + - $ref: '#/components/schemas/Cursor' + - type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/Variable' CreateVariableRequest: type: object required: - - variable + - variable properties: variable: - $ref: "#/components/schemas/VariableData" + $ref: '#/components/schemas/VariableData' CreateVariableResponse: type: object required: - - data + - data properties: data: - $ref: "#/components/schemas/Variable" + $ref: '#/components/schemas/Variable' VariableData: type: object required: - - key - - value - - sensitive + - key + - value properties: key: type: string - description: Key of the variable + description: | + Snake-case identifier (case-insensitive at the API boundary, + normalized to lowercase on storage to match `var.` in the + generated HCL). Either `MONEYCORP_API_KEY` or + `moneycorp_api_key` is accepted. value: type: string - description: Value of the variable + description: | + Value of the variable. Always treated as sensitive: `value` is + redacted (`REDACTED`) on every read endpoint. description: type: string description: Description of the variable - sensitive: - type: boolean - description: Whether the variable is sensitive Variable: allOf: - - $ref: "#/components/schemas/VariableData" - - type: object - required: - - id - properties: - id: - type: string - description: Unique identifier for the variable + - $ref: '#/components/schemas/VariableData' + - type: object + required: + - id + properties: + id: + type: string + description: Unique identifier for the variable Manifest: type: object required: - - id - - name - - latestVersion - - createdAt - - updatedAt + - id + - name + - latestVersion + - createdAt + - updatedAt properties: id: type: string @@ -1000,9 +1002,9 @@ components: ManifestVersion: type: object required: - - manifestId - - version - - createdAt + - manifestId + - version + - createdAt properties: manifestId: type: string @@ -1021,15 +1023,15 @@ components: CreateManifestResponse: type: object required: - - data + - data properties: data: type: object required: - - id - - version - - name - - createdAt + - id + - version + - name + - createdAt properties: id: type: string @@ -1043,57 +1045,57 @@ components: ManifestResponse: type: object required: - - data + - data properties: data: - $ref: "#/components/schemas/Manifest" + $ref: '#/components/schemas/Manifest' ManifestVersionResponse: type: object required: - - data + - data properties: data: - $ref: "#/components/schemas/ManifestVersion" + $ref: '#/components/schemas/ManifestVersion' ListManifestsResponse: type: object required: - - data + - cursor properties: - data: + cursor: allOf: - - $ref: "#/components/schemas/PaginationResponse" - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: "#/components/schemas/Manifest" + - $ref: '#/components/schemas/Cursor' + - type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/Manifest' ListManifestVersionsResponse: type: object required: - - data + - cursor properties: - data: + cursor: allOf: - - $ref: "#/components/schemas/PaginationResponse" - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: "#/components/schemas/ManifestVersion" + - $ref: '#/components/schemas/Cursor' + - type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/ManifestVersion' DeploymentResource: type: object required: - - id - - appId - - status - - createdAt - - updatedAt + - id + - appId + - status + - createdAt + - updatedAt properties: id: type: string @@ -1112,13 +1114,13 @@ components: type: string format: date-time state: - $ref: "#/components/schemas/State" + $ref: '#/components/schemas/State' CreateDeploymentRequest: type: object required: - - appId - - manifestId - - manifestVersion + - appId + - manifestId + - manifestVersion properties: appId: type: string @@ -1132,30 +1134,30 @@ components: DeploymentResponse: type: object required: - - data + - data properties: data: - $ref: "#/components/schemas/DeploymentResource" + $ref: '#/components/schemas/DeploymentResource' ListDeploymentsResponse: type: object required: - - data + - cursor properties: - data: + cursor: allOf: - - $ref: "#/components/schemas/PaginationResponse" - - type: object - required: - - items - properties: - items: - type: array - items: - $ref: "#/components/schemas/DeploymentResource" + - $ref: '#/components/schemas/Cursor' + - type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/DeploymentResource' UpdateManifestRequest: type: object required: - - name + - name properties: name: type: string @@ -1168,4 +1170,451 @@ components: errorMessage: type: string required: - - errorCode + - errorCode + V2ChartAccountMetadata: + properties: + default: + type: + - 'null' + - string + type: object + V2ChartAccountRules: + type: object + DotSelf: + type: object + V2ChartSegment: + additionalProperties: true + properties: + .metadata: + additionalProperties: + $ref: '#/components/schemas/V2ChartAccountMetadata' + type: object + .pattern: + type: + - 'null' + - string + .rules: + $ref: '#/components/schemas/V2ChartAccountRules' + .self: + $ref: '#/components/schemas/DotSelf' + type: object + V2QueryTemplateVar: + properties: + default: {} + type: + type: string + type: object + V2QueryTemplate: + properties: + body: + additionalProperties: {} + type: object + description: + type: + - 'null' + - string + params: + additionalProperties: {} + type: object + resource: + type: + - 'null' + - string + vars: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplateVar' + type: object + type: object + V2TransactionTemplate: + properties: + description: + type: + - 'null' + - string + runtime: + type: + - 'null' + - string + script: + type: + - 'null' + - string + type: object + V2SchemaData: + properties: + chart: + additionalProperties: + $ref: '#/components/schemas/V2ChartSegment' + type: + - object + - 'null' + queries: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplate' + type: object + transactions: + additionalProperties: + $ref: '#/components/schemas/V2TransactionTemplate' + type: object + type: object + Ledger: + required: + - name + properties: + name: + type: string + schema: + additionalProperties: + $ref: '#/components/schemas/V2SchemaData' + type: + - object + - 'null' + type: object + Pool: + properties: + accountIds: + items: + type: string + type: array + query: + additionalProperties: {} + type: object + type: object + ReconciliationLedger: + required: + - name + - query + properties: + name: + type: string + query: + additionalProperties: {} + type: + - object + - 'null' + type: object + ReconciliationPolicy: + required: + - name + - ledger + - pool + properties: + ledger: + $ref: '#/components/schemas/ReconciliationLedger' + name: + type: string + pool: + type: string + type: object + RegionSelector: + properties: + id: + type: string + name: + type: string + type: object + Webhook: + required: + - name + - endpoint + properties: + endpoint: + type: string + events: + items: + type: string + type: array + name: + type: string + secret: + type: string + type: object + Ledgers: + items: + $ref: '#/components/schemas/Ledger' + type: + - 'null' + - array + Payments: + properties: + connectors: + items: + required: + - name + - provider + properties: + configuration: + additionalProperties: {} + type: object + credentials: + additionalProperties: + type: string + type: object + name: + type: string + provider: + type: string + type: object + type: array + pools: + additionalProperties: + $ref: '#/components/schemas/Pool' + type: object + type: object + Reconciliation: + properties: + policies: + items: + $ref: '#/components/schemas/ReconciliationPolicy' + type: array + type: object + Stack: + required: + - name + - region + properties: + name: + type: string + region: + $ref: '#/components/schemas/RegionSelector' + version: + type: string + type: object + Webhooks: + items: + $ref: '#/components/schemas/Webhook' + type: + - 'null' + - array + application: + $schema: http://json-schema.org/draft-04/schema + required: + - stack + definitions: + DotSelf: + type: object + Ledger: + required: + - name + properties: + name: + type: string + schema: + additionalProperties: + $ref: '#/components/schemas/V2SchemaData' + type: + - object + - 'null' + type: object + Ledgers: + items: + $ref: '#/components/schemas/Ledger' + type: + - 'null' + - array + Payments: + properties: + connectors: + items: + required: + - name + - provider + properties: + configuration: + additionalProperties: {} + type: object + credentials: + additionalProperties: + type: string + type: object + name: + type: string + provider: + type: string + type: object + type: array + pools: + additionalProperties: + $ref: '#/components/schemas/Pool' + type: object + type: object + Pool: + properties: + accountIds: + items: + type: string + type: array + query: + additionalProperties: {} + type: object + type: object + Reconciliation: + properties: + policies: + items: + $ref: '#/components/schemas/ReconciliationPolicy' + type: array + type: object + ReconciliationLedger: + required: + - name + - query + properties: + name: + type: string + query: + additionalProperties: {} + type: + - object + - 'null' + type: object + ReconciliationPolicy: + required: + - name + - ledger + - pool + properties: + ledger: + $ref: '#/components/schemas/ReconciliationLedger' + name: + type: string + pool: + type: string + type: object + RegionSelector: + properties: + id: + type: string + name: + type: string + type: object + Stack: + required: + - name + - region + properties: + name: + type: string + region: + $ref: '#/components/schemas/RegionSelector' + version: + type: string + type: object + V2ChartAccountMetadata: + properties: + default: + type: + - 'null' + - string + type: object + V2ChartAccountRules: + type: object + V2ChartSegment: + additionalProperties: true + properties: + .metadata: + additionalProperties: + $ref: '#/components/schemas/V2ChartAccountMetadata' + type: object + .pattern: + type: + - 'null' + - string + .rules: + $ref: '#/components/schemas/V2ChartAccountRules' + .self: + $ref: '#/components/schemas/DotSelf' + type: object + V2QueryTemplate: + properties: + body: + additionalProperties: {} + type: object + description: + type: + - 'null' + - string + params: + additionalProperties: {} + type: object + resource: + type: + - 'null' + - string + vars: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplateVar' + type: object + type: object + V2QueryTemplateVar: + properties: + default: {} + type: + type: string + type: object + V2SchemaData: + properties: + chart: + additionalProperties: + $ref: '#/components/schemas/V2ChartSegment' + type: + - object + - 'null' + queries: + additionalProperties: + $ref: '#/components/schemas/V2QueryTemplate' + type: object + transactions: + additionalProperties: + $ref: '#/components/schemas/V2TransactionTemplate' + type: object + type: object + V2TransactionTemplate: + properties: + description: + type: + - 'null' + - string + runtime: + type: + - 'null' + - string + script: + type: + - 'null' + - string + type: object + Webhook: + required: + - name + - endpoint + properties: + endpoint: + type: string + events: + items: + type: string + type: array + name: + type: string + secret: + type: string + type: object + Webhooks: + items: + $ref: '#/components/schemas/Webhook' + type: + - 'null' + - array + properties: + ledgers: + $ref: '#/components/schemas/Ledgers' + payments: + $ref: '#/components/schemas/Payments' + reconciliation: + $ref: '#/components/schemas/Reconciliation' + stack: + $ref: '#/components/schemas/Stack' + webhooks: + $ref: '#/components/schemas/Webhooks' + type: object From 655a77e1a30eb866b857bac52e4035c14ade632c Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Fri, 5 Jun 2026 14:55:49 +0200 Subject: [PATCH 5/5] fix(cloud): regenerate deploy-server SDK and adapt download commands Spec dropped application/gzip from readDeployment and removed the binary variant from readManifest. Update download commands accordingly: - deployments download now requests YAML via the single ResponseStream - manifests download switches to readManifestVersion (defaults to "latest") --- cmd/cloud/apps/deployments/download.go | 38 +- cmd/cloud/apps/manifests/download.go | 30 +- .../deployserverclient/.speakeasy/gen.lock | 78 +-- .../.speakeasy/workflow.lock | 2 - internal/deployserverclient/README.md | 63 ++- internal/deployserverclient/USAGE.md | 5 +- internal/deployserverclient/deployserver.go | 197 +++++-- .../docs/models/components/security.md | 8 + .../docs/models/components/state.md | 6 +- .../docs/models/operations/option.md | 16 + .../docs/models/operations/readapprequest.md | 8 +- .../operations/readdeploymentrequest.md | 8 +- .../operations/readdeploymentresponse.md | 3 +- .../models/operations/readmanifestresponse.md | 1 - .../docs/sdks/deployserver/README.md | 155 ++++-- .../internal/config/sdkconfiguration.go | 5 +- .../models/components/security.go | 15 + .../models/components/state.go | 5 +- .../models/operations/options.go | 1 - .../models/operations/readapp.go | 4 +- .../models/operations/readdeployment.go | 20 +- .../models/operations/readmanifest.go | 11 - openapi/deployserver.yaml | 497 +----------------- 23 files changed, 496 insertions(+), 680 deletions(-) create mode 100644 internal/deployserverclient/docs/models/components/security.md create mode 100644 internal/deployserverclient/models/components/security.go diff --git a/cmd/cloud/apps/deployments/download.go b/cmd/cloud/apps/deployments/download.go index 768029c2..56f37884 100644 --- a/cmd/cloud/apps/deployments/download.go +++ b/cmd/cloud/apps/deployments/download.go @@ -14,10 +14,9 @@ import ( func NewDownload() *cobra.Command { return fctl.NewCommand("download", - fctl.WithShortDescription("Download a deployment's resolved manifest (yaml) or full configuration archive (gzip)"), + fctl.WithShortDescription("Download a deployment's resolved manifest as YAML"), fctl.WithStringFlag("id", "", "Deployment ID"), - fctl.WithStringFlag("format", "yaml", "Response format: yaml | gzip"), - fctl.WithStringFlag("out", "", "Output file path (required for gzip; defaults to stdout for yaml)"), + fctl.WithStringFlag("out", "", "Output file path (defaults to stdout)"), fctl.WithRunE(runDeploymentDownload), ) } @@ -28,22 +27,8 @@ func runDeploymentDownload(cmd *cobra.Command, _ []string) error { return fmt.Errorf("id is required") } - format := fctl.GetString(cmd, "format") out := fctl.GetString(cmd, "out") - var accept operations.AcceptHeaderEnum - switch format { - case "yaml": - accept = operations.AcceptHeaderEnumApplicationYaml - case "gzip": - accept = operations.AcceptHeaderEnumApplicationGzip - if out == "" { - return fmt.Errorf("--out is required when --format=gzip (binary content cannot be written to a TTY)") - } - default: - return fmt.Errorf("invalid --format %q (expected: yaml | gzip)", format) - } - cmd.SilenceUsage = true _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) @@ -66,26 +51,19 @@ func runDeploymentDownload(cmd *cobra.Command, _ []string) error { cmd.Context(), id, nil, - operations.WithAcceptHeaderOverride(accept), + operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationYaml), ) if err != nil { return err } - var stream io.ReadCloser - switch accept { - case operations.AcceptHeaderEnumApplicationYaml: - stream = resp.TwoHundredApplicationYamlResponseStream - case operations.AcceptHeaderEnumApplicationGzip: - stream = resp.TwoHundredApplicationGzipResponseStream - } - if stream == nil { - return fmt.Errorf("server returned no %s payload for deployment %s", accept, id) + if resp.ResponseStream == nil { + return fmt.Errorf("server returned no YAML payload for deployment %s", id) } - defer stream.Close() + defer resp.ResponseStream.Close() if out == "" { - if _, err := io.Copy(cmd.OutOrStdout(), stream); err != nil { + if _, err := io.Copy(cmd.OutOrStdout(), resp.ResponseStream); err != nil { return fmt.Errorf("write deployment payload: %w", err) } return nil @@ -97,7 +75,7 @@ func runDeploymentDownload(cmd *cobra.Command, _ []string) error { } defer func() { _ = f.Close() }() - if _, err := io.Copy(f, stream); err != nil { + if _, err := io.Copy(f, resp.ResponseStream); err != nil { return fmt.Errorf("write deployment payload: %w", err) } return f.Close() diff --git a/cmd/cloud/apps/manifests/download.go b/cmd/cloud/apps/manifests/download.go index 14f23ef9..572c8d63 100644 --- a/cmd/cloud/apps/manifests/download.go +++ b/cmd/cloud/apps/manifests/download.go @@ -14,9 +14,10 @@ import ( func NewDownload() *cobra.Command { return fctl.NewCommand("download", - fctl.WithShortDescription("Download a manifest's transpiled tar.gz archive of its latest version"), + fctl.WithShortDescription("Download a manifest version's raw YAML content"), fctl.WithStringFlag("id", "", "Manifest ID"), - fctl.WithStringFlag("out", "", "Output file path (required: gzip is binary)"), + fctl.WithStringFlag("version", "latest", "Version number or \"latest\""), + fctl.WithStringFlag("out", "", "Output file path (defaults to stdout)"), fctl.WithRunE(runManifestDownload), ) } @@ -27,11 +28,13 @@ func runManifestDownload(cmd *cobra.Command, _ []string) error { return fmt.Errorf("id is required") } - out := fctl.GetString(cmd, "out") - if out == "" { - return fmt.Errorf("--out is required (gzip is binary and cannot be written to a TTY)") + version := fctl.GetString(cmd, "version") + if version == "" { + return fmt.Errorf("version is required") } + out := fctl.GetString(cmd, "out") + cmd.SilenceUsage = true _, profile, profileName, relyingParty, err := fctl.LoadAndAuthenticateCurrentProfile(cmd) @@ -50,21 +53,28 @@ func runManifestDownload(cmd *cobra.Command, _ []string) error { return err } - resp, err := apiClient.ReadManifest( + resp, err := apiClient.ReadManifestVersion( cmd.Context(), id, - nil, - operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationGzip), + version, + operations.WithAcceptHeaderOverride(operations.AcceptHeaderEnumApplicationXYaml), ) if err != nil { return err } if resp.ResponseStream == nil { - return fmt.Errorf("server returned no gzip payload for manifest %s", id) + return fmt.Errorf("server returned no YAML payload for manifest %s version %s", id, version) } defer resp.ResponseStream.Close() + if out == "" { + if _, err := io.Copy(cmd.OutOrStdout(), resp.ResponseStream); err != nil { + return fmt.Errorf("write manifest payload: %w", err) + } + return nil + } + f, err := os.Create(out) // #nosec G304 -- user-specified output path on a CLI flag if err != nil { return fmt.Errorf("create output file: %w", err) @@ -72,7 +82,7 @@ func runManifestDownload(cmd *cobra.Command, _ []string) error { defer func() { _ = f.Close() }() if _, err := io.Copy(f, resp.ResponseStream); err != nil { - return fmt.Errorf("write manifest archive: %w", err) + return fmt.Errorf("write manifest payload: %w", err) } return f.Close() } diff --git a/internal/deployserverclient/.speakeasy/gen.lock b/internal/deployserverclient/.speakeasy/gen.lock index 2498b838..501008b0 100644 --- a/internal/deployserverclient/.speakeasy/gen.lock +++ b/internal/deployserverclient/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 12df0dd4-09cf-49f5-8116-53c77b28ba01 management: - docChecksum: 03e55b5f1af06ab89d7637b7bbd6a95d + docChecksum: f5ce490c03f43321db414fea57886595 docVersion: 0.1.0 speakeasyVersion: 1.759.2 generationVersion: 2.869.23 releaseVersion: 0.1.1 configChecksum: 65bf761ed2e45c2edc12016a208c0bb8 persistentEdits: - generation_id: e34fb87d-98de-4a8b-b896-e954f67f3e4e - pristine_commit_hash: 4e14ecbb38b7c5b3c54dda495b29079c9e1dad4d - pristine_tree_hash: 5a945dfe489196205cc74342a44ac1ec194c384d + generation_id: b3a2b883-5a65-4d6c-a4b5-556694ac6c6f + pristine_commit_hash: 4f83752b6bdadd241de4f921e43b7d20bd710f30 + pristine_tree_hash: 68f3c94c2dd7651a10d38ce1c8a8c6955473b25a features: go: acceptHeaders: 2.81.2 @@ -22,7 +22,9 @@ features: downloadStreams: 0.1.2 envVarSecurityUsage: 0.3.2 flattening: 2.81.2 + globalSecurity: 2.82.13 globalSecurityCallbacks: 0.1.0 + globalSecurityFlattening: 0.1.0 globalServerURLs: 2.83.1 intellisenseMarkdownSupport: 0.1.0 responseFormat: 0.1.2 @@ -48,12 +50,12 @@ trackedFiles: pristine_git_object: e6a994416d0f527912d2d272e2583458f4fc9bcb USAGE.md: id: 3aed33ce6e6f - last_write_checksum: sha1:bbacdb3bf345353aefe798258bf788687afab777 - pristine_git_object: eb58123de9ffa74878d22ed28cc871ffefdc7ca6 + last_write_checksum: sha1:e64f0c797a0a08e9f7d1cf3de0b5462343d21394 + pristine_git_object: 5e9db16f4c1c967289b654d79c909291e1e52e8f deployserver.go: id: 4e88cb1c88d3 - last_write_checksum: sha1:3915fd8d8301b50ef037e71298b1dbe335d5470f - pristine_git_object: 87df35a3300bd5f61600296d60d756e0c6e616e3 + last_write_checksum: sha1:6a002f47279489f88f6276eee8ef47bb1e92a12c + pristine_git_object: 9212799b25b650560a7385357fbe56fdd6b8a05f docs/models/apierrors/error.md: id: 7c6e7719d689 last_write_checksum: sha1:e3115a5a7de0780066dc4a2256c42f7c0976447b @@ -194,10 +196,14 @@ trackedFiles: id: c616d7701ed2 last_write_checksum: sha1:d2e6762d758029e501287c6c1b5bbacea874faa3 pristine_git_object: cc317df08105c5c792ff8f3cd67b5bb1f485bf51 + docs/models/components/security.md: + id: 54906b49ea28 + last_write_checksum: sha1:3d20d8f28e0ecfee6550ce09129b5ec06e25c24d + pristine_git_object: c15c11e5000d4802bfc26a199e249e734ad2b549 docs/models/components/state.md: id: 441de3ea6229 - last_write_checksum: sha1:0ee3cca8c7a402fc1aa36f5e3f8f75d277acc38c - pristine_git_object: 1cf3a814d7870e07ddc02391e6be7ce0c29762c2 + last_write_checksum: sha1:2ee342b694271c882a14006f561ea81fc4c7ff3a + pristine_git_object: 4e5096c4a66891a9695900b59c559baeb773d4c1 docs/models/components/updateapprequest.md: id: 405074ca5d37 last_write_checksum: sha1:d184f58db2351ccc0fa24f7a7606d63ec53984d4 @@ -324,8 +330,8 @@ trackedFiles: pristine_git_object: 0349721934edc32307e5285695b66d17c340872f docs/models/operations/option.md: id: 2ac1bd52a5fb - last_write_checksum: sha1:bcfbc3cd4a67cf8c276f1508b8ffee0ee5bb45ad - pristine_git_object: fe22ef08c679fa6cf8f70c453405db97a3e73c80 + last_write_checksum: sha1:793ef6714c6322eff196c44264b5308c9964083a + pristine_git_object: c511959bfd8c5137c45a023323a0bb6774d6dc5e docs/models/operations/pushmanifestversionrawrequest.md: id: fc1c2faac987 last_write_checksum: sha1:f404defcc70c8b6dcb819dfbb63cadaf5dbc4809 @@ -352,8 +358,8 @@ trackedFiles: pristine_git_object: 5f20740f220a8cd1fef84fb55deffc75635e0028 docs/models/operations/readapprequest.md: id: 87dd15e3966c - last_write_checksum: sha1:5f5c2f499d72fea65f8f3a29d819b55b17ef67e7 - pristine_git_object: 86116ae7bff6b3043e338b0b48d1d9da42585e53 + last_write_checksum: sha1:f06192b275e2605eed7e8a9cfc5a4936cb3e9a57 + pristine_git_object: c7041dc275a848564191df13f13b66dab150df88 docs/models/operations/readappresponse.md: id: 516dad5c8317 last_write_checksum: sha1:40f059afc4ded4284b1318ea86c9d6ed9d281d25 @@ -380,20 +386,20 @@ trackedFiles: pristine_git_object: 1388ac812646ffadd823d1bb11cfc4c2228b4499 docs/models/operations/readdeploymentrequest.md: id: 5b96618f6491 - last_write_checksum: sha1:351adeb91ac73593b54606db1f25e3fd4321cf88 - pristine_git_object: 1311e46907a17239a80dcf20eb55867c05ecb823 + last_write_checksum: sha1:f932ac8efa6ab8c6e94b7c7259db7f2e6bc21ccb + pristine_git_object: 52c58dbb080c6b57f9f934b3b9f1b5246dae8a12 docs/models/operations/readdeploymentresponse.md: id: 9d554c8b4f05 - last_write_checksum: sha1:73511946b7723ebca13317d42f663542a2d08ebe - pristine_git_object: 5a248012afe8bb6c2453ec1e359397d1dff3d712 + last_write_checksum: sha1:f8d04a1190c995c546fdb31768af93a57352cb8a + pristine_git_object: d63d2c3b071efcc7abec7d59dc28efb0e872e16c docs/models/operations/readmanifestrequest.md: id: 91ea98d58795 last_write_checksum: sha1:16551ee11c5cc18db61ef5bace565840261c9273 pristine_git_object: d785ed1deea75440082ca954b41e068c5ceaa1d8 docs/models/operations/readmanifestresponse.md: id: e1d36c0ae15b - last_write_checksum: sha1:c8a74e60db5d8cef75ebc600229089a50311be4b - pristine_git_object: 35202fdef3970260c931526e27c74768acfcbd5c + last_write_checksum: sha1:b064540fc256982901c12ef85b9ed8f31e16a7ff + pristine_git_object: f6626bd62e5da14e7dcb72b103e323163fa701f0 docs/models/operations/readmanifestversionrequest.md: id: fc96d48d85b9 last_write_checksum: sha1:00bbd804dbee924382ff97c7f7322961cc51e081 @@ -420,16 +426,16 @@ trackedFiles: pristine_git_object: f8b0e9ef7ee64c5c8ade8601fac272aa7909171e docs/sdks/deployserver/README.md: id: 7bbb48696892 - last_write_checksum: sha1:db4ed7cc26f7f1337e2d618117309907cb743934 - pristine_git_object: e6cdb3630042dc5eac726db319ca6ade53e3ee38 + last_write_checksum: sha1:4962abdafa3760f7c2297262c42de8a81b81df50 + pristine_git_object: 38b6bb51ec82a6ebea63740d05b607e4e0a166d1 go.mod: id: c47645c391ad last_write_checksum: sha1:ccfac949478bd60fae3010350a17ef6c9e8580bf pristine_git_object: 3189bf069eaf8dfb9018c4b403d2ff4a7e33e9c6 internal/config/sdkconfiguration.go: id: 33b8bfac5265 - last_write_checksum: sha1:78dca4bf8f1816129071559aa9e304c5331f3e19 - pristine_git_object: e0e5bebf73a006dfe3891faac24c6321653b1011 + last_write_checksum: sha1:5148d0658d626b9af95c22141725e94da07f0f47 + pristine_git_object: dd5ad42c3fbdc6e1e0178a0ab23baccf18594caf internal/hooks/hooks.go: id: 336be70ed5c0 last_write_checksum: sha1:93d4659d008e4af51582e5407bae6307cdfa6cc5 @@ -598,10 +604,14 @@ trackedFiles: id: 4b628607f38f last_write_checksum: sha1:6cc3d29087b54bfc47bd5646b81892b0fee333ec pristine_git_object: c707e31ef6e66e4dc88bc89d753d4bb528ae90d3 + models/components/security.go: + id: 3a5eba5fe9e0 + last_write_checksum: sha1:9a146f6b93f07556ac125224448fd06ecdb5cea6 + pristine_git_object: 5f41eea61eac2527fff133f9516135b8ff70fda8 models/components/state.go: id: cb569493a6e4 - last_write_checksum: sha1:2960474737e42f46e1f67bcec0a98270babbeaaf - pristine_git_object: 36d6cfe58680824e3652028111ecb28913a98af2 + last_write_checksum: sha1:c332a3b170a8c5876f68a10dc91a0f973077e5a6 + pristine_git_object: 4a14aefd93ad5cea5b2179c40422db51de1dc8d5 models/components/updateapprequest.go: id: 02e323c36bcb last_write_checksum: sha1:ef3cc70fe08244f4ebb38742e2086444ac1a67ba @@ -676,8 +686,8 @@ trackedFiles: pristine_git_object: 383a02ecd2db96c47e7691af304ca63386b551b9 models/operations/options.go: id: d20dd4db9865 - last_write_checksum: sha1:a48cf400249fe4cec80746623cbbd6831141c0f2 - pristine_git_object: 0010ed4393e80d0c29c4360949997aa6422ba8b6 + last_write_checksum: sha1:63bf566497cff1c15f022c5ef1e088614b458825 + pristine_git_object: 6c56bd901e7e6cdd8f3053cddca0b7bb577bc090 models/operations/pushmanifestversion.go: id: 103d3cd7154c last_write_checksum: sha1:1e79c961001d02886374474081b2f444092bad78 @@ -688,24 +698,24 @@ trackedFiles: pristine_git_object: 03411e7c0ab6606e466a50ee95861384dab8e0d1 models/operations/readapp.go: id: 5ffcd917de05 - last_write_checksum: sha1:616311f2d52977d2cc3d7fdb21ae16a111d242dd - pristine_git_object: ff16e36f0a7c3d5e1ec8615c8f74d3cafcf48e6d + last_write_checksum: sha1:5997868fdbb48083cfae50f1e990eafc952834a4 + pristine_git_object: fdaf235b8e0f5f4355a3b7f25152bc95267648f1 models/operations/readappvariables.go: id: 3c029298a72b last_write_checksum: sha1:2ebe235e100ef10034b5f8579dea0126c4e9e9a9 pristine_git_object: b273ef6b05ce4df4d48877c6546b07b202d019a3 models/operations/readdeployment.go: id: 91ac6c44d1bd - last_write_checksum: sha1:34ef44770f6ad1eb358ceb0ccafaed564f81c1b7 - pristine_git_object: d4cd445dc96ddad62666d77517941bbc0090113b + last_write_checksum: sha1:835b9dedfd9742db8e350b3ced4a99e5c75acd3f + pristine_git_object: 43788bebcf2233fca353e13d67c6453f0f172d25 models/operations/readdeploymentlogs.go: id: 33138b5f3516 last_write_checksum: sha1:50ac57766820913a5b2874e706f060d7960f2126 pristine_git_object: 0ac0a7172e2154a2bf949f88dc8cf506b961d86e models/operations/readmanifest.go: id: 9724390accda - last_write_checksum: sha1:05f74864cfc4c59747feb25d41ec3bebd6d1c98d - pristine_git_object: 2beac53507d2723d66beb5ff16d1bd7ccdd9112b + last_write_checksum: sha1:4230961090fe0df4302b5dcaed96f39fe666ae0d + pristine_git_object: da0a84d40b5eb3e16bca40e650c9e58671007222 models/operations/readmanifestversion.go: id: 6d717792910c last_write_checksum: sha1:8c5b0e35b09d98b466e65664f39f4490ebd8ee5e diff --git a/internal/deployserverclient/.speakeasy/workflow.lock b/internal/deployserverclient/.speakeasy/workflow.lock index 3c517955..e9a3235a 100644 --- a/internal/deployserverclient/.speakeasy/workflow.lock +++ b/internal/deployserverclient/.speakeasy/workflow.lock @@ -13,8 +13,6 @@ targets: sourceNamespace: terraform-hcp-proxy-api sourceRevisionDigest: sha256:d54ede8b0d8f74daea2fc161cf13846dd4a7084f96941f68356d8307bfa92186 sourceBlobDigest: sha256:8564cde40781c471d4f17f1781a0c92fcf0ddc26ca20fbb3a2cc2a39d0c22f70 - codeSamplesNamespace: terraform-hcp-proxy-api-go-code-samples - codeSamplesRevisionDigest: sha256:2008838684af30cac9f85a2e65e7a8ae14b310789d819f87e6d9c8e2988a40d2 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.759.2 diff --git a/internal/deployserverclient/README.md b/internal/deployserverclient/README.md index 9c4c58e3..55a8f66a 100644 --- a/internal/deployserverclient/README.md +++ b/internal/deployserverclient/README.md @@ -26,6 +26,7 @@ Developer-friendly & type-safe Go SDK specifically catered to leverage *github.c * [github.com/formancehq/fctl/internal/deployserverclient](#githubcomformancehqfctlinternaldeployserverclient) * [SDK Installation](#sdk-installation) * [SDK Example Usage](#sdk-example-usage) + * [Authentication](#authentication) * [Available Resources and Operations](#available-resources-and-operations) * [Retries](#retries) * [Error Handling](#error-handling) @@ -58,12 +59,15 @@ import ( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" + "os" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListApps(ctx, nil, nil) if err != nil { @@ -77,6 +81,47 @@ func main() { ``` + +## Authentication + +### Per-Client Security Schemes + +This SDK supports the following security scheme globally: + +| Name | Type | Scheme | Environment Variable | +| ------------ | ---- | ----------- | -------------------------- | +| `BearerAuth` | http | HTTP Bearer | `DEPLOYSERVER_BEARER_AUTH` | + +You can configure it using the `WithSecurity` option when initializing the SDK client instance. For example: +```go +package main + +import ( + "context" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" + "log" + "os" +) + +func main() { + ctx := context.Background() + + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) + + res, err := s.ListApps(ctx, nil, nil) + if err != nil { + log.Fatal(err) + } + if res.ListAppsResponse != nil { + // handle response + } +} + +``` + + ## Available Resources and Operations @@ -128,12 +173,15 @@ import ( "github.com/formancehq/fctl/internal/deployserverclient/v3/retry" "log" "models/operations" + "os" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListApps(ctx, nil, nil, operations.WithRetries( retry.Config{ @@ -165,6 +213,7 @@ import ( deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/retry" "log" + "os" ) func main() { @@ -182,6 +231,7 @@ func main() { }, RetryConnectionErrors: false, }), + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), ) res, err := s.ListApps(ctx, nil, nil) @@ -222,12 +272,15 @@ import ( "github.com/formancehq/fctl/internal/deployserverclient/v3/models/apierrors" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" + "os" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.AttachAppManifest(ctx, "", components.AttachManifestRequest{ ManifestID: "", @@ -273,6 +326,7 @@ import ( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" + "os" ) func main() { @@ -280,6 +334,7 @@ func main() { s := deployserverclient.New( deployserverclient.WithServerIndex(0), + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), ) res, err := s.ListApps(ctx, nil, nil) @@ -303,6 +358,7 @@ import ( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" + "os" ) func main() { @@ -310,6 +366,7 @@ func main() { s := deployserverclient.New( deployserverclient.WithServerURL("http://localhost:8080"), + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), ) res, err := s.ListApps(ctx, nil, nil) diff --git a/internal/deployserverclient/USAGE.md b/internal/deployserverclient/USAGE.md index eb58123d..5e9db16f 100644 --- a/internal/deployserverclient/USAGE.md +++ b/internal/deployserverclient/USAGE.md @@ -6,12 +6,15 @@ import ( "context" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" + "os" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListApps(ctx, nil, nil) if err != nil { diff --git a/internal/deployserverclient/deployserver.go b/internal/deployserverclient/deployserver.go index 87df35a3..9212799b 100644 --- a/internal/deployserverclient/deployserver.go +++ b/internal/deployserverclient/deployserver.go @@ -102,6 +102,23 @@ func WithClient(client HTTPClient) SDKOption { } } +// WithSecurity configures the SDK to use the provided security details +func WithSecurity(bearerAuth string) SDKOption { + return func(sdk *DeployServer) { + security := components.Security{BearerAuth: &bearerAuth} + sdk.sdkConfiguration.Security = utils.AsSecuritySource(&security) + } +} + +// WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication +func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption { + return func(sdk *DeployServer) { + sdk.sdkConfiguration.Security = func(ctx context.Context) (interface{}, error) { + return security(ctx) + } + } +} + func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *DeployServer) { sdk.sdkConfiguration.RetryConfig = &retryConfig @@ -129,6 +146,13 @@ func New(opts ...SDKOption) *DeployServer { opt(sdk) } + if sdk.sdkConfiguration.Security == nil { + var envVarSecurity components.Security + if utils.PopulateSecurityFromEnv(&envVarSecurity) { + sdk.sdkConfiguration.Security = utils.AsSecuritySource(envVarSecurity) + } + } + // Use WithClient to override the default client if you would like to customize the timeout if sdk.sdkConfiguration.Client == nil { sdk.sdkConfiguration.Client = &http.Client{Timeout: 60 * time.Second} @@ -176,7 +200,7 @@ func (s *DeployServer) ListApps(ctx context.Context, pageSize *int64, cursor *st Context: ctx, OperationID: "listApps", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -201,6 +225,10 @@ func (s *DeployServer) ListApps(ctx context.Context, pageSize *int64, cursor *st return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -396,7 +424,7 @@ func (s *DeployServer) CreateApp(ctx context.Context, request components.CreateA Context: ctx, OperationID: "createApp", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -424,6 +452,10 @@ func (s *DeployServer) CreateApp(ctx context.Context, request components.CreateA req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -624,7 +656,7 @@ func (s *DeployServer) UpdateApp(ctx context.Context, id string, updateAppReques Context: ctx, OperationID: "updateApp", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateAppRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -652,6 +684,10 @@ func (s *DeployServer) UpdateApp(ctx context.Context, id string, updateAppReques req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -833,7 +869,7 @@ func (s *DeployServer) ReadApp(ctx context.Context, id string, include []operati Context: ctx, OperationID: "readApp", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -858,6 +894,10 @@ func (s *DeployServer) ReadApp(ctx context.Context, id string, include []operati return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1023,10 +1063,11 @@ func (s *DeployServer) ReadApp(ctx context.Context, id string, include []operati // DeleteApp - Delete an app // Soft-deletes the app immediately and enqueues a destroy deployment to -// clean up any terraform-managed resources on Formance Cloud. The app -// becomes invisible to all subsequent reads. The destroy runs through -// the normal worker pipeline; the app row is hard-deleted by the worker -// once the destroy reaches a terminal status. +// clean up the app's resources on Formance Cloud via the openapi +// reconciler's tear-down path. The app becomes invisible to all +// subsequent reads. The destroy runs through the normal worker +// pipeline; once it reaches a successful terminal status the worker +// hard-deletes the app row. // // By default this returns 202 Accepted as soon as the destroy is // enqueued (or 202 with no body if no destroy was needed). Pass @@ -1067,7 +1108,7 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, wait *bool, opt Context: ctx, OperationID: "deleteApp", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1092,6 +1133,10 @@ func (s *DeployServer) DeleteApp(ctx context.Context, id string, wait *bool, opt return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1296,7 +1341,7 @@ func (s *DeployServer) AttachAppManifest(ctx context.Context, id string, attachM Context: ctx, OperationID: "attachAppManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "AttachManifestRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1324,6 +1369,10 @@ func (s *DeployServer) AttachAppManifest(ctx context.Context, id string, attachM req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1528,7 +1577,7 @@ func (s *DeployServer) DetachAppManifest(ctx context.Context, id string, opts .. Context: ctx, OperationID: "detachAppManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1549,6 +1598,10 @@ func (s *DeployServer) DetachAppManifest(ctx context.Context, id string, opts .. req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1731,7 +1784,7 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageSize Context: ctx, OperationID: "readAppVariables", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1756,6 +1809,10 @@ func (s *DeployServer) ReadAppVariables(ctx context.Context, id string, pageSize return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -1956,7 +2013,7 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV Context: ctx, OperationID: "createAppVariable", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateVariableRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1984,6 +2041,10 @@ func (s *DeployServer) CreateAppVariable(ctx context.Context, id string, createV req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -2184,7 +2245,7 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl Context: ctx, OperationID: "deleteAppVariable", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2205,6 +2266,10 @@ func (s *DeployServer) DeleteAppVariable(ctx context.Context, id string, variabl req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -2386,7 +2451,7 @@ func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, reque Context: ctx, OperationID: "createManifest_raw", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) if err != nil { @@ -2418,6 +2483,10 @@ func (s *DeployServer) CreateManifestRaw(ctx context.Context, name string, reque return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -2618,7 +2687,7 @@ func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestB Context: ctx, OperationID: "createManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2650,6 +2719,10 @@ func (s *DeployServer) CreateManifest(ctx context.Context, name string, requestB return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -2850,7 +2923,7 @@ func (s *DeployServer) ListManifests(ctx context.Context, pageSize *int64, curso Context: ctx, OperationID: "listManifests", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2875,6 +2948,10 @@ func (s *DeployServer) ListManifests(ctx context.Context, pageSize *int64, curso return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3049,7 +3126,6 @@ func (s *DeployServer) ReadManifest(ctx context.Context, manifestID string, incl supportedOptions := []string{ operations.SupportedOptionRetries, operations.SupportedOptionTimeout, - operations.SupportedOptionAcceptHeaderOverride, } for _, opt := range opts { @@ -3076,7 +3152,7 @@ func (s *DeployServer) ReadManifest(ctx context.Context, manifestID string, incl Context: ctx, OperationID: "readManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3094,18 +3170,17 @@ func (s *DeployServer) ReadManifest(ctx context.Context, manifestID string, incl if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - if o.AcceptHeaderOverride != nil { - req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) - } else { - req.Header.Set("Accept", "application/json;q=1, application/gzip;q=0") - } - + req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3223,10 +3298,6 @@ func (s *DeployServer) ReadManifest(ctx context.Context, manifestID string, incl } res.ManifestResponse = &out - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/gzip`): - res.ResponseStream = httpRes.Body - - return res, nil default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -3310,7 +3381,7 @@ func (s *DeployServer) UpdateManifest(ctx context.Context, manifestID string, up Context: ctx, OperationID: "updateManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateManifestRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3338,6 +3409,10 @@ func (s *DeployServer) UpdateManifest(ctx context.Context, manifestID string, up req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3537,7 +3612,7 @@ func (s *DeployServer) DeleteManifest(ctx context.Context, manifestID string, op Context: ctx, OperationID: "deleteManifest", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3558,6 +3633,10 @@ func (s *DeployServer) DeleteManifest(ctx context.Context, manifestID string, op req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3760,7 +3839,7 @@ func (s *DeployServer) PushManifestVersionRaw(ctx context.Context, manifestID st Context: ctx, OperationID: "pushManifestVersion_raw", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "raw", `request:"mediaType=application/yaml"`) if err != nil { @@ -3788,6 +3867,10 @@ func (s *DeployServer) PushManifestVersionRaw(ctx context.Context, manifestID st req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -3988,7 +4071,7 @@ func (s *DeployServer) PushManifestVersion(ctx context.Context, manifestID strin Context: ctx, OperationID: "pushManifestVersion", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -4016,6 +4099,10 @@ func (s *DeployServer) PushManifestVersion(ctx context.Context, manifestID strin req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -4217,7 +4304,7 @@ func (s *DeployServer) ListManifestVersions(ctx context.Context, manifestID stri Context: ctx, OperationID: "listManifestVersions", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4242,6 +4329,10 @@ func (s *DeployServer) ListManifestVersions(ctx context.Context, manifestID stri return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -4443,7 +4534,7 @@ func (s *DeployServer) ReadManifestVersion(ctx context.Context, manifestID strin Context: ctx, OperationID: "readManifestVersion", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4469,6 +4560,10 @@ func (s *DeployServer) ReadManifestVersion(ctx context.Context, manifestID strin req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -4668,7 +4763,7 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, request components. Context: ctx, OperationID: "createDeployment", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -4696,6 +4791,10 @@ func (s *DeployServer) CreateDeployment(ctx context.Context, request components. req.Header.Set("Content-Type", reqContentType) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -4897,7 +4996,7 @@ func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageS Context: ctx, OperationID: "listDeployments", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4922,6 +5021,10 @@ func (s *DeployServer) ListDeployments(ctx context.Context, appID *string, pageS return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -5123,7 +5226,7 @@ func (s *DeployServer) ReadDeployment(ctx context.Context, deploymentID string, Context: ctx, OperationID: "readDeployment", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5144,7 +5247,7 @@ func (s *DeployServer) ReadDeployment(ctx context.Context, deploymentID string, if o.AcceptHeaderOverride != nil { req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) } else { - req.Header.Set("Accept", "application/json;q=1, application/yaml;q=0.7, application/gzip;q=0") + req.Header.Set("Accept", "application/json;q=1, application/yaml;q=0") } req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) @@ -5153,6 +5256,10 @@ func (s *DeployServer) ReadDeployment(ctx context.Context, deploymentID string, return nil, fmt.Errorf("error populating query params: %w", err) } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } @@ -5270,12 +5377,8 @@ func (s *DeployServer) ReadDeployment(ctx context.Context, deploymentID string, } res.DeploymentResponse = &out - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/gzip`): - res.TwoHundredApplicationGzipResponseStream = httpRes.Body - - return res, nil case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/yaml`): - res.TwoHundredApplicationYamlResponseStream = httpRes.Body + res.ResponseStream = httpRes.Body return res, nil default: @@ -5360,7 +5463,7 @@ func (s *DeployServer) ReadDeploymentLogs(ctx context.Context, deploymentID stri Context: ctx, OperationID: "readDeploymentLogs", OAuth2Scopes: nil, - SecuritySource: nil, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5381,6 +5484,10 @@ func (s *DeployServer) ReadDeploymentLogs(ctx context.Context, deploymentID stri req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + for k, v := range o.SetHeaders { req.Header.Set(k, v) } diff --git a/internal/deployserverclient/docs/models/components/security.md b/internal/deployserverclient/docs/models/components/security.md new file mode 100644 index 00000000..c15c11e5 --- /dev/null +++ b/internal/deployserverclient/docs/models/components/security.md @@ -0,0 +1,8 @@ +# Security + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `BearerAuth` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/components/state.md b/internal/deployserverclient/docs/models/components/state.md index 1cf3a814..4e5096c4 100644 --- a/internal/deployserverclient/docs/models/components/state.md +++ b/internal/deployserverclient/docs/models/components/state.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `Stack` | map[string]`any` | :heavy_check_mark: | The stack details from the Terraform state | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Stack` | map[string]`any` | :heavy_check_mark: | The live stack details reported by Formance Cloud (a projection of
the bound stack from Membership). Shape is a free-form object
mirroring the upstream stack resource.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/option.md b/internal/deployserverclient/docs/models/operations/option.md index fe22ef08..c511959b 100644 --- a/internal/deployserverclient/docs/models/operations/option.md +++ b/internal/deployserverclient/docs/models/operations/option.md @@ -39,6 +39,22 @@ WithClient allows the overriding of the default HTTP client used by the SDK. deployserverclient.WithClient(httpClient) ``` +### WithSecurity + +WithSecurity configures the SDK to use the provided security details. + +```go +deployserverclient.WithSecurity(/* ... */) +``` + +### WithSecuritySource + +WithSecuritySource configures the SDK to invoke the provided function on each method call to determine authentication. + +```go +deployserverclient.WithSecuritySource(/* ... */) +``` + ### WithRetryConfig WithRetryConfig allows setting the default retry configuration used by the SDK for all supported operations. diff --git a/internal/deployserverclient/docs/models/operations/readapprequest.md b/internal/deployserverclient/docs/models/operations/readapprequest.md index 86116ae7..c7041dc2 100644 --- a/internal/deployserverclient/docs/models/operations/readapprequest.md +++ b/internal/deployserverclient/docs/models/operations/readapprequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `Include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the current Terraform workspace state.
| \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | N/A | +| `Include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the live stack state reported by Formance Cloud
(a projection of the bound stack from Membership, not a snapshot
persisted by the proxy).
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md b/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md index 1311e469..52c58dbb 100644 --- a/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md +++ b/internal/deployserverclient/docs/models/operations/readdeploymentrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `DeploymentID` | `string` | :heavy_check_mark: | N/A | -| `Include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the Terraform state produced by this deployment's run.
| \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DeploymentID` | `string` | :heavy_check_mark: | N/A | +| `Include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the live stack state reported by Formance Cloud
for this deployment's bound stack. Note: this is the **live**
projection from Membership, not a frozen per-deployment snapshot.
| \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md b/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md index 5a248012..d63d2c3b 100644 --- a/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md +++ b/internal/deployserverclient/docs/models/operations/readdeploymentresponse.md @@ -7,6 +7,5 @@ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `DeploymentResponse` | [*components.DeploymentResponse](../../models/components/deploymentresponse.md) | :heavy_minus_sign: | Deployment retrieved successfully | -| `TwoHundredApplicationGzipResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Deployment retrieved successfully | -| `TwoHundredApplicationYamlResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Deployment retrieved successfully | +| `ResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Deployment retrieved successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/models/operations/readmanifestresponse.md b/internal/deployserverclient/docs/models/operations/readmanifestresponse.md index 35202fde..f6626bd6 100644 --- a/internal/deployserverclient/docs/models/operations/readmanifestresponse.md +++ b/internal/deployserverclient/docs/models/operations/readmanifestresponse.md @@ -7,5 +7,4 @@ | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `ManifestResponse` | [*components.ManifestResponse](../../models/components/manifestresponse.md) | :heavy_minus_sign: | Manifest retrieved successfully | -| `ResponseStream` | `io.ReadCloser` | :heavy_minus_sign: | Manifest retrieved successfully | | `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/internal/deployserverclient/docs/sdks/deployserver/README.md b/internal/deployserverclient/docs/sdks/deployserver/README.md index e6cdb363..38b6bb51 100644 --- a/internal/deployserverclient/docs/sdks/deployserver/README.md +++ b/internal/deployserverclient/docs/sdks/deployserver/README.md @@ -41,6 +41,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -48,7 +49,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListApps(ctx, nil, nil) if err != nil { @@ -91,6 +94,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -99,7 +103,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.CreateApp(ctx, components.CreateAppRequest{ Name: "", @@ -143,6 +149,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -151,7 +158,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.UpdateApp(ctx, "", components.UpdateAppRequest{ Name: "", @@ -196,6 +205,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -203,7 +213,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadApp(ctx, "", nil) if err != nil { @@ -217,12 +229,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `id` | `string` | :heavy_check_mark: | N/A | -| `include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the current Terraform workspace state.
| -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `id` | `string` | :heavy_check_mark: | N/A | +| `include` | [][operations.ReadAppInclude](../../models/operations/readappinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the live stack state reported by Formance Cloud
(a projection of the bound stack from Membership, not a snapshot
persisted by the proxy).
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -237,10 +249,11 @@ func main() { ## DeleteApp Soft-deletes the app immediately and enqueues a destroy deployment to -clean up any terraform-managed resources on Formance Cloud. The app -becomes invisible to all subsequent reads. The destroy runs through -the normal worker pipeline; the app row is hard-deleted by the worker -once the destroy reaches a terminal status. +clean up the app's resources on Formance Cloud via the openapi +reconciler's tear-down path. The app becomes invisible to all +subsequent reads. The destroy runs through the normal worker +pipeline; once it reaches a successful terminal status the worker +hard-deletes the app row. By default this returns 202 Accepted as soon as the destroy is enqueued (or 202 with no body if no destroy was needed). Pass @@ -255,6 +268,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -262,7 +276,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.DeleteApp(ctx, "", deployserverclient.Pointer(false)) if err != nil { @@ -307,6 +323,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -315,7 +332,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.AttachAppManifest(ctx, "", components.AttachManifestRequest{ ManifestID: "", @@ -361,6 +380,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -368,7 +388,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.DetachAppManifest(ctx, "") if err != nil { @@ -410,6 +432,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -417,7 +440,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadAppVariables(ctx, "", nil, nil) if err != nil { @@ -461,6 +486,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -469,7 +495,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.CreateAppVariable(ctx, "", components.CreateVariableRequest{ Variable: components.VariableData{ @@ -517,6 +545,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -524,7 +553,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.DeleteAppVariable(ctx, "", "") if err != nil { @@ -567,15 +598,17 @@ package main import( "context" - deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "os" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) example, fileErr := os.Open("example.file") if fileErr != nil { @@ -623,6 +656,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" "log" @@ -631,7 +665,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.CreateManifest(ctx, "", operations.CreateManifestRequestBody{}) if err != nil { @@ -674,6 +710,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -681,7 +718,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListManifests(ctx, nil, nil) if err != nil { @@ -724,6 +763,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -731,7 +771,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadManifest(ctx, "", nil) if err != nil { @@ -774,6 +816,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -782,7 +825,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.UpdateManifest(ctx, "", components.UpdateManifestRequest{ Name: "", @@ -827,6 +872,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -834,7 +880,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.DeleteManifest(ctx, "") if err != nil { @@ -877,15 +925,17 @@ package main import( "context" - deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "os" + deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) example, fileErr := os.Open("example.file") if fileErr != nil { @@ -933,6 +983,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/operations" "log" @@ -941,7 +992,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.PushManifestVersion(ctx, "", operations.PushManifestVersionRequestBody{}) if err != nil { @@ -984,6 +1037,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -991,7 +1045,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListManifestVersions(ctx, "", nil, nil) if err != nil { @@ -1035,6 +1091,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -1042,7 +1099,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadManifestVersion(ctx, "", "") if err != nil { @@ -1085,6 +1144,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" "log" @@ -1093,7 +1153,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.CreateDeployment(ctx, components.CreateDeploymentRequest{ AppID: "", @@ -1139,6 +1201,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -1146,7 +1209,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ListDeployments(ctx, nil, nil, nil) if err != nil { @@ -1190,6 +1255,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -1197,7 +1263,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadDeployment(ctx, "", nil) if err != nil { @@ -1211,12 +1279,12 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `deploymentID` | `string` | :heavy_check_mark: | N/A | -| `include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the Terraform state produced by this deployment's run.
| -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `deploymentID` | `string` | :heavy_check_mark: | N/A | +| `include` | [][operations.ReadDeploymentInclude](../../models/operations/readdeploymentinclude.md) | :heavy_minus_sign: | Comma-separated list of related resources to include.
- `state`: Include the live stack state reported by Formance Cloud
for this deployment's bound stack. Note: this is the **live**
projection from Membership, not a frozen per-deployment snapshot.
| +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response @@ -1240,6 +1308,7 @@ package main import( "context" + "os" deployserverclient "github.com/formancehq/fctl/internal/deployserverclient/v3" "log" ) @@ -1247,7 +1316,9 @@ import( func main() { ctx := context.Background() - s := deployserverclient.New() + s := deployserverclient.New( + deployserverclient.WithSecurity(os.Getenv("DEPLOYSERVER_BEARER_AUTH")), + ) res, err := s.ReadDeploymentLogs(ctx, "") if err != nil { diff --git a/internal/deployserverclient/internal/config/sdkconfiguration.go b/internal/deployserverclient/internal/config/sdkconfiguration.go index e0e5bebf..dd5ad42c 100644 --- a/internal/deployserverclient/internal/config/sdkconfiguration.go +++ b/internal/deployserverclient/internal/config/sdkconfiguration.go @@ -4,6 +4,7 @@ package config import ( + "context" "github.com/formancehq/fctl/internal/deployserverclient/v3/retry" "net/http" "time" @@ -14,8 +15,8 @@ type HTTPClient interface { } type SDKConfiguration struct { - Client HTTPClient - + Client HTTPClient + Security func(context.Context) (interface{}, error) ServerURL string ServerIndex int ServerList []string diff --git a/internal/deployserverclient/models/components/security.go b/internal/deployserverclient/models/components/security.go new file mode 100644 index 00000000..5f41eea6 --- /dev/null +++ b/internal/deployserverclient/models/components/security.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +// @generated-id: f6f99ec31c6f + +package components + +type Security struct { + BearerAuth *string `security:"scheme,type=http,subtype=bearer,name=Authorization,env=deployserver_bearer_auth"` +} + +func (s *Security) GetBearerAuth() *string { + if s == nil { + return nil + } + return s.BearerAuth +} diff --git a/internal/deployserverclient/models/components/state.go b/internal/deployserverclient/models/components/state.go index 36d6cfe5..4a14aefd 100644 --- a/internal/deployserverclient/models/components/state.go +++ b/internal/deployserverclient/models/components/state.go @@ -4,7 +4,10 @@ package components type State struct { - // The stack details from the Terraform state + // The live stack details reported by Formance Cloud (a projection of + // the bound stack from Membership). Shape is a free-form object + // mirroring the upstream stack resource. + // Stack map[string]any `json:"stack"` } diff --git a/internal/deployserverclient/models/operations/options.go b/internal/deployserverclient/models/operations/options.go index 0010ed43..6c56bd90 100644 --- a/internal/deployserverclient/models/operations/options.go +++ b/internal/deployserverclient/models/operations/options.go @@ -23,7 +23,6 @@ type AcceptHeaderEnum string const ( AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" - AcceptHeaderEnumApplicationGzip AcceptHeaderEnum = "application/gzip" AcceptHeaderEnumApplicationXYaml AcceptHeaderEnum = "application/x-yaml" AcceptHeaderEnumApplicationYaml AcceptHeaderEnum = "application/yaml" ) diff --git a/internal/deployserverclient/models/operations/readapp.go b/internal/deployserverclient/models/operations/readapp.go index ff16e36f..fdaf235b 100644 --- a/internal/deployserverclient/models/operations/readapp.go +++ b/internal/deployserverclient/models/operations/readapp.go @@ -35,7 +35,9 @@ func (e *ReadAppInclude) UnmarshalJSON(data []byte) error { type ReadAppRequest struct { ID string `pathParam:"style=simple,explode=false,name=id"` // Comma-separated list of related resources to include. - // - `state`: Include the current Terraform workspace state. + // - `state`: Include the live stack state reported by Formance Cloud + // (a projection of the bound stack from Membership, not a snapshot + // persisted by the proxy). // Include []ReadAppInclude `queryParam:"style=form,explode=true,name=include"` } diff --git a/internal/deployserverclient/models/operations/readdeployment.go b/internal/deployserverclient/models/operations/readdeployment.go index d4cd445d..43788beb 100644 --- a/internal/deployserverclient/models/operations/readdeployment.go +++ b/internal/deployserverclient/models/operations/readdeployment.go @@ -36,7 +36,9 @@ func (e *ReadDeploymentInclude) UnmarshalJSON(data []byte) error { type ReadDeploymentRequest struct { DeploymentID string `pathParam:"style=simple,explode=false,name=deploymentId"` // Comma-separated list of related resources to include. - // - `state`: Include the Terraform state produced by this deployment's run. + // - `state`: Include the live stack state reported by Formance Cloud + // for this deployment's bound stack. Note: this is the **live** + // projection from Membership, not a frozen per-deployment snapshot. // Include []ReadDeploymentInclude `queryParam:"style=form,explode=true,name=include"` } @@ -61,10 +63,7 @@ type ReadDeploymentResponse struct { DeploymentResponse *components.DeploymentResponse // Deployment retrieved successfully // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationGzipResponseStream io.ReadCloser - // Deployment retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - TwoHundredApplicationYamlResponseStream io.ReadCloser + ResponseStream io.ReadCloser // Error Error *components.Error } @@ -83,18 +82,11 @@ func (r *ReadDeploymentResponse) GetDeploymentResponse() *components.DeploymentR return r.DeploymentResponse } -func (r *ReadDeploymentResponse) GetTwoHundredApplicationGzipResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.TwoHundredApplicationGzipResponseStream -} - -func (r *ReadDeploymentResponse) GetTwoHundredApplicationYamlResponseStream() io.ReadCloser { +func (r *ReadDeploymentResponse) GetResponseStream() io.ReadCloser { if r == nil { return nil } - return r.TwoHundredApplicationYamlResponseStream + return r.ResponseStream } func (r *ReadDeploymentResponse) GetError() *components.Error { diff --git a/internal/deployserverclient/models/operations/readmanifest.go b/internal/deployserverclient/models/operations/readmanifest.go index 2beac535..da0a84d4 100644 --- a/internal/deployserverclient/models/operations/readmanifest.go +++ b/internal/deployserverclient/models/operations/readmanifest.go @@ -5,7 +5,6 @@ package operations import ( "github.com/formancehq/fctl/internal/deployserverclient/v3/models/components" - "io" ) type ReadManifestRequest struct { @@ -32,9 +31,6 @@ type ReadManifestResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Manifest retrieved successfully ManifestResponse *components.ManifestResponse - // Manifest retrieved successfully - // The Close method must be called on this field, even if it is not used, to prevent resource leaks. - ResponseStream io.ReadCloser // Error Error *components.Error } @@ -53,13 +49,6 @@ func (r *ReadManifestResponse) GetManifestResponse() *components.ManifestRespons return r.ManifestResponse } -func (r *ReadManifestResponse) GetResponseStream() io.ReadCloser { - if r == nil { - return nil - } - return r.ResponseStream -} - func (r *ReadManifestResponse) GetError() *components.Error { if r == nil { return nil diff --git a/openapi/deployserver.yaml b/openapi/deployserver.yaml index d4bef3d3..6ea50aaa 100644 --- a/openapi/deployserver.yaml +++ b/openapi/deployserver.yaml @@ -1,6 +1,6 @@ openapi: 3.1.0 info: - title: Terraform HCP Proxy API + title: Formance Apps API contact: {} version: 0.1.0 servers: @@ -10,6 +10,8 @@ servers: description: Staging server - url: http://localhost:8080 description: Local server +security: + - bearerAuth: [] paths: /apps: get: @@ -92,7 +94,9 @@ paths: required: false description: | Comma-separated list of related resources to include. - - `state`: Include the current Terraform workspace state. + - `state`: Include the live stack state reported by Formance Cloud + (a projection of the bound stack from Membership, not a snapshot + persisted by the proxy). schema: type: array items: @@ -116,10 +120,11 @@ paths: summary: Delete an app description: | Soft-deletes the app immediately and enqueues a destroy deployment to - clean up any terraform-managed resources on Formance Cloud. The app - becomes invisible to all subsequent reads. The destroy runs through - the normal worker pipeline; the app row is hard-deleted by the worker - once the destroy reaches a terminal status. + clean up the app's resources on Formance Cloud via the openapi + reconciler's tear-down path. The app becomes invisible to all + subsequent reads. The destroy runs through the normal worker + pipeline; once it reaches a successful terminal status the worker + hard-deletes the app row. By default this returns 202 Accepted as soon as the destroy is enqueued (or 202 with no body if no destroy was needed). Pass @@ -374,11 +379,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ManifestResponse' - application/gzip: - schema: - type: string - format: binary - description: Transpiled tar.gz of the latest manifest version default: description: Error content: @@ -604,20 +604,20 @@ paths: description: | The desired response format. - `application/json`: Returns the deployment metadata in JSON format. - - `application/gzip`: Returns the full configuration version as a gzip archive. - `application/yaml`: Returns the original application manifest content. schema: type: string enum: - application/json - - application/gzip - application/yaml - name: include in: query required: false description: | Comma-separated list of related resources to include. - - `state`: Include the Terraform state produced by this deployment's run. + - `state`: Include the live stack state reported by Formance Cloud + for this deployment's bound stack. Note: this is the **live** + projection from Membership, not a frozen per-deployment snapshot. schema: type: array items: @@ -631,11 +631,6 @@ paths: application/json: schema: $ref: '#/components/schemas/DeploymentResponse' - application/gzip: - schema: - type: string - format: binary - description: Configuration version archive application/yaml: schema: type: string @@ -671,6 +666,16 @@ paths: schema: $ref: '#/components/schemas/Error' components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + description: | + Formance Cloud bearer token (JWT) issued by Membership. The proxy + validates the token and enforces scopes per operation; see the + per-operation `security` declarations (when present) for required + scopes. parameters: PageSize: name: pageSize @@ -695,8 +700,6 @@ components: schema: type: string schemas: - Application: - $ref: '#/components/schemas/application' State: type: object required: @@ -704,7 +707,10 @@ components: properties: stack: type: object - description: The stack details from the Terraform state + description: | + The live stack details reported by Formance Cloud (a projection of + the bound stack from Membership). Shape is a free-form object + mirroring the upstream stack resource. additionalProperties: true DeleteAppResponse: type: object @@ -1171,450 +1177,3 @@ components: type: string required: - errorCode - V2ChartAccountMetadata: - properties: - default: - type: - - 'null' - - string - type: object - V2ChartAccountRules: - type: object - DotSelf: - type: object - V2ChartSegment: - additionalProperties: true - properties: - .metadata: - additionalProperties: - $ref: '#/components/schemas/V2ChartAccountMetadata' - type: object - .pattern: - type: - - 'null' - - string - .rules: - $ref: '#/components/schemas/V2ChartAccountRules' - .self: - $ref: '#/components/schemas/DotSelf' - type: object - V2QueryTemplateVar: - properties: - default: {} - type: - type: string - type: object - V2QueryTemplate: - properties: - body: - additionalProperties: {} - type: object - description: - type: - - 'null' - - string - params: - additionalProperties: {} - type: object - resource: - type: - - 'null' - - string - vars: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplateVar' - type: object - type: object - V2TransactionTemplate: - properties: - description: - type: - - 'null' - - string - runtime: - type: - - 'null' - - string - script: - type: - - 'null' - - string - type: object - V2SchemaData: - properties: - chart: - additionalProperties: - $ref: '#/components/schemas/V2ChartSegment' - type: - - object - - 'null' - queries: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplate' - type: object - transactions: - additionalProperties: - $ref: '#/components/schemas/V2TransactionTemplate' - type: object - type: object - Ledger: - required: - - name - properties: - name: - type: string - schema: - additionalProperties: - $ref: '#/components/schemas/V2SchemaData' - type: - - object - - 'null' - type: object - Pool: - properties: - accountIds: - items: - type: string - type: array - query: - additionalProperties: {} - type: object - type: object - ReconciliationLedger: - required: - - name - - query - properties: - name: - type: string - query: - additionalProperties: {} - type: - - object - - 'null' - type: object - ReconciliationPolicy: - required: - - name - - ledger - - pool - properties: - ledger: - $ref: '#/components/schemas/ReconciliationLedger' - name: - type: string - pool: - type: string - type: object - RegionSelector: - properties: - id: - type: string - name: - type: string - type: object - Webhook: - required: - - name - - endpoint - properties: - endpoint: - type: string - events: - items: - type: string - type: array - name: - type: string - secret: - type: string - type: object - Ledgers: - items: - $ref: '#/components/schemas/Ledger' - type: - - 'null' - - array - Payments: - properties: - connectors: - items: - required: - - name - - provider - properties: - configuration: - additionalProperties: {} - type: object - credentials: - additionalProperties: - type: string - type: object - name: - type: string - provider: - type: string - type: object - type: array - pools: - additionalProperties: - $ref: '#/components/schemas/Pool' - type: object - type: object - Reconciliation: - properties: - policies: - items: - $ref: '#/components/schemas/ReconciliationPolicy' - type: array - type: object - Stack: - required: - - name - - region - properties: - name: - type: string - region: - $ref: '#/components/schemas/RegionSelector' - version: - type: string - type: object - Webhooks: - items: - $ref: '#/components/schemas/Webhook' - type: - - 'null' - - array - application: - $schema: http://json-schema.org/draft-04/schema - required: - - stack - definitions: - DotSelf: - type: object - Ledger: - required: - - name - properties: - name: - type: string - schema: - additionalProperties: - $ref: '#/components/schemas/V2SchemaData' - type: - - object - - 'null' - type: object - Ledgers: - items: - $ref: '#/components/schemas/Ledger' - type: - - 'null' - - array - Payments: - properties: - connectors: - items: - required: - - name - - provider - properties: - configuration: - additionalProperties: {} - type: object - credentials: - additionalProperties: - type: string - type: object - name: - type: string - provider: - type: string - type: object - type: array - pools: - additionalProperties: - $ref: '#/components/schemas/Pool' - type: object - type: object - Pool: - properties: - accountIds: - items: - type: string - type: array - query: - additionalProperties: {} - type: object - type: object - Reconciliation: - properties: - policies: - items: - $ref: '#/components/schemas/ReconciliationPolicy' - type: array - type: object - ReconciliationLedger: - required: - - name - - query - properties: - name: - type: string - query: - additionalProperties: {} - type: - - object - - 'null' - type: object - ReconciliationPolicy: - required: - - name - - ledger - - pool - properties: - ledger: - $ref: '#/components/schemas/ReconciliationLedger' - name: - type: string - pool: - type: string - type: object - RegionSelector: - properties: - id: - type: string - name: - type: string - type: object - Stack: - required: - - name - - region - properties: - name: - type: string - region: - $ref: '#/components/schemas/RegionSelector' - version: - type: string - type: object - V2ChartAccountMetadata: - properties: - default: - type: - - 'null' - - string - type: object - V2ChartAccountRules: - type: object - V2ChartSegment: - additionalProperties: true - properties: - .metadata: - additionalProperties: - $ref: '#/components/schemas/V2ChartAccountMetadata' - type: object - .pattern: - type: - - 'null' - - string - .rules: - $ref: '#/components/schemas/V2ChartAccountRules' - .self: - $ref: '#/components/schemas/DotSelf' - type: object - V2QueryTemplate: - properties: - body: - additionalProperties: {} - type: object - description: - type: - - 'null' - - string - params: - additionalProperties: {} - type: object - resource: - type: - - 'null' - - string - vars: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplateVar' - type: object - type: object - V2QueryTemplateVar: - properties: - default: {} - type: - type: string - type: object - V2SchemaData: - properties: - chart: - additionalProperties: - $ref: '#/components/schemas/V2ChartSegment' - type: - - object - - 'null' - queries: - additionalProperties: - $ref: '#/components/schemas/V2QueryTemplate' - type: object - transactions: - additionalProperties: - $ref: '#/components/schemas/V2TransactionTemplate' - type: object - type: object - V2TransactionTemplate: - properties: - description: - type: - - 'null' - - string - runtime: - type: - - 'null' - - string - script: - type: - - 'null' - - string - type: object - Webhook: - required: - - name - - endpoint - properties: - endpoint: - type: string - events: - items: - type: string - type: array - name: - type: string - secret: - type: string - type: object - Webhooks: - items: - $ref: '#/components/schemas/Webhook' - type: - - 'null' - - array - properties: - ledgers: - $ref: '#/components/schemas/Ledgers' - payments: - $ref: '#/components/schemas/Payments' - reconciliation: - $ref: '#/components/schemas/Reconciliation' - stack: - $ref: '#/components/schemas/Stack' - webhooks: - $ref: '#/components/schemas/Webhooks' - type: object