gooddata 0.6.53 → 0.6.54
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 +5 -5
- data/.flayignore +6 -0
- data/.gitignore +1 -0
- data/.pronto.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +14 -1
- data/DEPENDENCIES.md +324 -253
- data/Dockerfile.jruby +5 -7
- data/Dockerfile.ruby +8 -8
- data/Rakefile +24 -0
- data/ci.rake +47 -0
- data/docker-compose.yml +34 -0
- data/gooddata.gemspec +8 -2
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +0 -3
- data/lib/gooddata/helpers/data_helper.rb +10 -7
- data/lib/gooddata/helpers/global_helpers_params.rb +8 -3
- data/lib/gooddata/lcm/actions/apply_custom_maql.rb +2 -1
- data/lib/gooddata/lcm/actions/associate_clients.rb +10 -1
- data/lib/gooddata/lcm/actions/collect_client_projects.rb +78 -0
- data/lib/gooddata/lcm/actions/collect_clients.rb +20 -6
- data/lib/gooddata/lcm/actions/collect_data_product.rb +62 -0
- data/lib/gooddata/lcm/actions/collect_dynamic_schedule_params.rb +62 -0
- data/lib/gooddata/lcm/actions/{collect_attrs.rb → collect_ldm_objects.rb} +3 -3
- data/lib/gooddata/lcm/actions/collect_meta.rb +6 -3
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +2 -1
- data/lib/gooddata/lcm/actions/collect_segments.rb +6 -7
- data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +7 -4
- data/lib/gooddata/lcm/actions/create_segment_masters.rb +7 -3
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +53 -0
- data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +6 -2
- data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +30 -18
- data/lib/gooddata/lcm/actions/execute_schedules.rb +128 -0
- data/lib/gooddata/lcm/actions/provision_clients.rb +32 -21
- data/lib/gooddata/lcm/actions/purge_clients.rb +25 -39
- data/lib/gooddata/lcm/actions/rename_existing_client_projects.rb +70 -0
- data/lib/gooddata/lcm/actions/segments_filter.rb +6 -0
- data/lib/gooddata/lcm/actions/synchronize_cas.rb +11 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +2 -1
- data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +34 -15
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +10 -1
- data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +2 -1
- data/lib/gooddata/lcm/actions/synchronize_processes.rb +4 -7
- data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +8 -5
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +224 -0
- data/lib/gooddata/lcm/actions/synchronize_user_groups.rb +53 -0
- data/lib/gooddata/lcm/actions/synchronize_users.rb +324 -0
- data/lib/gooddata/lcm/dsl/type_dsl.rb +1 -0
- data/lib/gooddata/lcm/helpers/check_helper.rb +4 -0
- data/lib/gooddata/lcm/helpers/tags_helper.rb +4 -3
- data/lib/gooddata/lcm/lcm2.rb +33 -1
- data/lib/gooddata/lcm/types/complex/segment.rb +3 -0
- data/lib/gooddata/lcm/types/complex/update_preference.rb +8 -2
- data/lib/gooddata/lcm/types/special/array.rb +1 -3
- data/lib/gooddata/lcm/types/special/enum.rb +1 -3
- data/lib/gooddata/mixins/md_id_to_uri.rb +0 -1
- data/lib/gooddata/mixins/md_json.rb +2 -2
- data/lib/gooddata/models/blueprint/project_blueprint.rb +15 -0
- data/lib/gooddata/models/blueprint/to_wire.rb +1 -0
- data/lib/gooddata/models/client.rb +21 -9
- data/lib/gooddata/models/data_product.rb +149 -0
- data/lib/gooddata/models/domain.rb +26 -72
- data/lib/gooddata/models/from_wire.rb +2 -0
- data/lib/gooddata/models/metadata/report.rb +9 -3
- data/lib/gooddata/models/metadata/report_definition.rb +2 -2
- data/lib/gooddata/models/model.rb +1 -1
- data/lib/gooddata/models/process.rb +4 -0
- data/lib/gooddata/models/project.rb +58 -35
- data/lib/gooddata/models/project_creator.rb +13 -0
- data/lib/gooddata/models/segment.rb +63 -16
- data/lib/gooddata/models/style_setting.rb +2 -15
- data/lib/gooddata/models/user_group.rb +2 -0
- data/lib/gooddata/rest/connection.rb +32 -9
- data/lib/gooddata/rest/object_factory.rb +0 -25
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprints/invalid_blueprint.json +2 -2
- data/spec/data/blueprints/test_project_model_spec.json +1 -1
- data/spec/data/dynamic_schedule_params_table.csv +7 -0
- data/spec/data/workspace_table.csv +3 -3
- data/spec/environment/staging.rb +3 -3
- data/spec/integration/ads_output_stage_spec.rb +0 -10
- data/spec/integration/clients_spec.rb +1 -1
- data/spec/{unit → integration}/commands/command_projects_spec.rb +0 -0
- data/spec/{unit → integration}/core/connection_spec.rb +0 -0
- data/spec/{unit → integration}/core/logging_spec.rb +0 -0
- data/spec/{unit → integration}/core/project_spec.rb +0 -0
- data/spec/integration/date_dim_switch_spec.rb +13 -0
- data/spec/integration/full_process_schedule_spec.rb +2 -2
- data/spec/integration/helpers_spec.rb +16 -0
- data/spec/integration/lcm_spec.rb +12 -2
- data/spec/integration/mixins/id_to_uri_spec.rb +44 -0
- data/spec/integration/models/data_product_spec.rb +71 -0
- data/spec/{unit → integration}/models/domain_spec.rb +2 -2
- data/spec/{unit → integration}/models/invitation_spec.rb +0 -0
- data/spec/{unit → integration}/models/membership_spec.rb +0 -0
- data/spec/{unit → integration}/models/params_spec.rb +0 -0
- data/spec/{unit → integration}/models/profile_spec.rb +0 -0
- data/spec/{unit → integration}/models/project_role_spec.rb +0 -0
- data/spec/integration/models/project_spec.rb +225 -0
- data/spec/{unit → integration}/models/schedule_spec.rb +0 -0
- data/spec/{unit → integration}/models/unit_project_spec.rb +0 -0
- data/spec/integration/project_spec.rb +40 -5
- data/spec/integration/segments_spec.rb +27 -26
- data/spec/integration/user_filters_spec.rb +1 -1
- data/spec/spec_helper.rb +15 -19
- data/spec/unit/actions/associate_clients_spec.rb +47 -0
- data/spec/unit/actions/collect_client_projects_spec.rb +47 -0
- data/spec/unit/actions/collect_clients_spec.rb +27 -0
- data/spec/unit/actions/collect_data_product_spec.rb +64 -0
- data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +56 -0
- data/spec/unit/actions/collect_meta_spec.rb +4 -4
- data/spec/unit/actions/collect_segment_clients_spec.rb +44 -3
- data/spec/unit/actions/collect_tagged_objects_spec.rb +20 -4
- data/spec/unit/actions/create_segment_masters_spec.rb +64 -0
- data/spec/unit/actions/ensure_data_product_spec.rb +38 -0
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +51 -0
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +72 -0
- data/spec/unit/actions/execute_schedules_spec.rb +94 -0
- data/spec/unit/actions/provision_clients_spec.rb +45 -0
- data/spec/unit/actions/purge_clients_spec.rb +47 -0
- data/spec/unit/actions/rename_existing_client_projects_spec.rb +54 -0
- data/spec/unit/actions/segments_filter_spec.rb +46 -0
- data/spec/unit/actions/shared_examples_for_user_actions.rb +10 -0
- data/spec/unit/actions/synchronize_cas_spec.rb +58 -0
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +174 -13
- data/spec/unit/actions/synchronize_ldm_spec.rb +57 -0
- data/spec/unit/actions/synchronize_user_filters_spec.rb +142 -0
- data/spec/unit/actions/synchronize_user_groups_spec.rb +49 -0
- data/spec/unit/actions/synchronize_users_spec.rb +76 -0
- data/spec/unit/helpers/data_helper_spec.rb +17 -0
- data/spec/unit/helpers/global_helpers_spec.rb +16 -0
- data/spec/unit/helpers_spec.rb +0 -6
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +21 -4
- data/spec/unit/models/project_creator_spec.rb +16 -0
- data/spec/unit/models/project_spec.rb +66 -197
- metadata +202 -100
- data/PULL_REQUEST_TEMPLATE.md +0 -5
- data/lib/gooddata/bricks/middleware/params_inspect_middleware.rb +0 -21
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
7
|
require_relative 'base_action'
|
|
8
|
+
require_relative 'purge_clients'
|
|
8
9
|
|
|
9
10
|
module GoodData
|
|
10
11
|
module LCM2
|
|
@@ -32,34 +33,44 @@ module GoodData
|
|
|
32
33
|
|
|
33
34
|
class << self
|
|
34
35
|
def call(params)
|
|
36
|
+
synchronize_projects = []
|
|
37
|
+
data_product = params.data_product
|
|
35
38
|
client = params.gdc_gd_client
|
|
36
|
-
|
|
37
39
|
domain_name = params.organization || params.domain
|
|
38
40
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
begin
|
|
43
|
+
results = params.segments.map do |segment|
|
|
44
|
+
segment_object = domain.segments(segment.segment_id, data_product)
|
|
45
|
+
tmp = segment_object.provision_client_projects.map do |m|
|
|
46
|
+
Hash[m.each_pair.to_a].merge(type: :provision_result)
|
|
47
|
+
end
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
unless tmp.empty?
|
|
50
|
+
synchronize_projects << {
|
|
51
|
+
segment_id: segment.segment_id,
|
|
52
|
+
from: segment.development_pid,
|
|
53
|
+
to: tmp.map do |entry|
|
|
54
|
+
unless entry[:project_uri]
|
|
55
|
+
raise "Provisioning project for client id #{entry[:id]} has error: #{entry[:error]}"
|
|
56
|
+
end
|
|
57
|
+
{
|
|
58
|
+
pid: entry[:project_uri].split('/').last,
|
|
59
|
+
client_id: entry[:id]
|
|
60
|
+
}
|
|
53
61
|
end
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
client_id: entry[:id]
|
|
57
|
-
}
|
|
58
|
-
end
|
|
59
|
-
}
|
|
60
|
-
end
|
|
62
|
+
}
|
|
63
|
+
end
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
tmp
|
|
66
|
+
end
|
|
67
|
+
rescue => e
|
|
68
|
+
params.gdc_logger.error "Problem occurs when provisioning clients. Purge all invalid clients now ..."
|
|
69
|
+
res = PurgeClients.send(:call, params)
|
|
70
|
+
params.gdc_logger.debug "Purge clients result: #{res}"
|
|
71
|
+
deleted_client_ids = res[:results].select { |r| r[:status] == 'purged' }.map { |r| r[:client_id] }
|
|
72
|
+
params.gdc_logger.error "Deleted clients: #{deleted_client_ids.join(', ')}"
|
|
73
|
+
raise e
|
|
63
74
|
end
|
|
64
75
|
|
|
65
76
|
results.flatten!
|
|
@@ -12,14 +12,6 @@ module GoodData
|
|
|
12
12
|
DESCRIPTION = 'Purge LCM Clients'
|
|
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
|
|
23
15
|
end
|
|
24
16
|
|
|
25
17
|
RESULT_HEADER = [
|
|
@@ -30,41 +22,35 @@ module GoodData
|
|
|
30
22
|
|
|
31
23
|
class << self
|
|
32
24
|
def call(params)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
client_projects = params.client_projects
|
|
26
|
+
|
|
27
|
+
results = client_projects.pmap do |_, info|
|
|
28
|
+
client = info[:segment_client]
|
|
29
|
+
project = info[:project]
|
|
30
|
+
|
|
31
|
+
res = {
|
|
32
|
+
client_id: client.client_id,
|
|
33
|
+
project: project && project.pid
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if project.nil? || project.deleted?
|
|
37
|
+
client.delete
|
|
38
|
+
res[:status] = 'purged'
|
|
39
|
+
else
|
|
40
|
+
res[:status] = 'ok - not purged'
|
|
41
|
+
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
segment_names.include?(segment.segment_id.downcase)
|
|
43
|
+
res
|
|
45
44
|
end
|
|
46
45
|
|
|
47
|
-
results
|
|
48
|
-
segment.clients.map do |segment_client|
|
|
49
|
-
project = segment_client.project
|
|
50
|
-
res = {
|
|
51
|
-
client_id: segment_client.client_id,
|
|
52
|
-
project: project && project.pid
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if project.nil? || project.deleted?
|
|
56
|
-
segment_client.delete
|
|
57
|
-
res[:status] = 'purged'
|
|
58
|
-
else
|
|
59
|
-
res[:status] = 'ok - not purged'
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
res
|
|
63
|
-
end
|
|
64
|
-
end
|
|
46
|
+
results.pselect { |res| res[:status] == 'purged' }.pmap { |res| res[:client_id] }.each { |id| client_projects.delete(id) }
|
|
65
47
|
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
{
|
|
49
|
+
results: results,
|
|
50
|
+
params: {
|
|
51
|
+
client_projects: client_projects
|
|
52
|
+
}
|
|
53
|
+
}
|
|
68
54
|
end
|
|
69
55
|
end
|
|
70
56
|
end
|
|
@@ -0,0 +1,70 @@
|
|
|
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 RenameExistingClientProjects < BaseAction
|
|
12
|
+
DESCRIPTION = 'Rename Existing Client Projects'
|
|
13
|
+
|
|
14
|
+
PARAMS = define_params(self) do
|
|
15
|
+
description 'Clients'
|
|
16
|
+
param :clients, array_of(instance_of(Type::HashType)), required: true, generated: true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
RESULT_HEADER = [
|
|
20
|
+
:id,
|
|
21
|
+
:pid,
|
|
22
|
+
:old_title,
|
|
23
|
+
:new_title
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def call(params)
|
|
28
|
+
client_projects = params.client_projects
|
|
29
|
+
|
|
30
|
+
results = []
|
|
31
|
+
params.clients.each do |c|
|
|
32
|
+
info = client_projects[c[:id]]
|
|
33
|
+
next unless info
|
|
34
|
+
|
|
35
|
+
segment_client = info[:segment_client]
|
|
36
|
+
project = info[:project]
|
|
37
|
+
|
|
38
|
+
# If he is an existing client but has no project, he will be purged and then re-created again
|
|
39
|
+
# so his project absolutely does not need to be updated title
|
|
40
|
+
next unless project
|
|
41
|
+
|
|
42
|
+
# If his project is existing, we do not know this is a correct project or not because user
|
|
43
|
+
# can associate this client with another project and we need to check and update its title.
|
|
44
|
+
# If this is a new project, we do not need to verify its status because we already did it in
|
|
45
|
+
# CollectClients action
|
|
46
|
+
project = segment_client.project
|
|
47
|
+
|
|
48
|
+
new_title = c[:settings].find { |setting| setting[:name] == 'lcm.title' }[:value]
|
|
49
|
+
next unless new_title
|
|
50
|
+
|
|
51
|
+
old_title = project.title
|
|
52
|
+
next if new_title == old_title
|
|
53
|
+
|
|
54
|
+
project.title = new_title
|
|
55
|
+
project.save
|
|
56
|
+
|
|
57
|
+
results << {
|
|
58
|
+
id: c[:id],
|
|
59
|
+
pid: project.pid,
|
|
60
|
+
old_title: old_title,
|
|
61
|
+
new_title: new_title
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
results
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -22,6 +22,12 @@ module GoodData
|
|
|
22
22
|
class << self
|
|
23
23
|
def call(params)
|
|
24
24
|
filtered_segments = params.segments
|
|
25
|
+
|
|
26
|
+
segment_ids = filtered_segments.map(&:segment_id)
|
|
27
|
+
downcase_segment_ids = segment_ids.map(&:downcase)
|
|
28
|
+
duplicated_segment_ids = segment_ids.select { |e| downcase_segment_ids.count(e.downcase) > 1 }.uniq
|
|
29
|
+
fail "Parameter 'segments' contains duplicate segment id(s): #{duplicated_segment_ids.join(', ')}" if duplicated_segment_ids.any?
|
|
30
|
+
|
|
25
31
|
if params.segments_filter
|
|
26
32
|
segments_filter = params.segments_filter.map(&:downcase)
|
|
27
33
|
|
|
@@ -17,11 +17,22 @@ module GoodData
|
|
|
17
17
|
|
|
18
18
|
description 'Synchronization Info'
|
|
19
19
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
|
20
|
+
|
|
21
|
+
description 'Specifies whether to transfer computed attributes'
|
|
22
|
+
param :include_computed_attributes, instance_of(Type::BooleanType), required: false, default: true
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
class << self
|
|
23
26
|
def call(params)
|
|
27
|
+
# set default value for include_computed_attributes
|
|
28
|
+
# (we won't have to do this after TMA-690)
|
|
29
|
+
include_ca = params.include_computed_attributes
|
|
30
|
+
include_ca = true if include_ca.nil?
|
|
31
|
+
include_ca = include_ca.to_b
|
|
32
|
+
|
|
24
33
|
results = []
|
|
34
|
+
return results unless include_ca
|
|
35
|
+
|
|
25
36
|
client = params.gdc_gd_client
|
|
26
37
|
|
|
27
38
|
params.synchronize.each do |info|
|
|
@@ -45,7 +45,8 @@ module GoodData
|
|
|
45
45
|
|
|
46
46
|
domain_name = params.organization || params.domain
|
|
47
47
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
|
48
|
-
|
|
48
|
+
data_product = params.data_product
|
|
49
|
+
domain_segments = domain.segments(:all, data_product)
|
|
49
50
|
|
|
50
51
|
segments = params.segments.map do |seg|
|
|
51
52
|
domain_segments.find do |s|
|
|
@@ -40,14 +40,13 @@ module GoodData
|
|
|
40
40
|
class << self
|
|
41
41
|
def call(params)
|
|
42
42
|
client = params.gdc_gd_client
|
|
43
|
-
|
|
44
|
-
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
|
43
|
+
data_product = params.data_product
|
|
45
44
|
synchronize_segments = params.synchronize.group_by do |info|
|
|
46
45
|
info[:segment_id]
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
results = synchronize_segments.pmap do |segment_id, synchronize|
|
|
50
|
-
segment =
|
|
49
|
+
segment = data_product.segments.find { |s| s.segment_id == segment_id }
|
|
51
50
|
res = segment.synchronize_processes(
|
|
52
51
|
synchronize.flat_map do |info|
|
|
53
52
|
info[:to].flat_map do |to|
|
|
@@ -80,15 +79,12 @@ module GoodData
|
|
|
80
79
|
end
|
|
81
80
|
|
|
82
81
|
delete_extra_process_schedule = GoodData::Helpers.to_boolean(params.delete_extra_process_schedule)
|
|
82
|
+
schedule_params = params.schedule_params || {}
|
|
83
|
+
params_for_all_projects = schedule_params[:all_clients] || {}
|
|
84
|
+
params_for_all_schedules_in_all_projects = params_for_all_projects[:all_schedules]
|
|
83
85
|
|
|
84
86
|
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
|
|
87
|
+
from_project_etl_names = get_process_n_schedule_names(client, info.from) if delete_extra_process_schedule
|
|
92
88
|
|
|
93
89
|
to_projects = info.to
|
|
94
90
|
to_projects.peach do |entry|
|
|
@@ -98,7 +94,7 @@ module GoodData
|
|
|
98
94
|
if delete_extra_process_schedule
|
|
99
95
|
to_project_process_id_names = {}
|
|
100
96
|
to_project.processes.each do |process|
|
|
101
|
-
if
|
|
97
|
+
if from_project_etl_names[:processes].include?(process.name)
|
|
102
98
|
to_project_process_id_names[process.process_id] = process.name
|
|
103
99
|
else
|
|
104
100
|
process.delete
|
|
@@ -106,21 +102,31 @@ module GoodData
|
|
|
106
102
|
end
|
|
107
103
|
end
|
|
108
104
|
|
|
105
|
+
client_id = entry[:client_id]
|
|
106
|
+
params_for_this_client = schedule_params[client_id] || {}
|
|
107
|
+
params_for_all_schedules_in_this_client = params_for_this_client[nil]
|
|
108
|
+
|
|
109
|
+
to_project.set_metadata('GOODOT_CUSTOM_PROJECT_ID', client_id) # TMA-210
|
|
110
|
+
|
|
109
111
|
to_project.schedules.each do |schedule|
|
|
110
112
|
if delete_extra_process_schedule
|
|
111
|
-
unless
|
|
113
|
+
unless from_project_etl_names[:schedules].include?([schedule.name, to_project_process_id_names[schedule.process_id]])
|
|
112
114
|
schedule.delete
|
|
113
115
|
next
|
|
114
116
|
end
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
schedule.update_params(params.additional_params) if params.additional_params
|
|
118
|
-
|
|
119
120
|
schedule.update_params(
|
|
120
|
-
CLIENT_ID:
|
|
121
|
-
GOODOT_CUSTOM_PROJECT_ID:
|
|
121
|
+
CLIENT_ID: client_id, # needed for ADD and CloudConnect ETL
|
|
122
|
+
GOODOT_CUSTOM_PROJECT_ID: client_id # TMA-210
|
|
122
123
|
)
|
|
123
124
|
|
|
125
|
+
schedule.update_params(params_for_all_schedules_in_all_projects) if params_for_all_schedules_in_all_projects
|
|
126
|
+
schedule.update_params(params_for_all_projects[schedule.name]) if params_for_all_projects[schedule.name]
|
|
127
|
+
schedule.update_params(params_for_all_schedules_in_this_client) if params_for_all_schedules_in_this_client
|
|
128
|
+
schedule.update_params(params_for_this_client[schedule.name]) if params_for_this_client[schedule.name]
|
|
129
|
+
|
|
124
130
|
schedule.update_hidden_params(params.additional_hidden_params) if params.additional_hidden_params
|
|
125
131
|
schedule.enable
|
|
126
132
|
schedule.save
|
|
@@ -130,6 +136,19 @@ module GoodData
|
|
|
130
136
|
|
|
131
137
|
results.flatten
|
|
132
138
|
end
|
|
139
|
+
|
|
140
|
+
private
|
|
141
|
+
|
|
142
|
+
def get_process_n_schedule_names(client, project_id)
|
|
143
|
+
project = client.projects(project_id) || fail("Invalid 'from' project specified - '#{project_id}'")
|
|
144
|
+
processes = project.processes
|
|
145
|
+
process_id_names = Hash[processes.map { |process| [process.process_id, process.name] }]
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
processes: processes.map(&:name),
|
|
149
|
+
schedules: project.schedules.map { |schedule| [schedule.name, process_id_names[schedule.process_id]] }
|
|
150
|
+
}
|
|
151
|
+
end
|
|
133
152
|
end
|
|
134
153
|
end
|
|
135
154
|
end
|
|
@@ -23,10 +23,19 @@ module GoodData
|
|
|
23
23
|
|
|
24
24
|
description 'LDM Update Preference'
|
|
25
25
|
param :update_preference, instance_of(Type::UpdatePreferenceType), required: false
|
|
26
|
+
|
|
27
|
+
description 'Specifies whether to transfer computed attributes'
|
|
28
|
+
param :include_computed_attributes, instance_of(Type::BooleanType), required: false, default: true
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
class << self
|
|
29
32
|
def call(params)
|
|
33
|
+
# set default value for include_computed_attributes
|
|
34
|
+
# (we won't have to do this after TMA-690)
|
|
35
|
+
include_ca = params.include_computed_attributes
|
|
36
|
+
include_ca = true if include_ca.nil?
|
|
37
|
+
include_ca = include_ca.to_b
|
|
38
|
+
|
|
30
39
|
results = []
|
|
31
40
|
|
|
32
41
|
client = params.gdc_gd_client
|
|
@@ -39,7 +48,7 @@ module GoodData
|
|
|
39
48
|
from = development_client.projects(from_project) || fail("Invalid 'from' project specified - '#{from_project}'")
|
|
40
49
|
params.gdc_logger.info "Creating Blueprint, project: '#{from.title}', PID: #{from.pid}"
|
|
41
50
|
|
|
42
|
-
blueprint = from.blueprint
|
|
51
|
+
blueprint = from.blueprint(include_ca: include_ca)
|
|
43
52
|
info[:to] = to_projects.pmap do |entry|
|
|
44
53
|
pid = entry[:pid]
|
|
45
54
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
|
@@ -28,7 +28,8 @@ module GoodData
|
|
|
28
28
|
|
|
29
29
|
domain_name = params.organization || params.domain
|
|
30
30
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
|
31
|
-
|
|
31
|
+
data_product = params.data_product
|
|
32
|
+
domain_segments = domain.segments(:all, data_product)
|
|
32
33
|
|
|
33
34
|
params.segments.pmap do |segment_in|
|
|
34
35
|
segment_id = segment_in.segment_id
|
|
@@ -25,6 +25,7 @@ module GoodData
|
|
|
25
25
|
RESULT_HEADER = [
|
|
26
26
|
:from,
|
|
27
27
|
:to,
|
|
28
|
+
:name,
|
|
28
29
|
:status
|
|
29
30
|
]
|
|
30
31
|
|
|
@@ -48,20 +49,16 @@ module GoodData
|
|
|
48
49
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
|
49
50
|
|
|
50
51
|
params.gdc_logger.info "Transferring processes, from project: '#{from.title}', PID: '#{from.pid}', to project: '#{to_project.title}', PID: '#{to_project.pid}'"
|
|
51
|
-
GoodData::Project.transfer_processes(from, to_project, ads_output_stage_uri: info.ads_output_stage_uri)
|
|
52
|
+
res = GoodData::Project.transfer_processes(from, to_project, ads_output_stage_uri: info.ads_output_stage_uri)
|
|
52
53
|
|
|
53
54
|
to_project.add.output_stage.client_id = client_id if client_id && to_project.add.output_stage
|
|
54
55
|
|
|
55
|
-
results <<
|
|
56
|
-
from: from.pid,
|
|
57
|
-
to: to_project.pid,
|
|
58
|
-
status: 'ok'
|
|
59
|
-
}
|
|
56
|
+
results << res
|
|
60
57
|
end
|
|
61
58
|
end
|
|
62
59
|
|
|
63
60
|
# Return results
|
|
64
|
-
results
|
|
61
|
+
results.flatten
|
|
65
62
|
end
|
|
66
63
|
end
|
|
67
64
|
end
|
|
@@ -19,13 +19,16 @@ module GoodData
|
|
|
19
19
|
description 'Synchronization Info'
|
|
20
20
|
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
|
21
21
|
|
|
22
|
-
description 'Tag
|
|
23
|
-
param :
|
|
22
|
+
description 'Production Tag Names'
|
|
23
|
+
param :production_tags, array_of(instance_of(Type::StringType)), required: false
|
|
24
|
+
|
|
25
|
+
description 'Production Tag Names'
|
|
26
|
+
param :production_tag, instance_of(Type::StringType), required: false, deprecated: true, replacement: :production_tags
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
class << self
|
|
27
30
|
def call(params)
|
|
28
|
-
return [] unless params.production_tag
|
|
31
|
+
return [] unless params.production_tags || params.production_tag
|
|
29
32
|
|
|
30
33
|
results = []
|
|
31
34
|
|
|
@@ -42,12 +45,12 @@ module GoodData
|
|
|
42
45
|
pid = entry[:pid]
|
|
43
46
|
to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
|
|
44
47
|
|
|
45
|
-
GoodData::Project.transfer_tagged_stuff(from, to_project, params.production_tag)
|
|
48
|
+
GoodData::Project.transfer_tagged_stuff(from, to_project, params.production_tags || params.production_tag)
|
|
46
49
|
|
|
47
50
|
results << {
|
|
48
51
|
from: from_project,
|
|
49
52
|
to: pid,
|
|
50
|
-
tag: params.production_tag,
|
|
53
|
+
tag: params.production_tags || params.production_tag,
|
|
51
54
|
status: 'ok'
|
|
52
55
|
}
|
|
53
56
|
end
|