algosec-sdk 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rubocop.yml +68 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +7 -0
- data/LICENSE +20 -0
- data/README.md +208 -0
- data/Rakefile +21 -0
- data/algosec-sdk.gemspec +28 -0
- data/lib/algosec-sdk.rb +8 -0
- data/lib/algosec-sdk/client.rb +69 -0
- data/lib/algosec-sdk/exceptions.rb +37 -0
- data/lib/algosec-sdk/helpers/business_flow_helper.rb +347 -0
- data/lib/algosec-sdk/helpers/flow_comparisons.rb +48 -0
- data/lib/algosec-sdk/rest.rb +160 -0
- data/lib/algosec-sdk/version.rb +4 -0
- data/rakelib/end-to-end-integration.rake +72 -0
- metadata +175 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
desc 'Test API SDK end-to-end against an AlgoSec machine'
|
2
|
+
task :e2e, %i[app host user password] => [] do |_t, args|
|
3
|
+
require 'algosec-sdk'
|
4
|
+
args.with_defaults(
|
5
|
+
app: 'TEST',
|
6
|
+
host: 'local.algosec.com',
|
7
|
+
user: 'admin',
|
8
|
+
password: 'algosec'
|
9
|
+
)
|
10
|
+
options = {
|
11
|
+
host: args.host,
|
12
|
+
user: args.user,
|
13
|
+
password: args.password,
|
14
|
+
ssl_enabled: false
|
15
|
+
}
|
16
|
+
client = ALGOSEC_SDK::Client.new(options)
|
17
|
+
client.login
|
18
|
+
|
19
|
+
NEW_FLOW_NAME = 'test-flow-name'.freeze
|
20
|
+
NETWORK_OBJECT_IP = '192.168.123.124'.freeze
|
21
|
+
NETWORK_SERVICE_NAME = 'TCP/202'.freeze
|
22
|
+
NETWORK_SERVICE_DEFINITION = [%w[tcp 202]].freeze
|
23
|
+
|
24
|
+
puts '### END-TO-END INTEGRATION STARTED ###'
|
25
|
+
|
26
|
+
puts "Fetching latest application revision id for: #{args.app}"
|
27
|
+
app_revision_id = client.get_app_revision_id_by_name(args.app)
|
28
|
+
puts "Application Revision ID Fetched: #{app_revision_id}"
|
29
|
+
|
30
|
+
puts 'Fetching current application flows'
|
31
|
+
flows = client.get_application_flows(app_revision_id)
|
32
|
+
puts "#{flows.length} flows fetched"
|
33
|
+
|
34
|
+
puts 'Creating application flow'
|
35
|
+
begin
|
36
|
+
new_flow = client.create_application_flow(
|
37
|
+
app_revision_id,
|
38
|
+
NEW_FLOW_NAME,
|
39
|
+
[NETWORK_OBJECT_IP],
|
40
|
+
[NETWORK_OBJECT_IP],
|
41
|
+
[NETWORK_SERVICE_NAME],
|
42
|
+
[],
|
43
|
+
[],
|
44
|
+
'Flow Created by AlgoSec Ruby SDK'
|
45
|
+
)
|
46
|
+
puts "Flow created successfully: #{new_flow}"
|
47
|
+
puts "Flow created successfully. Flow ID is: #{new_flow['flowID']}"
|
48
|
+
rescue StandardError => ex
|
49
|
+
puts "Application flow creation failed with: #{ex}"
|
50
|
+
end
|
51
|
+
|
52
|
+
puts "Trying to fetch the pre-existing flow by it's name, due to bug in the returned new flowID"
|
53
|
+
new_flow = client.get_application_flow_by_name(app_revision_id, NEW_FLOW_NAME)
|
54
|
+
puts 'Flow successfully fetched by name'
|
55
|
+
|
56
|
+
# Refresh the app revision id in case a draft was created
|
57
|
+
app_revision_id = client.get_app_revision_id_by_name(args.app)
|
58
|
+
|
59
|
+
puts 'Getting flow connectivity'
|
60
|
+
flow_connectivity = client.get_flow_connectivity(app_revision_id, new_flow['flowID'])
|
61
|
+
puts "Fetched flow connectivity: #{flow_connectivity}"
|
62
|
+
|
63
|
+
puts 'Deleting the flow now'
|
64
|
+
client.delete_flow_by_id(app_revision_id, new_flow['flowID'])
|
65
|
+
puts 'Flow deleted successfully'
|
66
|
+
|
67
|
+
puts 'Fetching current application flows'
|
68
|
+
flows = client.get_application_flows(app_revision_id)
|
69
|
+
puts "#{flows.length} flows fetched"
|
70
|
+
|
71
|
+
puts '### END-TO-END INTEGRATION END ###'
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: algosec-sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Almog Cohen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httpclient
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ipaddress
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.49.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.49.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Gem to interact with AlgoSec API
|
126
|
+
email:
|
127
|
+
- almog.cohen@algosec.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rubocop.yml"
|
134
|
+
- ".ruby-gemset"
|
135
|
+
- ".ruby-version"
|
136
|
+
- ".travis.yml"
|
137
|
+
- CHANGELOG.md
|
138
|
+
- Gemfile
|
139
|
+
- LICENSE
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- algosec-sdk.gemspec
|
143
|
+
- lib/algosec-sdk.rb
|
144
|
+
- lib/algosec-sdk/client.rb
|
145
|
+
- lib/algosec-sdk/exceptions.rb
|
146
|
+
- lib/algosec-sdk/helpers/business_flow_helper.rb
|
147
|
+
- lib/algosec-sdk/helpers/flow_comparisons.rb
|
148
|
+
- lib/algosec-sdk/rest.rb
|
149
|
+
- lib/algosec-sdk/version.rb
|
150
|
+
- rakelib/end-to-end-integration.rake
|
151
|
+
homepage: https://github.com/algosec/algosec-ruby
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.6.14
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Gem to interact with AlgoSec API
|
175
|
+
test_files: []
|