Skip to content

Sync environments: primary domain, dedicated cluster and AWS role - #309

Open
joetannenbaum wants to merge 2 commits into
mainfrom
api-sync/environments
Open

joetannenbaum wants to merge 2 commits into
mainfrom
api-sync/environments

Conversation

@joetannenbaum

@joetannenbaum joetannenbaum commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Syncs environments with the current API spec: adds environment:primary-domain for the two new primary-domain endpoints, and picks up the dedicated cluster and AWS role fields the environment resource and update now carry.

Findings

Endpoint or field Spec CLI before
PUT /environments/{environment}/primary-domain Sets the custom domain the environment treats as its main address. Body: domain_id (required), which must be a verified root domain on the environment that doesn't redirect to another domain. Answers 200 with EnvironmentResource. No request class or command
DELETE /environments/{environment}/primary-domain Clears the environment's primary domain; the domain stays attached. No body; answers 204. No request class or command
EnvironmentResource.attributes.cluster_id New, required, string | null: the dedicated cluster the environment runs on, null on shared compute. Dropped: no DTO property, so --json/--fields couldn't show it
EnvironmentResource.attributes.aws_role_arn New, string | null: the IAM role the application assumes. Only present for an environment on a dedicated cluster, in an organization with bring your own IAM role enabled. Dropped: no DTO property
EnvironmentResource.attributes.aws_trust_policy New, string: the trust policy, as JSON, the role in aws_role_arn must have. Present when aws_role_arn is. Dropped: no DTO property
UpdateEnvironmentRequest.aws_role_arn New, string | null: sets the role; "Send null to remove the role." Only for an environment on a dedicated cluster with bring your own IAM role; applies on the next deployment. Not sendable: no option, no request field

Both primary-domain endpoints need the environment_domain.edit permission.

Changes

environment:primary-domain

  • UpdatePrimaryDomainRequest (with UpdateEnvironmentPrimaryDomainRequestData) and ClearPrimaryDomainRequest, plus updatePrimaryDomain() and clearPrimaryDomain() on EnvironmentsResource.
  • environment:primary-domain {environment?} {--domain=} {--clear} (alias env:primary-domain):
    • --domain takes a domain ID or name from the environment's domains; one that isn't attached fails before anything is sent.
    • --clear sends the DELETE. Passing both flags is refused.
    • With neither flag, it asks: a select of the environment's root domains (only a root domain can be primary), defaulting to the current primary, plus a "None" option when one is set. Headless runs need one of the flags.
    • Picking the domain that is already primary, or clearing when there is none, sends nothing and warns.
    • It re-fetches the environment after the write, so --json prints the same Environment shape as environment:get, with primaryDomainId and primaryDomain filled in.
    • It doesn't confirm: the domain stays attached either way, and the change can be reversed straight away.
  • README command table, the client README request list, and a line in the deploying-to-cloud skill's custom-domain section.

Dedicated cluster and AWS role

  • App\Dto\Environment gains clusterId, awsRoleArn and awsTrustPolicy.
  • UpdateEnvironmentRequestData gains awsRoleArn; an empty string goes out as the explicit null that removes the role, like start_command and nightwatch_token.
  • environment:update --aws-role-arn= sets it (empty string to remove). Interactively, "AWS role ARN" is offered in the field picker only for an environment on a dedicated cluster (clusterId set), since no other environment can assume a role; the option is still sent for any environment when passed.

Left alone

The live spec no longer lists model_gateway_key_id on UpdateEnvironmentRequest or the modelGatewayKey relationship on EnvironmentResource, but the include enum on the environment endpoints still offers modelGatewayKey and the ModelGatewayKeyResource schema is still there. That still reads as a partial API change, so environment:update --model-gateway-key-id stays as it is.

Tests

  • tests/Feature/EnvironmentPrimaryDomainTest.php covers the method, URL and body for set (by name and by ID) and clear, the --json shape, the no-op cases, an unattached domain, both flags together, and a headless run with neither.
  • tests/Feature/EnvironmentUpdateTest.php covers sending --aws-role-arn, removing it with an empty string (sent as null), and clusterId/awsRoleArn/awsTrustPolicy through environment:get --json --fields.
  • The full suite (PromptFallbackTest skipped locally), PHPStan and Pint pass.

Demo

This session's GitHub access rewrites image markdown, so each GIF below is a plain link. Add a ! before each [cloud ...] line to make it play inline.

cloud environment:primary-domain

environment:primary-domain with no arguments: the environment resolves, then a new select picks the primary domain from its root domains (or None to clear).

cloud environment:update

environment:update on an environment on a dedicated cluster: the new "AWS role ARN" option in the field picker, then its text prompt.

https://claude.ai/code/session_01T1Sq4Yc6BQ4S3vcDD6eqZ6


Generated by Claude Code

The API now sets and clears an environment's primary domain
(PUT and DELETE /environments/{environment}/primary-domain). The new
command takes --domain (ID or name) or --clear, and interactively offers
the environment's root domains plus an option to clear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1Sq4WQ3L3cL3CyKM4B8P4
The environment resource now carries `cluster_id`, `aws_role_arn` and
`aws_trust_policy`, and `PATCH /environments/{environment}` accepts
`aws_role_arn`. The DTO exposes all three; `environment:update` takes
`--aws-role-arn` (empty removes it) and offers it interactively only for
an environment on a dedicated cluster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1Sq4Yc6BQ4S3vcDD6eqZ6
@joetannenbaum joetannenbaum changed the title Add environment:primary-domain Sync environments: primary domain, dedicated cluster and AWS role Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants