algosec-sdk 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/.rubocop.yml +2 -2
- data/.travis.yml +3 -1
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/algosec-sdk.gemspec +3 -1
- data/lib/algosec-sdk.rb +2 -0
- data/lib/algosec-sdk/client.rb +2 -0
- data/lib/algosec-sdk/exceptions.rb +2 -0
- data/lib/algosec-sdk/helpers/business_flow_helper.rb +63 -3
- data/lib/algosec-sdk/helpers/flow_comparisons.rb +2 -0
- data/lib/algosec-sdk/rest.rb +2 -1
- data/lib/algosec-sdk/version.rb +3 -1
- data/rakelib/end-to-end-integration.rake +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d57a7f42feec59ab1260d8b662d201048b341515
|
4
|
+
data.tar.gz: f116ced6c0739e3823ced4f4e10b82219131025b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982599fbbf3ac54e546469470dac5d86d6456dddfd1669032b10df17e290759f51c46afe5a7e01b964aaae5de343bb966cc35db939ceb625d31503f212ae4a55
|
7
|
+
data.tar.gz: b8a0bd17374d44d8d642bc3b9a3bd7b13fd2d9f2d8e24d21e6cd39ccb0a2bfa11bd3ea61457c0ba1ae142b1e7c6a80e99feafda1f1e235fca7203ab40668044d
|
data/.bumpversion.cfg
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# See default at https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
2
|
AllCops:
|
3
|
-
TargetRubyVersion: 2.
|
3
|
+
TargetRubyVersion: 2.2
|
4
4
|
|
5
5
|
Metrics/ClassLength:
|
6
6
|
Max: 200
|
@@ -9,7 +9,7 @@ Metrics/LineLength:
|
|
9
9
|
Max: 120
|
10
10
|
|
11
11
|
Metrics/ModuleLength:
|
12
|
-
Max:
|
12
|
+
Max: 220
|
13
13
|
|
14
14
|
Metrics/ParameterLists:
|
15
15
|
Max: 6
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/algosec-sdk.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# http://guides.rubygems.org/specification-reference
|
2
4
|
require_relative './lib/algosec-sdk/version'
|
3
5
|
|
@@ -23,6 +25,6 @@ Gem::Specification.new do |spec|
|
|
23
25
|
spec.add_development_dependency 'pry'
|
24
26
|
spec.add_development_dependency 'rake'
|
25
27
|
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'rubocop', '
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.58.2'
|
27
29
|
spec.add_development_dependency 'simplecov'
|
28
30
|
end
|
data/lib/algosec-sdk.rb
CHANGED
data/lib/algosec-sdk/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'flow_comparisons'
|
2
4
|
require 'set'
|
3
5
|
require 'ipaddress'
|
@@ -30,6 +32,41 @@ module ALGOSEC_SDK
|
|
30
32
|
response_handler(rest_post('/BusinessFlow/rest/v1/login'))
|
31
33
|
end
|
32
34
|
|
35
|
+
# Create an application
|
36
|
+
# @param [String] name The application's name.
|
37
|
+
# @param [Array<String>] custom_fields Existing custom fields to assign to the application.
|
38
|
+
# @param [Array<String>] contacts Existing contacts to assign to the application.
|
39
|
+
# @param [Array<String>] labels Existing labels to assign to the application.
|
40
|
+
# @param [Array<String>] flows The flows to add to the application upon creation.
|
41
|
+
# @raise [RuntimeError] if the request failed
|
42
|
+
# @return Newly created Application object
|
43
|
+
def create_application(
|
44
|
+
name,
|
45
|
+
custom_fields = [],
|
46
|
+
contacts = [],
|
47
|
+
labels = [],
|
48
|
+
flows = []
|
49
|
+
)
|
50
|
+
new_application = {
|
51
|
+
name: name,
|
52
|
+
custom_fields: custom_fields,
|
53
|
+
contacts: contacts,
|
54
|
+
labels: labels,
|
55
|
+
flows: flows
|
56
|
+
}
|
57
|
+
response = rest_post('/BusinessFlow/rest/v1/applications/new', body: new_application)
|
58
|
+
response_handler(response)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Decommission an application
|
62
|
+
# @param [String] app_revision_id
|
63
|
+
# @raise [RuntimeError] if the request failed
|
64
|
+
# @return true
|
65
|
+
def decommission_application(app_revision_id)
|
66
|
+
response = rest_post("/BusinessFlow/rest/v1/applications/#{app_revision_id}/decommission")
|
67
|
+
response_handler(response)
|
68
|
+
end
|
69
|
+
|
33
70
|
# Get list of application flows for an application revision id
|
34
71
|
# @param [String, Symbol] app_revision_id
|
35
72
|
# @raise [RuntimeError] if the request failed
|
@@ -138,14 +175,37 @@ module ALGOSEC_SDK
|
|
138
175
|
requested_flow
|
139
176
|
end
|
140
177
|
|
178
|
+
# Get all applications
|
179
|
+
# @raise [RuntimeError] if the request failed
|
180
|
+
# @return [Array<Hash>] application objects
|
181
|
+
def get_applications
|
182
|
+
response = rest_get('/BusinessFlow/rest/v1/applications/')
|
183
|
+
response_handler(response)
|
184
|
+
end
|
185
|
+
|
186
|
+
# Get application by name
|
187
|
+
# @param [String, Symbol] app_name
|
188
|
+
# @raise [RuntimeError] if the request failed
|
189
|
+
# @return [Hash] application object
|
190
|
+
def get_application_by_name(app_name)
|
191
|
+
response = rest_get("/BusinessFlow/rest/v1/applications/name/#{app_name}")
|
192
|
+
response_handler(response)
|
193
|
+
end
|
194
|
+
|
141
195
|
# Get latest application revision id by application name
|
142
196
|
# @param [String, Symbol] app_name
|
143
197
|
# @raise [RuntimeError] if the request failed
|
144
198
|
# @return [Boolean] application revision id
|
145
199
|
def get_app_revision_id_by_name(app_name)
|
146
|
-
|
147
|
-
|
148
|
-
|
200
|
+
get_application_by_name(app_name)['revisionID']
|
201
|
+
end
|
202
|
+
|
203
|
+
# Get application id by it's name
|
204
|
+
# @param [String, Symbol] app_name
|
205
|
+
# @raise [RuntimeError] if the request failed
|
206
|
+
# @return [Boolean] application id
|
207
|
+
def get_app_id_by_name(app_name)
|
208
|
+
get_application_by_name(app_name)['applicationId']
|
149
209
|
end
|
150
210
|
|
151
211
|
# Apply application draft
|
data/lib/algosec-sdk/rest.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'uri'
|
2
4
|
require 'net/http'
|
3
5
|
require 'openssl'
|
@@ -57,7 +59,6 @@ module ALGOSEC_SDK
|
|
57
59
|
rescue SocketError => e
|
58
60
|
msg = "Failed to connect to AlgoSec host #{@host}!\n"
|
59
61
|
@logger.error msg
|
60
|
-
e.message.prepend(msg)
|
61
62
|
raise e
|
62
63
|
end
|
63
64
|
|
data/lib/algosec-sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algosec-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Almog Cohen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.58.2
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.58.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|