gooddata 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +20 -0
- data/CONTRIBUTING.md +12 -0
- data/README.md +5 -2
- data/Rakefile +0 -1
- data/dev-gooddata-sso.pub.encrypted +40 -0
- data/gooddata.gemspec +3 -3
- data/lib/gooddata/connection.rb +23 -13
- data/lib/gooddata/helpers/data_helper.rb +0 -1
- data/lib/gooddata/lcm/actions/apply_custom_maql.rb +8 -1
- data/lib/gooddata/lcm/actions/associate_clients.rb +8 -1
- data/lib/gooddata/lcm/actions/base_action.rb +10 -0
- data/lib/gooddata/lcm/actions/collect_ca_metrics.rb +7 -1
- data/lib/gooddata/lcm/actions/collect_client_projects.rb +3 -0
- data/lib/gooddata/lcm/actions/collect_clients.rb +3 -1
- data/lib/gooddata/lcm/actions/collect_data_product.rb +10 -2
- data/lib/gooddata/lcm/actions/collect_dynamic_schedule_params.rb +12 -1
- data/lib/gooddata/lcm/actions/collect_ldm_objects.rb +6 -2
- data/lib/gooddata/lcm/actions/collect_meta.rb +1 -1
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +8 -1
- data/lib/gooddata/lcm/actions/collect_segments.rb +6 -5
- data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +1 -1
- data/lib/gooddata/lcm/actions/collect_users_brick_users.rb +10 -4
- data/lib/gooddata/lcm/actions/create_segment_masters.rb +12 -2
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +10 -0
- data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +5 -1
- data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +3 -0
- data/lib/gooddata/lcm/actions/execute_schedules.rb +10 -0
- data/lib/gooddata/lcm/actions/import_object_collections.rb +1 -1
- data/lib/gooddata/lcm/actions/provision_clients.rb +12 -2
- data/lib/gooddata/lcm/actions/purge_clients.rb +2 -0
- data/lib/gooddata/lcm/actions/rename_existing_client_projects.rb +3 -0
- data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +4 -1
- data/lib/gooddata/lcm/actions/synchronize_cas.rb +7 -1
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +11 -1
- data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +7 -1
- data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +12 -7
- data/lib/gooddata/lcm/actions/synchronize_label_types.rb +4 -1
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +18 -7
- data/lib/gooddata/lcm/actions/synchronize_meta.rb +9 -0
- data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +11 -1
- data/lib/gooddata/lcm/actions/synchronize_processes.rb +7 -1
- data/lib/gooddata/lcm/actions/synchronize_schedules.rb +4 -1
- data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +6 -0
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +60 -15
- data/lib/gooddata/lcm/actions/synchronize_user_groups.rb +7 -1
- data/lib/gooddata/lcm/actions/synchronize_users.rb +106 -3
- data/lib/gooddata/lcm/actions/update_release_table.rb +19 -0
- data/lib/gooddata/lcm/helpers/check_helper.rb +21 -6
- data/lib/gooddata/lcm/lcm2.rb +35 -22
- data/lib/gooddata/lcm/types/class/gd_logger.rb +23 -0
- data/lib/gooddata/lcm/types/class/gd_product.rb +23 -0
- data/lib/gooddata/lcm/types/class/gd_project.rb +23 -0
- data/lib/gooddata/lcm/types/class/smart_hash.rb +23 -0
- data/lib/gooddata/lcm/types/complex/segment.rb +1 -1
- data/lib/gooddata/lcm/types/scalar/integer.rb +2 -2
- data/lib/gooddata/lcm/types/special/any.rb +18 -0
- data/lib/gooddata/models/blueprint/dataset_blueprint.rb +1 -1
- data/lib/gooddata/models/blueprint/to_manifest.rb +1 -3
- data/lib/gooddata/models/blueprint/to_wire.rb +2 -1
- data/lib/gooddata/models/from_wire.rb +13 -1
- data/lib/gooddata/models/metadata/folder.rb +22 -0
- data/lib/gooddata/models/metadata/metric.rb +5 -8
- data/lib/gooddata/models/model.rb +1 -1
- data/lib/gooddata/models/process.rb +42 -32
- data/lib/gooddata/models/project.rb +19 -36
- data/lib/gooddata/models/project_creator.rb +3 -1
- data/lib/gooddata/models/project_role.rb +3 -4
- data/lib/gooddata/models/schedule.rb +0 -2
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +9 -1
- data/lib/gooddata/models/user_filters/user_filter.rb +1 -2
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +18 -6
- data/lib/gooddata/rest/client.rb +1 -2
- data/lib/gooddata/rest/connection.rb +12 -46
- data/lib/gooddata/rest/phmap.rb +101 -56
- data/lib/gooddata/version.rb +1 -1
- data/rubydev_public.gpg.encrypted +51 -0
- data/rubydev_secret_keys.gpg.encrypted +109 -0
- data/spec/data/user_filters.csv +2 -0
- data/spec/environment/default.rb +2 -2
- data/spec/environment/development.rb +1 -1
- data/spec/environment/staging.rb +2 -3
- data/spec/environment/testing.rb +4 -4
- data/spec/integration/connection_spec.rb +37 -0
- data/spec/integration/core/connection_spec.rb +1 -1
- data/spec/integration/core/logging_spec.rb +8 -6
- data/spec/integration/core/project_spec.rb +1 -1
- data/spec/integration/mandatory_user_filter_spec.rb +53 -0
- data/spec/integration/mixins/id_to_uri_spec.rb +17 -5
- data/spec/integration/models/label_spec.rb +9 -0
- data/spec/integration/models/metric_spec.rb +24 -0
- data/spec/integration/models/process_spec.rb +35 -0
- data/spec/integration/models/project_role_spec.rb +1 -1
- data/spec/integration/models/schedule_spec.rb +0 -8
- data/spec/integration/schedule_spec.rb +4 -6
- data/spec/integration/user_filters_spec.rb +20 -16
- data/spec/integration/user_group_spec.rb +1 -1
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +354 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +299 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +354 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +354 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +354 -0
- data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +354 -0
- data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +2065 -0
- data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +119 -0
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +9812 -0
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +174 -0
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +58 -0
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +63 -0
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +299 -0
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +299 -0
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +2287 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +56 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +315 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +54 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +258 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +159 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +158 -0
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +809 -0
- data/spec/spec_helper.rb +46 -2
- data/spec/unit/actions/associate_clients_spec.rb +2 -1
- data/spec/unit/actions/collect_data_product_spec.rb +3 -1
- data/spec/unit/actions/collect_segment_clients_spec.rb +1 -0
- data/spec/unit/actions/create_segment_masters_spec.rb +1 -0
- data/spec/unit/actions/ensure_data_product_spec.rb +1 -0
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +2 -0
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +4 -0
- data/spec/unit/actions/provision_clients_spec.rb +2 -1
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -6
- data/spec/unit/actions/synchronize_ldm_spec.rb +20 -7
- data/spec/unit/actions/synchronize_user_filters_spec.rb +21 -0
- data/spec/unit/helpers/check_helper_production_spec.rb +34 -0
- data/spec/unit/helpers/check_helper_spec.rb +97 -9
- data/spec/unit/lcm/lcm2_spec.rb +67 -3
- data/spec/unit/models/blueprint/to_wire_spec.rb +1 -0
- data/spec/unit/models/dataset_blueprint.rb +14 -0
- data/spec/unit/models/from_wire_spec.rb +20 -0
- data/spec/unit/models/model_spec.rb +10 -0
- data/spec/unit/models/to_manifest_spec.rb +29 -0
- data/spec/unit/models/user_filters/user_filter_builder_spec.rb +44 -6
- data/spec/unit/rest/phmap_spec.rb +117 -0
- data/spec/vcr_configurer.rb +63 -0
- metadata +293 -33
- data/lib/gooddata/lcm/actions/ensure_segments.rb +0 -32
@@ -14,6 +14,15 @@ module GoodData
|
|
14
14
|
PARAMS = define_params(self) do
|
15
15
|
description 'Client Used for Connecting to GD'
|
16
16
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
17
|
+
|
18
|
+
description 'Client used to connecting to development domain'
|
19
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
20
|
+
|
21
|
+
description 'Synchronization Info'
|
22
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true
|
23
|
+
|
24
|
+
description 'Additional Hidden Parameters'
|
25
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
17
26
|
end
|
18
27
|
|
19
28
|
class << self
|
@@ -15,11 +15,20 @@ module GoodData
|
|
15
15
|
description 'Client Used for Connecting to GD'
|
16
16
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
17
17
|
|
18
|
+
description 'DataProduct to manage'
|
19
|
+
param :data_product, instance_of(Type::GDDataProductType), required: false
|
20
|
+
|
18
21
|
description 'Organization Name'
|
19
|
-
param :organization, instance_of(Type::StringType), required:
|
22
|
+
param :organization, instance_of(Type::StringType), required: false
|
23
|
+
|
24
|
+
description 'Domain'
|
25
|
+
param :domain, instance_of(Type::StringType), required: false
|
20
26
|
|
21
27
|
description 'Segments to manage'
|
22
28
|
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
29
|
+
|
30
|
+
description 'Additional Hidden Parameters'
|
31
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
23
32
|
end
|
24
33
|
|
25
34
|
class << self
|
@@ -27,6 +36,7 @@ module GoodData
|
|
27
36
|
client = params.gdc_gd_client
|
28
37
|
|
29
38
|
domain_name = params.organization || params.domain
|
39
|
+
fail "Either organisation or domain has to be specified in params" unless domain_name
|
30
40
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
31
41
|
data_product = params.data_product
|
32
42
|
domain_segments = domain.segments(:all, data_product)
|
@@ -15,11 +15,17 @@ module GoodData
|
|
15
15
|
description 'Client Used for Connecting to GD'
|
16
16
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
17
17
|
|
18
|
-
description '
|
18
|
+
description 'Client used to connecting to development domain'
|
19
19
|
param :development_client, instance_of(Type::GdClientType), required: true
|
20
20
|
|
21
21
|
description 'Synchronization Info'
|
22
22
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
23
|
+
|
24
|
+
description 'Logger'
|
25
|
+
param :gdc_logger, instance_of(Type::GdLogger), required: true
|
26
|
+
|
27
|
+
description 'Additional Hidden Parameters'
|
28
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
23
29
|
end
|
24
30
|
|
25
31
|
RESULT_HEADER = [
|
@@ -15,7 +15,7 @@ module GoodData
|
|
15
15
|
description 'Client Used for Connecting to GD'
|
16
16
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
17
17
|
|
18
|
-
description '
|
18
|
+
description 'Client used to connecting to development domain'
|
19
19
|
param :development_client, instance_of(Type::GdClientType), required: true
|
20
20
|
|
21
21
|
description 'Synchronization Info'
|
@@ -26,6 +26,9 @@ module GoodData
|
|
26
26
|
|
27
27
|
description 'Schedule Additional Secure Parameters'
|
28
28
|
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
29
|
+
|
30
|
+
description 'Logger'
|
31
|
+
param :gdc_logger, instance_of(Type::GdLogger), required: true
|
29
32
|
end
|
30
33
|
|
31
34
|
RESULT_HEADER = [
|
@@ -16,6 +16,9 @@ module GoodData
|
|
16
16
|
description 'Client Used for Connecting to GD'
|
17
17
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
18
18
|
|
19
|
+
description 'Client used to connecting to development domain'
|
20
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
21
|
+
|
19
22
|
description 'Synchronization Info'
|
20
23
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
21
24
|
|
@@ -24,6 +27,9 @@ module GoodData
|
|
24
27
|
|
25
28
|
description 'Production Tag Names'
|
26
29
|
param :production_tag, instance_of(Type::StringType), required: false, deprecated: true, replacement: :production_tags
|
30
|
+
|
31
|
+
description 'Additional Hidden Parameters'
|
32
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
27
33
|
end
|
28
34
|
|
29
35
|
class << self
|
@@ -42,8 +42,32 @@ module GoodData
|
|
42
42
|
description 'Restricts synchronization to specified segments'
|
43
43
|
param :segments_filter, array_of(instance_of(Type::StringType)), required: false
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
description 'Organization Name'
|
46
|
+
param :organization, instance_of(Type::StringType), required: false
|
47
|
+
|
48
|
+
description 'Domain'
|
49
|
+
param :domain, instance_of(Type::StringType), required: false
|
50
|
+
|
51
|
+
description 'DataProduct to manage'
|
52
|
+
param :data_product, instance_of(Type::GDDataProductType), required: true
|
53
|
+
|
54
|
+
description 'Segments to manage'
|
55
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: false
|
56
|
+
|
57
|
+
description 'Logger'
|
58
|
+
param :gdc_logger, instance_of(Type::GdLogger), required: true
|
59
|
+
|
60
|
+
description 'GDC Project'
|
61
|
+
param :gdc_project, instance_of(Type::GdProjectType), required: false
|
62
|
+
|
63
|
+
description 'GDC Project Id'
|
64
|
+
param :gdc_project_id, instance_of(Type::StringType), required: false
|
65
|
+
|
66
|
+
description 'User brick users'
|
67
|
+
param :users_brick_users, instance_of(Type::ObjectType), required: false
|
68
|
+
|
69
|
+
description 'Makes the brick run without altering user filters'
|
70
|
+
param :dry_run, instance_of(Type::StringType), required: false, default: false
|
47
71
|
end
|
48
72
|
|
49
73
|
class << self
|
@@ -61,8 +85,10 @@ module GoodData
|
|
61
85
|
def call(params)
|
62
86
|
client = params.gdc_gd_client
|
63
87
|
domain_name = params.organization || params.domain
|
88
|
+
fail "Either organisation or domain has to be specified in params" unless domain_name
|
64
89
|
domain = client.domain(domain_name) if domain_name
|
65
90
|
project = client.projects(params.gdc_project) || client.projects(params.gdc_project_id)
|
91
|
+
fail "Either project or project_id has to be specified in params" unless project
|
66
92
|
data_product = params.data_product
|
67
93
|
|
68
94
|
data_source = GoodData::Helpers::DataSource.new(params.input_source)
|
@@ -101,29 +127,39 @@ module GoodData
|
|
101
127
|
ignore_missing_values: params.ignore_missing_values == 'true',
|
102
128
|
do_not_touch_filters_that_are_not_mentioned: params.do_not_touch_filters_that_are_not_mentioned == 'true',
|
103
129
|
domain: domain,
|
104
|
-
dry_run:
|
130
|
+
dry_run: params[:dry_run],
|
105
131
|
users_brick_input: params.users_brick_users
|
106
132
|
}
|
107
133
|
|
108
134
|
puts "Synchronizing in mode \"#{mode}\""
|
109
135
|
case mode
|
110
136
|
when 'sync_project'
|
111
|
-
|
112
|
-
|
137
|
+
without_check(PARAMS, params) do
|
138
|
+
CSV.foreach(File.open(data_source.realize(params), 'r:UTF-8'), headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
139
|
+
filters << row
|
140
|
+
end
|
113
141
|
end
|
114
142
|
filters_to_load = GoodData::UserFilterBuilder.get_filters(filters, symbolized_config)
|
115
143
|
puts "Synchronizing #{filters_to_load.count} filters"
|
116
144
|
project.add_data_permissions(filters_to_load, run_params)
|
117
145
|
when 'sync_one_project_based_on_pid'
|
118
|
-
|
119
|
-
|
146
|
+
without_check(PARAMS, params) do
|
147
|
+
CSV.foreach(File.open(data_source.realize(params), 'r:UTF-8'), headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
148
|
+
filters << row if row[multiple_projects_column] == project.pid
|
149
|
+
end
|
120
150
|
end
|
121
151
|
filters_to_load = GoodData::UserFilterBuilder.get_filters(filters, symbolized_config)
|
122
152
|
puts "Synchronizing #{filters_to_load.count} filters"
|
123
153
|
project.add_data_permissions(filters_to_load, run_params)
|
124
154
|
when 'sync_multiple_projects_based_on_pid'
|
125
|
-
|
126
|
-
|
155
|
+
without_check(PARAMS, params) do
|
156
|
+
CSV.foreach(File.open(data_source.realize(params), 'r:UTF-8'), headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
157
|
+
filters << row.to_hash
|
158
|
+
end
|
159
|
+
end
|
160
|
+
if filters.empty?
|
161
|
+
fail 'The filter set can not be empty when using sync_multiple_projects_* mode as the filters contain \
|
162
|
+
the project ids in which the permissions should be changed'
|
127
163
|
end
|
128
164
|
filters.group_by { |u| u[multiple_projects_column] }.flat_map do |project_id, new_filters|
|
129
165
|
fail "Project id cannot be empty" if project_id.blank?
|
@@ -135,7 +171,9 @@ module GoodData
|
|
135
171
|
when 'sync_one_project_based_on_custom_id'
|
136
172
|
filter_value = UserBricksHelper.resolve_client_id(domain, project, data_product)
|
137
173
|
|
138
|
-
filepath =
|
174
|
+
filepath = without_check(PARAMS, params) do
|
175
|
+
File.open(data_source.realize(params), 'r:UTF-8')
|
176
|
+
end
|
139
177
|
CSV.foreach(filepath, headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
140
178
|
client_id = row[multiple_projects_column].to_s
|
141
179
|
filters << row if client_id == filter_value
|
@@ -150,10 +188,15 @@ module GoodData
|
|
150
188
|
puts "Synchronizing #{filters_to_load.count} filters"
|
151
189
|
project.add_data_permissions(filters_to_load, run_params)
|
152
190
|
when 'sync_multiple_projects_based_on_custom_id'
|
153
|
-
|
154
|
-
|
191
|
+
without_check(PARAMS, params) do
|
192
|
+
CSV.foreach(File.open(data_source.realize(params), 'r:UTF-8'), headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
193
|
+
filters << row.to_hash
|
194
|
+
end
|
195
|
+
end
|
196
|
+
if filters.empty?
|
197
|
+
fail 'The filter set can not be empty when using sync_multiple_projects_* mode as the filters contain \
|
198
|
+
the project ids in which the permissions should be changed'
|
155
199
|
end
|
156
|
-
fail 'The filter set can not be empty when using sync_multiple_projects_based_on_custom_id mode' if filters.empty?
|
157
200
|
filters.group_by { |u| u[multiple_projects_column] }.flat_map do |client_id, new_filters|
|
158
201
|
fail "Client id cannot be empty" if client_id.blank?
|
159
202
|
project = domain.clients(client_id, data_product).project
|
@@ -163,8 +206,10 @@ module GoodData
|
|
163
206
|
project.add_data_permissions(filters_to_load, run_params)
|
164
207
|
end
|
165
208
|
when 'sync_domain_client_workspaces'
|
166
|
-
|
167
|
-
|
209
|
+
without_check(PARAMS, params) do
|
210
|
+
CSV.foreach(File.open(data_source.realize(params), 'r:UTF-8'), headers: csv_with_headers, return_headers: false, encoding: 'utf-8') do |row|
|
211
|
+
filters << row.to_hash
|
212
|
+
end
|
168
213
|
end
|
169
214
|
|
170
215
|
domain_clients = domain.clients(:all, data_product)
|
@@ -16,11 +16,17 @@ module GoodData
|
|
16
16
|
description 'Client Used for Connecting to GD'
|
17
17
|
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
18
18
|
|
19
|
-
description '
|
19
|
+
description 'Client used to connecting to development domain'
|
20
20
|
param :development_client, instance_of(Type::GdClientType), required: true
|
21
21
|
|
22
22
|
description 'Synchronization Info'
|
23
23
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
24
|
+
|
25
|
+
description 'Logger'
|
26
|
+
param :gdc_logger, instance_of(Type::GdLogger), required: true
|
27
|
+
|
28
|
+
description 'Additional Hidden Parameters'
|
29
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
24
30
|
end
|
25
31
|
|
26
32
|
class << self
|
@@ -25,13 +25,107 @@ module GoodData
|
|
25
25
|
description 'Column That Contains Target Project IDs'
|
26
26
|
param :multiple_projects_column, instance_of(Type::StringType), required: false
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
description 'DataProduct to manage'
|
29
|
+
param :data_product, instance_of(Type::GDDataProductType), required: false
|
30
|
+
|
31
|
+
description 'Organization Name'
|
32
|
+
param :organization, instance_of(Type::StringType), required: false
|
33
|
+
|
34
|
+
description 'Domain'
|
35
|
+
param :domain, instance_of(Type::StringType), required: false
|
36
|
+
|
37
|
+
description 'Logger'
|
38
|
+
param :gdc_logger, instance_of(Type::GdLogger), required: true
|
39
|
+
|
40
|
+
description 'GDC Project'
|
41
|
+
param :gdc_project, instance_of(Type::GdProjectType), required: false
|
42
|
+
|
43
|
+
description 'GDC Project Id'
|
44
|
+
param :gdc_project_id, instance_of(Type::StringType), required: false
|
45
|
+
|
46
|
+
description 'Segments to manage'
|
47
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: false
|
48
|
+
|
49
|
+
description 'Additional Hidden Parameters'
|
50
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
51
|
+
|
52
|
+
description 'Whitelists'
|
53
|
+
param :whitelists, array_of(instance_of(Type::StringType)), required: false
|
54
|
+
|
55
|
+
description 'Regular expresion whitelists'
|
56
|
+
param :regexp_whitelists, array_of(instance_of(Type::StringType)), required: false
|
57
|
+
|
58
|
+
description 'Ignore Failures Flag'
|
59
|
+
param :ignore_failures, instance_of(Type::BooleanType), required: false, default: false
|
60
|
+
|
61
|
+
description 'Remove users from project flag'
|
62
|
+
param :remove_users_from_project, instance_of(Type::BooleanType), required: false, default: false
|
63
|
+
|
64
|
+
description 'Do not touch users that are not mentioned flag'
|
65
|
+
param :do_not_touch_users_that_are_not_mentioned, instance_of(Type::BooleanType), required: false, default: false
|
66
|
+
|
67
|
+
description 'Create non existing user groups flag'
|
68
|
+
param :create_non_existing_user_groups, instance_of(Type::BooleanType), required: false, default: true
|
69
|
+
|
70
|
+
description 'Single sign on provider'
|
71
|
+
param :sso_provider, instance_of(Type::StringType), required: false
|
72
|
+
|
73
|
+
description 'ADS client'
|
74
|
+
param :ads_client, instance_of(Type::AdsClientType), required: false
|
75
|
+
|
76
|
+
description 'Authentication modes'
|
77
|
+
param :authentication_modes, instance_of(Type::StringType), required: false
|
78
|
+
|
79
|
+
description 'First name column'
|
80
|
+
param :first_name_column, instance_of(Type::StringType), required: false
|
81
|
+
|
82
|
+
description 'Last name column'
|
83
|
+
param :last_name_column, instance_of(Type::StringType), required: false
|
84
|
+
|
85
|
+
description 'Login column'
|
86
|
+
param :login_column, instance_of(Type::StringType), required: false
|
87
|
+
|
88
|
+
description 'Password column'
|
89
|
+
param :password_column, instance_of(Type::StringType), required: false
|
90
|
+
|
91
|
+
description 'Email column'
|
92
|
+
param :email_column, instance_of(Type::StringType), required: false
|
93
|
+
|
94
|
+
description 'Role column'
|
95
|
+
param :role_column, instance_of(Type::StringType), required: false
|
96
|
+
|
97
|
+
description 'Sso provider column'
|
98
|
+
param :sso_provider_column, instance_of(Type::StringType), required: false
|
99
|
+
|
100
|
+
description 'Authentication modes column'
|
101
|
+
param :authentication_modes_column, instance_of(Type::StringType), required: false
|
102
|
+
|
103
|
+
description 'User groups column'
|
104
|
+
param :user_groups_column, instance_of(Type::StringType), required: false
|
105
|
+
|
106
|
+
description 'Language column'
|
107
|
+
param :language_column, instance_of(Type::StringType), required: false
|
108
|
+
|
109
|
+
description 'Company column'
|
110
|
+
param :company_column, instance_of(Type::StringType), required: false
|
111
|
+
|
112
|
+
description 'Position column'
|
113
|
+
param :position_column, instance_of(Type::StringType), required: false
|
114
|
+
|
115
|
+
description 'Country column'
|
116
|
+
param :country_column, instance_of(Type::StringType), required: false
|
117
|
+
|
118
|
+
description 'Phone column'
|
119
|
+
param :phone_column, instance_of(Type::StringType), required: false
|
120
|
+
|
121
|
+
description 'Ip whitelist column'
|
122
|
+
param :ip_whitelist_column, instance_of(Type::StringType), required: false
|
30
123
|
end
|
31
124
|
|
32
125
|
class << self
|
33
126
|
MODES = %w(
|
34
127
|
add_to_organization
|
128
|
+
remove_from_organization
|
35
129
|
sync_project
|
36
130
|
sync_domain_and_project
|
37
131
|
sync_multiple_projects_based_on_pid
|
@@ -48,7 +142,9 @@ module GoodData
|
|
48
142
|
def call(params)
|
49
143
|
client = params.gdc_gd_client
|
50
144
|
domain_name = params.organization || params.domain
|
145
|
+
fail "Either organisation or domain has to be specified in params" unless domain_name
|
51
146
|
project = client.projects(params.gdc_project) || client.projects(params.gdc_project_id)
|
147
|
+
fail "Either project or project_id has to be specified in params" unless project
|
52
148
|
data_source = GoodData::Helpers::DataSource.new(params.input_source)
|
53
149
|
data_product = params.data_product
|
54
150
|
mode = params.sync_mode
|
@@ -88,6 +184,11 @@ module GoodData
|
|
88
184
|
results = case mode
|
89
185
|
when 'add_to_organization'
|
90
186
|
domain.create_users(new_users.uniq { |u| u[:login] || u[:email] })
|
187
|
+
when 'remove_from_organization'
|
188
|
+
user_ids = new_users.uniq { |u| u[:login] || u[:email] }.map { |u| u[:login] || u[:email] }
|
189
|
+
users = user_ids.map { |u| domain.users(u, client: client) }
|
190
|
+
params.gdc_logger.warn "Deleting #{users.count} users from domain #{domain_name}"
|
191
|
+
users.map(&:delete)
|
91
192
|
when 'sync_project'
|
92
193
|
project.import_users(new_users,
|
93
194
|
domain: domain,
|
@@ -289,7 +390,9 @@ module GoodData
|
|
289
390
|
if dwh
|
290
391
|
data = dwh.execute_select(params.input_source.query)
|
291
392
|
else
|
292
|
-
tmp =
|
393
|
+
tmp = without_check(PARAMS, params) do
|
394
|
+
File.open(data_source.realize(params), 'r:UTF-8')
|
395
|
+
end
|
293
396
|
data = CSV.read(tmp, headers: true)
|
294
397
|
end
|
295
398
|
|
@@ -14,6 +14,24 @@ module GoodData
|
|
14
14
|
PARAMS = define_params(self) do
|
15
15
|
description 'ADS Client'
|
16
16
|
param :ads_client, instance_of(Type::AdsClientType), required: true
|
17
|
+
|
18
|
+
description 'Client Used for Connecting to GD'
|
19
|
+
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
20
|
+
|
21
|
+
description 'Organization Name'
|
22
|
+
param :organization, instance_of(Type::StringType), required: false
|
23
|
+
|
24
|
+
description 'Domain'
|
25
|
+
param :domain, instance_of(Type::StringType), required: false
|
26
|
+
|
27
|
+
description 'Segments to manage'
|
28
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
29
|
+
|
30
|
+
description 'Table Name'
|
31
|
+
param :release_table_name, instance_of(Type::StringType), required: false
|
32
|
+
|
33
|
+
description 'Query'
|
34
|
+
param :query, instance_of(Type::GdSmartHashType), required: false
|
17
35
|
end
|
18
36
|
|
19
37
|
DEFAULT_TABLE_NAME = 'LCM_RELEASE'
|
@@ -23,6 +41,7 @@ module GoodData
|
|
23
41
|
client = params.gdc_gd_client
|
24
42
|
|
25
43
|
domain_name = params.organization || params.domain
|
44
|
+
fail "Either organisation or domain has to be specified in params" unless domain_name
|
26
45
|
client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
27
46
|
|
28
47
|
params.segments.map do |segment_in|
|
@@ -16,22 +16,37 @@ module GoodData
|
|
16
16
|
type = specification[param_name][:type]
|
17
17
|
if value.nil? || (value.is_a?(String) && value.empty?)
|
18
18
|
if specification[param_name][:opts][:default]
|
19
|
-
|
19
|
+
if specification.select { |x| specification[x][:opts][:replacement] == param_name }.first.nil?
|
20
|
+
params[param_name] = specification[param_name][:opts][:default]
|
21
|
+
else
|
22
|
+
GoodData.logger.warn "WARNING: Default value for parameter '#{param_name}' was not filled because deprecated parameter is used instead."
|
23
|
+
end
|
20
24
|
elsif specification[param_name][:opts][:required]
|
21
|
-
|
25
|
+
if ENV['RSPEC_ENV'] == 'test'
|
26
|
+
fail "Mandatory parameter '#{param_name}' of type '#{type}' is not specified"
|
27
|
+
else
|
28
|
+
GoodData.logger.error("Mandatory parameter '#{param_name}' of type '#{type}' is not specified")
|
29
|
+
end
|
22
30
|
end
|
23
31
|
else
|
24
32
|
if type.class.const_get(:CATEGORY) == :complex && !value.is_a?(Hash)
|
25
|
-
|
26
|
-
|
33
|
+
if ENV['RSPEC_ENV'] == 'test'
|
34
|
+
fail "Expected parameter '#{param_name}' to be kind of '#{type}', got '#{value.class.name}'"
|
35
|
+
else
|
36
|
+
GoodData.logger.error("Expected parameter '#{param_name}' to be kind of '#{type}', got '#{value.class.name}'")
|
37
|
+
end
|
27
38
|
end
|
28
39
|
|
29
40
|
if specification[param_name][:opts][:deprecated]
|
30
|
-
|
41
|
+
GoodData.logger.warn("WARNING: Parameter '#{param_name}' is deprecated. Please use '#{specification[param_name][:opts][:replacement]}' instead.")
|
31
42
|
end
|
32
43
|
|
33
44
|
unless type.check(value)
|
34
|
-
|
45
|
+
if ENV['RSPEC_ENV'] == 'test'
|
46
|
+
fail "Parameter '#{param_name}' has invalid type, expected: #{type}, got #{value.class}"
|
47
|
+
else
|
48
|
+
GoodData.logger.error("Parameter '#{param_name}' has invalid type, expected: #{type}, got #{value.class}")
|
49
|
+
end
|
35
50
|
end
|
36
51
|
end
|
37
52
|
end
|