soar-registry-staff 0.0.4 → 0.0.5
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/soar/registry/staff/identity/base.rb +2 -1
- data/lib/soar/registry/staff/test/directory/orchestrator.rb +5 -9
- data/lib/soar/registry/staff/test/directory/provider/base.rb +2 -6
- data/lib/soar/registry/staff/test/directory/provider/dynamo_db.rb +7 -9
- data/lib/soar/registry/staff/test/directory/provider/stub.rb +8 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20edb028d48cc27989de741fd123662dca816078
|
4
|
+
data.tar.gz: c68357ad354ce8b4cfb127b30eedcd826e598898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf0753a8fbbc188ad2d233f716c34ecda802793f5338d77e3a7377fb6eaf8980bedd80b02850a2962d72ec15ace3f269ad62e21988afad2735bfbedf7132f50
|
7
|
+
data.tar.gz: e24425243ff29c540d790e4021e36b261f110bf2430576e43437c4f12e9d65fbd72176a3867facfa8bd6a83c70dd40a18bb87348361182e581ffd763c692c9d8
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'soar_idm/soar_idm'
|
2
2
|
require 'soar/registry/staff/translator/dynamo_db'
|
3
3
|
require 'soar/registry/staff/directory/dynamo_db'
|
4
|
+
require 'soar/registry/staff/directory/stub'
|
4
5
|
|
5
6
|
module Soar
|
6
7
|
module Registry
|
@@ -20,7 +21,7 @@ module Soar
|
|
20
21
|
##
|
21
22
|
def initialize(configuration)
|
22
23
|
@translator = Object.const_get(configuration['rule_set']['adaptor']).new
|
23
|
-
@directory = Object::const_get(configuration['provider']['adaptor']).new
|
24
|
+
@directory = Object::const_get(configuration['provider']['adaptor']).new
|
24
25
|
@directory.bootstrap(configuration['provider']['config'])
|
25
26
|
@directory.authenticate(configuration['provider']['credentials'])
|
26
27
|
@client = @directory.connect
|
@@ -8,13 +8,13 @@ module Soar
|
|
8
8
|
attr_reader :directory
|
9
9
|
|
10
10
|
def initialize(provider)
|
11
|
-
@provider = provider
|
12
|
-
@directory =
|
11
|
+
@provider = provider
|
12
|
+
@directory = provider.directory
|
13
13
|
end
|
14
14
|
|
15
15
|
def reset_data
|
16
16
|
clear_data
|
17
|
-
|
17
|
+
load_sample_data
|
18
18
|
end
|
19
19
|
|
20
20
|
def clear_data
|
@@ -41,12 +41,8 @@ module Soar
|
|
41
41
|
@provider.create_data_structure
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
@provider.
|
46
|
-
end
|
47
|
-
|
48
|
-
def load_sample_identities(identities)
|
49
|
-
@provider.load_sample_identities(identities)
|
44
|
+
def load_sample_data
|
45
|
+
@provider.load_sample_data
|
50
46
|
end
|
51
47
|
|
52
48
|
def valid_configuration
|
@@ -10,11 +10,7 @@ module Soar
|
|
10
10
|
class Base
|
11
11
|
|
12
12
|
attr_reader :directory
|
13
|
-
|
14
|
-
def get_sample_identities
|
15
|
-
file = File.read("lib/soar/registry/staff/test/fixtures/identity_data.json")
|
16
|
-
JSON.parse(file)
|
17
|
-
end
|
13
|
+
attr_reader :identities
|
18
14
|
|
19
15
|
def valid_credentials
|
20
16
|
valid_config = valid_configuration
|
@@ -22,7 +18,7 @@ module Soar
|
|
22
18
|
end
|
23
19
|
|
24
20
|
def valid_configuration
|
25
|
-
|
21
|
+
@config
|
26
22
|
end
|
27
23
|
|
28
24
|
def invalid_credentials(valid_credentials)
|
@@ -11,14 +11,16 @@ module Soar
|
|
11
11
|
module Provider
|
12
12
|
class DynamoDb < Base
|
13
13
|
|
14
|
-
def initialize
|
14
|
+
def initialize(config={}, data_structure={}, data={})
|
15
|
+
@config = config
|
16
|
+
@identities = data
|
17
|
+
@data_structure = data_structure
|
15
18
|
@directory = Soar::Registry::Staff::Directory::DynamoDb.new
|
16
19
|
end
|
17
20
|
|
18
21
|
def create_data_structure
|
19
22
|
if not @directory.client.list_tables.table_names.include?(valid_configuration['provider']['config']['table'])
|
20
|
-
|
21
|
-
@directory.client.create_table(fixture)
|
23
|
+
@directory.client.create_table(@data_structure)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
@@ -28,8 +30,8 @@ module Soar
|
|
28
30
|
})
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
32
|
-
identities.each { |identity|
|
33
|
+
def load_sample_data
|
34
|
+
@identities.each { |identity|
|
33
35
|
@directory.client.put_item({
|
34
36
|
table_name: valid_configuration['provider']['config']['table'],
|
35
37
|
item: Hashie.symbolize_keys(deep_copy(identity))
|
@@ -57,10 +59,6 @@ module Soar
|
|
57
59
|
@directory.configuration['region'] == config['provider']['config']['region'] and @directory.configuration['endpoint'] == config['provider']['config']['endpoint']
|
58
60
|
end
|
59
61
|
|
60
|
-
def valid_configuration?(config)
|
61
|
-
@directory.configuration['region'] == config['provider']['config']['region'] and @directory.configuration['endpoint'] == config['provider']['config']['endpoint']
|
62
|
-
end
|
63
|
-
|
64
62
|
def invalid_configuration(valid_config)
|
65
63
|
invalid_config = []
|
66
64
|
['table', 'region', 'endpoint'].each { |index|
|
@@ -13,7 +13,10 @@ module Soar
|
|
13
13
|
|
14
14
|
attr_reader :directory
|
15
15
|
|
16
|
-
def initialize
|
16
|
+
def initialize(config={}, data_structure={}, data={})
|
17
|
+
@config = config
|
18
|
+
@identities = data
|
19
|
+
@data_structure = data_structure
|
17
20
|
@directory = Soar::Registry::Staff::Directory::Stub.new
|
18
21
|
end
|
19
22
|
|
@@ -25,8 +28,8 @@ module Soar
|
|
25
28
|
@directory.interface.clear
|
26
29
|
end
|
27
30
|
|
28
|
-
def
|
29
|
-
identities.each { |identity|
|
31
|
+
def load_sample_data
|
32
|
+
@identities.each { |identity|
|
30
33
|
@directory.interface.add('identities', identity)
|
31
34
|
}
|
32
35
|
end
|
@@ -40,9 +43,8 @@ module Soar
|
|
40
43
|
end
|
41
44
|
|
42
45
|
def valid_configuration
|
43
|
-
config =
|
44
|
-
config
|
45
|
-
return config
|
46
|
+
@config['provider']['adaptor'] = "Soar::Registry::Staff::Directory::Stub"
|
47
|
+
return @config
|
46
48
|
end
|
47
49
|
|
48
50
|
def valid_configuration?(config)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar-registry-staff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Mulder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashy_db
|