gooddata 0.6.51 → 0.6.52

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +13 -1
  4. data/CONTRIBUTING.md +25 -0
  5. data/PULL_REQUEST_TEMPLATE.md +5 -0
  6. data/README.md +7 -4
  7. data/gooddata.gemspec +2 -3
  8. data/lib/gooddata.rb +1 -0
  9. data/lib/gooddata/bricks/base_downloader.rb +6 -6
  10. data/lib/gooddata/bricks/middleware/aws_middleware.rb +15 -5
  11. data/lib/gooddata/bricks/middleware/dwh_middleware.rb +15 -3
  12. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +13 -4
  13. data/lib/gooddata/bricks/middleware/logger_middleware.rb +3 -0
  14. data/lib/gooddata/exceptions/no_project_error.rb +5 -1
  15. data/lib/gooddata/goodzilla/goodzilla.rb +7 -6
  16. data/lib/gooddata/helpers/data_helper.rb +4 -4
  17. data/lib/gooddata/helpers/global_helpers_params.rb +61 -39
  18. data/lib/gooddata/lcm/actions/apply_custom_maql.rb +9 -0
  19. data/lib/gooddata/lcm/actions/associate_clients.rb +23 -4
  20. data/lib/gooddata/lcm/actions/collect_attrs.rb +56 -0
  21. data/lib/gooddata/lcm/actions/collect_ca_metrics.rb +53 -0
  22. data/lib/gooddata/lcm/actions/collect_clients.rb +25 -3
  23. data/lib/gooddata/lcm/actions/collect_meta.rb +83 -0
  24. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +12 -4
  25. data/lib/gooddata/lcm/actions/collect_segments.rb +4 -4
  26. data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +74 -0
  27. data/lib/gooddata/lcm/actions/create_segment_masters.rb +16 -30
  28. data/lib/gooddata/lcm/actions/ensure_release_table.rb +0 -3
  29. data/lib/gooddata/lcm/actions/ensure_segments.rb +1 -4
  30. data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +5 -5
  31. data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +8 -5
  32. data/lib/gooddata/lcm/actions/hello_world.rb +0 -3
  33. data/lib/gooddata/lcm/actions/import_object_collections.rb +60 -0
  34. data/lib/gooddata/lcm/actions/print_actions.rb +0 -3
  35. data/lib/gooddata/lcm/actions/print_modes.rb +0 -3
  36. data/lib/gooddata/lcm/actions/print_types.rb +1 -4
  37. data/lib/gooddata/lcm/actions/provision_clients.rb +5 -5
  38. data/lib/gooddata/lcm/actions/purge_clients.rb +4 -10
  39. data/lib/gooddata/lcm/actions/segments_filter.rb +0 -6
  40. data/lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb +8 -4
  41. data/lib/gooddata/lcm/actions/synchronize_cas.rb +61 -0
  42. data/lib/gooddata/lcm/actions/synchronize_clients.rb +9 -3
  43. data/lib/gooddata/lcm/actions/synchronize_color_palette.rb +13 -5
  44. data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +71 -17
  45. data/lib/gooddata/lcm/actions/synchronize_label_types.rb +8 -5
  46. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +17 -8
  47. data/lib/gooddata/lcm/actions/synchronize_meta.rb +0 -3
  48. data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +9 -4
  49. data/lib/gooddata/lcm/actions/synchronize_processes.rb +9 -5
  50. data/lib/gooddata/lcm/actions/synchronize_schedules.rb +15 -5
  51. data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +61 -0
  52. data/lib/gooddata/lcm/actions/update_release_table.rb +0 -3
  53. data/lib/gooddata/lcm/helpers/tags_helper.rb +35 -0
  54. data/lib/gooddata/lcm/lcm.rb +22 -4
  55. data/lib/gooddata/lcm/lcm2.rb +66 -13
  56. data/lib/gooddata/lcm/types/complex/update_preference.rb +1 -1
  57. data/lib/gooddata/mixins/md_finders.rb +4 -2
  58. data/lib/gooddata/mixins/md_object_indexer.rb +13 -3
  59. data/lib/gooddata/mixins/md_object_query.rb +8 -2
  60. data/lib/gooddata/models/blueprint/date_dimension.rb +6 -0
  61. data/lib/gooddata/models/blueprint/project_blueprint.rb +41 -11
  62. data/lib/gooddata/models/blueprint/project_builder.rb +20 -0
  63. data/lib/gooddata/models/blueprint/to_wire.rb +7 -0
  64. data/lib/gooddata/models/client.rb +6 -0
  65. data/lib/gooddata/models/domain.rb +6 -6
  66. data/lib/gooddata/models/from_wire.rb +5 -1
  67. data/lib/gooddata/models/metadata.rb +55 -9
  68. data/lib/gooddata/models/metadata/attribute.rb +19 -4
  69. data/lib/gooddata/models/metadata/dashboard.rb +15 -3
  70. data/lib/gooddata/models/metadata/dataset.rb +5 -2
  71. data/lib/gooddata/models/metadata/dimension.rb +4 -1
  72. data/lib/gooddata/models/metadata/fact.rb +9 -2
  73. data/lib/gooddata/models/metadata/folder.rb +4 -1
  74. data/lib/gooddata/models/metadata/metric.rb +11 -3
  75. data/lib/gooddata/models/metadata/report.rb +7 -2
  76. data/lib/gooddata/models/metadata/report_definition.rb +11 -4
  77. data/lib/gooddata/models/metadata/scheduled_mail.rb +4 -1
  78. data/lib/gooddata/models/metadata/variable.rb +7 -2
  79. data/lib/gooddata/models/model.rb +14 -3
  80. data/lib/gooddata/models/process.rb +10 -9
  81. data/lib/gooddata/models/project.rb +134 -36
  82. data/lib/gooddata/models/project_creator.rb +43 -20
  83. data/lib/gooddata/models/report_data_result.rb +6 -2
  84. data/lib/gooddata/models/schedule.rb +6 -3
  85. data/lib/gooddata/models/subscription.rb +8 -1
  86. data/lib/gooddata/models/user_filters/user_filter.rb +1 -0
  87. data/lib/gooddata/models/user_filters/user_filter_builder.rb +18 -4
  88. data/lib/gooddata/models/user_filters/variable_user_filter.rb +3 -1
  89. data/lib/gooddata/rest/client.rb +4 -6
  90. data/lib/gooddata/rest/connection.rb +10 -2
  91. data/lib/gooddata/version.rb +1 -1
  92. data/spec/data/blueprints/test_blueprint.json +1 -0
  93. data/spec/data/wire_models/test_blueprint.json +3 -0
  94. data/spec/data/workspace_table.csv +3 -0
  95. data/spec/environment/development.rb +4 -1
  96. data/spec/environment/environment.rb +1 -1
  97. data/spec/environment/staging.rb +5 -1
  98. data/spec/environment/testing.rb +5 -2
  99. data/spec/integration/blueprint_with_ca_spec.rb +56 -0
  100. data/spec/integration/clients_spec.rb +21 -0
  101. data/spec/integration/command_datawarehouse_spec.rb +7 -1
  102. data/spec/integration/create_from_template_spec.rb +9 -3
  103. data/spec/integration/project_spec.rb +7 -0
  104. data/spec/integration/segments_spec.rb +0 -53
  105. data/spec/integration/subscription_spec.rb +29 -4
  106. data/spec/integration/urn_date_dim_spec.rb +53 -0
  107. data/spec/integration/user_filters_spec.rb +6 -0
  108. data/spec/integration/variables_spec.rb +1 -2
  109. data/spec/spec_helper.rb +5 -30
  110. data/spec/unit/actions/collect_clients_spec.rb +38 -0
  111. data/spec/unit/actions/collect_meta_spec.rb +87 -0
  112. data/spec/unit/actions/collect_segment_clients_spec.rb +40 -0
  113. data/spec/unit/actions/collect_tagged_objects_spec.rb +110 -0
  114. data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +51 -0
  115. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +55 -1
  116. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +15 -0
  117. data/spec/unit/helpers/data_helper_spec.rb +3 -5
  118. data/spec/unit/helpers/global_helpers_spec.rb +29 -0
  119. data/spec/unit/helpers_spec.rb +18 -1
  120. data/spec/unit/models/blueprint/project_blueprint_spec.rb +1 -23
  121. data/spec/unit/models/domain_spec.rb +19 -0
  122. data/spec/unit/models/metadata_spec.rb +34 -0
  123. data/spec/unit/models/schedule_spec.rb +31 -0
  124. data/spec/unit/models/to_manifest_spec.rb +10 -2
  125. data/spec/unit/models/unit_project_spec.rb +6 -1
  126. data/spec/unit/rest/polling_spec.rb +13 -1
  127. 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.each do |info|
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.each do |entry|
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 "Transferring Custom Color Palette, from project: '#{from.title}', PID: '#{from.pid}', to project: '#{to_project.title}', PID: '#{to_project.pid}'"
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.flat_map do |segment_id, synchronize|
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
- res[:syncedResult][:clients].flat_map do |item|
52
- item = item[:client]
53
- {
54
- segment: segment_id,
55
- master_project: segment.master_project_id,
56
- client_id: item[:id],
57
- client_project: item[:project].split('/').last,
58
- status: 'ok'
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.synchronize.each do |info|
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.each do |entry|
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
- schedule.update_params(params.additional_params || {})
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.each do |info|
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.map do |project|
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.each do |info|
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.each do |entry|
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
- # Return results
59
- results
63
+ {
64
+ results: results,
65
+ params: {
66
+ synchronize: synchronize
67
+ }
68
+ }
60
69
  end
61
70
  end
62
71
  end
@@ -18,9 +18,6 @@ module GoodData
18
18
 
19
19
  class << self
20
20
  def call(params)
21
- # Check if all required parameters were passed
22
- BaseAction.check_params(PARAMS, params)
23
-
24
21
  results = []
25
22
 
26
23
  client = params.gdc_gd_client
@@ -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.map do |segment_in|
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.each do |info|
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.each do |to|
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.each do |info|
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.each do |entry|
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