lex-jfrog 0.1.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 +7 -0
- data/.github/workflows/ci.yml +18 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +66 -0
- data/CHANGELOG.md +12 -0
- data/CLAUDE.md +46 -0
- data/Dockerfile +6 -0
- data/Gemfile +12 -0
- data/LICENSE +21 -0
- data/README.md +46 -0
- data/lex-jfrog.gemspec +30 -0
- data/lib/legion/extensions/jfrog/artifactory/client.rb +35 -0
- data/lib/legion/extensions/jfrog/artifactory/helpers/client.rb +24 -0
- data/lib/legion/extensions/jfrog/artifactory/runners/release_bundles.rb +48 -0
- data/lib/legion/extensions/jfrog/artifactory/runners/repositories.rb +61 -0
- data/lib/legion/extensions/jfrog/artifactory/runners/searches.rb +88 -0
- data/lib/legion/extensions/jfrog/artifactory/runners/security.rb +58 -0
- data/lib/legion/extensions/jfrog/artifactory/runners/storage.rb +44 -0
- data/lib/legion/extensions/jfrog/artifactory.rb +18 -0
- data/lib/legion/extensions/jfrog/version.rb +9 -0
- data/lib/legion/extensions/jfrog.rb +12 -0
- metadata +81 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1f055453ad237adcb0da07627360e29327f88f317c9a6e1bf5905ba7f9f58687
|
|
4
|
+
data.tar.gz: 788f943372ef35e90e3722131087d6e3da618e245fa56661e1d770b437408b7e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6a8761ac49b9e9b1d04e4e8024dbcb9ba71bc4b46b67b993ed031379db8cc24a7834dc28610aefad21a1fcf03091d305e95f69e5f35cc991e078b9b6dbb145ea
|
|
7
|
+
data.tar.gz: 1ba670c3727718cfd7a3a7fad43be0441d99e7ae3b9d5bca93ff61e76c0f51e05c8ec31d8ac4900f98f0df826ed3787027f468816013a2c40e996354472e3546
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
ci:
|
|
11
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
12
|
+
|
|
13
|
+
release:
|
|
14
|
+
needs: ci
|
|
15
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
16
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
17
|
+
secrets:
|
|
18
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
6
|
+
Layout/LineLength:
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
|
+
EnforcedStyle: space
|
|
11
|
+
|
|
12
|
+
Layout/HashAlignment:
|
|
13
|
+
EnforcedHashRocketStyle: table
|
|
14
|
+
EnforcedColonStyle: table
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
25
|
+
Metrics/BlockLength:
|
|
26
|
+
Max: 40
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'spec/**/*'
|
|
29
|
+
|
|
30
|
+
Metrics/AbcSize:
|
|
31
|
+
Max: 60
|
|
32
|
+
|
|
33
|
+
Metrics/CyclomaticComplexity:
|
|
34
|
+
Max: 15
|
|
35
|
+
|
|
36
|
+
Metrics/PerceivedComplexity:
|
|
37
|
+
Max: 17
|
|
38
|
+
|
|
39
|
+
Metrics/ParameterLists:
|
|
40
|
+
Max: 10
|
|
41
|
+
|
|
42
|
+
Style/Documentation:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Style/SymbolArray:
|
|
46
|
+
Enabled: true
|
|
47
|
+
|
|
48
|
+
Style/FrozenStringLiteralComment:
|
|
49
|
+
Enabled: true
|
|
50
|
+
EnforcedStyle: always
|
|
51
|
+
|
|
52
|
+
Naming/FileName:
|
|
53
|
+
Enabled: false
|
|
54
|
+
|
|
55
|
+
Naming/PredicateMethod:
|
|
56
|
+
Enabled: false
|
|
57
|
+
|
|
58
|
+
Naming/PredicatePrefix:
|
|
59
|
+
Enabled: false
|
|
60
|
+
|
|
61
|
+
Gemspec/DevelopmentDependencies:
|
|
62
|
+
Enabled: false
|
|
63
|
+
|
|
64
|
+
Lint/EmptyClass:
|
|
65
|
+
Exclude:
|
|
66
|
+
- 'spec/**/*'
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-03-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Initial release with Artifactory sub-module
|
|
7
|
+
- Repositories runner (create, get, update, delete, list, exists, batch)
|
|
8
|
+
- Searches runner (AQL, artifact, GAVC, property, checksum, usage, date range, pattern, Docker)
|
|
9
|
+
- Security runner (users, permissions, API keys)
|
|
10
|
+
- Storage runner (trash, garbage collection, storage info)
|
|
11
|
+
- ReleaseBundles runner (list, get, delete, import, status)
|
|
12
|
+
- Standalone Client class for framework-free usage
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# lex-jfrog: JFrog Integration for LegionIO
|
|
2
|
+
|
|
3
|
+
**Parent**: `/Users/miverso2/rubymine/legion/extensions-other/CLAUDE.md`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Monolith Legion Extension connecting LegionIO to JFrog products. Currently implements Artifactory; designed for future Xray, Pipelines, and Distribution sub-modules.
|
|
8
|
+
|
|
9
|
+
**GitHub**: https://github.com/LegionIO/lex-jfrog
|
|
10
|
+
**License**: MIT
|
|
11
|
+
**Version**: 0.1.0
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Legion::Extensions::Jfrog
|
|
17
|
+
├── Artifactory/
|
|
18
|
+
│ ├── Helpers/
|
|
19
|
+
│ │ └── Client # Faraday connection (host + Bearer token)
|
|
20
|
+
│ ├── Runners/
|
|
21
|
+
│ │ ├── Repositories # CRUD, batch, list, exists
|
|
22
|
+
│ │ ├── Searches # AQL, artifact, GAVC, property, checksum, Docker
|
|
23
|
+
│ │ ├── Security # Users, permissions, API keys
|
|
24
|
+
│ │ ├── Storage # Trash, GC, storage info
|
|
25
|
+
│ │ └── ReleaseBundles # Bundle CRUD, import, status
|
|
26
|
+
│ └── Client # Standalone client (includes all runners)
|
|
27
|
+
└── (future: Xray/, Pipelines/, Distribution/)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Dependencies
|
|
31
|
+
|
|
32
|
+
| Gem | Purpose |
|
|
33
|
+
|-----|---------|
|
|
34
|
+
| faraday | HTTP client for Artifactory REST API |
|
|
35
|
+
|
|
36
|
+
## Testing
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bundle install
|
|
40
|
+
bundle exec rspec
|
|
41
|
+
bundle exec rubocop
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Esity
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# lex-jfrog
|
|
2
|
+
|
|
3
|
+
JFrog integration for [LegionIO](https://github.com/LegionIO/LegionIO). Monolith gem covering JFrog product APIs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-jfrog
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Modules
|
|
12
|
+
|
|
13
|
+
### Artifactory (`Jfrog::Artifactory`)
|
|
14
|
+
|
|
15
|
+
| Runner | Methods |
|
|
16
|
+
|--------|---------|
|
|
17
|
+
| Repositories | `create`, `get`, `update`, `delete`, `list`, `exists?`, `create_batch`, `update_batch` |
|
|
18
|
+
| Searches | `aql`, `artifact_search`, `gavc_search`, `property_search`, `checksum_search`, `usage_search`, `date_range_search`, `pattern_search`, `docker_repositories`, `docker_tags` |
|
|
19
|
+
| Security | `get_user`, `list_permissions`, `get_permission`, `create_permission`, `delete_permission`, `create_api_key`, `get_api_key`, `revoke_api_key` |
|
|
20
|
+
| Storage | `empty_trash`, `delete_trash_item`, `restore_trash_item`, `run_garbage_collection`, `storage_info` |
|
|
21
|
+
| ReleaseBundles | `list_bundles`, `list_versions`, `get_version`, `delete_version`, `import_version`, `import_status` |
|
|
22
|
+
|
|
23
|
+
## Standalone Usage
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require 'legion/extensions/jfrog/artifactory/client'
|
|
27
|
+
|
|
28
|
+
client = Legion::Extensions::Jfrog::Artifactory::Client.new(
|
|
29
|
+
host: 'https://myinstance.jfrog.io/artifactory',
|
|
30
|
+
token: ENV['JFROG_TOKEN']
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
client.list # list all repos
|
|
34
|
+
client.aql(query: 'items.find({"repo":"libs"})') # AQL search
|
|
35
|
+
client.get_user(username: 'admin') # user details
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Ruby >= 3.4
|
|
41
|
+
- [LegionIO](https://github.com/LegionIO/LegionIO) framework (optional, for full extension mode)
|
|
42
|
+
- JFrog Artifactory instance with access token
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT
|
data/lex-jfrog.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/legion/extensions/jfrog/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'lex-jfrog'
|
|
7
|
+
spec.version = Legion::Extensions::Jfrog::VERSION
|
|
8
|
+
spec.authors = ['Esity']
|
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'LEX JFrog'
|
|
12
|
+
spec.description = 'Connects LegionIO to JFrog products (Artifactory, Xray, Pipelines)'
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-jfrog'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
|
+
|
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-jfrog'
|
|
19
|
+
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-jfrog'
|
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-jfrog/blob/main/CHANGELOG.md'
|
|
21
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-jfrog/issues'
|
|
22
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
23
|
+
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
end
|
|
27
|
+
spec.require_paths = ['lib']
|
|
28
|
+
|
|
29
|
+
spec.add_dependency 'faraday', '>= 2.0'
|
|
30
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/repositories'
|
|
5
|
+
require_relative 'runners/searches'
|
|
6
|
+
require_relative 'runners/security'
|
|
7
|
+
require_relative 'runners/storage'
|
|
8
|
+
require_relative 'runners/release_bundles'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Jfrog
|
|
13
|
+
module Artifactory
|
|
14
|
+
class Client
|
|
15
|
+
include Helpers::Client
|
|
16
|
+
include Runners::Repositories
|
|
17
|
+
include Runners::Searches
|
|
18
|
+
include Runners::Security
|
|
19
|
+
include Runners::Storage
|
|
20
|
+
include Runners::ReleaseBundles
|
|
21
|
+
|
|
22
|
+
attr_reader :opts
|
|
23
|
+
|
|
24
|
+
def initialize(host:, token: nil, **extra)
|
|
25
|
+
@opts = { host: host, token: token, **extra }.compact
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def client(**override)
|
|
29
|
+
super(**@opts, **override)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Jfrog
|
|
8
|
+
module Artifactory
|
|
9
|
+
module Helpers
|
|
10
|
+
module Client
|
|
11
|
+
def client(host:, token: nil, **)
|
|
12
|
+
Faraday.new(url: host) do |conn|
|
|
13
|
+
conn.request :json
|
|
14
|
+
conn.response :json, content_type: /\bjson$/
|
|
15
|
+
conn.headers['Content-Type'] = 'application/json'
|
|
16
|
+
conn.headers['Authorization'] = "Bearer #{token}" if token
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Jfrog
|
|
6
|
+
module Artifactory
|
|
7
|
+
module Runners
|
|
8
|
+
module ReleaseBundles
|
|
9
|
+
extend Legion::Extensions::Jfrog::Artifactory::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def list_bundles(**)
|
|
12
|
+
response = client(**).get('/api/release_bundles')
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def list_versions(bundle_name:, **)
|
|
17
|
+
response = client(**).get("/api/release_bundles/#{bundle_name}/versions")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_version(bundle_name:, version:, **)
|
|
22
|
+
response = client(**).get("/api/release_bundles/#{bundle_name}/#{version}")
|
|
23
|
+
{ result: response.body, status: response.status }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def delete_version(bundle_name:, version:, **)
|
|
27
|
+
response = client(**).delete("/api/release_bundles/#{bundle_name}/#{version}")
|
|
28
|
+
{ result: response.body, status: response.status }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def import_version(bundle_name:, version:, **)
|
|
32
|
+
response = client(**).post("/api/release_bundles/#{bundle_name}/#{version}/import")
|
|
33
|
+
{ result: response.body, status: response.status }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def import_status(bundle_name:, version:, **)
|
|
37
|
+
response = client(**).get("/api/release_bundles/#{bundle_name}/#{version}/import/status")
|
|
38
|
+
{ result: response.body, status: response.status }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
42
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Jfrog
|
|
6
|
+
module Artifactory
|
|
7
|
+
module Runners
|
|
8
|
+
module Repositories
|
|
9
|
+
extend Legion::Extensions::Jfrog::Artifactory::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def create(repo_key:, repo_type:, package_type:, **)
|
|
12
|
+
body = { key: repo_key, rclass: repo_type, packageType: package_type }
|
|
13
|
+
response = client(**).put("/api/repositories/#{repo_key}", body)
|
|
14
|
+
{ result: response.body, status: response.status }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get(repo_key:, **)
|
|
18
|
+
response = client(**).get("/api/repositories/#{repo_key}")
|
|
19
|
+
{ result: response.body, status: response.status }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def update(repo_key:, body: {}, **)
|
|
23
|
+
response = client(**).post("/api/repositories/#{repo_key}", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def delete(repo_key:, **)
|
|
28
|
+
response = client(**).delete("/api/repositories/#{repo_key}")
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def list(type: nil, **)
|
|
33
|
+
path = '/api/repositories'
|
|
34
|
+
path += "?type=#{type}" if type
|
|
35
|
+
response = client(**).get(path)
|
|
36
|
+
{ result: response.body, status: response.status }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def exists?(repo_key:, **)
|
|
40
|
+
response = client(**).get("/api/repositories/#{repo_key}")
|
|
41
|
+
{ result: response.status == 200, status: response.status }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def create_batch(repositories:, **)
|
|
45
|
+
response = client(**).put('/api/repositories', repositories)
|
|
46
|
+
{ result: response.body, status: response.status }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def update_batch(repositories:, **)
|
|
50
|
+
response = client(**).post('/api/repositories', repositories)
|
|
51
|
+
{ result: response.body, status: response.status }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
55
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Jfrog
|
|
6
|
+
module Artifactory
|
|
7
|
+
module Runners
|
|
8
|
+
module Searches
|
|
9
|
+
extend Legion::Extensions::Jfrog::Artifactory::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def aql(query:, **)
|
|
12
|
+
response = client(**).post('/api/search/aql', query)
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def artifact_search(name:, repos: nil, **)
|
|
17
|
+
params = { name: name }
|
|
18
|
+
params[:repos] = repos if repos
|
|
19
|
+
response = client(**).get('/api/search/artifact', params)
|
|
20
|
+
{ result: response.body, status: response.status }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def gavc_search(group: nil, artifact: nil, version: nil, classifier: nil, repos: nil, **)
|
|
24
|
+
params = {}
|
|
25
|
+
params[:g] = group if group
|
|
26
|
+
params[:a] = artifact if artifact
|
|
27
|
+
params[:v] = version if version
|
|
28
|
+
params[:c] = classifier if classifier
|
|
29
|
+
params[:repos] = repos if repos
|
|
30
|
+
response = client(**).get('/api/search/gavc', params)
|
|
31
|
+
{ result: response.body, status: response.status }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def property_search(properties:, repos: nil, **)
|
|
35
|
+
params = properties.dup
|
|
36
|
+
params[:repos] = repos if repos
|
|
37
|
+
response = client(**).get('/api/search/prop', params)
|
|
38
|
+
{ result: response.body, status: response.status }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def checksum_search(checksum:, repos: nil, **)
|
|
42
|
+
headers = { 'X-Checksum-Sha256' => checksum }
|
|
43
|
+
params = {}
|
|
44
|
+
params[:repos] = repos if repos
|
|
45
|
+
response = client(**).get('/api/search/checksum', params) do |req|
|
|
46
|
+
req.headers.merge!(headers)
|
|
47
|
+
end
|
|
48
|
+
{ result: response.body, status: response.status }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def usage_search(not_used_since:, repos: nil, **)
|
|
52
|
+
params = { notUsedSince: not_used_since }
|
|
53
|
+
params[:repos] = repos if repos
|
|
54
|
+
response = client(**).get('/api/search/usage', params)
|
|
55
|
+
{ result: response.body, status: response.status }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def date_range_search(from:, to: nil, repos: nil, **)
|
|
59
|
+
params = { from: from }
|
|
60
|
+
params[:to] = to if to
|
|
61
|
+
params[:repos] = repos if repos
|
|
62
|
+
response = client(**).get('/api/search/dates', params)
|
|
63
|
+
{ result: response.body, status: response.status }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def pattern_search(pattern:, **)
|
|
67
|
+
response = client(**).get('/api/search/pattern', pattern: pattern)
|
|
68
|
+
{ result: response.body, status: response.status }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def docker_repositories(**)
|
|
72
|
+
response = client(**).get('/api/docker/repositories')
|
|
73
|
+
{ result: response.body, status: response.status }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def docker_tags(repo:, image:, **)
|
|
77
|
+
response = client(**).get("/api/docker/#{repo}/v2/#{image}/tags/list")
|
|
78
|
+
{ result: response.body, status: response.status }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
82
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Jfrog
|
|
6
|
+
module Artifactory
|
|
7
|
+
module Runners
|
|
8
|
+
module Security
|
|
9
|
+
extend Legion::Extensions::Jfrog::Artifactory::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def get_user(username:, **)
|
|
12
|
+
response = client(**).get("/api/security/users/#{username}")
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def list_permissions(**)
|
|
17
|
+
response = client(**).get('/api/security/permissions')
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_permission(permission_name:, **)
|
|
22
|
+
response = client(**).get("/api/security/permissions/#{permission_name}")
|
|
23
|
+
{ result: response.body, status: response.status }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_permission(permission_name:, body:, **)
|
|
27
|
+
response = client(**).put("/api/security/permissions/#{permission_name}", body)
|
|
28
|
+
{ result: response.body, status: response.status }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def delete_permission(permission_name:, **)
|
|
32
|
+
response = client(**).delete("/api/security/permissions/#{permission_name}")
|
|
33
|
+
{ result: response.body, status: response.status }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def create_api_key(**)
|
|
37
|
+
response = client(**).post('/api/security/apiKey')
|
|
38
|
+
{ result: response.body, status: response.status }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def get_api_key(**)
|
|
42
|
+
response = client(**).get('/api/security/apiKey')
|
|
43
|
+
{ result: response.body, status: response.status }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def revoke_api_key(**)
|
|
47
|
+
response = client(**).delete('/api/security/apiKey')
|
|
48
|
+
{ result: response.body, status: response.status }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
52
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Jfrog
|
|
6
|
+
module Artifactory
|
|
7
|
+
module Runners
|
|
8
|
+
module Storage
|
|
9
|
+
extend Legion::Extensions::Jfrog::Artifactory::Helpers::Client
|
|
10
|
+
|
|
11
|
+
def empty_trash(**)
|
|
12
|
+
response = client(**).post('/api/trash/empty')
|
|
13
|
+
{ result: response.body, status: response.status }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def delete_trash_item(path:, **)
|
|
17
|
+
response = client(**).delete("/api/trash/items/#{path}")
|
|
18
|
+
{ result: response.body, status: response.status }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def restore_trash_item(path:, target:, **)
|
|
22
|
+
body = { target: target }
|
|
23
|
+
response = client(**).post("/api/trash/restore/#{path}", body)
|
|
24
|
+
{ result: response.body, status: response.status }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def run_garbage_collection(**)
|
|
28
|
+
response = client(**).post('/api/system/storage/gc')
|
|
29
|
+
{ result: response.body, status: response.status }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def storage_info(**)
|
|
33
|
+
response = client(**).get('/api/storageinfo')
|
|
34
|
+
{ result: response.body, status: response.status }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
38
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/jfrog/artifactory/helpers/client'
|
|
4
|
+
require 'legion/extensions/jfrog/artifactory/runners/repositories'
|
|
5
|
+
require 'legion/extensions/jfrog/artifactory/runners/searches'
|
|
6
|
+
require 'legion/extensions/jfrog/artifactory/runners/security'
|
|
7
|
+
require 'legion/extensions/jfrog/artifactory/runners/storage'
|
|
8
|
+
require 'legion/extensions/jfrog/artifactory/runners/release_bundles'
|
|
9
|
+
require 'legion/extensions/jfrog/artifactory/client'
|
|
10
|
+
|
|
11
|
+
module Legion
|
|
12
|
+
module Extensions
|
|
13
|
+
module Jfrog
|
|
14
|
+
module Artifactory
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: lex-jfrog
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Esity
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.0'
|
|
26
|
+
description: Connects LegionIO to JFrog products (Artifactory, Xray, Pipelines)
|
|
27
|
+
email:
|
|
28
|
+
- matthewdiverson@gmail.com
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- ".github/workflows/ci.yml"
|
|
34
|
+
- ".gitignore"
|
|
35
|
+
- ".rspec"
|
|
36
|
+
- ".rubocop.yml"
|
|
37
|
+
- CHANGELOG.md
|
|
38
|
+
- CLAUDE.md
|
|
39
|
+
- Dockerfile
|
|
40
|
+
- Gemfile
|
|
41
|
+
- LICENSE
|
|
42
|
+
- README.md
|
|
43
|
+
- lex-jfrog.gemspec
|
|
44
|
+
- lib/legion/extensions/jfrog.rb
|
|
45
|
+
- lib/legion/extensions/jfrog/artifactory.rb
|
|
46
|
+
- lib/legion/extensions/jfrog/artifactory/client.rb
|
|
47
|
+
- lib/legion/extensions/jfrog/artifactory/helpers/client.rb
|
|
48
|
+
- lib/legion/extensions/jfrog/artifactory/runners/release_bundles.rb
|
|
49
|
+
- lib/legion/extensions/jfrog/artifactory/runners/repositories.rb
|
|
50
|
+
- lib/legion/extensions/jfrog/artifactory/runners/searches.rb
|
|
51
|
+
- lib/legion/extensions/jfrog/artifactory/runners/security.rb
|
|
52
|
+
- lib/legion/extensions/jfrog/artifactory/runners/storage.rb
|
|
53
|
+
- lib/legion/extensions/jfrog/version.rb
|
|
54
|
+
homepage: https://github.com/LegionIO/lex-jfrog
|
|
55
|
+
licenses:
|
|
56
|
+
- MIT
|
|
57
|
+
metadata:
|
|
58
|
+
homepage_uri: https://github.com/LegionIO/lex-jfrog
|
|
59
|
+
source_code_uri: https://github.com/LegionIO/lex-jfrog
|
|
60
|
+
documentation_uri: https://github.com/LegionIO/lex-jfrog
|
|
61
|
+
changelog_uri: https://github.com/LegionIO/lex-jfrog/blob/main/CHANGELOG.md
|
|
62
|
+
bug_tracker_uri: https://github.com/LegionIO/lex-jfrog/issues
|
|
63
|
+
rubygems_mfa_required: 'true'
|
|
64
|
+
rdoc_options: []
|
|
65
|
+
require_paths:
|
|
66
|
+
- lib
|
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '3.4'
|
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
requirements: []
|
|
78
|
+
rubygems_version: 3.6.9
|
|
79
|
+
specification_version: 4
|
|
80
|
+
summary: LEX JFrog
|
|
81
|
+
test_files: []
|