-
Notifications
You must be signed in to change notification settings - Fork 894
feat(coder): Add PATCH /templateversions/:templateversion endpoint #6698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f5bf8f9
73aa2dd
7a39d34
7be61cd
1d34942
7d0b0c9
a480655
aca5131
9b35142
e5d6642
41bc1dd
c792dca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,10 @@ type TemplateVersionVariable struct { | |
Sensitive bool `json:"sensitive"` | ||
} | ||
|
||
type PatchTemplateVersionRequest struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that I asked this question on slack, but it was missed. Why in the first place we need to modify the template name? Why using the randomly generated one is bad? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think being able to add a custom name for the template version is way easier to identify and find it after IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we need this feature considering the fact that everywhere we keep using the randomly generated. @bpmct what do you think? |
||
Name string `json:"name"` | ||
} | ||
|
||
// TemplateVersion returns a template version by ID. | ||
func (c *Client) TemplateVersion(ctx context.Context, id uuid.UUID) (TemplateVersion, error) { | ||
res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s", id), nil) | ||
|
@@ -291,3 +295,15 @@ func (c *Client) PreviousTemplateVersion(ctx context.Context, organization uuid. | |
var version TemplateVersion | ||
return version, json.NewDecoder(res.Body).Decode(&version) | ||
} | ||
|
||
func (c *Client) UpdateTemplateVersion(ctx context.Context, version, req PatchTemplateVersionRequest) error { | ||
res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/templateversions/%s", version), req) | ||
if err != nil { | ||
return err | ||
} | ||
defer res.Body.Close() | ||
if res.StatusCode != http.StatusNoContent { | ||
return ReadBodyAsError(res) | ||
} | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1250,6 +1250,81 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion} \ | |
|
||
To perform this operation, you must be authenticated. [Learn more](authentication.md). | ||
|
||
## Patch template version by ID | ||
|
||
### Code samples | ||
|
||
```shell | ||
# Example request using curl | ||
curl -X PATCH http://coder-server:8080/api/v2/templateversions/{templateversion} \ | ||
-H 'Accept: application/json' \ | ||
-H 'Coder-Session-Token: API_KEY' | ||
``` | ||
|
||
`PATCH /templateversions/{templateversion}` | ||
|
||
### Parameters | ||
|
||
| Name | In | Type | Required | Description | | ||
| ----------------- | ---- | ------------ | -------- | ------------------- | | ||
| `templateversion` | path | string(uuid) | true | Template version ID | | ||
|
||
### Example responses | ||
|
||
> 200 Response | ||
|
||
```json | ||
{ | ||
"created_at": "2019-08-24T14:15:22Z", | ||
"created_by": { | ||
"avatar_url": "http://example.com", | ||
"created_at": "2019-08-24T14:15:22Z", | ||
"email": "[email protected]", | ||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", | ||
"last_seen_at": "2019-08-24T14:15:22Z", | ||
"organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"], | ||
"roles": [ | ||
{ | ||
"display_name": "string", | ||
"name": "string" | ||
} | ||
], | ||
"status": "active", | ||
"username": "string" | ||
}, | ||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", | ||
"job": { | ||
"canceled_at": "2019-08-24T14:15:22Z", | ||
"completed_at": "2019-08-24T14:15:22Z", | ||
"created_at": "2019-08-24T14:15:22Z", | ||
"error": "string", | ||
"error_code": "MISSING_TEMPLATE_PARAMETER", | ||
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", | ||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", | ||
"started_at": "2019-08-24T14:15:22Z", | ||
"status": "pending", | ||
"tags": { | ||
"property1": "string", | ||
"property2": "string" | ||
}, | ||
"worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b" | ||
}, | ||
"name": "string", | ||
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", | ||
"readme": "string", | ||
"template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", | ||
"updated_at": "2019-08-24T14:15:22Z" | ||
} | ||
``` | ||
|
||
### Responses | ||
|
||
| Status | Meaning | Description | Schema | | ||
| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------- | | ||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TemplateVersion](schemas.md#codersdktemplateversion) | | ||
|
||
To perform this operation, you must be authenticated. [Learn more](authentication.md). | ||
|
||
## Cancel template version by ID | ||
|
||
### Code samples | ||
|
Uh oh!
There was an error while loading. Please reload this page.