labclient 0.5.0 → 0.7.0
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.
- checksums.yaml +4 -4
- data/lib/labclient/client/meta.rb +1 -0
- data/lib/labclient/client/setup.rb +3 -2
- data/lib/labclient/client.rb +8 -4
- data/lib/labclient/common.rb +1 -1
- data/lib/labclient/files/create.rb +1 -1
- data/lib/labclient/files/delete.rb +1 -1
- data/lib/labclient/files/file.rb +11 -0
- data/lib/labclient/files/show.rb +6 -4
- data/lib/labclient/files/update.rb +1 -1
- data/lib/labclient/groups/ldap/sync.rb +0 -1
- data/lib/labclient/http.rb +15 -5
- data/lib/labclient/issues/delete.rb +2 -2
- data/lib/labclient/jobs/artifacts.rb +24 -8
- data/lib/labclient/jobs/job.rb +10 -3
- data/lib/labclient/projects/methods.rb +15 -2
- data/lib/labclient/projects/reference.rb +4 -0
- data/lib/labclient/projects/templates/client.rb +17 -0
- data/lib/labclient/projects/templates/list.rb +30 -0
- data/lib/labclient/projects/templates/show.rb +36 -0
- data/lib/labclient/registry/repository.rb +5 -0
- data/lib/labclient/repository/repository_tree.rb +7 -0
- data/lib/labclient/repository/tree.rb +1 -1
- data/lib/labclient/terraform/create.rb +23 -0
- data/lib/labclient/terraform/delete.rb +16 -0
- data/lib/labclient/terraform/lock.rb +17 -0
- data/lib/labclient/terraform/show.rb +22 -0
- data/lib/labclient/terraform/terraform_state.rb +11 -0
- data/lib/labclient/terraform/unlock.rb +16 -0
- data/lib/labclient/version.rb +1 -1
- data/lib/labclient.rb +24 -6
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d74d5b878f7c98298959ec6c47bb4b81a6dcb336391eb4fae8df4f38a180d920
|
4
|
+
data.tar.gz: b31895a60a9f209d39f30b33b6975e173e0ce0bc557b3cab30afb6aceb65642e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5548da86087095cf0093be6635ef81da29a2cec523a13834a793056898da03561039cccce12fa757b726945752362498c5673b15f5f33590c6edaf7ff14aff2c
|
7
|
+
data.tar.gz: 0d145b1acb0dee2c10ef8ced865a1e073791fcb1616123db9e39ffaabeb1279cff646d1ab0afd6e4a83d87771e4980c7e0ee2bea1a0162c4cc9c42cb584b1f56
|
@@ -17,14 +17,15 @@ module LabClient
|
|
17
17
|
# If nothing entered Prompt for Input
|
18
18
|
def prompt_for_url
|
19
19
|
print 'Enter GitLab URL (e.g. https://gitlab.com): '
|
20
|
-
@settings[:url] = $stdin.gets&.chomp
|
20
|
+
@settings[:url] = ENV['LABCLIENT_TESTING'] ? 'testu' : $stdin.gets&.chomp
|
21
21
|
raise 'LabClient Error - Missing URL!' if @settings[:url].blank?
|
22
22
|
end
|
23
23
|
|
24
24
|
# Check for Token
|
25
25
|
def prompt_for_token
|
26
26
|
print 'Enter Personal Access Token: '
|
27
|
-
|
27
|
+
|
28
|
+
@settings[:token] = ENV['LABCLIENT_TESTING'] ? 'testt' : $stdin.gets&.chomp
|
28
29
|
end
|
29
30
|
|
30
31
|
# Fill Defaults
|
data/lib/labclient/client.rb
CHANGED
@@ -84,13 +84,17 @@ module LabClient
|
|
84
84
|
when LabStruct
|
85
85
|
klass ? klass.new(resp.data, resp, self) : resp.data
|
86
86
|
when Array
|
87
|
-
if
|
88
|
-
resp
|
87
|
+
if klass.nil?
|
88
|
+
PaginatedResponse.new(Klass, resp, self)
|
89
89
|
else
|
90
|
-
PaginatedResponse.new(
|
90
|
+
PaginatedResponse.new(klass, resp, self)
|
91
91
|
end
|
92
|
+
# Return Response/Status Object if there is no output otherwise
|
93
|
+
when NilClass
|
94
|
+
resp
|
95
|
+
# Default handler / if klass defined store plain response in data
|
92
96
|
else
|
93
|
-
resp.data
|
97
|
+
klass ? klass.new({ data: resp.data, response: resp }, resp, self) : resp
|
94
98
|
end
|
95
99
|
end
|
96
100
|
end
|
data/lib/labclient/common.rb
CHANGED
@@ -47,7 +47,7 @@ module LabClient
|
|
47
47
|
project_id = format_id(project_id)
|
48
48
|
|
49
49
|
# Path Name Encoding
|
50
|
-
file_path =
|
50
|
+
file_path = ERB::Util.url_encode(file_path)
|
51
51
|
|
52
52
|
client.request(:post, "projects/#{project_id}/repository/files/#{file_path}", nil, query)
|
53
53
|
end
|
@@ -38,7 +38,7 @@ module LabClient
|
|
38
38
|
project_id = format_id(project_id)
|
39
39
|
|
40
40
|
# Path Name Encoding
|
41
|
-
file_path =
|
41
|
+
file_path = ERB::Util.url_encode(file_path)
|
42
42
|
|
43
43
|
client.request(:delete, "projects/#{project_id}/repository/files/#{file_path}", nil, query)
|
44
44
|
end
|
data/lib/labclient/files/show.rb
CHANGED
@@ -27,25 +27,27 @@ module LabClient
|
|
27
27
|
desc 'via Project'
|
28
28
|
example <<~DOC
|
29
29
|
project = client.projects.show(264)
|
30
|
-
project.file('
|
30
|
+
project.file('README.md')
|
31
31
|
DOC
|
32
32
|
end
|
33
33
|
|
34
34
|
def show(project_id, file_path, ref = :main, kind = nil)
|
35
|
+
# LabStruct vs LabFile
|
36
|
+
return_kind = kind == :raw ? LabFile : nil
|
37
|
+
|
35
38
|
kind = case kind
|
36
39
|
when :raw
|
37
40
|
'/raw'
|
38
41
|
when :blame
|
39
42
|
'/blame'
|
40
43
|
end
|
41
|
-
# GET /projects/:id/repository/files/:file_path
|
42
44
|
|
43
45
|
project_id = format_id(project_id)
|
44
46
|
|
45
47
|
# Path Name Encoding
|
46
|
-
file_path =
|
48
|
+
file_path = ERB::Util.url_encode(file_path)
|
47
49
|
|
48
|
-
client.request(:get, "projects/#{project_id}/repository/files/#{file_path}#{kind}",
|
50
|
+
client.request(:get, "projects/#{project_id}/repository/files/#{file_path}#{kind}", return_kind, ref: ref)
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -44,7 +44,7 @@ module LabClient
|
|
44
44
|
project_id = format_id(project_id)
|
45
45
|
|
46
46
|
# Path Name Encoding
|
47
|
-
file_path =
|
47
|
+
file_path = ERB::Util.url_encode(file_path)
|
48
48
|
|
49
49
|
client.request(:put, "projects/#{project_id}/repository/files/#{file_path}", nil, query)
|
50
50
|
end
|
data/lib/labclient/http.rb
CHANGED
@@ -82,15 +82,25 @@ module Typhoeus
|
|
82
82
|
self
|
83
83
|
end
|
84
84
|
|
85
|
+
# Check if response body can be parsed
|
86
|
+
def json_body?
|
87
|
+
content_type = headers['content-type']
|
88
|
+
|
89
|
+
return false unless content_type
|
90
|
+
return true if content_type.include? 'application/json'
|
91
|
+
|
92
|
+
false
|
93
|
+
end
|
94
|
+
|
85
95
|
def process_body
|
86
|
-
if body.empty?
|
87
|
-
|
88
|
-
|
89
|
-
body
|
90
|
-
else
|
96
|
+
return nil if body.empty?
|
97
|
+
|
98
|
+
if json_body?
|
91
99
|
result = Oj.load(body, mode: :compat, symbol_keys: true, object_class: LabClient::LabStruct)
|
92
100
|
result.instance_variable_set(:@response, self) if result.instance_of?(LabClient::LabStruct)
|
93
101
|
result
|
102
|
+
else
|
103
|
+
body
|
94
104
|
end
|
95
105
|
end
|
96
106
|
|
@@ -3,10 +3,10 @@ module LabClient
|
|
3
3
|
# Specifics
|
4
4
|
class Issues < Common
|
5
5
|
doc 'Delete' do
|
6
|
-
desc '
|
6
|
+
desc 'Only for administrators and project owners. Deletes an issue. [Project ID, Issue IID]'
|
7
7
|
example 'client.issues.delete(5, 1)'
|
8
8
|
result <<~DOC
|
9
|
-
=> #<
|
9
|
+
=> #<TyphoeusResponse code: 204>
|
10
10
|
DOC
|
11
11
|
end
|
12
12
|
|
@@ -3,11 +3,15 @@ module LabClient
|
|
3
3
|
# Specifics
|
4
4
|
class Jobs < Common
|
5
5
|
doc 'Artifacts' do
|
6
|
-
desc 'Get the job’s artifacts zipped archive of a project. [Project ID, Job ID,
|
6
|
+
desc 'Get the job’s artifacts zipped archive of a project. [Project ID, Job ID, Job Token, File Path]'
|
7
7
|
example 'client.jobs.artifacts(264, 1)'
|
8
8
|
|
9
9
|
markdown <<~DOC
|
10
|
-
|
10
|
+
---
|
11
|
+
|
12
|
+
Two methods are available. `download_artifacts` will download and write to the local directory (or file path) and `artifacts`/`show_artifacts` which will return a `LabFile` with the key of `data` for the response result.
|
13
|
+
|
14
|
+
File Output will default to the current directory + job id + file extension. 14.zip (Still returning `LabFile`)
|
11
15
|
|
12
16
|
Job Token: To be used with triggers for multi-project pipelines. It should be invoked only inside `.gitlab-ci.yml`. Its value is always `$CI_JOB_TOKEN`.
|
13
17
|
DOC
|
@@ -16,7 +20,7 @@ module LabClient
|
|
16
20
|
doc 'Artifacts' do
|
17
21
|
desc 'Specific output location'
|
18
22
|
example <<~DOC
|
19
|
-
client.jobs.
|
23
|
+
client.jobs.download_artifacts(264, 1, '/tmp/output.zip')
|
20
24
|
DOC
|
21
25
|
end
|
22
26
|
|
@@ -24,6 +28,7 @@ module LabClient
|
|
24
28
|
desc 'via Project'
|
25
29
|
example <<~DOC
|
26
30
|
project = client.projects.show(264)
|
31
|
+
project.job_download_artifacts(7)
|
27
32
|
project.job_artifacts(7)
|
28
33
|
DOC
|
29
34
|
end
|
@@ -32,18 +37,29 @@ module LabClient
|
|
32
37
|
desc 'via Job'
|
33
38
|
example <<~DOC
|
34
39
|
job = client.jobs.show(264, 7)
|
35
|
-
job.
|
40
|
+
job.download_artifacts
|
41
|
+
job.show_artifacts
|
36
42
|
DOC
|
37
43
|
end
|
38
44
|
|
39
|
-
def artifacts(project_id, job_id,
|
45
|
+
def artifacts(project_id, job_id, job_token = nil)
|
40
46
|
job_id = format_id(job_id)
|
41
47
|
project_id = format_id(project_id)
|
42
|
-
file_path ||= "#{Dir.pwd}/#{job_id}.zip"
|
43
48
|
query = { job_token: job_token } if job_token
|
44
|
-
output = client.request(:get, "projects/#{project_id}/jobs/#{job_id}/artifacts", nil, query)
|
45
49
|
|
46
|
-
|
50
|
+
# Don't try to process output
|
51
|
+
client.request(:get, "projects/#{project_id}/jobs/#{job_id}/artifacts", LabFile, query)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Helper to write immediately to a file
|
55
|
+
def download_artifacts(project_id, job_id, file_path = nil, job_token = nil)
|
56
|
+
file_path ||= "#{Dir.pwd}/#{job_id}.zip"
|
57
|
+
output = artifacts(project_id, job_id, job_token)
|
58
|
+
|
59
|
+
File.write(file_path, output.data) if output.success?
|
60
|
+
|
61
|
+
# Return LabFile
|
62
|
+
output
|
47
63
|
end
|
48
64
|
end
|
49
65
|
end
|
data/lib/labclient/jobs/job.rb
CHANGED
@@ -17,9 +17,16 @@ module LabClient
|
|
17
17
|
Pipeline.new(@table[:pipeline], response, client)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
# File Write Response
|
21
|
+
def download_artifacts(file_path = nil, job_token = nil)
|
21
22
|
project_id = collect_project_id
|
22
|
-
client.jobs.
|
23
|
+
client.jobs.download_artifacts(project_id, id, job_token, file_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
# LabFile Response
|
27
|
+
def show_artifacts(job_token = nil)
|
28
|
+
project_id = collect_project_id
|
29
|
+
client.jobs.artifacts(project_id, id, job_token)
|
23
30
|
end
|
24
31
|
|
25
32
|
def artifacts_path(artifacts_path, file_path = nil)
|
@@ -65,7 +72,7 @@ module LabClient
|
|
65
72
|
help do
|
66
73
|
@group_name = 'Jobs'
|
67
74
|
subtitle 'Job'
|
68
|
-
option '
|
75
|
+
option 'download_artifacts', 'Download Job artifacts. [File Path, Job Token]'
|
69
76
|
option 'artifacts_path', 'Download Job artifacts path. [File Path, Output Path]'
|
70
77
|
option 'trace', 'Get Job Output'
|
71
78
|
option 'cancel', 'Cancel Job'
|
@@ -226,8 +226,12 @@ module LabClient
|
|
226
226
|
client.jobs.show(id, job_id)
|
227
227
|
end
|
228
228
|
|
229
|
-
def
|
230
|
-
client.jobs.
|
229
|
+
def job_download_artifacts(job_id, file_path = nil, job_token = nil)
|
230
|
+
client.jobs.download_artifacts(id, job_id, file_path, job_token)
|
231
|
+
end
|
232
|
+
|
233
|
+
def job_artifacts(job_id, job_token = nil)
|
234
|
+
client.jobs.artifacts(id, job_id, job_token)
|
231
235
|
end
|
232
236
|
|
233
237
|
def job_artifacts_latest(branch_name, job_name, file_path = nil, job_token = nil)
|
@@ -717,6 +721,15 @@ module LabClient
|
|
717
721
|
client.projects.clusters.show(id, cluster_id)
|
718
722
|
end
|
719
723
|
|
724
|
+
# Templates
|
725
|
+
def templates(template_type)
|
726
|
+
client.projects.templates.list(id, template_type)
|
727
|
+
end
|
728
|
+
|
729
|
+
def template_show(template_type, template_name, query = {})
|
730
|
+
client.projects.templates.show(id, template_type, template_name, query)
|
731
|
+
end
|
732
|
+
|
720
733
|
# Reload
|
721
734
|
def reload
|
722
735
|
update_self client.projects.show(id)
|
@@ -264,6 +264,10 @@ module LabClient
|
|
264
264
|
# Clusters
|
265
265
|
option 'clusters', 'Returns a list of project clusters.'
|
266
266
|
|
267
|
+
# Clusters
|
268
|
+
option 'templates', 'List Templates of Type [String/Symbol]'
|
269
|
+
option 'template_show', 'Get one template of a particular type [Type: String/Symbol, Name: String/Symbol, Params: Hash]'
|
270
|
+
|
267
271
|
option 'events', 'List project events [Hash]'
|
268
272
|
option 'parent', 'Show (API Call) Project Parent, returns either Group or User'
|
269
273
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Inspect Helper
|
4
|
+
class ProjectTemplates < Common
|
5
|
+
include ClassHelpers
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# Top namespace
|
10
|
+
module LabClient
|
11
|
+
# Specifics
|
12
|
+
class Projects < Common
|
13
|
+
def templates
|
14
|
+
ProjectTemplates.new(client)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class ProjectTemplates < Common
|
5
|
+
doc 'List' do
|
6
|
+
desc 'Get all templates of a particular type. [Project ID, String/Symbol]'
|
7
|
+
example 'client.projects.templates.list(15, :issues)'
|
8
|
+
result '[{:key=>"Code Contributions", :name=>"Code Contributions"}, ...]'
|
9
|
+
|
10
|
+
markdown <<~DOC
|
11
|
+
| Attribute | Type | Required | Description |
|
12
|
+
| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
13
|
+
| type | string | yes | The type of the template. Accepted values are: `dockerfiles`, `gitignores`, `gitlab_ci_ymls`, `licenses`, `issues`, `merge_requests` |
|
14
|
+
DOC
|
15
|
+
end
|
16
|
+
|
17
|
+
doc 'List' do
|
18
|
+
desc 'Via Project [String/Symbol]'
|
19
|
+
example <<~DOC
|
20
|
+
project = client.projects.show(16)
|
21
|
+
project.templates(:issues)
|
22
|
+
DOC
|
23
|
+
end
|
24
|
+
|
25
|
+
def list(project_id, template_type)
|
26
|
+
project_id = format_id(project_id)
|
27
|
+
client.request(:get, "projects/#{project_id}/templates/#{template_type}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class ProjectTemplates < Common
|
5
|
+
doc 'Show' do
|
6
|
+
desc 'Get one template of a particular type. [Project ID, Type: String/Symbol, Name: String/Symbol, Hash]'
|
7
|
+
example 'client.projects.templates.show(15,:issues,:elasticsearch)'
|
8
|
+
result '[#<Runner id: 1, status: online>, ... ]'
|
9
|
+
|
10
|
+
markdown <<~DOC
|
11
|
+
|
12
|
+
| Attribute | Type | Required | Description |
|
13
|
+
| ---------------------------- | ----------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
|
14
|
+
| type | string | yes | The type of the template. One of: `dockerfiles`, `gitignores`, `gitlab_ci_ymls`, `licenses`, `issues`, or `merge_requests`. |
|
15
|
+
| name | string | yes | The key of the template, as obtained from the collection endpoint |
|
16
|
+
| source_template_project_id | integer | no | The project ID where a given template is being stored. This is useful when multiple templates from different projects have the same name. If multiple templates have the same name, the match from `closest ancestor` is returned if `source_template_project_id` is not specified |
|
17
|
+
| project | string | no | The project name to use when expanding placeholders in the template. Only affects licenses |
|
18
|
+
| fullname | string | no | The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses |
|
19
|
+
DOC
|
20
|
+
end
|
21
|
+
|
22
|
+
doc 'List' do
|
23
|
+
desc 'Via Project [String/Symbol]'
|
24
|
+
example <<~DOC
|
25
|
+
project = client.projects.show(16)
|
26
|
+
project.template_show(:issues, 'Elasticsearch')
|
27
|
+
DOC
|
28
|
+
end
|
29
|
+
|
30
|
+
def show(project_id, template_type, template_name, query = {})
|
31
|
+
project_id = format_id(project_id)
|
32
|
+
|
33
|
+
client.request(:get, "projects/#{project_id}/templates/#{template_type}/#{template_name}", nil, query)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -29,7 +29,7 @@ module LabClient
|
|
29
29
|
def tree(project_id, query = {})
|
30
30
|
project_id = format_id(project_id)
|
31
31
|
|
32
|
-
client.request(:get, "projects/#{project_id}/repository/tree",
|
32
|
+
client.request(:get, "projects/#{project_id}/repository/tree", RepositoryTree, query)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Terraform < Common
|
5
|
+
doc 'Create' do
|
6
|
+
desc 'Creates a new State. [Project ID, StateName, LockID, Hash]'
|
7
|
+
example 'client.terraform.create(5, {})'
|
8
|
+
result '#<TerraformState serial: 4>'
|
9
|
+
|
10
|
+
markdown <<~DOC
|
11
|
+
Attributes for Hash
|
12
|
+
|
13
|
+
ID,Operation,Info,Who,Version,Created,Path
|
14
|
+
DOC
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(project_id, name, xid, body)
|
18
|
+
project_id = format_id(project_id)
|
19
|
+
|
20
|
+
client.request(:post, "projects/#{project_id}/terraform/state/#{name}?ID=#{xid}", nil, body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Terraform < Common
|
5
|
+
doc 'Delete' do
|
6
|
+
desc 'Delete Terraform State. [Project ID, StateName]'
|
7
|
+
example 'client.terraform.delete(5, :state_name)'
|
8
|
+
end
|
9
|
+
|
10
|
+
def delete(project_id, name)
|
11
|
+
project_id = format_id(project_id)
|
12
|
+
|
13
|
+
client.request(:delete, "projects/#{project_id}/terraform/state/#{name}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Terraform < Common
|
5
|
+
doc 'Lock' do
|
6
|
+
desc 'Locks a new State. [Project ID, Hash]'
|
7
|
+
example 'client.wikis.Lock(5, content: "Lots of Stuff", title: "Title!")'
|
8
|
+
result '#<TerraformState slug: Title!>'
|
9
|
+
end
|
10
|
+
|
11
|
+
def lock(project_id, name, query)
|
12
|
+
project_id = format_id(project_id)
|
13
|
+
|
14
|
+
client.request(:post, "projects/#{project_id}/terraform/state/#{name}/lock", nil, query)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Terraform < Common
|
5
|
+
doc 'Show' do
|
6
|
+
desc 'Collect Terraform State Information'
|
7
|
+
example 'client.terraform.show(264, "README.md")'
|
8
|
+
|
9
|
+
markdown <<~DOC
|
10
|
+
Ref will default to `main`
|
11
|
+
|
12
|
+
Kind can be left empty or set to either :raw or :blame
|
13
|
+
DOC
|
14
|
+
end
|
15
|
+
|
16
|
+
def show(project_id, name)
|
17
|
+
project_id = format_id(project_id)
|
18
|
+
|
19
|
+
client.request(:get, "projects/#{project_id}/terraform/state/#{name}", TerraformState)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Top namespace
|
2
|
+
module LabClient
|
3
|
+
# Specifics
|
4
|
+
class Terraform < Common
|
5
|
+
doc 'Lock' do
|
6
|
+
desc 'Unlock State [Project ID, StateName Lock ID]'
|
7
|
+
example 'client.terraform.lock(5, :state_name, 123)'
|
8
|
+
end
|
9
|
+
|
10
|
+
def unlock(project_id, name, xid)
|
11
|
+
project_id = format_id(project_id)
|
12
|
+
|
13
|
+
client.request(:delete, "projects/#{project_id}/terraform/state/#{name}/lock?ID=#{xid}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/labclient/version.rb
CHANGED
data/lib/labclient.rb
CHANGED
@@ -7,6 +7,9 @@ require 'gitlab_chronic_duration'
|
|
7
7
|
require 'ostruct'
|
8
8
|
require 'ougai'
|
9
9
|
|
10
|
+
# Escaping Paths - https://stackoverflow.com/questions/2824126/whats-the-difference-between-uri-escape-and-cgi-escape/13059657#13059657
|
11
|
+
require 'erb'
|
12
|
+
|
10
13
|
require 'labclient/version'
|
11
14
|
require 'labclient/logger'
|
12
15
|
require 'labclient/docs'
|
@@ -266,6 +269,11 @@ require 'labclient/projects/access_requests/approve'
|
|
266
269
|
require 'labclient/projects/access_requests/deny'
|
267
270
|
require 'labclient/projects/access_requests/access_request'
|
268
271
|
|
272
|
+
# Project Templates
|
273
|
+
require 'labclient/projects/templates/client'
|
274
|
+
require 'labclient/projects/templates/show'
|
275
|
+
require 'labclient/projects/templates/list'
|
276
|
+
|
269
277
|
# ===========================================================
|
270
278
|
# Final Projects
|
271
279
|
# ===========================================================
|
@@ -771,18 +779,13 @@ require 'labclient/pipelines/pipeline'
|
|
771
779
|
# Repository
|
772
780
|
require 'labclient/repository/alias'
|
773
781
|
require 'labclient/repository/tree'
|
782
|
+
require 'labclient/repository/repository_tree'
|
774
783
|
require 'labclient/repository/blob'
|
775
784
|
require 'labclient/repository/archive'
|
776
785
|
require 'labclient/repository/compare'
|
777
786
|
require 'labclient/repository/contributors'
|
778
787
|
require 'labclient/repository/merge_base'
|
779
788
|
|
780
|
-
# Files
|
781
|
-
require 'labclient/files/show'
|
782
|
-
require 'labclient/files/create'
|
783
|
-
require 'labclient/files/update'
|
784
|
-
require 'labclient/files/delete'
|
785
|
-
|
786
789
|
# Branches
|
787
790
|
require 'labclient/branches/list'
|
788
791
|
require 'labclient/branches/show'
|
@@ -865,6 +868,21 @@ require 'labclient/feature_flags/delete'
|
|
865
868
|
require 'labclient/feature_flags/list'
|
866
869
|
require 'labclient/feature_flags/feature_flag'
|
867
870
|
|
871
|
+
# Files
|
872
|
+
require 'labclient/files/file'
|
873
|
+
require 'labclient/files/show'
|
874
|
+
require 'labclient/files/create'
|
875
|
+
require 'labclient/files/update'
|
876
|
+
require 'labclient/files/delete'
|
877
|
+
|
878
|
+
# Terraform
|
879
|
+
require 'labclient/terraform/create'
|
880
|
+
require 'labclient/terraform/lock'
|
881
|
+
require 'labclient/terraform/unlock'
|
882
|
+
require 'labclient/terraform/delete'
|
883
|
+
require 'labclient/terraform/show'
|
884
|
+
require 'labclient/terraform/terraform_state'
|
885
|
+
|
868
886
|
require 'labclient/resource_labels/resource_label'
|
869
887
|
|
870
888
|
# Generators
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davin Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -449,6 +449,7 @@ files:
|
|
449
449
|
- lib/labclient/feature_flags/list.rb
|
450
450
|
- lib/labclient/files/create.rb
|
451
451
|
- lib/labclient/files/delete.rb
|
452
|
+
- lib/labclient/files/file.rb
|
452
453
|
- lib/labclient/files/show.rb
|
453
454
|
- lib/labclient/files/update.rb
|
454
455
|
- lib/labclient/generator/generator.rb
|
@@ -798,6 +799,9 @@ files:
|
|
798
799
|
- lib/labclient/projects/stars/starred_projects.rb
|
799
800
|
- lib/labclient/projects/stars/starrers.rb
|
800
801
|
- lib/labclient/projects/submodule.rb
|
802
|
+
- lib/labclient/projects/templates/client.rb
|
803
|
+
- lib/labclient/projects/templates/list.rb
|
804
|
+
- lib/labclient/projects/templates/show.rb
|
801
805
|
- lib/labclient/projects/transfer.rb
|
802
806
|
- lib/labclient/projects/triggers/client.rb
|
803
807
|
- lib/labclient/projects/triggers/create.rb
|
@@ -848,6 +852,7 @@ files:
|
|
848
852
|
- lib/labclient/repository/contributors.rb
|
849
853
|
- lib/labclient/repository/merge_base.rb
|
850
854
|
- lib/labclient/repository/raw_blob.rb
|
855
|
+
- lib/labclient/repository/repository_tree.rb
|
851
856
|
- lib/labclient/repository/tree.rb
|
852
857
|
- lib/labclient/resource_labels/epics/client.rb
|
853
858
|
- lib/labclient/resource_labels/epics/list.rb
|
@@ -891,6 +896,12 @@ files:
|
|
891
896
|
- lib/labclient/tags/show.rb
|
892
897
|
- lib/labclient/tags/tag.rb
|
893
898
|
- lib/labclient/tags/update.rb
|
899
|
+
- lib/labclient/terraform/create.rb
|
900
|
+
- lib/labclient/terraform/delete.rb
|
901
|
+
- lib/labclient/terraform/lock.rb
|
902
|
+
- lib/labclient/terraform/show.rb
|
903
|
+
- lib/labclient/terraform/terraform_state.rb
|
904
|
+
- lib/labclient/terraform/unlock.rb
|
894
905
|
- lib/labclient/todos/list.rb
|
895
906
|
- lib/labclient/todos/mark_all_done.rb
|
896
907
|
- lib/labclient/todos/mark_done.rb
|