fs-gitlab 4.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +270 -0
  3. data/LICENSE.txt +24 -0
  4. data/README.md +260 -0
  5. data/exe/gitlab +11 -0
  6. data/lib/gitlab/api.rb +24 -0
  7. data/lib/gitlab/cli.rb +89 -0
  8. data/lib/gitlab/cli_helpers.rb +243 -0
  9. data/lib/gitlab/client/access_requests.rb +103 -0
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +137 -0
  13. data/lib/gitlab/client/boards.rb +146 -0
  14. data/lib/gitlab/client/branches.rb +135 -0
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +135 -0
  17. data/lib/gitlab/client/builds.rb +108 -0
  18. data/lib/gitlab/client/commits.rb +216 -0
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +34 -0
  21. data/lib/gitlab/client/environments.rb +89 -0
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +60 -0
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +94 -0
  30. data/lib/gitlab/client/groups.rb +358 -0
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +231 -0
  33. data/lib/gitlab/client/jobs.rb +250 -0
  34. data/lib/gitlab/client/keys.rb +29 -0
  35. data/lib/gitlab/client/labels.rb +88 -0
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +265 -0
  39. data/lib/gitlab/client/merge_requests.rb +386 -0
  40. data/lib/gitlab/client/milestones.rb +106 -0
  41. data/lib/gitlab/client/namespaces.rb +22 -0
  42. data/lib/gitlab/client/notes.rb +313 -0
  43. data/lib/gitlab/client/packages.rb +95 -0
  44. data/lib/gitlab/client/pipeline_schedules.rb +147 -0
  45. data/lib/gitlab/client/pipeline_triggers.rb +103 -0
  46. data/lib/gitlab/client/pipelines.rb +105 -0
  47. data/lib/gitlab/client/project_badges.rb +85 -0
  48. data/lib/gitlab/client/project_clusters.rb +83 -0
  49. data/lib/gitlab/client/project_release_links.rb +76 -0
  50. data/lib/gitlab/client/project_releases.rb +79 -0
  51. data/lib/gitlab/client/projects.rb +708 -0
  52. data/lib/gitlab/client/protected_tags.rb +59 -0
  53. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  54. data/lib/gitlab/client/repositories.rb +113 -0
  55. data/lib/gitlab/client/repository_files.rb +131 -0
  56. data/lib/gitlab/client/repository_submodules.rb +27 -0
  57. data/lib/gitlab/client/resource_label_events.rb +82 -0
  58. data/lib/gitlab/client/resource_state_events.rb +57 -0
  59. data/lib/gitlab/client/runners.rb +211 -0
  60. data/lib/gitlab/client/search.rb +66 -0
  61. data/lib/gitlab/client/services.rb +53 -0
  62. data/lib/gitlab/client/sidekiq.rb +39 -0
  63. data/lib/gitlab/client/snippets.rb +95 -0
  64. data/lib/gitlab/client/system_hooks.rb +64 -0
  65. data/lib/gitlab/client/tags.rb +97 -0
  66. data/lib/gitlab/client/templates.rb +100 -0
  67. data/lib/gitlab/client/todos.rb +46 -0
  68. data/lib/gitlab/client/user_snippets.rb +114 -0
  69. data/lib/gitlab/client/users.rb +397 -0
  70. data/lib/gitlab/client/versions.rb +18 -0
  71. data/lib/gitlab/client/wikis.rb +79 -0
  72. data/lib/gitlab/client.rb +95 -0
  73. data/lib/gitlab/configuration.rb +57 -0
  74. data/lib/gitlab/error.rb +170 -0
  75. data/lib/gitlab/file_response.rb +48 -0
  76. data/lib/gitlab/help.rb +94 -0
  77. data/lib/gitlab/objectified_hash.rb +51 -0
  78. data/lib/gitlab/page_links.rb +35 -0
  79. data/lib/gitlab/paginated_response.rb +110 -0
  80. data/lib/gitlab/request.rb +109 -0
  81. data/lib/gitlab/shell.rb +83 -0
  82. data/lib/gitlab/shell_history.rb +57 -0
  83. data/lib/gitlab/version.rb +5 -0
  84. data/lib/gitlab.rb +56 -0
  85. metadata +204 -0
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to builds.
5
+ # @see https://docs.gitlab.com/ce/api/builds.html
6
+ module Builds
7
+ # Gets a list of project builds.
8
+ #
9
+ # @example
10
+ # Gitlab.builds(5)
11
+ # Gitlab.builds(5, { per_page: 10, page: 2 })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @param [Integer, String] project The ID or name of a project.
18
+ # @return [Array<Gitlab::ObjectifiedHash>]
19
+ def builds(project, options = {})
20
+ get("/projects/#{url_encode project}/builds", query: options)
21
+ end
22
+
23
+ # Gets a single build.
24
+ #
25
+ # @example
26
+ # Gitlab.build(5, 36)
27
+ #
28
+ # @param [Integer, String] project The ID or name of a project.
29
+ # @param [Integer] id The ID of a build.
30
+ # @return [Gitlab::ObjectifiedHash]
31
+ def build(project, id)
32
+ get("/projects/#{url_encode project}/builds/#{id}")
33
+ end
34
+
35
+ # Gets build artifacts.
36
+ #
37
+ # @example
38
+ # Gitlab.build_artifacts(1, 8)
39
+ #
40
+ # @param [Integer, String] project The ID or name of a project.
41
+ # @param [Integer] id The ID of a build.
42
+ # @return [Gitlab::FileResponse]
43
+ def build_artifacts(project, id)
44
+ get("/projects/#{url_encode project}/builds/#{id}/artifacts",
45
+ format: nil,
46
+ headers: { Accept: 'application/octet-stream' },
47
+ parser: proc { |body, _|
48
+ if body.encoding == Encoding::ASCII_8BIT # binary response
49
+ ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
50
+ else # error with json response
51
+ ::Gitlab::Request.parse(body)
52
+ end
53
+ })
54
+ end
55
+
56
+ # Gets a list of builds for specific commit in a project.
57
+ #
58
+ # @example
59
+ # Gitlab.commit_builds(5, 'asdf')
60
+ # Gitlab.commit_builds(5, 'asdf', { per_page: 10, page: 2 })
61
+ #
62
+ # @param [Integer, String] project The ID or name of a project.
63
+ # @param [String] sha The SHA checksum of a commit.
64
+ # @param [Hash] options A customizable set of options.
65
+ # @option options [Integer] :page The page number.
66
+ # @option options [Integer] :per_page The number of results per page.
67
+ # @return [Array<Gitlab::ObjectifiedHash>] The list of builds.
68
+ def commit_builds(project, sha, options = {})
69
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/builds", query: options)
70
+ end
71
+
72
+ # Cancels a build.
73
+ #
74
+ # @example
75
+ # Gitlab.build_cancel(5, 1)
76
+ #
77
+ # @param [Integer, String] project The ID or name of a project.
78
+ # @param [Integer] id The ID of a build.
79
+ # @return [Gitlab::ObjectifiedHash] The builds changes.
80
+ def build_cancel(project, id)
81
+ post("/projects/#{url_encode project}/builds/#{id}/cancel")
82
+ end
83
+
84
+ # Retry a build.
85
+ #
86
+ # @example
87
+ # Gitlab.build_retry(5, 1)
88
+ #
89
+ # @param [Integer, String] project The ID or name of a project.
90
+ # @param [Integer] id The ID of a build.
91
+ # @return [Array<Gitlab::ObjectifiedHash>] The builds changes.
92
+ def build_retry(project, id)
93
+ post("/projects/#{url_encode project}/builds/#{id}/retry")
94
+ end
95
+
96
+ # Erase a single build of a project (remove build artifacts and a build trace)
97
+ #
98
+ # @example
99
+ # Gitlab.build_erase(5, 1)
100
+ #
101
+ # @param [Integer, String] project The ID or name of a project.
102
+ # @param [Integer] id The ID of a build.
103
+ # @return [Gitlab::ObjectifiedHash] The build's changes.
104
+ def build_erase(project, id)
105
+ post("/projects/#{url_encode project}/builds/#{id}/erase")
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,216 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to repository commits.
5
+ # @see https://docs.gitlab.com/ce/api/commits.html
6
+ module Commits
7
+ # Gets a list of project commits.
8
+ #
9
+ # @example
10
+ # Gitlab.commits('viking')
11
+ # Gitlab.repo_commits('gitlab', { ref: 'api' })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [String] :ref The branch or tag name of a project repository.
16
+ # @option options [Integer] :page The page number.
17
+ # @option options [Integer] :per_page The number of results per page.
18
+ # @return [Array<Gitlab::ObjectifiedHash>]
19
+ def commits(project, options = {})
20
+ get("/projects/#{url_encode project}/repository/commits", query: options)
21
+ end
22
+ alias repo_commits commits
23
+
24
+ # Gets a specific commit identified by the commit hash or name of a branch or tag.
25
+ #
26
+ # @example
27
+ # Gitlab.commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
28
+ # Gitlab.repo_commit(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
29
+ #
30
+ # @param [Integer, String] project The ID or name of a project.
31
+ # @param [String] sha The commit hash or name of a repository branch or tag
32
+ # @return [Gitlab::ObjectifiedHash]
33
+ def commit(project, sha)
34
+ get("/projects/#{url_encode project}/repository/commits/#{sha}")
35
+ end
36
+ alias repo_commit commit
37
+
38
+ # Get all references (from branches or tags) a commit is pushed to.
39
+ #
40
+ # @example
41
+ # Gitlab.commit_refs(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
42
+ #
43
+ # @param [Integer, String] project The ID or name of a project.
44
+ # @param [String] sha The commit hash
45
+ # @param [Hash] options A customizable set of options.
46
+ # @option options [String] :type The scope of commits. Possible values `branch`, `tag`, `all`. Default is `all`.
47
+ # @option options [Integer] :page The page number.
48
+ # @option options [Integer] :per_page The number of results per page.
49
+ # @return [Gitlab::ObjectifiedHash]
50
+ def commit_refs(project, sha, options = {})
51
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/refs", query: options)
52
+ end
53
+
54
+ # Cherry picks a commit to a given branch.
55
+ #
56
+ # @example
57
+ # Gitlab.cherry_pick_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master')
58
+ #
59
+ # @param [Integer, String] project The ID or name of a project.
60
+ # @param [String] sha The commit hash or name of a repository branch or tag
61
+ # @param [String] branch The name of the branch
62
+ # @param [Hash] options A customizable set of options.
63
+ # @option options [Boolean] :dry_run Don't commit any changes
64
+ # @return [Gitlab::ObjectifiedHash]
65
+ def cherry_pick_commit(project, sha, branch, options = {})
66
+ options[:branch] = branch
67
+
68
+ post("/projects/#{url_encode project}/repository/commits/#{sha}/cherry_pick", body: options)
69
+ end
70
+
71
+ # Reverts a commit in a given branch.
72
+ #
73
+ # @example
74
+ # Gitlab.revert_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master')
75
+ #
76
+ # @param [Integer, String] project The ID or name of a project.
77
+ # @param [String] sha The commit hash or name of a repository branch or tag
78
+ # @param [String] branch The name of the branch
79
+ # @param [Hash] options A customizable set of options.
80
+ # @option options [Boolean] :dry_run Don't commit any changes
81
+ # @return [Gitlab::ObjectifiedHash]
82
+ def revert_commit(project, sha, branch, options = {})
83
+ options[:branch] = branch
84
+
85
+ post("/projects/#{url_encode project}/repository/commits/#{sha}/revert", body: options)
86
+ end
87
+
88
+ # Get the diff of a commit in a project.
89
+ #
90
+ # @example
91
+ # Gitlab.commit_diff(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
92
+ # Gitlab.repo_commit_diff(3, 'ed899a2f4b50b4370feeea94676502b42383c746')
93
+ #
94
+ # @param [Integer, String] project The ID or name of a project.
95
+ # @param [String] sha The name of a repository branch or tag or if not given the default branch.
96
+ # @return [Gitlab::ObjectifiedHash]
97
+ def commit_diff(project, sha)
98
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/diff")
99
+ end
100
+ alias repo_commit_diff commit_diff
101
+
102
+ # Gets a list of comments for a commit.
103
+ #
104
+ # @example
105
+ # Gitlab.commit_comments(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
106
+ #
107
+ # @param [Integer] project The ID of a project.
108
+ # @param [String] sha The commit hash or name of a repository branch or tag.
109
+ # @option options [Integer] :page The page number.
110
+ # @option options [Integer] :per_page The number of results per page.
111
+ # @return [Array<Gitlab::ObjectifiedHash>]
112
+ def commit_comments(project, commit, options = {})
113
+ get("/projects/#{url_encode project}/repository/commits/#{commit}/comments", query: options)
114
+ end
115
+ alias repo_commit_comments commit_comments
116
+
117
+ # Creates a new comment for a commit.
118
+ #
119
+ # @example
120
+ # Gitlab.create_commit_comment(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b', 'Nice work on this commit!')
121
+ #
122
+ # @param [Integer, String] project The ID or name of a project.
123
+ # @param [String] sha The commit hash or name of a repository branch or tag.
124
+ # @param [String] note The text of a comment.
125
+ # @param [Hash] options A customizable set of options.
126
+ # @option options [String] :path The file path.
127
+ # @option options [Integer] :line The line number.
128
+ # @option options [String] :line_type The line type (new or old).
129
+ # @return [Gitlab::ObjectifiedHash] Information about created comment.
130
+ def create_commit_comment(project, commit, note, options = {})
131
+ post("/projects/#{url_encode project}/repository/commits/#{commit}/comments", body: options.merge(note: note))
132
+ end
133
+ alias repo_create_commit_comment create_commit_comment
134
+
135
+ # Get the status of a commit
136
+ #
137
+ # @example
138
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
139
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins' })
140
+ # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins', all: true })
141
+ #
142
+ # @param [Integer, String] project The ID or name of a project.
143
+ # @param [String] sha The commit hash
144
+ # @param [Hash] options A customizable set of options.
145
+ # @option options [String] :ref Filter by ref name, it can be branch or tag
146
+ # @option options [String] :stage Filter by stage
147
+ # @option options [String] :name Filter by status name, eg. jenkins
148
+ # @option options [Boolean] :all The flag to return all statuses, not only latest ones
149
+ def commit_status(project, sha, options = {})
150
+ get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options)
151
+ end
152
+ alias repo_commit_status commit_status
153
+
154
+ # Adds or updates a status of a commit.
155
+ #
156
+ # @example
157
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success')
158
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' })
159
+ # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' })
160
+ #
161
+ # @param [Integer, String] project The ID or name of a project.
162
+ # @param [String] sha The commit hash
163
+ # @param [String] state of the status. Can be: pending, running, success, failed, canceled
164
+ # @param [Hash] options A customizable set of options.
165
+ # @option options [String] :ref The ref (branch or tag) to which the status refers
166
+ # @option options [String] :name Filter by status name, eg. jenkins
167
+ # @option options [String] :target_url The target URL to associate with this status
168
+ def update_commit_status(project, sha, state, options = {})
169
+ post("/projects/#{url_encode project}/statuses/#{sha}", body: options.merge(state: state))
170
+ end
171
+ alias repo_update_commit_status update_commit_status
172
+
173
+ # Creates a single commit with one or more changes
174
+ #
175
+ # @see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
176
+ # Introduced in Gitlab 8.13
177
+ #
178
+ # @example
179
+ # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'create', file_path: '/foo.txt', content: 'bar'}])
180
+ # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'delete', file_path: '/foo.txt'}])
181
+ #
182
+ # @param [Integer, String] project The ID or name of a project.
183
+ # @param [String] branch the branch name you wish to commit to
184
+ # @param [String] message the commit message
185
+ # @param [Array[Hash]] An array of action hashes to commit as a batch. See the next table for what attributes it can take.
186
+ # @option options [String] :author_email the email address of the author
187
+ # @option options [String] :author_name the name of the author
188
+ # @return [Gitlab::ObjectifiedHash] hash of commit related data
189
+ def create_commit(project, branch, message, actions, options = {})
190
+ payload = {
191
+ branch: branch,
192
+ commit_message: message,
193
+ actions: actions
194
+ }.merge(options)
195
+ post("/projects/#{url_encode project}/repository/commits", body: payload)
196
+ end
197
+
198
+ # Gets a list of merge requests for a commit.
199
+ #
200
+ # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
201
+ # Introduced in Gitlab 10.7
202
+ #
203
+ # @example
204
+ # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
205
+ #
206
+ # @param [Integer] project The ID of a project.
207
+ # @param [String] sha The commit hash.
208
+ # @option options [Integer] :page The page number.
209
+ # @option options [Integer] :per_page The number of results per page.
210
+ # @return [Array<Gitlab::ObjectifiedHash>]
211
+ def commit_merge_requests(project, commit, options = {})
212
+ get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options)
213
+ end
214
+ alias repo_commit_merge_requests commit_merge_requests
215
+ end
216
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to GitLab Container Registry.
5
+ # @see https://docs.gitlab.com/ce/api/container_registry.html
6
+ module ContainerRegistry
7
+ # Get a list of registry repositories in a project.
8
+ #
9
+ # @example
10
+ # Gitlab.registry_repositories(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of registry repositories in a project.
14
+ def registry_repositories(project)
15
+ get("/projects/#{url_encode project}/registry/repositories")
16
+ end
17
+
18
+ # Delete a repository in registry.
19
+ #
20
+ # @example
21
+ # Gitlab.delete_registry_repository(5, 2)
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [Integer] id The ID of registry repository.
25
+ # @return [void] This API call returns an empty response body.
26
+ def delete_registry_repository(project, id)
27
+ delete("/projects/#{url_encode project}/registry/repositories/#{id}")
28
+ end
29
+
30
+ # Get a list of tags for given registry repository.
31
+ #
32
+ # @example
33
+ # Gitlab.registry_repository_tags(5, 2)
34
+ #
35
+ # @param [Integer, String] project The ID or name of a project.
36
+ # @param [Integer] repository_id The ID of registry repository.
37
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of tags of a registry repository.
38
+ def registry_repository_tags(project, repository_id)
39
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags")
40
+ end
41
+
42
+ # Get details of a registry repository tag.
43
+ #
44
+ # @example
45
+ # Gitlab.registry_repository_tag(5, 2, 'v10.0.0')
46
+ #
47
+ # @param [Integer, String] project The ID or name of a project.
48
+ # @param [Integer] repository_id The ID of registry repository.
49
+ # @param [String] tag_name The name of tag.
50
+ # @return <Gitlab::ObjectifiedHash> Returns details about the registry repository tag
51
+ def registry_repository_tag(project, repository_id, tag_name)
52
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
53
+ end
54
+
55
+ # Delete a registry repository tag.
56
+ #
57
+ # @example
58
+ # Gitlab.delete_registry_repository_tag(5, 2, 'v10.0.0')
59
+ #
60
+ # @param [Integer, String] project The ID or name of a project.
61
+ # @param [Integer] repository_id The ID of registry repository.
62
+ # @param [String] tag_name The name of tag.
63
+ # @return [void] This API call returns an empty response body.
64
+ def delete_registry_repository_tag(project, repository_id, tag_name)
65
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
66
+ end
67
+
68
+ # Delete repository tags in bulk based on given criteria.
69
+ #
70
+ # @example
71
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '.*')
72
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d')
73
+ #
74
+ # @param [Integer, String] project The ID or name of a project.
75
+ # @param [Integer] repository_id The ID of registry repository.
76
+ # @param [Hash] options A customizable set of options.
77
+ # @option options [String] :name_regex(required) The regex of the name to delete. To delete all tags specify .*.
78
+ # @option options [Integer] :keep_n(optional) The amount of latest tags of given name to keep.
79
+ # @option options [String] :older_than(required) Tags to delete that are older than the given time, written in human readable form 1h, 1d, 1month.
80
+ # @return [void] This API call returns an empty response body.
81
+ def bulk_delete_registry_repository_tags(project, repository_id, options = {})
82
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags", body: options)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to deployments.
5
+ # @see https://docs.gitlab.com/ce/api/deployments.html
6
+ module Deployments
7
+ # Gets a list of project deployments.
8
+ #
9
+ # @example
10
+ # Gitlab.deployments(5)
11
+ # Gitlab.deployments(5, { per_page: 10, page: 2 })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def deployments(project, options = {})
19
+ get("/projects/#{url_encode project}/deployments", query: options)
20
+ end
21
+
22
+ # Gets a single deployment.
23
+ #
24
+ # @example
25
+ # Gitlab.deployment(5, 36)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of an deployment.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def deployment(project, id)
31
+ get("/projects/#{url_encode project}/deployments/#{id}")
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to environments.
5
+ # @see https://docs.gitlab.com/ce/api/environments.html
6
+ module Environments
7
+ # Gets a list of project environments.
8
+ #
9
+ # @example
10
+ # Gitlab.environments(5)
11
+ # Gitlab.environments(5, { per_page: 10, page: 2 })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def environments(project, options = {})
19
+ get("/projects/#{url_encode project}/environments", query: options)
20
+ end
21
+
22
+ # Gets a single environment.
23
+ #
24
+ # @example
25
+ # Gitlab.environment(5, 36)
26
+ #
27
+ # @param [Integer, String] project The ID or name of a project.
28
+ # @param [Integer] id The ID of an environment.
29
+ # @return [Gitlab::ObjectifiedHash]
30
+ def environment(project, id)
31
+ get("/projects/#{url_encode project}/environments/#{id}")
32
+ end
33
+
34
+ # Create an environment.
35
+ #
36
+ # @examples
37
+ # Gitlab.create_environment(5, 'test-branch')
38
+ # Gitlab.create_environment(5, 'test-branch', external_url: 'https://test-branch.example.host.com')
39
+ #
40
+ # @param [Integer, String] project The ID or name of a project.
41
+ # @param [String] env_name Name for the environment
42
+ # @option options [String] :external_url Optional URL for viewing the deployed project in this environment
43
+ # @return [Gitlab::ObjectifiedHash] The updated environment.
44
+ def create_environment(project, env_name, options = {})
45
+ body = { name: env_name }.merge(options)
46
+ post("/projects/#{url_encode project}/environments", body: body)
47
+ end
48
+
49
+ # Update an environment.
50
+ #
51
+ # @examples
52
+ # Gitlab.edit_environment(5, 36, name: 'test-branch')
53
+ # Gitlab.edit_environment(5, 36, external_url: 'https://test-branch.example.host.com')
54
+ #
55
+ # @param [Integer, String] project The ID or name of a project.
56
+ # @param [Integer] id The ID of an environment.
57
+ # @param [Hash] options A hash of the attribute keys & values to update.
58
+ # @option options [String] env_name Name for the environment
59
+ # @option options [String] external_url Optional URL for viewing the deployed project in this environment
60
+ # @return [Gitlab::ObjectifiedHash] The updated environment.
61
+ def edit_environment(project, id, options = {})
62
+ put("/projects/#{url_encode project}/environments/#{id}", body: options)
63
+ end
64
+
65
+ # Deletes an environment.
66
+ #
67
+ # @example
68
+ # Gitlab.delete_environment(5, 36)
69
+ #
70
+ # @param [Integer, String] project The ID or name of a project.
71
+ # @param [Integer] id The ID of an environment.
72
+ # @return [Gitlab::ObjectifiedHash] Information about the deleted environment.
73
+ def delete_environment(project, id)
74
+ delete("/projects/#{url_encode project}/environments/#{id}")
75
+ end
76
+
77
+ # Stop an environment.
78
+ #
79
+ # @example
80
+ # Gitlab.stop_environment(5, 36)
81
+ #
82
+ # @param [Integer, String] project The ID or name of a project.
83
+ # @param [Integer] id The ID of an environment.
84
+ # @return [Array<Gitlab::ObjectifiedHash>] The stopped environment.
85
+ def stop_environment(project, id)
86
+ post("/projects/#{url_encode project}/environments/#{id}/stop")
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to issues.
5
+ # @see https://docs.gitlab.com/ee/api/epic_issues.html
6
+ module EpicIssues
7
+ # List issues for an epic.
8
+ # Gets all issues that are assigned to an epic and the authenticated user has access to..
9
+ # @example
10
+ # Gitlab.epic_issues(5, 7)
11
+ # Gitlab.epic_issues(5, 7, { per_page: 40 })
12
+ #
13
+ # @param [Integer, String] group The ID or name of a group.
14
+ # @param [Integer] epic The iid of an epic.
15
+ # @param [Hash] options A customizable set of options.
16
+ # @option options [Integer] :page The page number.
17
+ # @option options [Integer] :per_page The number of results per page.
18
+ # @return [Array<Gitlab::ObjectifiedHash>]
19
+ def epic_issues(group, epic, options = {})
20
+ get("/groups/#{url_encode group}/epics/#{epic}/issues", query: options)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to Epics.
5
+ # @see https://docs.gitlab.com/ee/api/epics.html
6
+ module Epics
7
+ # Gets a list of epics.
8
+ #
9
+ # @example
10
+ # Gitlab.epics(123)
11
+ # Gitlab.epics(123, { per_page: 40, page: 2 })
12
+ #
13
+ # @param [Integer] group_id The ID of a group.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [Integer] :page The page number.
16
+ # @option options [Integer] :per_page The number of results per page.
17
+ # @return [Array<Gitlab::ObjectifiedHash>]
18
+ def epics(group_id, options = {})
19
+ get("/groups/#{group_id}/epics", query: options)
20
+ end
21
+
22
+ # Gets a single epic.
23
+ #
24
+ # @example
25
+ # Gitlab.epic(123, 1)
26
+ #
27
+ # @param [Integer] group_id The ID of a group.
28
+ # @param [Integer] epic_iid The ID of a epic.
29
+ # @param [Hash] options A customizable set of options.
30
+ # @return [Gitlab::ObjectifiedHash]
31
+ def epic(group_id, epic_iid, options = {})
32
+ get("/groups/#{group_id}/epics/#{epic_iid}", query: options)
33
+ end
34
+
35
+ # Creates a new epic.
36
+ #
37
+ # @example
38
+ # Gitlab.create_epic(123, "My new epic title")
39
+ #
40
+ # @param [Integer] group_id The ID of a group.
41
+ # @param [String] title
42
+ # @param [Hash] options A customizable set of options.
43
+ # @return [Gitlab::ObjectifiedHash] Information about created epic.
44
+ def create_epic(group_id, title, options = {})
45
+ body = options.merge(title: title)
46
+ post("/groups/#{group_id}/epics", body: body)
47
+ end
48
+
49
+ # Deletes an epic.
50
+ #
51
+ # @example
52
+ # Gitlab.delete_epic(42, 123)
53
+ # @param [Integer] group_id The ID of a group.
54
+ # @param [Integer] epic_iid The IID of an epic.
55
+ def delete_epic(group_id, epic_iid)
56
+ delete("/groups/#{group_id}/epics/#{epic_iid}")
57
+ end
58
+
59
+ # Updates an existing epic.
60
+ #
61
+ # @example
62
+ # Gitlab.edit_epic(42)
63
+ # Gitlab.edit_epic(42, 123, { title: 'New epic title' })
64
+ #
65
+ # @param [Integer] group_id The ID.
66
+ # @param [Integer] epic_iid The IID of an epic.
67
+ # @param [Hash] options A customizable set of options
68
+ # @return [Gitlab::ObjectifiedHash] Information about the edited epic.
69
+ def edit_epic(group_id, epic_iid, options = {})
70
+ put("/groups/#{group_id}/epics/#{epic_iid}", body: options)
71
+ end
72
+ end
73
+ end