gooddata 0.6.51 → 0.6.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.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
|
DESCRIPTION = 'Apply Custom MAQL DDL'
|
|
18
18
|
|
|
19
19
|
PARAMS = define_params(self) do
|
|
20
|
+
description 'Client Used for Connecting to GD'
|
|
21
|
+
param :gdc_gd_client, instance_of(Type::GdClientType), required: true
|
|
22
|
+
|
|
23
|
+
description 'Organization Name'
|
|
24
|
+
param :organization, instance_of(Type::StringType), required: true
|
|
25
|
+
|
|
26
|
+
description 'Segments to manage'
|
|
27
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
|
28
|
+
|
|
20
29
|
description 'Should be custom MAQL DDL Applied'
|
|
21
30
|
param :apply_maql_ddl, instance_of(Type::BooleanType), required: false, default: false
|
|
22
31
|
end
|
|
@@ -14,6 +14,21 @@ 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 'Delete Extra Clients'
|
|
22
|
+
param :delete_extra, instance_of(Type::BooleanType), required: false, default: false
|
|
23
|
+
|
|
24
|
+
description 'Physically Delete Client Projects'
|
|
25
|
+
param :delete_projects, instance_of(Type::BooleanType), required: false, default: false
|
|
26
|
+
|
|
27
|
+
description 'Clients'
|
|
28
|
+
param :clients, array_of(instance_of(Type::HashType)), required: true, generated: true
|
|
29
|
+
|
|
30
|
+
description 'Segments to provision'
|
|
31
|
+
param :segments_filter, array_of(instance_of(Type::StringType)), required: false
|
|
17
32
|
end
|
|
18
33
|
|
|
19
34
|
RESULT_HEADER = [
|
|
@@ -26,14 +41,18 @@ module GoodData
|
|
|
26
41
|
|
|
27
42
|
class << self
|
|
28
43
|
def call(params)
|
|
29
|
-
# Check if all required parameters were passed
|
|
30
|
-
BaseAction.check_params(PARAMS, params)
|
|
31
|
-
|
|
32
44
|
client = params.gdc_gd_client
|
|
33
45
|
|
|
34
46
|
domain_name = params.organization || params.domain
|
|
35
47
|
domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
|
|
36
48
|
|
|
49
|
+
params.clients.group_by { |data| data[:segment] }.each do |segment_name, clients|
|
|
50
|
+
segment = domain.segments(segment_name)
|
|
51
|
+
(clients.map(&:id) - segment.clients.map(&:id)).each do |c|
|
|
52
|
+
segment.create_client(id: c)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
37
56
|
domain.update_clients_settings(params.clients)
|
|
38
57
|
|
|
39
58
|
delete_projects = GoodData::Helpers.to_boolean(params.delete_projects)
|
|
@@ -50,7 +69,7 @@ module GoodData
|
|
|
50
69
|
if params.segments_filter && params.segments_filter.any?
|
|
51
70
|
{ delete_extra_in_segments: params.segments_filter }
|
|
52
71
|
else
|
|
53
|
-
{ delete_extra: delete_extra }
|
|
72
|
+
{ delete_extra: GoodData::Helpers.to_boolean(params.delete_extra) }
|
|
54
73
|
end
|
|
55
74
|
end
|
|
56
75
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
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 CollectAttributes < BaseAction
|
|
12
|
+
DESCRIPTION = "Collect all attributes (include CAs) to transfer label type and drill path"
|
|
13
|
+
|
|
14
|
+
PARAMS = define_params(self) do
|
|
15
|
+
description 'Development Client Used for Connecting to GD'
|
|
16
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
|
17
|
+
|
|
18
|
+
description 'Synchronization Info'
|
|
19
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class << self
|
|
23
|
+
def call(params)
|
|
24
|
+
results = []
|
|
25
|
+
|
|
26
|
+
development_client = params.development_client
|
|
27
|
+
|
|
28
|
+
synchronize = params.synchronize.pmap do |info|
|
|
29
|
+
from = info.from
|
|
30
|
+
from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
|
|
31
|
+
objects = (from_project.attributes.to_a + from_project.labels.to_a).map(&:uri)
|
|
32
|
+
|
|
33
|
+
info[:transfer_uris] ||= []
|
|
34
|
+
info[:transfer_uris] += objects
|
|
35
|
+
|
|
36
|
+
results += objects.map do |uri|
|
|
37
|
+
{
|
|
38
|
+
project: from,
|
|
39
|
+
transfer_uri: uri
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
info
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
results: results,
|
|
48
|
+
params: {
|
|
49
|
+
synchronize: synchronize
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
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 CollectComputedAttributeMetrics < BaseAction
|
|
12
|
+
DESCRIPTION = 'Collect all metrics which is used in computed attributes in development projects'
|
|
13
|
+
|
|
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
|
+
end
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
def call(params)
|
|
21
|
+
results = []
|
|
22
|
+
development_client = params.development_client
|
|
23
|
+
|
|
24
|
+
synchronize = params.synchronize.pmap do |info|
|
|
25
|
+
from = info.from
|
|
26
|
+
from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
|
|
27
|
+
|
|
28
|
+
metric_uris = from_project.computed_attributes.flat_map { |a| a.using('metric').map { |m| m['link'] } }
|
|
29
|
+
|
|
30
|
+
info[:transfer_uris] ||= []
|
|
31
|
+
info[:transfer_uris] += metric_uris
|
|
32
|
+
|
|
33
|
+
results += metric_uris.map do |uri|
|
|
34
|
+
{
|
|
35
|
+
project: from,
|
|
36
|
+
transfer_uri: uri
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
info
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
results: results,
|
|
45
|
+
params: {
|
|
46
|
+
synchronize: synchronize
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -14,6 +14,27 @@ 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 'Segments to manage'
|
|
19
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
|
20
|
+
|
|
21
|
+
description 'Client Id Column'
|
|
22
|
+
param :client_id_column, instance_of(Type::StringType), required: false
|
|
23
|
+
|
|
24
|
+
description 'Segment Id Column'
|
|
25
|
+
param :segment_id_column, instance_of(Type::StringType), required: false
|
|
26
|
+
|
|
27
|
+
description 'Project Id Column'
|
|
28
|
+
param :project_id_column, instance_of(Type::StringType), required: false
|
|
29
|
+
|
|
30
|
+
description 'Client Project Title Column'
|
|
31
|
+
param :project_title_column, instance_of(Type::StringType), required: false
|
|
32
|
+
|
|
33
|
+
description 'Client Project Token Column'
|
|
34
|
+
param :project_token_column, instance_of(Type::StringType), required: false
|
|
35
|
+
|
|
36
|
+
description 'Input Source'
|
|
37
|
+
param :input_source, instance_of(Type::HashType), required: true
|
|
17
38
|
end
|
|
18
39
|
|
|
19
40
|
RESULT_HEADER = [
|
|
@@ -24,9 +45,6 @@ module GoodData
|
|
|
24
45
|
|
|
25
46
|
class << self
|
|
26
47
|
def call(params)
|
|
27
|
-
# Check if all required parameters were passed
|
|
28
|
-
BaseAction.check_params(PARAMS, params)
|
|
29
|
-
|
|
30
48
|
segment_names = params.segments.map(&:segment_id)
|
|
31
49
|
|
|
32
50
|
clients = collect_clients(params, segment_names)
|
|
@@ -58,8 +76,12 @@ module GoodData
|
|
|
58
76
|
clients = []
|
|
59
77
|
data_source = GoodData::Helpers::DataSource.new(params.input_source)
|
|
60
78
|
input_data = File.open(data_source.realize(params), 'r:UTF-8')
|
|
79
|
+
GoodData.logger.debug("Input data: #{input_data.read}")
|
|
80
|
+
GoodData.logger.debug("Segment names: #{segment_names}")
|
|
61
81
|
CSV.foreach(input_data, :headers => true, :return_headers => false, encoding: 'utf-8') do |row|
|
|
82
|
+
GoodData.logger.debug("Processing row: #{row}")
|
|
62
83
|
segment_name = row[segment_id_column]
|
|
84
|
+
GoodData.logger.debug("Segment name: #{segment_name}")
|
|
63
85
|
if segment_names.nil? || segment_names.include?(segment_name)
|
|
64
86
|
clients << {
|
|
65
87
|
id: row[client_id_column],
|
|
@@ -0,0 +1,83 @@
|
|
|
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 CollectMeta < BaseAction
|
|
12
|
+
DESCRIPTION = "Collect tagged dashboards (or all dashboards if not specify production tag) \
|
|
13
|
+
with objects inside dashboards (reports, metrics ...) from development projects"
|
|
14
|
+
|
|
15
|
+
PARAMS = define_params(self) do
|
|
16
|
+
description 'Production Tag Name'
|
|
17
|
+
param :production_tag, instance_of(Type::StringType), required: false
|
|
18
|
+
|
|
19
|
+
description 'Development Client Used for Connecting to GD'
|
|
20
|
+
param :development_client, instance_of(Type::GdClientType), required: true
|
|
21
|
+
|
|
22
|
+
description 'Synchronization Info'
|
|
23
|
+
param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
|
|
24
|
+
|
|
25
|
+
description 'Segments to search for segment-specific production tags'
|
|
26
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: false
|
|
27
|
+
|
|
28
|
+
description 'Flag to mark if we need to transfer all objects'
|
|
29
|
+
param :transfer_all, instance_of(Type::BooleanType), required: false, default: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class << self
|
|
33
|
+
def call(params)
|
|
34
|
+
results = []
|
|
35
|
+
|
|
36
|
+
development_client = params.development_client
|
|
37
|
+
segments_to_tags = Helpers.segment_production_tags(params.segments)
|
|
38
|
+
transfer_all = GoodData::Helpers.to_boolean(params.transfer_all)
|
|
39
|
+
|
|
40
|
+
synchronize = params.synchronize.pmap do |info|
|
|
41
|
+
from = info.from
|
|
42
|
+
from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
|
|
43
|
+
|
|
44
|
+
segment_tags = segments_to_tags[info.segment]
|
|
45
|
+
production_tags = Helpers.parse_production_tags(params.production_tag, segment_tags)
|
|
46
|
+
|
|
47
|
+
if transfer_all || production_tags.empty?
|
|
48
|
+
objects = GoodData::Dashboard.all(
|
|
49
|
+
project: from_project,
|
|
50
|
+
client: development_client
|
|
51
|
+
)
|
|
52
|
+
else
|
|
53
|
+
objects = GoodData::Dashboard.find_by_tag(
|
|
54
|
+
production_tags,
|
|
55
|
+
project: from_project,
|
|
56
|
+
client: development_client
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
info[:transfer_uris] ||= []
|
|
61
|
+
info[:transfer_uris] += objects.map(&:uri)
|
|
62
|
+
|
|
63
|
+
results += objects.map do |uri|
|
|
64
|
+
{
|
|
65
|
+
project: from,
|
|
66
|
+
transfer_uri: uri
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
info
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
{
|
|
74
|
+
results: results,
|
|
75
|
+
params: {
|
|
76
|
+
synchronize: synchronize
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -20,6 +20,12 @@ module GoodData
|
|
|
20
20
|
|
|
21
21
|
description 'ADS Client'
|
|
22
22
|
param :ads_client, instance_of(Type::AdsClientType), required: true
|
|
23
|
+
|
|
24
|
+
description 'Segments to manage'
|
|
25
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: true
|
|
26
|
+
|
|
27
|
+
description 'Table Name'
|
|
28
|
+
param :release_table_name, instance_of(Type::StringType), required: false
|
|
23
29
|
end
|
|
24
30
|
|
|
25
31
|
RESULT_HEADER = [
|
|
@@ -33,9 +39,6 @@ module GoodData
|
|
|
33
39
|
|
|
34
40
|
class << self
|
|
35
41
|
def call(params)
|
|
36
|
-
# Check if all required parameters were passed
|
|
37
|
-
BaseAction.check_params(PARAMS, params)
|
|
38
|
-
|
|
39
42
|
client = params.gdc_gd_client
|
|
40
43
|
|
|
41
44
|
domain_name = params.organization || params.domain
|
|
@@ -50,6 +53,11 @@ module GoodData
|
|
|
50
53
|
|
|
51
54
|
results = []
|
|
52
55
|
synchronize_clients = segments.map do |segment|
|
|
56
|
+
segment_clients = segment.clients
|
|
57
|
+
missing_project_clients = segment_clients.reject(&:project?).map(&:client_id)
|
|
58
|
+
|
|
59
|
+
raise "Client(s) missing workspace: #{missing_project_clients.join(', ')}. Please make sure all clients have workspace." unless missing_project_clients.empty?
|
|
60
|
+
|
|
53
61
|
replacements = {
|
|
54
62
|
table_name: params.release_table_name || DEFAULT_TABLE_NAME,
|
|
55
63
|
segment_id: segment.segment_id
|
|
@@ -68,7 +76,7 @@ module GoodData
|
|
|
68
76
|
sync_info = {
|
|
69
77
|
segment_id: segment.segment_id,
|
|
70
78
|
from: master_pid,
|
|
71
|
-
to:
|
|
79
|
+
to: segment_clients.map do |segment_client|
|
|
72
80
|
client_project = segment_client.project
|
|
73
81
|
to_pid = client_project.pid
|
|
74
82
|
results << {
|
|
@@ -17,13 +17,13 @@ module GoodData
|
|
|
17
17
|
|
|
18
18
|
description 'Organization Name'
|
|
19
19
|
param :organization, instance_of(Type::StringType), required: true
|
|
20
|
+
|
|
21
|
+
description 'Segments to provision'
|
|
22
|
+
param :segments_filter, array_of(instance_of(Type::StringType)), required: false
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
class << self
|
|
23
26
|
def call(params)
|
|
24
|
-
# Check if all required parameters were passed
|
|
25
|
-
BaseAction.check_params(PARAMS, params)
|
|
26
|
-
|
|
27
27
|
client = params.gdc_gd_client
|
|
28
28
|
|
|
29
29
|
domain_name = params.organization || params.domain
|
|
@@ -36,7 +36,7 @@ module GoodData
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
segments = domain_segments.
|
|
39
|
+
segments = domain_segments.pmap do |segment|
|
|
40
40
|
project = nil
|
|
41
41
|
|
|
42
42
|
begin
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
require_relative '../helpers/helpers'
|
|
9
|
+
|
|
10
|
+
module GoodData
|
|
11
|
+
module LCM2
|
|
12
|
+
class CollectTaggedObjects < BaseAction
|
|
13
|
+
DESCRIPTION = 'Collect all objects tagged with the +$PRODUCTION_TAG+ from development projects'
|
|
14
|
+
|
|
15
|
+
PARAMS = define_params(self) do
|
|
16
|
+
description 'Development Client Used for Connecting to GD'
|
|
17
|
+
param :development_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
|
+
|
|
25
|
+
description 'Segments to search for segment-specific production tags'
|
|
26
|
+
param :segments, array_of(instance_of(Type::SegmentType)), required: false
|
|
27
|
+
|
|
28
|
+
description 'Flag to mark if we need to transfer all objects'
|
|
29
|
+
param :transfer_all, instance_of(Type::BooleanType), required: false, default: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class << self
|
|
33
|
+
def call(params)
|
|
34
|
+
results = []
|
|
35
|
+
segments_to_tags = Helpers.segment_production_tags(params.segments)
|
|
36
|
+
transfer_all = GoodData::Helpers.to_boolean(params.transfer_all)
|
|
37
|
+
return results unless params.production_tag || segments_to_tags.any? || transfer_all
|
|
38
|
+
development_client = params.development_client
|
|
39
|
+
|
|
40
|
+
synchronize = params.synchronize.pmap do |info|
|
|
41
|
+
from = info.from
|
|
42
|
+
from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
|
|
43
|
+
|
|
44
|
+
segment_tags = segments_to_tags[info.segment]
|
|
45
|
+
production_tags = Helpers.parse_production_tags(params.production_tag, segment_tags)
|
|
46
|
+
if production_tags.any?
|
|
47
|
+
objects = from_project.find_by_tag(production_tags)
|
|
48
|
+
else
|
|
49
|
+
objects = (from_project.reports.to_a + from_project.metrics.to_a + from_project.variables.to_a).map(&:uri)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
info[:transfer_uris] ||= []
|
|
53
|
+
info[:transfer_uris] += objects
|
|
54
|
+
|
|
55
|
+
results += objects.map do |uri|
|
|
56
|
+
{
|
|
57
|
+
project: from,
|
|
58
|
+
transfer_uri: uri
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
info
|
|
63
|
+
end
|
|
64
|
+
{
|
|
65
|
+
results: results,
|
|
66
|
+
params: {
|
|
67
|
+
synchronize: synchronize
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|