nexus_api 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/lib/endpoints/tags.rb +35 -12
- data/lib/nexus_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 593a1c9c8f0ae411f0dceb74937549defaa861aed877a911363535ef08c1666c
|
4
|
+
data.tar.gz: 041e2a1f1acc3955688d56fc840a41c2b8f337499c0f7bfa751eff7fecd73ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e5b2a098e126a0e5d80819949ad50e78be80ef3ba69128e1a00e1cb15963baa69922acb811198f0abc11846a2a677dcbfd5eb471774424809afa64e51aa0b86
|
7
|
+
data.tar.gz: bb214d0d407c604860e63eadd0bf489a7b61d6b9d1cadf3d639f8d0212d3ad53ae9e8f916b55efdfd5881b3140ba084656282fd4028dec13a40233f8f55c7633
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
|
8
|
+
## [1.4.0](https://github.com/Cisco-AMP/nexus_api/compare/v1.3.0...v1.4.0) - 2020-05-05
|
9
|
+
### Added
|
10
|
+
- Optional `tag` parameter to `associate_tag()` and `delete_associated_tag()` methods
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Made `sha1` parameter optional for `associate_tag()` and `delete_associated_tag()` methods
|
14
|
+
|
15
|
+
|
8
16
|
## [1.3.0](https://github.com/Cisco-AMP/nexus_api/compare/v1.2.1...v1.3.0) - 2020-04-30
|
9
17
|
### Added
|
10
18
|
- Optional source and general keyword match into staging endpoint method (`move_components_to()`)
|
data/Gemfile.lock
CHANGED
data/lib/endpoints/tags.rb
CHANGED
@@ -21,24 +21,47 @@ module NexusAPI
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# POST /service/rest/v1/tags/associate/{tagName}
|
24
|
-
def associate_tag(name:, sha1
|
24
|
+
def associate_tag(name:, sha1: nil, repository: nil, tag: nil)
|
25
25
|
repository ||= @team_config.tag_repository
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
if sha1.nil? && repository.nil? && tag.nil?
|
27
|
+
puts_error(__method__)
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
|
31
|
+
search_query = "?wait=true"
|
32
|
+
search_query += "&sha1=#{sha1}" unless sha1.nil?
|
33
|
+
search_query += "&repository=#{repository}" unless repository.nil?
|
34
|
+
search_query += "&tag=#{tag}" unless tag.nil?
|
35
|
+
|
31
36
|
@connection.post(endpoint: "tags/associate/#{name}" + search_query)
|
32
37
|
end
|
33
38
|
|
34
39
|
# DELETE /service/rest/v1/tags/associate/{tagName}
|
35
|
-
def delete_associated_tag(name:, sha1
|
40
|
+
def delete_associated_tag(name:, sha1: nil, repository: nil, tag: nil)
|
36
41
|
repository ||= @team_config.tag_repository
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
parameters = {}
|
43
|
+
parameters['sha1'] = sha1 unless sha1.nil?
|
44
|
+
parameters['repository'] = repository unless repository.nil?
|
45
|
+
parameters['tag'] = tag unless tag.nil?
|
46
|
+
if parameters.empty?
|
47
|
+
puts_error(__method__)
|
48
|
+
return false
|
49
|
+
end
|
50
|
+
|
51
|
+
search_query = parameters.map do |parameter, value|
|
52
|
+
"#{parameter}=#{value}"
|
53
|
+
end.join("&")
|
54
|
+
|
55
|
+
@connection.delete(endpoint: "tags/associate/#{name}?" + search_query)
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def puts_error(method)
|
62
|
+
puts "ERROR: NexusAPI::API::#{method}() requires AT LEAST one optional parameter to"
|
63
|
+
puts " be set otherwise ALL assets in Nexus will be tagged. If this is desired"
|
64
|
+
puts " please open an issue or a PR to add a new method to handle this case."
|
42
65
|
end
|
43
66
|
end
|
44
67
|
end
|
data/lib/nexus_api/version.rb
CHANGED