From 946771d0b016ae92b15a60bc3290a33b94191ffe Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 3 Mar 2020 15:08:08 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- doc/api/admin_sidekiq_queues.md | 47 +++++ doc/api/api_resources.md | 69 +++---- doc/api/graphql/reference/gitlab_schema.graphql | 81 ++++++++ doc/api/graphql/reference/gitlab_schema.json | 234 ++++++++++++++++++++++++ doc/api/graphql/reference/index.md | 20 ++ 5 files changed, 417 insertions(+), 34 deletions(-) create mode 100644 doc/api/admin_sidekiq_queues.md (limited to 'doc/api') diff --git a/doc/api/admin_sidekiq_queues.md b/doc/api/admin_sidekiq_queues.md new file mode 100644 index 00000000000..73568581d7f --- /dev/null +++ b/doc/api/admin_sidekiq_queues.md @@ -0,0 +1,47 @@ +# Admin Sidekiq queues API + +> **Note:** This feature was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25998) in GitLab 12.9 + +Delete jobs from a Sidekiq queue that match the given +[metadata](../development/logging.md#logging-context-metadata-through-rails-or-grape-requests). + +The response has three fields: + +1. `deleted_jobs` - the number of jobs deleted by the request. +1. `queue_size` - the remaining size of the queue after processing the + request. +1. `completed` - whether or not the request was able to process the + entire queue in time. If not, retrying with the same parameters may + delete further jobs (including those added after the first request + was issued). + +This API endpoint is only available to admin users. + +``` +DELETE /admin/sidekiq/queues/:queue_name +``` + +| Attribute | Type | Required | Description | +| --------- | -------------- | -------- | ----------- | +| `queue_name` | string | yes | The name of the queue to delete jobs from | +| `user` | string | no | The username of the user who scheduled the jobs | +| `project` | string | no | The full path of the project where the jobs were scheduled from | +| `root_namespace` | string | no | The root namespace of the project | +| `subscription_plan` | string | no | The subscription plan of the root namespace (GitLab.com only) | +| `caller_id` | string | no | The endpoint or background job that schedule the job (for example: `ProjectsController#create`, `/api/:version/projects/:id`, `PostReceive`) | + +At least one attribute, other than `queue_name`, is required. + +```shell +curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/admin/sidekiq/queues/authorized_projects?user=root +``` + +Example response: + +```json +{ + "completed": true, + "deleted_jobs": 7, + "queue_size": 14 +} +``` diff --git a/doc/api/api_resources.md b/doc/api/api_resources.md index a20b903d534..6a8394752c5 100644 --- a/doc/api/api_resources.md +++ b/doc/api/api_resources.md @@ -105,41 +105,42 @@ The following API resources are available in the group context: The following API resources are available outside of project and group contexts (including `/users`): -| Resource | Available endpoints | -|:--------------------------------------------------|:------------------------------------------------------------------------| -| [Appearance](appearance.md) **(CORE ONLY)** | `/application/appearance` | -| [Applications](applications.md) | `/applications` | +| Resource | Available endpoints | +|:---------------------------------------------------|:------------------------------------------------------------------------| +| [Admin Sidekiq queues](admin_sidekiq_queues.md) | `/admin/sidekiq/queues/:queue_name` | +| [Appearance](appearance.md) **(CORE ONLY)** | `/application/appearance` | +| [Applications](applications.md) | `/applications` | | [Audit Events](audit_events.md) **(PREMIUM ONLY)** | `/audit_events` | -| [Avatar](avatar.md) | `/avatar` | -| [Broadcast messages](broadcast_messages.md) | `/broadcast_messages` | -| [Code snippets](snippets.md) | `/snippets` | -| [Custom attributes](custom_attributes.md) | `/users/:id/custom_attributes` (also available for groups and projects) | -| [Deploy keys](deploy_keys.md) | `/deploy_keys` (also available for projects) | -| [Events](events.md) | `/events`, `/users/:id/events` (also available for projects) | -| [Feature flags](features.md) | `/features` | -| [Geo Nodes](geo_nodes.md) **(PREMIUM ONLY)** | `/geo_nodes` | -| [Import repository from GitHub](import.md) | `/import/github` | -| [Issues](issues.md) | `/issues` (also available for groups and projects) | -| [Issues Statistics](issues_statistics.md) | `/issues_statistics` (also available for groups and projects) | -| [Keys](keys.md) | `/keys` | -| [License](license.md) **(CORE ONLY)** | `/license` | -| [Markdown](markdown.md) | `/markdown` | -| [Merge requests](merge_requests.md) | `/merge_requests` (also available for groups and projects) | -| [Namespaces](namespaces.md) | `/namespaces` | -| [Notification settings](notification_settings.md) | `/notification_settings` (also available for groups and projects) | -| [Pages domains](pages_domains.md) | `/pages/domains` (also available for projects) | -| [Projects](projects.md) | `/users/:id/projects` (also available for projects) | -| [Runners](runners.md) | `/runners` (also available for projects) | -| [Search](search.md) | `/search` (also available for groups and projects) | -| [Settings](settings.md) **(CORE ONLY)** | `/application/settings` | -| [Statistics](statistics.md) | `/application/statistics` | -| [Sidekiq metrics](sidekiq_metrics.md) | `/sidekiq` | -| [Suggestions](suggestions.md) | `/suggestions` | -| [System hooks](system_hooks.md) | `/hooks` | -| [Todos](todos.md) | `/todos` | -| [Users](users.md) | `/users` | -| [Validate `.gitlab-ci.yml` file](lint.md) | `/lint` | -| [Version](version.md) | `/version` | +| [Avatar](avatar.md) | `/avatar` | +| [Broadcast messages](broadcast_messages.md) | `/broadcast_messages` | +| [Code snippets](snippets.md) | `/snippets` | +| [Custom attributes](custom_attributes.md) | `/users/:id/custom_attributes` (also available for groups and projects) | +| [Deploy keys](deploy_keys.md) | `/deploy_keys` (also available for projects) | +| [Events](events.md) | `/events`, `/users/:id/events` (also available for projects) | +| [Feature flags](features.md) | `/features` | +| [Geo Nodes](geo_nodes.md) **(PREMIUM ONLY)** | `/geo_nodes` | +| [Import repository from GitHub](import.md) | `/import/github` | +| [Issues](issues.md) | `/issues` (also available for groups and projects) | +| [Issues Statistics](issues_statistics.md) | `/issues_statistics` (also available for groups and projects) | +| [Keys](keys.md) | `/keys` | +| [License](license.md) **(CORE ONLY)** | `/license` | +| [Markdown](markdown.md) | `/markdown` | +| [Merge requests](merge_requests.md) | `/merge_requests` (also available for groups and projects) | +| [Namespaces](namespaces.md) | `/namespaces` | +| [Notification settings](notification_settings.md) | `/notification_settings` (also available for groups and projects) | +| [Pages domains](pages_domains.md) | `/pages/domains` (also available for projects) | +| [Projects](projects.md) | `/users/:id/projects` (also available for projects) | +| [Runners](runners.md) | `/runners` (also available for projects) | +| [Search](search.md) | `/search` (also available for groups and projects) | +| [Settings](settings.md) **(CORE ONLY)** | `/application/settings` | +| [Statistics](statistics.md) | `/application/statistics` | +| [Sidekiq metrics](sidekiq_metrics.md) | `/sidekiq` | +| [Suggestions](suggestions.md) | `/suggestions` | +| [System hooks](system_hooks.md) | `/hooks` | +| [Todos](todos.md) | `/todos` | +| [Users](users.md) | `/users` | +| [Validate `.gitlab-ci.yml` file](lint.md) | `/lint` | +| [Version](version.md) | `/version` | ## Templates API resources diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 75d94f58605..808d54fd86b 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -38,6 +38,66 @@ type AddAwardEmojiPayload { errors: [String!]! } +""" +Autogenerated input type of AdminSidekiqQueuesDeleteJobs +""" +input AdminSidekiqQueuesDeleteJobsInput { + """ + Delete jobs matching caller_id in the context metadata + """ + callerId: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + Delete jobs matching project in the context metadata + """ + project: String + + """ + The name of the queue to delete jobs from + """ + queueName: String! + + """ + Delete jobs matching root_namespace in the context metadata + """ + rootNamespace: String + + """ + Delete jobs matching subscription_plan in the context metadata + """ + subscriptionPlan: String + + """ + Delete jobs matching user in the context metadata + """ + user: String +} + +""" +Autogenerated return type of AdminSidekiqQueuesDeleteJobs +""" +type AdminSidekiqQueuesDeleteJobsPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + Reasons why the mutation failed. + """ + errors: [String!]! + + """ + Information about the status of the deletion request + """ + result: DeleteJobsResponse +} + """ An emoji awarded by a user. """ @@ -601,6 +661,26 @@ type CreateSnippetPayload { snippet: Snippet } +""" +The response from the AdminSidekiqQueuesDeleteJobs mutation. +""" +type DeleteJobsResponse { + """ + Whether or not the entire queue was processed in time; if not, retrying the same request is safe + """ + completed: Boolean + + """ + The number of matching jobs deleted + """ + deletedJobs: Int + + """ + The queue size after processing + """ + queueSize: Int +} + """ A single design """ @@ -4767,6 +4847,7 @@ enum MoveType { type Mutation { addAwardEmoji(input: AddAwardEmojiInput!): AddAwardEmojiPayload + adminSidekiqQueuesDeleteJobs(input: AdminSidekiqQueuesDeleteJobsInput!): AdminSidekiqQueuesDeleteJobsPayload createDiffNote(input: CreateDiffNoteInput!): CreateDiffNotePayload createEpic(input: CreateEpicInput!): CreateEpicPayload createImageDiffNote(input: CreateImageDiffNoteInput!): CreateImageDiffNotePayload diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 9434c15b681..b7fa9b21320 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -19106,6 +19106,33 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "adminSidekiqQueuesDeleteJobs", + "description": null, + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AdminSidekiqQueuesDeleteJobsInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AdminSidekiqQueuesDeleteJobsPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "createDiffNote", "description": null, @@ -19978,6 +20005,213 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AdminSidekiqQueuesDeleteJobsPayload", + "description": "Autogenerated return type of AdminSidekiqQueuesDeleteJobs", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "errors", + "description": "Reasons why the mutation failed.", + "args": [ + + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "result", + "description": "Information about the status of the deletion request", + "args": [ + + ], + "type": { + "kind": "OBJECT", + "name": "DeleteJobsResponse", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteJobsResponse", + "description": "The response from the AdminSidekiqQueuesDeleteJobs mutation.", + "fields": [ + { + "name": "completed", + "description": "Whether or not the entire queue was processed in time; if not, retrying the same request is safe", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletedJobs", + "description": "The number of matching jobs deleted", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queueSize", + "description": "The queue size after processing", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AdminSidekiqQueuesDeleteJobsInput", + "description": "Autogenerated input type of AdminSidekiqQueuesDeleteJobs", + "fields": null, + "inputFields": [ + { + "name": "user", + "description": "Delete jobs matching user in the context metadata", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "project", + "description": "Delete jobs matching project in the context metadata", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "rootNamespace", + "description": "Delete jobs matching root_namespace in the context metadata", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "subscriptionPlan", + "description": "Delete jobs matching subscription_plan in the context metadata", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "callerId", + "description": "Delete jobs matching caller_id in the context metadata", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "queueName", + "description": "The name of the queue to delete jobs from", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "AddAwardEmojiPayload", diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 9d1d95ff2fb..54333464603 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -26,6 +26,16 @@ Autogenerated return type of AddAwardEmoji | `clientMutationId` | String | A unique identifier for the client performing the mutation. | | `errors` | String! => Array | Reasons why the mutation failed. | +## AdminSidekiqQueuesDeleteJobsPayload + +Autogenerated return type of AdminSidekiqQueuesDeleteJobs + +| Name | Type | Description | +| --- | ---- | ---------- | +| `clientMutationId` | String | A unique identifier for the client performing the mutation. | +| `errors` | String! => Array | Reasons why the mutation failed. | +| `result` | DeleteJobsResponse | Information about the status of the deletion request | + ## AwardEmoji An emoji awarded by a user. @@ -129,6 +139,16 @@ Autogenerated return type of CreateSnippet | `errors` | String! => Array | Reasons why the mutation failed. | | `snippet` | Snippet | The snippet after mutation | +## DeleteJobsResponse + +The response from the AdminSidekiqQueuesDeleteJobs mutation. + +| Name | Type | Description | +| --- | ---- | ---------- | +| `completed` | Boolean | Whether or not the entire queue was processed in time; if not, retrying the same request is safe | +| `deletedJobs` | Int | The number of matching jobs deleted | +| `queueSize` | Int | The queue size after processing | + ## Design A single design -- cgit v1.2.3