Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cfcd67b8
Commit
cfcd67b8
authored
Feb 21, 2022
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation, remove unused code
parent
829f9695
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
2 deletions
+62
-2
doc/api/alert_management_alerts.md
doc/api/alert_management_alerts.md
+61
-0
ee/app/services/alert_management/metric_images/upload_service.rb
...services/alert_management/metric_images/upload_service.rb
+1
-2
No files found.
doc/api/alert_management_alerts.md
View file @
cfcd67b8
...
@@ -11,6 +11,36 @@ This is the documentation of Alert Management Alerts API.
...
@@ -11,6 +11,36 @@ This is the documentation of Alert Management Alerts API.
NOTE:
NOTE:
This API is limited to metric images. For more API endpoints please refer to the
[
GraphQL API
](
graphql/reference/index.md#alertmanagementalert
)
.
This API is limited to metric images. For more API endpoints please refer to the
[
GraphQL API
](
graphql/reference/index.md#alertmanagementalert
)
.
## Upload metric image
```
plaintext
POST /projects/:id/alert_management_alerts/:alert_iid/metric_images
```
| Attribute | Type | Required | Description |
|-------------|---------|----------|--------------------------------------|
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
index.md#namespaced-path-encoding
)
owned by the authenticated user |
|
`alert_iid`
| integer | yes | The internal ID of a project's alert |
```
shell
curl
--request
POST
--header
"PRIVATE-TOKEN: <your_access_token>"
--form
'file=@/path/to/file.png'
\
--form
'url=http://example.com'
--form
'url_text=Example website'
"https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images"
```
Example response:
```
json
{
"id"
:
17
,
"created_at"
:
"2020-11-12T20:07:58.156Z"
,
"filename"
:
"sample_2054"
,
"file_path"
:
"/uploads/-/system/alert_metric_image/file/17/sample_2054.png"
,
"url"
:
"example.com/metric"
,
"url_text"
:
"An example metric"
}
```
## List metric images
## List metric images
```
plaintext
```
plaintext
...
@@ -48,3 +78,34 @@ Example response:
...
@@ -48,3 +78,34 @@ Example response:
}
}
]
]
```
```
## Update metric image
```
plaintext
PUT /projects/:id/alert_management_alerts/:alert_iid/metric_image/:image_id
```
| Attribute | Type | Required | Description |
|-------------|---------|----------|--------------------------------------|
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
index.md#namespaced-path-encoding
)
owned by the authenticated user |
|
`alert_iid`
| integer | yes | The internal ID of a project's alert |
|
`image_id`
| integer | yes | The ID of the image |
|
`url`
| string | no | The URL to view more metric information |
|
`url_text`
| string | no | A description of the image or URL |
```
shell
curl
--header
"PRIVATE-TOKEN: <your_access_token>"
--request
PUT
--form
'url=http://example.com'
--form
'url_text=Example website'
"https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images/1"
```
Example response:
```
json
{
"id"
:
23
,
"created_at"
:
"2020-11-13T00:06:18.084Z"
,
"filename"
:
"file.png"
,
"file_path"
:
"/uploads/-/system/alert_metric_image/file/23/file.png"
,
"url"
:
"http://example.com"
,
"url_text"
:
"Example website"
}
```
ee/app/services/alert_management/metric_images/upload_service.rb
View file @
cfcd67b8
...
@@ -3,13 +3,12 @@
...
@@ -3,13 +3,12 @@
module
AlertManagement
module
AlertManagement
module
MetricImages
module
MetricImages
class
UploadService
<
BaseService
class
UploadService
<
BaseService
attr_reader
:alert
,
:
project
,
:
file
,
:url
,
:url_text
,
:metric
attr_reader
:alert
,
:file
,
:url
,
:url_text
,
:metric
def
initialize
(
alert
,
current_user
,
params
=
{})
def
initialize
(
alert
,
current_user
,
params
=
{})
super
super
@alert
=
alert
@alert
=
alert
@project
=
alert
&
.
project
@file
=
params
.
fetch
(
:file
)
@file
=
params
.
fetch
(
:file
)
@url
=
params
.
fetch
(
:url
,
nil
)
@url
=
params
.
fetch
(
:url
,
nil
)
@url_text
=
params
.
fetch
(
:url_text
,
nil
)
@url_text
=
params
.
fetch
(
:url_text
,
nil
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment