gooddata 0.6.51 → 0.6.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +13 -1
- data/CONTRIBUTING.md +25 -0
- data/PULL_REQUEST_TEMPLATE.md +5 -0
- data/README.md +7 -4
- data/gooddata.gemspec +2 -3
- data/lib/gooddata.rb +1 -0
- data/lib/gooddata/bricks/base_downloader.rb +6 -6
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +15 -5
- data/lib/gooddata/bricks/middleware/dwh_middleware.rb +15 -3
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +13 -4
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +3 -0
- data/lib/gooddata/exceptions/no_project_error.rb +5 -1
- data/lib/gooddata/goodzilla/goodzilla.rb +7 -6
- data/lib/gooddata/helpers/data_helper.rb +4 -4
- data/lib/gooddata/helpers/global_helpers_params.rb +61 -39
- data/lib/gooddata/lcm/actions/apply_custom_maql.rb +9 -0
- data/lib/gooddata/lcm/actions/associate_clients.rb +23 -4
- data/lib/gooddata/lcm/actions/collect_attrs.rb +56 -0
- data/lib/gooddata/lcm/actions/collect_ca_metrics.rb +53 -0
- data/lib/gooddata/lcm/actions/collect_clients.rb +25 -3
- data/lib/gooddata/lcm/actions/collect_meta.rb +83 -0
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +12 -4
- data/lib/gooddata/lcm/actions/collect_segments.rb +4 -4
- data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +74 -0
- data/lib/gooddata/lcm/actions/create_segment_masters.rb +16 -30
- data/lib/gooddata/lcm/actions/ensure_release_table.rb +0 -3
- data/lib/gooddata/lcm/actions/ensure_segments.rb +1 -4
- data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +5 -5
- data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +8 -5
- data/lib/gooddata/lcm/actions/hello_world.rb +0 -3
- data/lib/gooddata/lcm/actions/import_object_collections.rb +60 -0
- data/lib/gooddata/lcm/actions/print_actions.rb +0 -3
- data/lib/gooddata/lcm/actions/print_modes.rb +0 -3
- data/lib/gooddata/lcm/actions/print_types.rb +1 -4
- data/lib/gooddata/lcm/actions/provision_clients.rb +5 -5
- data/lib/gooddata/lcm/actions/purge_clients.rb +4 -10
- data/lib/gooddata/lcm/actions/segments_filter.rb +0 -6
- data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +8 -4
- data/lib/gooddata/lcm/actions/synchronize_cas.rb +61 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +9 -3
- data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +13 -5
- data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +71 -17
- data/lib/gooddata/lcm/actions/synchronize_label_types.rb +8 -5
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +17 -8
- data/lib/gooddata/lcm/actions/synchronize_meta.rb +0 -3
- data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +9 -4
- data/lib/gooddata/lcm/actions/synchronize_processes.rb +9 -5
- data/lib/gooddata/lcm/actions/synchronize_schedules.rb +15 -5
- data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +61 -0
- data/lib/gooddata/lcm/actions/update_release_table.rb +0 -3
- data/lib/gooddata/lcm/helpers/tags_helper.rb +35 -0
- data/lib/gooddata/lcm/lcm.rb +22 -4
- data/lib/gooddata/lcm/lcm2.rb +66 -13
- data/lib/gooddata/lcm/types/complex/update_preference.rb +1 -1
- data/lib/gooddata/mixins/md_finders.rb +4 -2
- data/lib/gooddata/mixins/md_object_indexer.rb +13 -3
- data/lib/gooddata/mixins/md_object_query.rb +8 -2
- data/lib/gooddata/models/blueprint/date_dimension.rb +6 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +41 -11
- data/lib/gooddata/models/blueprint/project_builder.rb +20 -0
- data/lib/gooddata/models/blueprint/to_wire.rb +7 -0
- data/lib/gooddata/models/client.rb +6 -0
- data/lib/gooddata/models/domain.rb +6 -6
- data/lib/gooddata/models/from_wire.rb +5 -1
- data/lib/gooddata/models/metadata.rb +55 -9
- data/lib/gooddata/models/metadata/attribute.rb +19 -4
- data/lib/gooddata/models/metadata/dashboard.rb +15 -3
- data/lib/gooddata/models/metadata/dataset.rb +5 -2
- data/lib/gooddata/models/metadata/dimension.rb +4 -1
- data/lib/gooddata/models/metadata/fact.rb +9 -2
- data/lib/gooddata/models/metadata/folder.rb +4 -1
- data/lib/gooddata/models/metadata/metric.rb +11 -3
- data/lib/gooddata/models/metadata/report.rb +7 -2
- data/lib/gooddata/models/metadata/report_definition.rb +11 -4
- data/lib/gooddata/models/metadata/scheduled_mail.rb +4 -1
- data/lib/gooddata/models/metadata/variable.rb +7 -2
- data/lib/gooddata/models/model.rb +14 -3
- data/lib/gooddata/models/process.rb +10 -9
- data/lib/gooddata/models/project.rb +134 -36
- data/lib/gooddata/models/project_creator.rb +43 -20
- data/lib/gooddata/models/report_data_result.rb +6 -2
- data/lib/gooddata/models/schedule.rb +6 -3
- data/lib/gooddata/models/subscription.rb +8 -1
- data/lib/gooddata/models/user_filters/user_filter.rb +1 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +18 -4
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +3 -1
- data/lib/gooddata/rest/client.rb +4 -6
- data/lib/gooddata/rest/connection.rb +10 -2
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprints/test_blueprint.json +1 -0
- data/spec/data/wire_models/test_blueprint.json +3 -0
- data/spec/data/workspace_table.csv +3 -0
- data/spec/environment/development.rb +4 -1
- data/spec/environment/environment.rb +1 -1
- data/spec/environment/staging.rb +5 -1
- data/spec/environment/testing.rb +5 -2
- data/spec/integration/blueprint_with_ca_spec.rb +56 -0
- data/spec/integration/clients_spec.rb +21 -0
- data/spec/integration/command_datawarehouse_spec.rb +7 -1
- data/spec/integration/create_from_template_spec.rb +9 -3
- data/spec/integration/project_spec.rb +7 -0
- data/spec/integration/segments_spec.rb +0 -53
- data/spec/integration/subscription_spec.rb +29 -4
- data/spec/integration/urn_date_dim_spec.rb +53 -0
- data/spec/integration/user_filters_spec.rb +6 -0
- data/spec/integration/variables_spec.rb +1 -2
- data/spec/spec_helper.rb +5 -30
- data/spec/unit/actions/collect_clients_spec.rb +38 -0
- data/spec/unit/actions/collect_meta_spec.rb +87 -0
- data/spec/unit/actions/collect_segment_clients_spec.rb +40 -0
- data/spec/unit/actions/collect_tagged_objects_spec.rb +110 -0
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +51 -0
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +55 -1
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +15 -0
- data/spec/unit/helpers/data_helper_spec.rb +3 -5
- data/spec/unit/helpers/global_helpers_spec.rb +29 -0
- data/spec/unit/helpers_spec.rb +18 -1
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +1 -23
- data/spec/unit/models/domain_spec.rb +19 -0
- data/spec/unit/models/metadata_spec.rb +34 -0
- data/spec/unit/models/schedule_spec.rb +31 -0
- data/spec/unit/models/to_manifest_spec.rb +10 -2
- data/spec/unit/models/unit_project_spec.rb +6 -1
- data/spec/unit/rest/polling_spec.rb +13 -1
- metadata +49 -31
@@ -17,6 +17,15 @@ module GoodData
|
|
17
17
|
|
18
18
|
description 'Organization Name'
|
19
19
|
param :organization, instance_of(Type::StringType), required: true
|
20
|
+
|
21
|
+
description 'Segments to manage'
|
22
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
23
|
+
|
24
|
+
description 'Table Name'
|
25
|
+
param :release_table_name, instance_of(Type::StringType), required: false
|
26
|
+
|
27
|
+
description 'ADS Client'
|
28
|
+
param :ads_client, instance_of(Type::AdsClientType), required: true
|
20
29
|
end
|
21
30
|
|
22
31
|
RESULT_HEADER = [
|
@@ -32,9 +41,6 @@ module GoodData
|
|
32
41
|
|
33
42
|
class << self
|
34
43
|
def call(params)
|
35
|
-
# Check if all required parameters were passed
|
36
|
-
BaseAction.check_params(PARAMS, params)
|
37
|
-
|
38
44
|
client = params.gdc_gd_client
|
39
45
|
|
40
46
|
domain_name = params.organization || params.domain
|
@@ -14,6 +14,12 @@ 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 'Development Client Used for Connecting to GD'
|
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, generated: true
|
17
23
|
end
|
18
24
|
|
19
25
|
RESULT_HEADER = [
|
@@ -24,23 +30,25 @@ module GoodData
|
|
24
30
|
|
25
31
|
class << self
|
26
32
|
def call(params)
|
27
|
-
BaseAction.check_params(PARAMS, params)
|
28
|
-
|
29
33
|
results = []
|
30
34
|
|
31
35
|
client = params.gdc_gd_client
|
32
36
|
development_client = params.development_client
|
33
37
|
|
34
|
-
params.synchronize.
|
38
|
+
params.synchronize.peach do |info|
|
35
39
|
from_project = info.from
|
36
40
|
to_projects = info.to
|
37
41
|
|
38
42
|
from = development_client.projects(from_project) || fail("Invalid 'from' project specified - '#{from_project}'")
|
39
|
-
to_projects.
|
43
|
+
to_projects.peach do |entry|
|
40
44
|
pid = entry[:pid]
|
41
45
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
42
46
|
|
43
|
-
params.gdc_logger.info
|
47
|
+
params.gdc_logger.info(
|
48
|
+
"Transferring Custom Color Palette, from project: " \
|
49
|
+
"'#{from.title}', PID: '#{from.pid}', to project: " \
|
50
|
+
"'#{to_project.title}', PID: '#{to_project.pid}'"
|
51
|
+
)
|
44
52
|
GoodData::Project.transfer_color_palette(from, to_project)
|
45
53
|
|
46
54
|
results << {
|
@@ -14,6 +14,18 @@ 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 'Organization Name'
|
19
|
+
param :organization, instance_of(Type::StringType), required: true
|
20
|
+
|
21
|
+
description 'Synchronization Info'
|
22
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
23
|
+
|
24
|
+
description 'Schedule Additional Parameters'
|
25
|
+
param :additional_params, instance_of(Type::HashType), required: false
|
26
|
+
|
27
|
+
description 'Schedule Additional Secure Parameters'
|
28
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
17
29
|
end
|
18
30
|
|
19
31
|
# will be updated later based on the way etl synchronization
|
@@ -27,9 +39,6 @@ module GoodData
|
|
27
39
|
|
28
40
|
class << self
|
29
41
|
def call(params)
|
30
|
-
# Check if all required parameters were passed
|
31
|
-
BaseAction.check_params(PARAMS, params)
|
32
|
-
|
33
42
|
client = params.gdc_gd_client
|
34
43
|
domain_name = params.organization || params.domain
|
35
44
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
@@ -37,7 +46,7 @@ module GoodData
|
|
37
46
|
info[:segment_id]
|
38
47
|
end
|
39
48
|
|
40
|
-
results = synchronize_segments.
|
49
|
+
results = synchronize_segments.pmap do |segment_id, synchronize|
|
41
50
|
segment = domain.segments(segment_id)
|
42
51
|
res = segment.synchronize_processes(
|
43
52
|
synchronize.flat_map do |info|
|
@@ -48,32 +57,77 @@ module GoodData
|
|
48
57
|
)
|
49
58
|
|
50
59
|
res = GoodData::Helpers.symbolize_keys(res)
|
51
|
-
|
52
|
-
|
53
|
-
{
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
|
61
|
+
if res[:syncedResult][:errors]
|
62
|
+
params.gdc_logger.error "Error: #{res[:syncedResult][:errors].pretty_inspect}"
|
63
|
+
fail "Failed to sync processes/schedules for segment #{segment_id}"
|
64
|
+
end
|
65
|
+
|
66
|
+
if res[:syncedResult][:clients]
|
67
|
+
res[:syncedResult][:clients].flat_map do |item|
|
68
|
+
item = item[:client]
|
69
|
+
{
|
70
|
+
segment: segment_id,
|
71
|
+
master_project: segment.master_project_id,
|
72
|
+
client_id: item[:id],
|
73
|
+
client_project: item[:project].split('/').last,
|
74
|
+
status: 'ok'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
else
|
78
|
+
[]
|
60
79
|
end
|
61
80
|
end
|
62
81
|
|
63
|
-
params.
|
82
|
+
delete_extra_process_schedule = GoodData::Helpers.to_boolean(params.delete_extra_process_schedule)
|
83
|
+
|
84
|
+
params.synchronize.peach do |info|
|
85
|
+
if delete_extra_process_schedule
|
86
|
+
from_project = client.projects(info.from) || fail("Invalid 'from' project specified - '#{info.from}'")
|
87
|
+
from_project_processes = from_project.processes
|
88
|
+
from_project_process_id_names = Hash[from_project_processes.map { |process| [process.process_id, process.name] }]
|
89
|
+
from_project_process_names = from_project_processes.map(&:name)
|
90
|
+
from_project_schedule_names = from_project.schedules.map { |schedule| [schedule.name, from_project_process_id_names[schedule.process_id]] }
|
91
|
+
end
|
92
|
+
|
64
93
|
to_projects = info.to
|
65
|
-
to_projects.
|
94
|
+
to_projects.peach do |entry|
|
66
95
|
pid = entry[:pid]
|
67
96
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
97
|
+
|
98
|
+
if delete_extra_process_schedule
|
99
|
+
to_project_process_id_names = {}
|
100
|
+
to_project.processes.each do |process|
|
101
|
+
if from_project_process_names.include?(process.name)
|
102
|
+
to_project_process_id_names[process.process_id] = process.name
|
103
|
+
else
|
104
|
+
process.delete
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
68
109
|
to_project.schedules.each do |schedule|
|
69
|
-
|
110
|
+
if delete_extra_process_schedule
|
111
|
+
unless from_project_schedule_names.include?([schedule.name, to_project_process_id_names[schedule.process_id]])
|
112
|
+
schedule.delete
|
113
|
+
next
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
additional_params = params.additional_params || {}
|
118
|
+
additional_params.merge!(
|
119
|
+
CLIENT_ID: entry[:client_id], # needed for ADD and CloudConnect ETL
|
120
|
+
GOODOT_CUSTOM_PROJECT_ID: entry[:client_id] # TMA-210
|
121
|
+
)
|
122
|
+
schedule.update_params(additional_params)
|
70
123
|
schedule.update_hidden_params(params.additional_hidden_params || {})
|
124
|
+
schedule.enable
|
71
125
|
schedule.save
|
72
126
|
end
|
73
127
|
end
|
74
128
|
end
|
75
129
|
|
76
|
-
results
|
130
|
+
results.flatten
|
77
131
|
end
|
78
132
|
end
|
79
133
|
end
|
@@ -14,6 +14,12 @@ 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 'Development Client Used for Connecting to GD'
|
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, generated: true
|
17
23
|
end
|
18
24
|
|
19
25
|
RESULT_HEADER = [
|
@@ -24,20 +30,17 @@ module GoodData
|
|
24
30
|
|
25
31
|
class << self
|
26
32
|
def call(params)
|
27
|
-
# Check if all required parameters were passed
|
28
|
-
BaseAction.check_params(PARAMS, params)
|
29
|
-
|
30
33
|
results = []
|
31
34
|
|
32
35
|
client = params.gdc_gd_client
|
33
36
|
development_client = params.development_client
|
34
37
|
|
35
|
-
params.synchronize.
|
38
|
+
params.synchronize.peach do |info|
|
36
39
|
from = info.from
|
37
40
|
to = info.to
|
38
41
|
|
39
42
|
from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
|
40
|
-
to_projects = to.
|
43
|
+
to_projects = to.pmap do |project|
|
41
44
|
client.projects(project.pid)
|
42
45
|
end
|
43
46
|
|
@@ -15,6 +15,9 @@ 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 'Development Client Used for Connecting to GD'
|
19
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
20
|
+
|
18
21
|
description 'Synchronization Info'
|
19
22
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
20
23
|
|
@@ -24,15 +27,12 @@ module GoodData
|
|
24
27
|
|
25
28
|
class << self
|
26
29
|
def call(params)
|
27
|
-
# Check if all required parameters were passed
|
28
|
-
BaseAction.check_params(PARAMS, params)
|
29
|
-
|
30
30
|
results = []
|
31
31
|
|
32
32
|
client = params.gdc_gd_client
|
33
33
|
development_client = params.development_client
|
34
34
|
|
35
|
-
params.synchronize.
|
35
|
+
synchronize = params.synchronize.map do |info|
|
36
36
|
from_project = info.from
|
37
37
|
to_projects = info.to
|
38
38
|
|
@@ -40,23 +40,32 @@ module GoodData
|
|
40
40
|
params.gdc_logger.info "Creating Blueprint, project: '#{from.title}', PID: #{from.pid}"
|
41
41
|
|
42
42
|
blueprint = from.blueprint
|
43
|
-
to_projects.
|
43
|
+
info[:to] = to_projects.pmap do |entry|
|
44
44
|
pid = entry[:pid]
|
45
45
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
46
46
|
|
47
47
|
params.gdc_logger.info "Updating from Blueprint, project: '#{to_project.title}', PID: #{pid}"
|
48
|
-
to_project.update_from_blueprint(blueprint)
|
48
|
+
ca_scripts = to_project.update_from_blueprint(blueprint, update_preference: params.update_preference, execute_ca_scripts: false)
|
49
|
+
|
50
|
+
entry[:ca_scripts] = ca_scripts
|
49
51
|
|
50
52
|
results << {
|
51
53
|
from: from_project,
|
52
54
|
to: pid,
|
53
55
|
status: 'ok'
|
54
56
|
}
|
57
|
+
entry
|
55
58
|
end
|
59
|
+
|
60
|
+
info
|
56
61
|
end
|
57
62
|
|
58
|
-
|
59
|
-
|
63
|
+
{
|
64
|
+
results: results,
|
65
|
+
params: {
|
66
|
+
synchronize: synchronize
|
67
|
+
}
|
68
|
+
}
|
60
69
|
end
|
61
70
|
end
|
62
71
|
end
|
@@ -12,20 +12,25 @@ module GoodData
|
|
12
12
|
DESCRIPTION = 'Synchronize New Segments'
|
13
13
|
|
14
14
|
PARAMS = define_params(self) do
|
15
|
+
description 'Client Used for Connecting to GD'
|
16
|
+
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
17
|
+
|
18
|
+
description 'Organization Name'
|
19
|
+
param :organization, instance_of(Type::StringType), required: true
|
20
|
+
|
21
|
+
description 'Segments to manage'
|
22
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
15
23
|
end
|
16
24
|
|
17
25
|
class << self
|
18
26
|
def call(params)
|
19
|
-
# Check if all required parameters were passed
|
20
|
-
BaseAction.check_params(PARAMS, params)
|
21
|
-
|
22
27
|
client = params.gdc_gd_client
|
23
28
|
|
24
29
|
domain_name = params.organization || params.domain
|
25
30
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
26
31
|
domain_segments = domain.segments
|
27
32
|
|
28
|
-
params.segments.
|
33
|
+
params.segments.pmap do |segment_in|
|
29
34
|
segment_id = segment_in.segment_id
|
30
35
|
|
31
36
|
segment = domain_segments.find do |ds|
|
@@ -14,8 +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
|
+
|
17
18
|
description 'Uri of the source output stage. It must be in the same domain as the target project.'
|
18
19
|
param :ads_output_stage_uri, instance_of(Type::StringType), required: false
|
20
|
+
|
21
|
+
description 'Development Client Used for Connecting to GD'
|
22
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
23
|
+
|
24
|
+
description 'Synchronization Info'
|
25
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
19
26
|
end
|
20
27
|
|
21
28
|
RESULT_HEADER = [
|
@@ -26,21 +33,18 @@ module GoodData
|
|
26
33
|
|
27
34
|
class << self
|
28
35
|
def call(params)
|
29
|
-
# Check if all required parameters were passed
|
30
|
-
BaseAction.check_params(PARAMS, params)
|
31
|
-
|
32
36
|
results = []
|
33
37
|
|
34
38
|
client = params.gdc_gd_client
|
35
39
|
development_client = params.development_client
|
36
40
|
|
37
|
-
params.synchronize.
|
41
|
+
params.synchronize.peach do |info|
|
38
42
|
from_project = info.from
|
39
43
|
to_projects = info.to
|
40
44
|
|
41
45
|
from = development_client.projects(from_project) || fail("Invalid 'from' project specified - '#{from_project}'")
|
42
46
|
|
43
|
-
to_projects.
|
47
|
+
to_projects.peach do |to|
|
44
48
|
pid = to[:pid]
|
45
49
|
client_id = to[:client_id]
|
46
50
|
|
@@ -14,6 +14,18 @@ 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 'Development Client Used for Connecting to GD'
|
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, generated: true
|
23
|
+
|
24
|
+
description 'Schedule Additional Parameters'
|
25
|
+
param :additional_params, instance_of(Type::HashType), required: false
|
26
|
+
|
27
|
+
description 'Schedule Additional Secure Parameters'
|
28
|
+
param :additional_hidden_params, instance_of(Type::HashType), required: false
|
17
29
|
end
|
18
30
|
|
19
31
|
RESULT_HEADER = [
|
@@ -27,20 +39,17 @@ module GoodData
|
|
27
39
|
|
28
40
|
class << self
|
29
41
|
def call(params)
|
30
|
-
# Check if all required parameters were passed
|
31
|
-
BaseAction.check_params(PARAMS, params)
|
32
|
-
|
33
42
|
results = []
|
34
43
|
|
35
44
|
client = params.gdc_gd_client
|
36
45
|
development_client = params.development_client
|
37
46
|
|
38
|
-
params.synchronize.
|
47
|
+
params.synchronize.peach do |info|
|
39
48
|
from_project = info.from
|
40
49
|
to_projects = info.to
|
41
50
|
|
42
51
|
from = development_client.projects(from_project) || fail("Invalid 'from' project specified - '#{from_project}'")
|
43
|
-
to_projects.
|
52
|
+
to_projects.peach do |entry|
|
44
53
|
pid = entry[:pid]
|
45
54
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
46
55
|
|
@@ -58,6 +67,7 @@ module GoodData
|
|
58
67
|
# s.update_params('SEGMENT_ID' => segment.id)
|
59
68
|
schedule.update_params(params.additional_params || {})
|
60
69
|
schedule.update_hidden_params(params.additional_hidden_params || {})
|
70
|
+
schedule.disable
|
61
71
|
schedule.save
|
62
72
|
|
63
73
|
{
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
6
|
+
|
7
|
+
require_relative 'base_action'
|
8
|
+
|
9
|
+
module GoodData
|
10
|
+
module LCM2
|
11
|
+
class SynchronizeTagObjects < BaseAction
|
12
|
+
DESCRIPTION = "Synchronizes objects that have the production_tag even though they would normally be ignored \
|
13
|
+
(e.g. metrics that are not used in any dashboards)."
|
14
|
+
|
15
|
+
PARAMS = define_params(self) do
|
16
|
+
description 'Client Used for Connecting to GD'
|
17
|
+
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
18
|
+
|
19
|
+
description 'Synchronization Info'
|
20
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
21
|
+
|
22
|
+
description 'Tag Name'
|
23
|
+
param :production_tag, instance_of(Type::StringType), required: false
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def call(params)
|
28
|
+
return [] unless params.production_tag
|
29
|
+
|
30
|
+
results = []
|
31
|
+
|
32
|
+
client = params.gdc_gd_client
|
33
|
+
development_client = params.development_client
|
34
|
+
|
35
|
+
params.synchronize.each do |info|
|
36
|
+
from_project = info.from
|
37
|
+
to_projects = info.to
|
38
|
+
|
39
|
+
from = development_client.projects(from_project) || fail("Invalid 'from' project specified - '#{from_project}'")
|
40
|
+
|
41
|
+
to_projects.each do |entry|
|
42
|
+
pid = entry[:pid]
|
43
|
+
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
44
|
+
|
45
|
+
GoodData::Project.transfer_tagged_stuff(from, to_project, params.production_tag)
|
46
|
+
|
47
|
+
results << {
|
48
|
+
from: from_project,
|
49
|
+
to: pid,
|
50
|
+
tag: params.production_tag,
|
51
|
+
status: 'ok'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
results
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|