Repository navigation
feat(sdk): set a service's port and exposure, and follow a published value - #10
Merged
Merged
Conversation
A service a project creation builds from a repository starts without a
port and closed to the internet, and nothing in the public API could change
either: a client had to send its user to the console before a first
deployment could go live.
`setServicePort` and `setServiceExposure` call the two settings routes the
API already serves, `PUT /api/cloud/services/{serviceId}/port` and
`PUT /api/cloud/services/{serviceId}/network`. The operations live in their
own spec file, `openapi/services.yaml`, as the root file's byte ceiling asks.
Co-Authored-By: Claude <noreply@anthropic.com>
A database the resource plan creates publishes its connection string, and
the app service only gets it through a variable that follows that value.
The public API could set a variable to a value, never make it follow one,
so a client could create the database and not connect the app to it.
`followPublishedValue` calls the route the API already serves,
`POST /api/cloud/services/{serviceId}/variables/references`. The value
itself never reaches the client.
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A project created from a repository gets a first service with no port, closed to the internet, and a database the resource plan creates is not connected to it. Nothing in the public API could change any of the three, so a client such as the DMS module could create the project, its database and push a version, but the deployment could never go live without a visit to the console.
What
CloudApi.setServicePort(serviceId, port | null)→PUT /api/cloud/services/{serviceId}/portCloudApi.setServiceExposure(serviceId, isPublic)→PUT /api/cloud/services/{serviceId}/networkCloudApi.followPublishedValue(serviceId, key, { serviceId, publishedKey })→POST /api/cloud/services/{serviceId}/variables/references: the variable follows what a resource publishes (MONGO_URL,REDIS_URL…); the value never reaches the client.The three routes already exist on the API (
CloudServiceSettingsController, authorized onprojects.deployof the service's project, refused on a preview). This PR only documents them in the public spec and types the calls. The operations live in a new part file,sdk/openapi/services.yaml: the root spec has a 20 000-byte ceiling and "new parts go in their own file".Refusals documented per operation (400 / 404 / 409 with their codes).
Tests
sdk/test/services.test.ts: method, encoded path and body of each call, an empty 200/204 answer accepted, and refusals surfaced as aCloudApiErrorwith their code.pnpm --dir sdk test: 41 passing; typecheck and lint clean.Checked against a live API from a local build of this branch: the port, the exposure and the followed value were each accepted, and the service then deployed and answered on its address.
Release
The DMS module needs these calls, so it needs a published version after the merge.