feat: Expose workspace build parameters via API (#5743)

This commit is contained in:
Marcin Tojek
2023-01-17 16:24:45 +01:00
committed by GitHub
parent 985fac642e
commit 1b0560ceb4
13 changed files with 463 additions and 45 deletions

View File

@ -405,6 +405,56 @@ Status Code **200**
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get build parameters for workspace build
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/parameters \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /workspacebuilds/{workspacebuild}/parameters`
### Parameters
| Name | In | Type | Required | Description |
| ---------------- | ---- | ------ | -------- | ------------------ |
| `workspacebuild` | path | string | true | Workspace build ID |
### Example responses
> 200 Response
```json
[
{
"name": "string",
"value": "string"
}
]
```
### Responses
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.WorkspaceBuildParameter](schemas.md#codersdkworkspacebuildparameter) |
<h3 id="get-build-parameters-for-workspace-build-responseschema">Response Schema</h3>
Status Code **200**
| Name | Type | Required | Restrictions | Description |
| -------------- | ------ | -------- | ------------ | ----------- |
| `[array item]` | array | false | | |
| `» name` | string | false | | |
| `» value` | string | false | | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get workspace resources for workspace build
### Code samples
@ -1042,6 +1092,12 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/builds \
"source_value": "string"
}
],
"rich_parameter_values": [
{
"name": "string",
"value": "string"
}
],
"state": [0],
"template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
"transition": "create"

View File

@ -870,6 +870,12 @@ CreateParameterRequest is a structure used to create a new parameter value for a
"source_value": "string"
}
],
"rich_parameter_values": [
{
"name": "string",
"value": "string"
}
],
"state": [0],
"template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1",
"transition": "create"
@ -878,14 +884,15 @@ CreateParameterRequest is a structure used to create a new parameter value for a
### Properties
| Name | Type | Required | Restrictions | Description |
| --------------------- | --------------------------------------------------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dry_run` | boolean | false | | |
| `orphan` | boolean | false | | Orphan may be set for the Destroy transition. |
| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values are optional. It will write params to the 'workspace' scope. This will overwrite any existing parameters with the same name. This will not delete old params not included in this list. |
| `state` | array of integer | false | | |
| `template_version_id` | string | false | | |
| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | true | | |
| Name | Type | Required | Restrictions | Description |
| ----------------------- | ----------------------------------------------------------------------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dry_run` | boolean | false | | |
| `orphan` | boolean | false | | Orphan may be set for the Destroy transition. |
| `parameter_values` | array of [codersdk.CreateParameterRequest](#codersdkcreateparameterrequest) | false | | Parameter values are optional. It will write params to the 'workspace' scope. This will overwrite any existing parameters with the same name. This will not delete old params not included in this list. |
| `rich_parameter_values` | array of [codersdk.WorkspaceBuildParameter](#codersdkworkspacebuildparameter) | false | | |
| `state` | array of integer | false | | |
| `template_version_id` | string | false | | |
| `transition` | [codersdk.WorkspaceTransition](#codersdkworkspacetransition) | true | | |
#### Enumerated Values
@ -5105,6 +5112,22 @@ Parameter represents a set value for the scope.
| `transition` | `stop` |
| `transition` | `delete` |
## codersdk.WorkspaceBuildParameter
```json
{
"name": "string",
"value": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
| ------- | ------ | -------- | ------------ | ----------- |
| `name` | string | false | | |
| `value` | string | false | | |
## codersdk.WorkspaceQuota
```json