occi 2.3.1 → 2.4.0
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.
- data/etc/model/infrastructure/compute.json +44 -44
- data/etc/model/infrastructure/ipnetwork.json +20 -20
- data/etc/model/infrastructure/ipnetworkinterface.json +20 -20
- data/etc/model/infrastructure/network.json +15 -15
- data/etc/model/infrastructure/networkinterface.json +15 -15
- data/etc/model/infrastructure/storage.json +14 -14
- data/etc/model/infrastructure/storagelink.json +13 -13
- data/lib/occi/client.rb +4 -5
- data/lib/occi/core/attribute_properties.rb +65 -12
- data/lib/occi/core/attributes.rb +1 -1
- data/lib/occi/core/category.rb +0 -7
- data/lib/occi/core/entity.rb +54 -23
- data/lib/occi/core/kind.rb +3 -3
- data/lib/occi/core/link.rb +51 -10
- data/lib/occi/core/resource.rb +20 -4
- data/lib/occi/model.rb +3 -3
- data/lib/occi/parser.rb +7 -5
- data/lib/occi/version.rb +1 -1
- metadata +2 -2
|
@@ -11,45 +11,45 @@
|
|
|
11
11
|
"occi":{
|
|
12
12
|
"compute":{
|
|
13
13
|
"architecture":{
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"Mutable":true,
|
|
15
|
+
"Required":false,
|
|
16
|
+
"Type":"string",
|
|
17
|
+
"Pattern":"x86|x64",
|
|
18
|
+
"Default":"x86"
|
|
19
19
|
},
|
|
20
20
|
"cores":{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
21
|
+
"Mutable":true,
|
|
22
|
+
"Required":false,
|
|
23
|
+
"Type":"number",
|
|
24
|
+
"Minimum":1,
|
|
25
|
+
"Maximum":32767
|
|
26
26
|
},
|
|
27
27
|
"hostname":{
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"Mutable":true,
|
|
29
|
+
"Required":false,
|
|
30
|
+
"Type":"string",
|
|
31
|
+
"Pattern":"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*"
|
|
32
32
|
},
|
|
33
33
|
"speed":{
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
34
|
+
"Mutable":true,
|
|
35
|
+
"Required":false,
|
|
36
|
+
"Type":"number",
|
|
37
|
+
"Minimum":0,
|
|
38
|
+
"Maximum":32767
|
|
39
39
|
},
|
|
40
40
|
"memory":{
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
41
|
+
"Mutable":true,
|
|
42
|
+
"Required":false,
|
|
43
|
+
"Type":"number",
|
|
44
|
+
"Minimum":0,
|
|
45
|
+
"Maximum":32767
|
|
46
46
|
},
|
|
47
47
|
"state":{
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
48
|
+
"Mutable":false,
|
|
49
|
+
"Required":false,
|
|
50
|
+
"Type":"string",
|
|
51
|
+
"Pattern":"inactive|active|suspended|error",
|
|
52
|
+
"Default":"inactive"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"title":"Stop Compute instance",
|
|
76
76
|
"attributes":{
|
|
77
77
|
"method":{
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
78
|
+
"Mutable":true,
|
|
79
|
+
"Required":false,
|
|
80
|
+
"Type":"string",
|
|
81
|
+
"Pattern":"graceful|acpioff|poweroff",
|
|
82
|
+
"Default":"poweroff"
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
},
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"title":"Restart Compute instance",
|
|
90
90
|
"attributes":{
|
|
91
91
|
"method":{
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
92
|
+
"Mutable":true,
|
|
93
|
+
"Required":false,
|
|
94
|
+
"Type":"string",
|
|
95
|
+
"Pattern":"graceful|warm|cold",
|
|
96
|
+
"Default":"cold"
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
},
|
|
@@ -103,11 +103,11 @@
|
|
|
103
103
|
"title":"Suspend Compute instance",
|
|
104
104
|
"attributes":{
|
|
105
105
|
"method":{
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
106
|
+
"Mutable":true,
|
|
107
|
+
"Required":false,
|
|
108
|
+
"Type":"string",
|
|
109
|
+
"Pattern":"hibernate|suspend",
|
|
110
|
+
"Default":"suspend"
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
"occi":{
|
|
9
9
|
"network":{
|
|
10
10
|
"address":{
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
11
|
+
"Mutable":true,
|
|
12
|
+
"Required":false,
|
|
13
|
+
"Type":"string",
|
|
14
|
+
"Pattern":"(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4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2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*)",
|
|
22
|
+
"Default":"10.0.0.1"
|
|
23
23
|
},
|
|
24
24
|
"allocation":{
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
25
|
+
"Mutable":true,
|
|
26
|
+
"Required":false,
|
|
27
|
+
"Type":"string",
|
|
28
|
+
"Pattern":"dynamic|static",
|
|
29
|
+
"Default":"dynamic"
|
|
30
30
|
},
|
|
31
31
|
"state":{
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"Mutable":false,
|
|
33
|
+
"Required":false,
|
|
34
|
+
"Type":"string",
|
|
35
|
+
"Pattern":"active|inactive",
|
|
36
|
+
"Default":"inactive"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
"occi":{
|
|
9
9
|
"networkinterface":{
|
|
10
10
|
"address":{
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
11
|
+
"Mutable":true,
|
|
12
|
+
"Required":false,
|
|
13
|
+
"Type":"string",
|
|
14
|
+
"Pattern":"(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{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
+
"Default":"10.0.0.0/8"
|
|
16
16
|
},
|
|
17
17
|
"gateway":{
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
18
|
+
"Mutable":true,
|
|
19
|
+
"Required":false,
|
|
20
|
+
"Type":"string",
|
|
21
|
+
"Pattern":"(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*)",
|
|
22
|
+
"Default":"10.0.0.1"
|
|
23
23
|
},
|
|
24
24
|
"allocation":{
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
25
|
+
"Mutable":true,
|
|
26
|
+
"Required":false,
|
|
27
|
+
"Type":"string",
|
|
28
|
+
"Pattern":"dynamic|static",
|
|
29
|
+
"Default":"dynamic"
|
|
30
30
|
},
|
|
31
31
|
"state":{
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"Mutable":false,
|
|
33
|
+
"Required":false,
|
|
34
|
+
"Type":"string",
|
|
35
|
+
"Pattern":"active|inactive",
|
|
36
|
+
"Default":"inactive"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
"occi":{
|
|
12
12
|
"network":{
|
|
13
13
|
"vlan":{
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
14
|
+
"Mutable":true,
|
|
15
|
+
"Required":false,
|
|
16
|
+
"Type":"number",
|
|
17
|
+
"Minimum":0,
|
|
18
|
+
"Maximum":4095,
|
|
19
|
+
"Default":0
|
|
20
20
|
},
|
|
21
21
|
"label":{
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
22
|
+
"Mutable":true,
|
|
23
|
+
"Required":false,
|
|
24
|
+
"Type":"string",
|
|
25
|
+
"Pattern":".*"
|
|
26
26
|
},
|
|
27
27
|
"state":{
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
28
|
+
"Mutable":false,
|
|
29
|
+
"Required":false,
|
|
30
|
+
"Type":"string",
|
|
31
|
+
"Pattern":"active|inactive|error",
|
|
32
|
+
"Default":"inactive"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
"occi":{
|
|
12
12
|
"networkinterface":{
|
|
13
13
|
"interface":{
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"Mutable":true,
|
|
15
|
+
"Required":false,
|
|
16
|
+
"Type":"string",
|
|
17
|
+
"Pattern":".*",
|
|
18
|
+
"Default":"eth0"
|
|
19
19
|
},
|
|
20
20
|
"mac":{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
21
|
+
"Mutable":true,
|
|
22
|
+
"Required":false,
|
|
23
|
+
"Type":"string",
|
|
24
|
+
"Pattern":"^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$",
|
|
25
|
+
"Default":"00:16:3e:00:00:00"
|
|
26
26
|
},
|
|
27
27
|
"state":{
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
28
|
+
"Mutable":false,
|
|
29
|
+
"Required":false,
|
|
30
|
+
"Type":"string",
|
|
31
|
+
"Pattern":"active|inactive",
|
|
32
|
+
"Default":"inactive"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
"occi":{
|
|
12
12
|
"storage":{
|
|
13
13
|
"size":{
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"Mutable":true,
|
|
15
|
+
"Required":false,
|
|
16
|
+
"Type":"number",
|
|
17
|
+
"Minimum":0,
|
|
18
|
+
"Maximum":32767
|
|
19
19
|
},
|
|
20
20
|
"state":{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
21
|
+
"Mutable":false,
|
|
22
|
+
"Required":false,
|
|
23
|
+
"Type":"string",
|
|
24
|
+
"Pattern":"online|offline|backup|snapshot|resize|degraded",
|
|
25
|
+
"Default":"offline"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"title":"Resize Storage",
|
|
65
65
|
"attributes":{
|
|
66
66
|
"size":{
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
67
|
+
"Mutable":true,
|
|
68
|
+
"Required":false,
|
|
69
|
+
"Type":"number",
|
|
70
|
+
"Default":"suspend"
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -11,23 +11,23 @@
|
|
|
11
11
|
"occi":{
|
|
12
12
|
"storagelink":{
|
|
13
13
|
"deviceid":{
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
14
|
+
"Mutable":true,
|
|
15
|
+
"Required":false,
|
|
16
|
+
"Type":"string",
|
|
17
|
+
"Pattern":".*"
|
|
18
18
|
},
|
|
19
19
|
"mountpoint":{
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"Mutable":true,
|
|
21
|
+
"Required":false,
|
|
22
|
+
"Type":"string",
|
|
23
|
+
"Pattern":".*"
|
|
24
24
|
},
|
|
25
25
|
"state":{
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
26
|
+
"Mutable":false,
|
|
27
|
+
"Required":false,
|
|
28
|
+
"Type":"string",
|
|
29
|
+
"Pattern":"active|inactive",
|
|
30
|
+
"Default":"inactive"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
data/lib/occi/client.rb
CHANGED
|
@@ -44,17 +44,16 @@ module OCCI
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def post_resource(attributes, kind, mixins, resources_to_link)
|
|
47
|
-
resource = OCCI::Core::Resource.new
|
|
48
|
-
resource.kind = kind.type_identifier
|
|
47
|
+
resource = OCCI::Core::Resource.new(kind.type_identifier)
|
|
49
48
|
mixins = mixins.collect { |mixin| mixin.type_identifiers } unless mixins.first.kind_of? String
|
|
50
49
|
resource.mixins = mixins
|
|
51
50
|
attributes = OCCI::Core::Attributes.split(attributes) unless attributes.kind_of? OCCI::Core::Attributes
|
|
52
51
|
resource.attributes = attributes
|
|
53
52
|
resource.links = []
|
|
54
53
|
resources_to_link.each do |res|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
link
|
|
54
|
+
kind = 'http://schemas.ogf.org/occi/infrastructure#storagelink' if @model.get_by_id(res.kind).related_to? 'http://schemas.ogf.org/occi/infrastructure#storage'
|
|
55
|
+
kind = 'http://schemas.ogf.org/occi/infrastructure#networkinterface' if @model.get_by_id(res.kind).related_to? 'http://schemas.ogf.org/occi/infrastructure#network'
|
|
56
|
+
link = OCCI::Link.new(kind)
|
|
58
57
|
link.titlte "Link to #{res.title}"
|
|
59
58
|
link.target = res.location
|
|
60
59
|
resource.links << link
|
|
@@ -5,39 +5,92 @@ module OCCI
|
|
|
5
5
|
class AttributeProperties < Hashie::Mash
|
|
6
6
|
|
|
7
7
|
def initialize(attributes = nil, default = nil)
|
|
8
|
-
if
|
|
9
|
-
attributes[:
|
|
10
|
-
attributes
|
|
11
|
-
attributes
|
|
12
|
-
attributes
|
|
13
|
-
end
|
|
8
|
+
if [:Type, :Required, :Mutable, :Pattern, :Default, :Minimum, :Maximum, :Description].any? { |k| attributes.key?(k) }
|
|
9
|
+
attributes[:Type] ||= "string"
|
|
10
|
+
attributes[:Required] ||= false
|
|
11
|
+
attributes[:Mutable] ||= false
|
|
12
|
+
attributes[:Pattern] ||= ".*"
|
|
13
|
+
end if attributes
|
|
14
14
|
super(attributes, default)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def combine
|
|
18
18
|
array = []
|
|
19
19
|
self.each_key do |key|
|
|
20
|
-
|
|
20
|
+
#puts "Key :#{key}"
|
|
21
|
+
#puts self[key].keys
|
|
22
|
+
#puts self[key].key? 'type'
|
|
23
|
+
if self[key].key? 'Type'
|
|
21
24
|
array << key
|
|
22
25
|
else
|
|
23
|
-
self[key]
|
|
26
|
+
attribute = self[key]
|
|
27
|
+
attribute.combine.each { |attr| array << key + '.' + attr }
|
|
24
28
|
end
|
|
25
29
|
end
|
|
26
30
|
array
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def combine_with_defaults
|
|
30
|
-
hash = {}
|
|
34
|
+
hash = { }
|
|
31
35
|
self.each_key do |key|
|
|
32
|
-
if self[key].include? '
|
|
33
|
-
hash[key] = self[key]['
|
|
36
|
+
if self[key].include? 'Type'
|
|
37
|
+
hash[key] = self[key]['Default']
|
|
34
38
|
else
|
|
35
|
-
self[key].combine_with_defaults.each { |k,v| hash[key + '.' + k] = v }
|
|
39
|
+
self[key].combine_with_defaults.each { |k, v| hash[key + '.' + k] = v }
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
hash
|
|
39
43
|
end
|
|
40
44
|
|
|
45
|
+
def convert_value(val, duping=false) #:nodoc:
|
|
46
|
+
case val
|
|
47
|
+
when self.class
|
|
48
|
+
val.dup
|
|
49
|
+
when ::Hash
|
|
50
|
+
val = val.dup if duping
|
|
51
|
+
self.class.subkey_class.new(val)
|
|
52
|
+
when Array
|
|
53
|
+
val.collect { |e| convert_value(e) }
|
|
54
|
+
else
|
|
55
|
+
val
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def method_missing(method_name, *args, &blk)
|
|
60
|
+
return self.[](method_name, &blk) if key?(method_name)
|
|
61
|
+
match = method_name.to_s.match(/(.*?)([?=!]?)$/)
|
|
62
|
+
case match[2]
|
|
63
|
+
when "="
|
|
64
|
+
key = match[1]
|
|
65
|
+
self[key] = args.first
|
|
66
|
+
if %w|Type Required Mutable Pattern Default Minimum Maximum Description|.any? { |k| key.to_s == k }
|
|
67
|
+
self["Type"] = "string" unless key?("Type")
|
|
68
|
+
self["Required"] = false unless key?("Required")
|
|
69
|
+
self["Mutable"] = false unless key?("Mutable")
|
|
70
|
+
self["Pattern"] = ".*" unless key?("Pattern")
|
|
71
|
+
end
|
|
72
|
+
when "?"
|
|
73
|
+
!!self[match[1]]
|
|
74
|
+
when "!"
|
|
75
|
+
initializing_reader(match[1])
|
|
76
|
+
else
|
|
77
|
+
default(method_name, *args, &blk)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Sets an attribute in the Mash. Key will be converted to
|
|
82
|
+
# a string before it is set, and Hashes will be converted
|
|
83
|
+
# into Mashes for nesting purposes.
|
|
84
|
+
def []=(key, value) #:nodoc:
|
|
85
|
+
regular_writer(convert_key(key), convert_value(value))
|
|
86
|
+
if %w|Type Required Mutable Pattern Default Minimum Maximum Description|.any? { |k| key.to_s == k }
|
|
87
|
+
self["Type"] = "string" unless key?("Type")
|
|
88
|
+
self["Required"] = false unless key?("Required")
|
|
89
|
+
self["Mutable"] = false unless key?("Mutable")
|
|
90
|
+
self["Pattern"] = ".*" unless key?("Pattern")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
41
94
|
end
|
|
42
95
|
end
|
|
43
96
|
end
|
data/lib/occi/core/attributes.rb
CHANGED
data/lib/occi/core/category.rb
CHANGED
|
@@ -24,13 +24,6 @@ module OCCI
|
|
|
24
24
|
@scheme + @term
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# converts and adds supplied attributes to attributes of the category
|
|
28
|
-
# @param [Hash] attributes
|
|
29
|
-
# @return [OCCI::Core::AttributeProperties] attributes hash converted to attribute properties
|
|
30
|
-
def attributes=(attributes)
|
|
31
|
-
@attributes = OCCI::Core::AttributeProperties.new(attributes)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
27
|
# check if category is related to another category
|
|
35
28
|
# @param [String] category_id Type identifier of a related category
|
|
36
29
|
# @return [true,false] true if category is related to category_id else false
|
data/lib/occi/core/entity.rb
CHANGED
|
@@ -11,7 +11,8 @@ module OCCI
|
|
|
11
11
|
module Core
|
|
12
12
|
class Entity
|
|
13
13
|
|
|
14
|
-
attr_accessor :
|
|
14
|
+
attr_accessor :mixins, :attributes, :actions
|
|
15
|
+
attr_reader :kind
|
|
15
16
|
|
|
16
17
|
# @return [OCCI::Core::Kind] kind definition of Entity type
|
|
17
18
|
def self.kind_definition
|
|
@@ -19,15 +20,15 @@ module OCCI
|
|
|
19
20
|
|
|
20
21
|
kind.title = "Entity"
|
|
21
22
|
|
|
22
|
-
kind.attributes.occi!.core!.id!.
|
|
23
|
-
kind.attributes.occi!.core!.id!.
|
|
24
|
-
kind.attributes.occi!.core!.id!.
|
|
25
|
-
kind.attributes.occi!.core!.id!.
|
|
23
|
+
kind.attributes.occi!.core!.id!.Type = "string"
|
|
24
|
+
kind.attributes.occi!.core!.id!.Pattern = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
|
|
25
|
+
kind.attributes.occi!.core!.id!.Required = false
|
|
26
|
+
kind.attributes.occi!.core!.id!.Mutable = false
|
|
26
27
|
|
|
27
|
-
kind.attributes.occi!.core!.title!.
|
|
28
|
-
kind.attributes.occi!.core!.title!.
|
|
29
|
-
kind.attributes.occi!.core!.title!.
|
|
30
|
-
kind.attributes.occi!.core!.title!.
|
|
28
|
+
kind.attributes.occi!.core!.title!.Type = "string"
|
|
29
|
+
kind.attributes.occi!.core!.title!.Pattern = ".*"
|
|
30
|
+
kind.attributes.occi!.core!.title!.Required = false
|
|
31
|
+
kind.attributes.occi!.core!.title!.Mutable = true
|
|
31
32
|
|
|
32
33
|
kind
|
|
33
34
|
end
|
|
@@ -35,11 +36,24 @@ module OCCI
|
|
|
35
36
|
# @param [String] kind
|
|
36
37
|
# @param [String] mixins
|
|
37
38
|
# @param [OCCI::Core::Attributes] attributes
|
|
38
|
-
def initialize(kind, mixins=nil, attributes=nil)
|
|
39
|
+
def initialize(kind, mixins=nil, attributes=nil, actions=nil)
|
|
40
|
+
@checked = false
|
|
41
|
+
raise "Kind #{kind} not of type String" unless kind.kind_of? String
|
|
39
42
|
@kind = kind
|
|
40
43
|
@mixins = mixins.to_a
|
|
41
44
|
@attributes = OCCI::Core::Attributes.new(attributes)
|
|
42
|
-
|
|
45
|
+
@actions = actions.to_a
|
|
46
|
+
self.id = UUIDTools::UUID.timestamp_create.to_s
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def mixins=(mixins)
|
|
50
|
+
@checked=false
|
|
51
|
+
@mixins =mixins
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def attributes=(attributes)
|
|
55
|
+
@checked =false
|
|
56
|
+
@attributes=attributes
|
|
43
57
|
end
|
|
44
58
|
|
|
45
59
|
# set id for entity
|
|
@@ -53,6 +67,17 @@ module OCCI
|
|
|
53
67
|
@attributes.occi!.core!.id
|
|
54
68
|
end
|
|
55
69
|
|
|
70
|
+
# set title attribute for entity
|
|
71
|
+
# @param [String] title
|
|
72
|
+
def title=(title)
|
|
73
|
+
@attributes.occi!.core!.title = title
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# @return [String] title attribute of entity
|
|
77
|
+
def title
|
|
78
|
+
@attributes.occi!.core!.title
|
|
79
|
+
end
|
|
80
|
+
|
|
56
81
|
# @return [String] location of the entity
|
|
57
82
|
def location
|
|
58
83
|
'/' + @kind.split('#').last + '/' + @attributes.occi!.core!.id
|
|
@@ -79,28 +104,33 @@ module OCCI
|
|
|
79
104
|
attributes = OCCI::Core::Attributes.new(attributes)
|
|
80
105
|
definitions.each_key do |key|
|
|
81
106
|
properties = definitions[key]
|
|
82
|
-
value = attributes[key] ||= properties
|
|
83
|
-
if properties.
|
|
84
|
-
raise "required attribute #{key} not found" if value.nil? && properties.
|
|
85
|
-
next if value.nil? && !properties.
|
|
86
|
-
case properties.
|
|
107
|
+
value = attributes[key] ||= properties.Default
|
|
108
|
+
if properties.key? :Type
|
|
109
|
+
raise "required attribute #{key} not found" if value.nil? && properties.Required
|
|
110
|
+
next if value.nil? && !properties.Required
|
|
111
|
+
case properties.Type
|
|
87
112
|
when 'number'
|
|
88
|
-
raise "attribute #{key} value #{value} from class #{value.class.name} does not match attribute property type #{properties.
|
|
89
|
-
raise "attribute #{key} with value #{value} not in range #{properties.
|
|
113
|
+
raise "attribute #{key} value #{value} from class #{value.class.name} does not match attribute property type #{properties.Type}" unless value.kind_of?(Numeric)
|
|
114
|
+
raise "attribute #{key} with value #{value} not in range #{properties.Minimum}-#{properties.Maximum}" unless (properties.Minimum..properties.Maximum) === value if properties.Minimum && properties.Maximum
|
|
90
115
|
when 'boolean'
|
|
91
|
-
raise "attribute #{key} value #{value} from class #{value.class.name} does not match attribute property type #{properties.
|
|
116
|
+
raise "attribute #{key} value #{value} from class #{value.class.name} does not match attribute property type #{properties.Type}" unless !!value == value
|
|
92
117
|
else
|
|
93
|
-
raise "attribute #{key} with value #{value} from class #{value.class.name} does not match attribute property type #{properties.
|
|
94
|
-
raise "attribute #{key} with length #{value.length} not in range #{properties.
|
|
118
|
+
raise "attribute #{key} with value #{value} from class #{value.class.name} does not match attribute property type #{properties.Type}" unless value.kind_of?(String)
|
|
119
|
+
raise "attribute #{key} with length #{value.length} not in range #{properties.Minimum}-#{properties.Maximum}" unless (properties.Minimum..properties.Maximum) === value.length if properties.Minimum && properties.Maximum
|
|
95
120
|
end
|
|
96
|
-
raise "attribute #{key} with value #{value} does not match pattern #{properties.
|
|
121
|
+
raise "attribute #{key} with value #{value} does not match pattern #{properties.Pattern}" if value.to_s.scan(Regexp.new(properties.Pattern)).empty? if properties.Pattern
|
|
97
122
|
attributes[key] = value
|
|
98
123
|
else
|
|
99
124
|
attributes[key] = check(value, definitions[key])
|
|
100
125
|
end
|
|
101
126
|
end
|
|
102
127
|
attributes.delete_if { |_, v| v.nil? } # remove empty attributes
|
|
103
|
-
|
|
128
|
+
@checked = true
|
|
129
|
+
attributes
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def checked?
|
|
133
|
+
@checked && @attributes.checked?
|
|
104
134
|
end
|
|
105
135
|
|
|
106
136
|
# @param [Hash] options
|
|
@@ -109,6 +139,7 @@ module OCCI
|
|
|
109
139
|
entity = Hashie::Mash.new
|
|
110
140
|
entity.kind = @kind if @kind
|
|
111
141
|
entity.mixins = @mixins if @mixins.any?
|
|
142
|
+
entity.actions = @actions if @actions.any?
|
|
112
143
|
entity.attributes = @attributes if @attributes.any?
|
|
113
144
|
entity
|
|
114
145
|
end
|
data/lib/occi/core/kind.rb
CHANGED
|
@@ -26,12 +26,12 @@ module OCCI
|
|
|
26
26
|
def entity_type
|
|
27
27
|
case type_identifier
|
|
28
28
|
when "http://schemas.ogf.org/occi/core#resource"
|
|
29
|
-
return OCCI::Core::Resource
|
|
29
|
+
return OCCI::Core::Resource
|
|
30
30
|
when "http://schemas.ogf.org/occi/core#link"
|
|
31
|
-
return OCCI::Core::Link
|
|
31
|
+
return OCCI::Core::Link
|
|
32
32
|
else
|
|
33
33
|
raise "no model back reference provided for kind #{self.typ_identifier}" unless @model
|
|
34
|
-
@model.get_by_id(self
|
|
34
|
+
@model.get_by_id(self.related.first).entity_type unless self.term == 'entity'
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
data/lib/occi/core/link.rb
CHANGED
|
@@ -6,26 +6,67 @@ module OCCI
|
|
|
6
6
|
module Core
|
|
7
7
|
class Link < Entity
|
|
8
8
|
|
|
9
|
+
attr_reader :rel
|
|
10
|
+
|
|
9
11
|
# @return [OCCI::Core::Kind] kind definition of Link type
|
|
10
12
|
def self.kind_definition
|
|
11
|
-
kind = OCCI::Core::Kind.new('http://schemas.ogf.org/occi/core#','link')
|
|
13
|
+
kind = OCCI::Core::Kind.new('http://schemas.ogf.org/occi/core#', 'link')
|
|
12
14
|
|
|
13
15
|
kind.related = %w{http://schemas.ogf.org/occi/core#entity}
|
|
14
|
-
kind.title
|
|
16
|
+
kind.title = "Link"
|
|
15
17
|
|
|
16
|
-
kind.attributes.occi!.core!.target!.
|
|
17
|
-
kind.attributes.occi!.core!.target!.
|
|
18
|
-
kind.attributes.occi!.core!.target!.
|
|
19
|
-
kind.attributes.occi!.core!.target!.
|
|
18
|
+
kind.attributes.occi!.core!.target!.Type = "string"
|
|
19
|
+
kind.attributes.occi!.core!.target!.Pattern = ".*"
|
|
20
|
+
kind.attributes.occi!.core!.target!.Required = false
|
|
21
|
+
kind.attributes.occi!.core!.target!.Mutable = true
|
|
20
22
|
|
|
21
|
-
kind.attributes.occi!.core!.source!.
|
|
22
|
-
kind.attributes.occi!.core!.source!.
|
|
23
|
-
kind.attributes.occi!.core!.source!.
|
|
24
|
-
kind.attributes.occi!.core!.source!.
|
|
23
|
+
kind.attributes.occi!.core!.source!.Type = "string"
|
|
24
|
+
kind.attributes.occi!.core!.source!.Pattern = ".*"
|
|
25
|
+
kind.attributes.occi!.core!.source!.Required = false
|
|
26
|
+
kind.attributes.occi!.core!.source!.Mutable = true
|
|
25
27
|
|
|
26
28
|
kind
|
|
27
29
|
end
|
|
28
30
|
|
|
31
|
+
# @return [String] target attribute of the link
|
|
32
|
+
def target
|
|
33
|
+
self.attributes.occi!.core!.summary
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# set target attribute of link
|
|
37
|
+
# @param [String] target
|
|
38
|
+
def target=(target)
|
|
39
|
+
self.attributes.occi!.core!.target = target
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @return [String] source attribute of the link
|
|
43
|
+
def source
|
|
44
|
+
self.attributes.occi!.core!.source
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# set source attribute of link
|
|
48
|
+
# @param [String] source
|
|
49
|
+
def source=(source)
|
|
50
|
+
self.attributes.occi!.core!.source = source
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def check(model)
|
|
54
|
+
target = model.get_by_id(self.target)
|
|
55
|
+
@rel = model.type_identifier if target.kind_of? OCCI::Core::Resource
|
|
56
|
+
super(model)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @param [Hash] options
|
|
60
|
+
# @return [Hashie::Mash] link as Hashie::Mash to be parsed into a JSON object
|
|
61
|
+
def as_json(options={ })
|
|
62
|
+
link = Hashie::Mash.new
|
|
63
|
+
link.kind = @kind if @kind
|
|
64
|
+
link.rel = @rel if @rel
|
|
65
|
+
link.mixins = @mixins if @mixins.any?
|
|
66
|
+
link.attributes = @attributes if @attributes.any?
|
|
67
|
+
link
|
|
68
|
+
end
|
|
69
|
+
|
|
29
70
|
end
|
|
30
71
|
end
|
|
31
72
|
end
|
data/lib/occi/core/resource.rb
CHANGED
|
@@ -21,14 +21,19 @@ module OCCI
|
|
|
21
21
|
kind.related = %w{http://schemas.ogf.org/occi/core#entity}
|
|
22
22
|
kind.title = 'Resource'
|
|
23
23
|
|
|
24
|
-
kind.attributes.occi!.core!.summary!.
|
|
25
|
-
kind.attributes.occi!.core!.summary!.
|
|
26
|
-
kind.attributes.occi!.core!.summary!.
|
|
27
|
-
kind.attributes.occi!.core!.summary!.
|
|
24
|
+
kind.attributes.occi!.core!.summary!.Type = 'string'
|
|
25
|
+
kind.attributes.occi!.core!.summary!.Pattern = '.*'
|
|
26
|
+
kind.attributes.occi!.core!.summary!.Required = false
|
|
27
|
+
kind.attributes.occi!.core!.summary!.Mutable = true
|
|
28
28
|
|
|
29
29
|
kind
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def links=(links)
|
|
33
|
+
@checked = false
|
|
34
|
+
@links = links
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
# set id for resource and update the the source of all links
|
|
33
38
|
# @param [UUIDTools::UUID] id
|
|
34
39
|
def id=(id)
|
|
@@ -36,6 +41,17 @@ module OCCI
|
|
|
36
41
|
@links.each { |link| link.attributes.occi!.core!.source = self.location }
|
|
37
42
|
end
|
|
38
43
|
|
|
44
|
+
# @return [String] summary attribute of the resource
|
|
45
|
+
def summary
|
|
46
|
+
self.attributes.occi!.core!.summary
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# set summary attribute of resource
|
|
50
|
+
# @param [String] summary
|
|
51
|
+
def summary=(summary)
|
|
52
|
+
self.attributes.occi!.core!.summary = summary
|
|
53
|
+
end
|
|
54
|
+
|
|
39
55
|
# update the source of all links before returning them
|
|
40
56
|
# @return [Array] links of resource
|
|
41
57
|
def links
|
data/lib/occi/model.rb
CHANGED
|
@@ -24,7 +24,7 @@ module OCCI
|
|
|
24
24
|
# register OCCI Infrastructure categories
|
|
25
25
|
def register_infrastructure
|
|
26
26
|
OCCI::Log.info "### Registering OCCI Infrastructure categories ###"
|
|
27
|
-
register_files 'etc/model/infrastructure'
|
|
27
|
+
register_files File.dirname(__FILE__) + '/../../etc/model/infrastructure'
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# register OCCI categories from files
|
|
@@ -50,7 +50,7 @@ module OCCI
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def reset()
|
|
53
|
-
@categories.each_value.each { |category| category.entities = [] if category.entities }
|
|
53
|
+
@categories.each_value.each { |category| category.entities = [] if category.respond_to? :entities }
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
# ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -88,7 +88,7 @@ module OCCI
|
|
|
88
88
|
#
|
|
89
89
|
# @param [OCCI::Collection] filter
|
|
90
90
|
# @return [OCCI::Collection] collection
|
|
91
|
-
def get(filter =
|
|
91
|
+
def get(filter = OCCI::Collection.new)
|
|
92
92
|
collection = OCCI::Collection.new
|
|
93
93
|
if filter.empty?
|
|
94
94
|
@categories.each_value do |category|
|
data/lib/occi/parser.rb
CHANGED
|
@@ -36,6 +36,8 @@ module OCCI
|
|
|
36
36
|
case media_type
|
|
37
37
|
when 'text/uri-list'
|
|
38
38
|
body.each_line { |line| locations << URI.parse(line) }
|
|
39
|
+
when 'text/occi'
|
|
40
|
+
nil
|
|
39
41
|
when 'text/plain', nil
|
|
40
42
|
locations.concat self.text_locations(body)
|
|
41
43
|
category ? collection = self.text_categories(body) : collection = self.text_entity(body, entity_type) if locations.empty? && collection.empty?
|
|
@@ -87,11 +89,11 @@ module OCCI
|
|
|
87
89
|
if entity_type == OCCI::Core::Link
|
|
88
90
|
entity.target = link.attributes!.occi!.core!.target
|
|
89
91
|
entity.source = link.attributes!.occi!.core!.source
|
|
90
|
-
collection.links << OCCI::Core::Link.new(entity.kind,entity.mixins,entity.attributes)
|
|
92
|
+
collection.links << OCCI::Core::Link.new(entity.kind, entity.mixins, entity.attributes)
|
|
91
93
|
elsif entity_type == OCCI::Core::Resource
|
|
92
94
|
link_strings = header['HTTP_LINK'].to_s.split(',')
|
|
93
95
|
link_strings.each { |link| entity.links << OCCIANTLR::Parser.new('Link: ' + link).link }
|
|
94
|
-
collection.resources << OCCI::Core::Resource.new(entity.kind,entity.mixins,entity.attributes,entity.links)
|
|
96
|
+
collection.resources << OCCI::Core::Resource.new(entity.kind, entity.mixins, entity.attributes, entity.links)
|
|
95
97
|
end
|
|
96
98
|
collection
|
|
97
99
|
end
|
|
@@ -127,10 +129,10 @@ module OCCI
|
|
|
127
129
|
if entity_type == OCCI::Core::Link
|
|
128
130
|
entity.target = links.first.attributes!.occi!.core!.target
|
|
129
131
|
entity.source = links.first.attributes!.occi!.core!.source
|
|
130
|
-
collection.links << OCCI::Core::Link.new(entity.kind,entity.mixins,entity.attributes)
|
|
132
|
+
collection.links << OCCI::Core::Link.new(entity.kind, entity.mixins, entity.attributes)
|
|
131
133
|
elsif entity_type == OCCI::Core::Resource
|
|
132
134
|
entity.links = links
|
|
133
|
-
collection.resources << OCCI::Core::Resource.new(entity.kind,entity.mixins,entity.attributes,entity.links)
|
|
135
|
+
collection.resources << OCCI::Core::Resource.new(entity.kind, entity.mixins, entity.attributes, entity.links)
|
|
134
136
|
end unless entity.kind.nil?
|
|
135
137
|
collection
|
|
136
138
|
end
|
|
@@ -290,7 +292,7 @@ module OCCI
|
|
|
290
292
|
raise "Disk with id #{id} not found" unless storage
|
|
291
293
|
storagelink.attributes.occi!.core!.target = storage.location
|
|
292
294
|
elsif host_resource.start_with? 'ovf:/file/'
|
|
293
|
-
id = host_resource.gsub('ovf:/file/','')
|
|
295
|
+
id = host_resource.gsub('ovf:/file/', '')
|
|
294
296
|
storagelink.attributes.occi!.core!.target = references[id]
|
|
295
297
|
end
|
|
296
298
|
compute.links << storagelink
|
data/lib/occi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: occi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2012-07-
|
|
13
|
+
date: 2012-07-26 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: json
|