4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/3scale_toolbox/crds/backend_dump.rb', line 4
def to_cr
{
'apiVersion' => 'capabilities.3scale.net/v1beta1',
'kind' => 'Backend',
'metadata' => {
'annotations' => {
'3scale_toolbox_created_at' => Time.now.utc.iso8601,
'3scale_toolbox_version' => ThreeScaleToolbox::VERSION
},
'name' => cr_name
},
'spec' => {
'name' => name,
'systemName' => system_name,
'privateBaseURL' => private_endpoint,
'description' => description,
'mappingRules' => mapping_rules.map(&:to_cr),
'metrics' => metrics.each_with_object({}) do |metric, hash|
hash[metric.system_name] = metric.to_cr
end,
'methods' => methods.each_with_object({}) do |method, hash|
hash[method.system_name] = method.to_cr
end
}
}
end
|