Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now
BE: Add mutation APIs for workspace ports
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=509828) - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=509828) </details> <!--IssueSummary end--> MR: Pending <!-- The first line of this issue description must be one of the following: 1. `MR: Pending` 2. `MR: <MR link with trailing +>`, 3. If there are multiple MRs: ``` MRs: - <MR 1 link with trailing +>` - <MR 2 link with trailing +>` - ... ``` 4. `MR: No MR` ...and the first description line of the MR should be `Issue: <Issue link with trailing +>` For more context, see: https://about.gitlab.com/handbook/engineering/development/dev/create/ide/index.html#relationship-of-issues-to-mrs --> <!-- The following sections should be filled out as part of the refinement process before the issue is prioritized. For more context, see: https://about.gitlab.com/handbook/engineering/development/dev/create/ide/#2-pre-iteration-planning-meeting --> ## Description As a pre-requisite to enable management of ports through a VSCode extension from within a workspace we want to introduce the following mutations: 1. Mutation for creating a new `workspace_ports` record 2. Mutation for removing an existing record ## Acceptance Criteria - [ ] Add new create/remove APIs for workspace ports - [ ] Add a new field in the WorkspaceCreate mutation to return workspace ports - [ ] New mutations mounted in `ee/app/graphql/ee/types/mutation_type.rb` - [ ] Add remote development domain logic modules to handle mutation requests - [ ] Add new policy for workspace ports to allow create/delete with workspace level authorization rules - [ ] GraphQL docs updated - [ ] Add unit tests for each new class - [ ] Update remote_development `integration_spec.rb` to test the new mutations ## Technical Requirement **GraphQL changes** - `Mutation.workspaceCreate` | | name | type | |----- | ------ | ------ | | field | `workspacePorts` | `[WorkspacePort!]` | - `Mutation.workspaceAddPort`: | | name | type | | ------- | ------ | ------ | | argument | `portNumber` | `Int` | | argument | `workspaceId` | `GlobalIDType[::RemoteDevelopment::Workspace]` | | field | `workspacePort` | `WorkspacePort` | All ports added with this mutation should have `port_type` set as `user_defined` - `Mutation.workspaceRemovePort`: | | name | type | | ------- | ------ | ------ | | argument | `portNumber` | `Int` | | argument | `workspaceId` | `GlobalIDType[::RemoteDevelopment::Workspace]` | Only `user_defined` ports should be removed with this mutation ------------------------------------------------- **Authorization Policy** - Policy should have workspace level authorization rules <!-- Replace with other type, e.g. bug or maintenance, if appropriate --> <!-- Replace with other subtype if appropriate --> <!-- By default, all issues start in the unprioritized status. See https://handbook.gitlab.com/handbook/engineering/development/dev/create/remote-development/#-planning-process --> <!-- For simplicity and to avoid triage bot warnings about missing workflow labels, we will default to issues starting at the refinement phase -->
issue