saklient 0.0.1

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.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +43 -0
  6. data/Rakefile +1 -0
  7. data/config.sh.sample +5 -0
  8. data/example.rb +83 -0
  9. data/example.sh +6 -0
  10. data/lib/saklient/cloud/api.rb +382 -0
  11. data/lib/saklient/cloud/client.rb +111 -0
  12. data/lib/saklient/cloud/enums/eappliance_class.rb +39 -0
  13. data/lib/saklient/cloud/enums/eavailability.rb +79 -0
  14. data/lib/saklient/cloud/enums/edisk_connection.rb +39 -0
  15. data/lib/saklient/cloud/enums/escope.rb +39 -0
  16. data/lib/saklient/cloud/enums/escript_class.rb +39 -0
  17. data/lib/saklient/cloud/enums/eserver_instance_status.rb +44 -0
  18. data/lib/saklient/cloud/enums/estorage_class.rb +34 -0
  19. data/lib/saklient/cloud/errors/access_api_key_disabled_exception.rb +23 -0
  20. data/lib/saklient/cloud/errors/access_sakura_exception.rb +23 -0
  21. data/lib/saklient/cloud/errors/access_staff_exception.rb +23 -0
  22. data/lib/saklient/cloud/errors/access_token_exception.rb +23 -0
  23. data/lib/saklient/cloud/errors/access_xhr_or_api_key_exception.rb +23 -0
  24. data/lib/saklient/cloud/errors/account_not_found_exception.rb +23 -0
  25. data/lib/saklient/cloud/errors/account_not_specified_exception.rb +23 -0
  26. data/lib/saklient/cloud/errors/ambiguous_identifier_exception.rb +23 -0
  27. data/lib/saklient/cloud/errors/ambiguous_zone_exception.rb +23 -0
  28. data/lib/saklient/cloud/errors/api_proxy_timeout_exception.rb +23 -0
  29. data/lib/saklient/cloud/errors/api_proxy_timeout_non_get_exception.rb +23 -0
  30. data/lib/saklient/cloud/errors/archive_is_incomplete_exception.rb +23 -0
  31. data/lib/saklient/cloud/errors/boot_failure_by_lock_exception.rb +23 -0
  32. data/lib/saklient/cloud/errors/boot_failure_in_group_exception.rb +23 -0
  33. data/lib/saklient/cloud/errors/busy_exception.rb +23 -0
  34. data/lib/saklient/cloud/errors/cant_resize_smaller_exception.rb +23 -0
  35. data/lib/saklient/cloud/errors/cdrom_device_locked_exception.rb +23 -0
  36. data/lib/saklient/cloud/errors/cdrom_disabled_exception.rb +23 -0
  37. data/lib/saklient/cloud/errors/cdrom_in_use_exception.rb +23 -0
  38. data/lib/saklient/cloud/errors/cdrom_is_incomplete_exception.rb +23 -0
  39. data/lib/saklient/cloud/errors/connect_to_same_switch_exception.rb +23 -0
  40. data/lib/saklient/cloud/errors/contract_creation_exception.rb +23 -0
  41. data/lib/saklient/cloud/errors/copy_to_itself_exception.rb +23 -0
  42. data/lib/saklient/cloud/errors/delete_disk_b4_template_exception.rb +23 -0
  43. data/lib/saklient/cloud/errors/delete_ip_v6_nets_first_exception.rb +23 -0
  44. data/lib/saklient/cloud/errors/delete_res_b4_account_exception.rb +23 -0
  45. data/lib/saklient/cloud/errors/delete_router_b4_switch_exception.rb +23 -0
  46. data/lib/saklient/cloud/errors/delete_static_route_first_exception.rb +23 -0
  47. data/lib/saklient/cloud/errors/disabled_in_sandbox_exception.rb +23 -0
  48. data/lib/saklient/cloud/errors/disconnect_b4_delete_exception.rb +23 -0
  49. data/lib/saklient/cloud/errors/disconnect_b4_update_exception.rb +23 -0
  50. data/lib/saklient/cloud/errors/disk_connection_limit_exception.rb +23 -0
  51. data/lib/saklient/cloud/errors/disk_is_copying_exception.rb +23 -0
  52. data/lib/saklient/cloud/errors/disk_is_not_available_exception.rb +23 -0
  53. data/lib/saklient/cloud/errors/disk_license_mismatch_exception.rb +23 -0
  54. data/lib/saklient/cloud/errors/disk_or_ss_in_migration_exception.rb +23 -0
  55. data/lib/saklient/cloud/errors/disk_stock_run_out_exception.rb +23 -0
  56. data/lib/saklient/cloud/errors/dns_aaaa_record_not_found_exception.rb +23 -0
  57. data/lib/saklient/cloud/errors/dns_arecord_not_found_exception.rb +23 -0
  58. data/lib/saklient/cloud/errors/dns_ptr_update_failure_exception.rb +23 -0
  59. data/lib/saklient/cloud/errors/dont_create_in_sandbox_exception.rb +23 -0
  60. data/lib/saklient/cloud/errors/duplicate_account_code_exception.rb +23 -0
  61. data/lib/saklient/cloud/errors/duplicate_entry_exception.rb +23 -0
  62. data/lib/saklient/cloud/errors/duplicate_user_code_exception.rb +23 -0
  63. data/lib/saklient/cloud/errors/file_not_uploaded_exception.rb +23 -0
  64. data/lib/saklient/cloud/errors/filter_array_comparison_exception.rb +23 -0
  65. data/lib/saklient/cloud/errors/filter_bad_operator_exception.rb +23 -0
  66. data/lib/saklient/cloud/errors/filter_null_comparison_exception.rb +23 -0
  67. data/lib/saklient/cloud/errors/filter_unknown_operator_exception.rb +23 -0
  68. data/lib/saklient/cloud/errors/ftp_cannot_close_exception.rb +23 -0
  69. data/lib/saklient/cloud/errors/ftp_is_already_close_exception.rb +23 -0
  70. data/lib/saklient/cloud/errors/ftp_is_already_open_exception.rb +23 -0
  71. data/lib/saklient/cloud/errors/ftp_must_be_closed_exception.rb +23 -0
  72. data/lib/saklient/cloud/errors/host_operation_failure_exception.rb +23 -0
  73. data/lib/saklient/cloud/errors/illegal_das_usage_exception.rb +23 -0
  74. data/lib/saklient/cloud/errors/in_migration_exception.rb +23 -0
  75. data/lib/saklient/cloud/errors/invalid_format_exception.rb +23 -0
  76. data/lib/saklient/cloud/errors/invalid_param_comb_exception.rb +23 -0
  77. data/lib/saklient/cloud/errors/invalid_range_exception.rb +23 -0
  78. data/lib/saklient/cloud/errors/invalid_uri_argument_exception.rb +23 -0
  79. data/lib/saklient/cloud/errors/ip_v6_net_already_attached_exception.rb +23 -0
  80. data/lib/saklient/cloud/errors/limit_count_in_account_exception.rb +23 -0
  81. data/lib/saklient/cloud/errors/limit_count_in_member_exception.rb +23 -0
  82. data/lib/saklient/cloud/errors/limit_count_in_network_exception.rb +23 -0
  83. data/lib/saklient/cloud/errors/limit_count_in_router_exception.rb +23 -0
  84. data/lib/saklient/cloud/errors/limit_count_in_zone_exception.rb +23 -0
  85. data/lib/saklient/cloud/errors/limit_memory_in_account_exception.rb +23 -0
  86. data/lib/saklient/cloud/errors/limit_size_in_account_exception.rb +23 -0
  87. data/lib/saklient/cloud/errors/missing_iso_image_exception.rb +23 -0
  88. data/lib/saklient/cloud/errors/missing_param_exception.rb +23 -0
  89. data/lib/saklient/cloud/errors/must_be_of_same_zone_exception.rb +23 -0
  90. data/lib/saklient/cloud/errors/no_display_response_exception.rb +23 -0
  91. data/lib/saklient/cloud/errors/not_for_router_exception.rb +23 -0
  92. data/lib/saklient/cloud/errors/not_replicating_exception.rb +23 -0
  93. data/lib/saklient/cloud/errors/not_with_hybridconn_exception.rb +23 -0
  94. data/lib/saklient/cloud/errors/old_storage_plan_exception.rb +23 -0
  95. data/lib/saklient/cloud/errors/operation_failure_exception.rb +23 -0
  96. data/lib/saklient/cloud/errors/operation_timeout_exception.rb +23 -0
  97. data/lib/saklient/cloud/errors/original_hash_mismatch_exception.rb +23 -0
  98. data/lib/saklient/cloud/errors/packet_filter_applying_exception.rb +23 -0
  99. data/lib/saklient/cloud/errors/packet_filter_version_mismatch_exception.rb +23 -0
  100. data/lib/saklient/cloud/errors/param_ip_not_found_exception.rb +23 -0
  101. data/lib/saklient/cloud/errors/param_res_not_found_exception.rb +23 -0
  102. data/lib/saklient/cloud/errors/payment_credit_card_exception.rb +23 -0
  103. data/lib/saklient/cloud/errors/payment_payment_exception.rb +23 -0
  104. data/lib/saklient/cloud/errors/payment_registration_exception.rb +23 -0
  105. data/lib/saklient/cloud/errors/payment_tel_certification_exception.rb +23 -0
  106. data/lib/saklient/cloud/errors/payment_unpayable_exception.rb +23 -0
  107. data/lib/saklient/cloud/errors/penalty_operation_exception.rb +23 -0
  108. data/lib/saklient/cloud/errors/replica_already_exists_exception.rb +23 -0
  109. data/lib/saklient/cloud/errors/replica_not_found_exception.rb +23 -0
  110. data/lib/saklient/cloud/errors/res_already_connected_exception.rb +23 -0
  111. data/lib/saklient/cloud/errors/res_already_disconnected_exception.rb +23 -0
  112. data/lib/saklient/cloud/errors/res_already_exists_exception.rb +23 -0
  113. data/lib/saklient/cloud/errors/res_used_in_zone_exception.rb +23 -0
  114. data/lib/saklient/cloud/errors/resource_path_not_found_exception.rb +23 -0
  115. data/lib/saklient/cloud/errors/run_out_of_ip_address_exception.rb +23 -0
  116. data/lib/saklient/cloud/errors/same_license_required_exception.rb +23 -0
  117. data/lib/saklient/cloud/errors/server_could_not_stop_exception.rb +23 -0
  118. data/lib/saklient/cloud/errors/server_is_cleaning_exception.rb +23 -0
  119. data/lib/saklient/cloud/errors/server_operation_failure_exception.rb +23 -0
  120. data/lib/saklient/cloud/errors/server_power_must_be_down_exception.rb +23 -0
  121. data/lib/saklient/cloud/errors/server_power_must_be_up_exception.rb +23 -0
  122. data/lib/saklient/cloud/errors/service_temporarily_unavailable_exception.rb +23 -0
  123. data/lib/saklient/cloud/errors/size_mismatch_exception.rb +23 -0
  124. data/lib/saklient/cloud/errors/snapshot_in_migration_exception.rb +23 -0
  125. data/lib/saklient/cloud/errors/still_creating_exception.rb +23 -0
  126. data/lib/saklient/cloud/errors/storage_abnormal_exception.rb +23 -0
  127. data/lib/saklient/cloud/errors/storage_operation_failure_exception.rb +23 -0
  128. data/lib/saklient/cloud/errors/switch_hybrid_connected_exception.rb +23 -0
  129. data/lib/saklient/cloud/errors/template_ftp_is_open_exception.rb +23 -0
  130. data/lib/saklient/cloud/errors/template_is_incomplete_exception.rb +23 -0
  131. data/lib/saklient/cloud/errors/too_many_request_exception.rb +23 -0
  132. data/lib/saklient/cloud/errors/unknown_exception.rb +23 -0
  133. data/lib/saklient/cloud/errors/unknown_os_type_exception.rb +23 -0
  134. data/lib/saklient/cloud/errors/unsupported_res_class_exception.rb +23 -0
  135. data/lib/saklient/cloud/errors/user_not_specified_exception.rb +23 -0
  136. data/lib/saklient/cloud/errors/vnc_proxy_request_failure_exception.rb +23 -0
  137. data/lib/saklient/cloud/models/model.rb +348 -0
  138. data/lib/saklient/cloud/models/model_appliance.rb +161 -0
  139. data/lib/saklient/cloud/models/model_archive.rb +207 -0
  140. data/lib/saklient/cloud/models/model_disk.rb +200 -0
  141. data/lib/saklient/cloud/models/model_disk_plan.rb +156 -0
  142. data/lib/saklient/cloud/models/model_icon.rb +178 -0
  143. data/lib/saklient/cloud/models/model_iface.rb +115 -0
  144. data/lib/saklient/cloud/models/model_ipv6_net.rb +106 -0
  145. data/lib/saklient/cloud/models/model_iso_image.rb +207 -0
  146. data/lib/saklient/cloud/models/model_router.rb +148 -0
  147. data/lib/saklient/cloud/models/model_router_plan.rb +106 -0
  148. data/lib/saklient/cloud/models/model_script.rb +178 -0
  149. data/lib/saklient/cloud/models/model_server.rb +237 -0
  150. data/lib/saklient/cloud/models/model_server_plan.rb +119 -0
  151. data/lib/saklient/cloud/models/model_swytch.rb +138 -0
  152. data/lib/saklient/cloud/models/query_params.rb +44 -0
  153. data/lib/saklient/cloud/product.rb +95 -0
  154. data/lib/saklient/cloud/resources/appliance.rb +551 -0
  155. data/lib/saklient/cloud/resources/archive.rb +861 -0
  156. data/lib/saklient/cloud/resources/disk.rb +802 -0
  157. data/lib/saklient/cloud/resources/disk_config.rb +353 -0
  158. data/lib/saklient/cloud/resources/disk_plan.rb +194 -0
  159. data/lib/saklient/cloud/resources/ftp_info.rb +93 -0
  160. data/lib/saklient/cloud/resources/icon.rb +268 -0
  161. data/lib/saklient/cloud/resources/iface.rb +329 -0
  162. data/lib/saklient/cloud/resources/ipv4_net.rb +275 -0
  163. data/lib/saklient/cloud/resources/ipv6_net.rb +238 -0
  164. data/lib/saklient/cloud/resources/iso_image.rb +666 -0
  165. data/lib/saklient/cloud/resources/resource.rb +287 -0
  166. data/lib/saklient/cloud/resources/router.rb +508 -0
  167. data/lib/saklient/cloud/resources/router_plan.rb +230 -0
  168. data/lib/saklient/cloud/resources/script.rb +554 -0
  169. data/lib/saklient/cloud/resources/server.rb +730 -0
  170. data/lib/saklient/cloud/resources/server_instance.rb +217 -0
  171. data/lib/saklient/cloud/resources/server_plan.rb +285 -0
  172. data/lib/saklient/cloud/resources/swytch.rb +521 -0
  173. data/lib/saklient/errors/exception_factory.rb +532 -0
  174. data/lib/saklient/errors/http_bad_gateway_exception.rb +21 -0
  175. data/lib/saklient/errors/http_bad_request_exception.rb +21 -0
  176. data/lib/saklient/errors/http_conflict_exception.rb +21 -0
  177. data/lib/saklient/errors/http_exception.rb +27 -0
  178. data/lib/saklient/errors/http_expectation_failed_exception.rb +21 -0
  179. data/lib/saklient/errors/http_failed_dependency_exception.rb +21 -0
  180. data/lib/saklient/errors/http_forbidden_exception.rb +21 -0
  181. data/lib/saklient/errors/http_gateway_timeout_exception.rb +21 -0
  182. data/lib/saklient/errors/http_gone_exception.rb +21 -0
  183. data/lib/saklient/errors/http_http_version_not_supported_exception.rb +21 -0
  184. data/lib/saklient/errors/http_insufficient_storage_exception.rb +21 -0
  185. data/lib/saklient/errors/http_internal_server_error_exception.rb +21 -0
  186. data/lib/saklient/errors/http_length_required_exception.rb +21 -0
  187. data/lib/saklient/errors/http_locked_exception.rb +21 -0
  188. data/lib/saklient/errors/http_method_not_allowed_exception.rb +21 -0
  189. data/lib/saklient/errors/http_not_acceptable_exception.rb +21 -0
  190. data/lib/saklient/errors/http_not_extended_exception.rb +21 -0
  191. data/lib/saklient/errors/http_not_found_exception.rb +21 -0
  192. data/lib/saklient/errors/http_not_implemented_exception.rb +21 -0
  193. data/lib/saklient/errors/http_payment_required_exception.rb +21 -0
  194. data/lib/saklient/errors/http_precondition_failed_exception.rb +21 -0
  195. data/lib/saklient/errors/http_proxy_authentication_required_exception.rb +21 -0
  196. data/lib/saklient/errors/http_request_entity_too_large_exception.rb +21 -0
  197. data/lib/saklient/errors/http_request_timeout_exception.rb +21 -0
  198. data/lib/saklient/errors/http_request_uri_too_long_exception.rb +21 -0
  199. data/lib/saklient/errors/http_requested_range_not_satisfiable_exception.rb +21 -0
  200. data/lib/saklient/errors/http_service_unavailable_exception.rb +21 -0
  201. data/lib/saklient/errors/http_unauthorized_exception.rb +21 -0
  202. data/lib/saklient/errors/http_unprocessable_entity_exception.rb +21 -0
  203. data/lib/saklient/errors/http_unsupported_media_type_exception.rb +21 -0
  204. data/lib/saklient/errors/http_upgrade_required_exception.rb +21 -0
  205. data/lib/saklient/errors/http_variant_also_negotiates_exception.rb +21 -0
  206. data/lib/saklient/errors/saklient_exception.rb +22 -0
  207. data/lib/saklient/util.rb +121 -0
  208. data/lib/saklient/version.rb +5 -0
  209. data/saklient.gemspec +24 -0
  210. data/spec/archive_spec.rb +141 -0
  211. data/spec/enum_spec.rb +24 -0
  212. data/spec/exception_spec.rb +25 -0
  213. data/spec/iso_image_spec.rb +172 -0
  214. data/spec/router_spec.rb +124 -0
  215. data/spec/server_spec.rb +261 -0
  216. data/spec/util_spec.rb +72 -0
  217. data/test-sshkey.txt +27 -0
  218. metadata +281 -0
@@ -0,0 +1,275 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../client'
4
+ require_relative 'resource'
5
+ require_relative 'swytch'
6
+
7
+ module Saklient
8
+ module Cloud
9
+ module Resources
10
+
11
+ # IPv4ネットワークの実体1つに対応し, 属性の取得や操作を行うためのクラス.
12
+ class Ipv4Net < Saklient::Cloud::Resources::Resource
13
+
14
+ protected
15
+
16
+ # ID
17
+ #
18
+ # @return [String]
19
+ attr_accessor :m_id
20
+
21
+ # ネットワークアドレス
22
+ #
23
+ # @return [String]
24
+ attr_accessor :m_address
25
+
26
+ # マスク長
27
+ #
28
+ # @return [Fixnum]
29
+ attr_accessor :m_mask_len
30
+
31
+ # デフォルトルート
32
+ #
33
+ # @return [String]
34
+ attr_accessor :m_default_route
35
+
36
+ # ネクストホップ
37
+ #
38
+ # @return [String]
39
+ attr_accessor :m_next_hop
40
+
41
+ # @private
42
+ # @return [String]
43
+ def _api_path
44
+ return '/subnet'
45
+ end
46
+
47
+ # @private
48
+ # @return [String]
49
+ def _root_key
50
+ return 'Subnet'
51
+ end
52
+
53
+ # @private
54
+ # @return [String]
55
+ def _root_key_m
56
+ return 'Subnets'
57
+ end
58
+
59
+ public
60
+
61
+ # @private
62
+ # @return [String]
63
+ def _class_name
64
+ return 'Ipv4Net'
65
+ end
66
+
67
+ # @private
68
+ # @return [String]
69
+ def _id
70
+ return get_id
71
+ end
72
+
73
+ # 最新のリソース情報を再取得します.
74
+ #
75
+ # @return [Swytch] this
76
+ def reload
77
+ return _reload
78
+ end
79
+
80
+ # @private
81
+ # @param [Saklient::Cloud::Client] client
82
+ # @param [any] obj
83
+ # @param [bool] wrapped
84
+ def initialize(client, obj, wrapped = false)
85
+ super(client)
86
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
87
+ Saklient::Util::validate_type(wrapped, 'bool')
88
+ api_deserialize(obj, wrapped)
89
+ end
90
+
91
+ protected
92
+
93
+ # @return [bool]
94
+ attr_accessor :n_id
95
+
96
+ # (This method is generated in Translator_default#buildImpl)
97
+ #
98
+ # @private
99
+ # @return [String]
100
+ def get_id
101
+ return @m_id
102
+ end
103
+
104
+ public
105
+
106
+ # ID
107
+ #
108
+ # @return [String]
109
+ attr_reader :id
110
+
111
+ def id
112
+ get_id
113
+ end
114
+
115
+ protected
116
+
117
+ # @return [bool]
118
+ attr_accessor :n_address
119
+
120
+ # (This method is generated in Translator_default#buildImpl)
121
+ #
122
+ # @private
123
+ # @return [String]
124
+ def get_address
125
+ return @m_address
126
+ end
127
+
128
+ public
129
+
130
+ # ネットワークアドレス
131
+ #
132
+ # @return [String]
133
+ attr_reader :address
134
+
135
+ def address
136
+ get_address
137
+ end
138
+
139
+ protected
140
+
141
+ # @return [bool]
142
+ attr_accessor :n_mask_len
143
+
144
+ # (This method is generated in Translator_default#buildImpl)
145
+ #
146
+ # @private
147
+ # @return [Fixnum]
148
+ def get_mask_len
149
+ return @m_mask_len
150
+ end
151
+
152
+ public
153
+
154
+ # マスク長
155
+ #
156
+ # @return [Fixnum]
157
+ attr_reader :mask_len
158
+
159
+ def mask_len
160
+ get_mask_len
161
+ end
162
+
163
+ protected
164
+
165
+ # @return [bool]
166
+ attr_accessor :n_default_route
167
+
168
+ # (This method is generated in Translator_default#buildImpl)
169
+ #
170
+ # @private
171
+ # @return [String]
172
+ def get_default_route
173
+ return @m_default_route
174
+ end
175
+
176
+ public
177
+
178
+ # デフォルトルート
179
+ #
180
+ # @return [String]
181
+ attr_reader :default_route
182
+
183
+ def default_route
184
+ get_default_route
185
+ end
186
+
187
+ protected
188
+
189
+ # @return [bool]
190
+ attr_accessor :n_next_hop
191
+
192
+ # (This method is generated in Translator_default#buildImpl)
193
+ #
194
+ # @private
195
+ # @return [String]
196
+ def get_next_hop
197
+ return @m_next_hop
198
+ end
199
+
200
+ public
201
+
202
+ # ネクストホップ
203
+ #
204
+ # @return [String]
205
+ attr_reader :next_hop
206
+
207
+ def next_hop
208
+ get_next_hop
209
+ end
210
+
211
+ protected
212
+
213
+ # (This method is generated in Translator_default#buildImpl)
214
+ #
215
+ # @param [any] r
216
+ def api_deserialize_impl(r)
217
+ @is_new = (r).nil?
218
+ r = {} if @is_new
219
+ @is_incomplete = false
220
+ if Saklient::Util::exists_path(r, 'ID')
221
+ @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
222
+ else
223
+ @m_id = nil
224
+ @is_incomplete = true
225
+ end
226
+ @n_id = false
227
+ if Saklient::Util::exists_path(r, 'NetworkAddress')
228
+ @m_address = (Saklient::Util::get_by_path(r, 'NetworkAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'NetworkAddress').to_s
229
+ else
230
+ @m_address = nil
231
+ @is_incomplete = true
232
+ end
233
+ @n_address = false
234
+ if Saklient::Util::exists_path(r, 'NetworkMaskLen')
235
+ @m_mask_len = (Saklient::Util::get_by_path(r, 'NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'NetworkMaskLen').to_s).to_i(10)
236
+ else
237
+ @m_mask_len = nil
238
+ @is_incomplete = true
239
+ end
240
+ @n_mask_len = false
241
+ if Saklient::Util::exists_path(r, 'DefaultRoute')
242
+ @m_default_route = (Saklient::Util::get_by_path(r, 'DefaultRoute')).nil? ? nil : Saklient::Util::get_by_path(r, 'DefaultRoute').to_s
243
+ else
244
+ @m_default_route = nil
245
+ @is_incomplete = true
246
+ end
247
+ @n_default_route = false
248
+ if Saklient::Util::exists_path(r, 'NextHop')
249
+ @m_next_hop = (Saklient::Util::get_by_path(r, 'NextHop')).nil? ? nil : Saklient::Util::get_by_path(r, 'NextHop').to_s
250
+ else
251
+ @m_next_hop = nil
252
+ @is_incomplete = true
253
+ end
254
+ @n_next_hop = false
255
+ end
256
+
257
+ # @private
258
+ # @param [bool] withClean
259
+ # @return [any]
260
+ def api_serialize_impl(withClean = false)
261
+ Saklient::Util::validate_type(withClean, 'bool')
262
+ ret = {}
263
+ Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
264
+ Saklient::Util::set_by_path(ret, 'NetworkAddress', @m_address) if withClean || @n_address
265
+ Saklient::Util::set_by_path(ret, 'NetworkMaskLen', @m_mask_len) if withClean || @n_mask_len
266
+ Saklient::Util::set_by_path(ret, 'DefaultRoute', @m_default_route) if withClean || @n_default_route
267
+ Saklient::Util::set_by_path(ret, 'NextHop', @m_next_hop) if withClean || @n_next_hop
268
+ return ret
269
+ end
270
+
271
+ end
272
+
273
+ end
274
+ end
275
+ end
@@ -0,0 +1,238 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../client'
4
+ require_relative 'resource'
5
+ require_relative 'swytch'
6
+
7
+ module Saklient
8
+ module Cloud
9
+ module Resources
10
+
11
+ # IPv6ネットワークの実体1つに対応し, 属性の取得や操作を行うためのクラス.
12
+ class Ipv6Net < Saklient::Cloud::Resources::Resource
13
+
14
+ protected
15
+
16
+ # ID
17
+ #
18
+ # @return [String]
19
+ attr_accessor :m_id
20
+
21
+ # ネットワークプレフィックス
22
+ #
23
+ # @return [String]
24
+ attr_accessor :m_prefix
25
+
26
+ # ネットワークプレフィックス長
27
+ #
28
+ # @return [Fixnum]
29
+ attr_accessor :m_prefix_len
30
+
31
+ # このネットワーク範囲における最後のIPv6アドレス
32
+ #
33
+ # @return [String]
34
+ attr_accessor :m_prefix_tail
35
+
36
+ # @private
37
+ # @return [String]
38
+ def _api_path
39
+ return '/ipv6net'
40
+ end
41
+
42
+ # @private
43
+ # @return [String]
44
+ def _root_key
45
+ return 'IPv6Net'
46
+ end
47
+
48
+ # @private
49
+ # @return [String]
50
+ def _root_key_m
51
+ return 'IPv6Nets'
52
+ end
53
+
54
+ public
55
+
56
+ # @private
57
+ # @return [String]
58
+ def _class_name
59
+ return 'Ipv6Net'
60
+ end
61
+
62
+ # @private
63
+ # @return [String]
64
+ def _id
65
+ return get_id
66
+ end
67
+
68
+ # 最新のリソース情報を再取得します.
69
+ #
70
+ # @return [Swytch] this
71
+ def reload
72
+ return _reload
73
+ end
74
+
75
+ # @private
76
+ # @param [Saklient::Cloud::Client] client
77
+ # @param [any] obj
78
+ # @param [bool] wrapped
79
+ def initialize(client, obj, wrapped = false)
80
+ super(client)
81
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
82
+ Saklient::Util::validate_type(wrapped, 'bool')
83
+ api_deserialize(obj, wrapped)
84
+ end
85
+
86
+ protected
87
+
88
+ # @return [bool]
89
+ attr_accessor :n_id
90
+
91
+ # (This method is generated in Translator_default#buildImpl)
92
+ #
93
+ # @private
94
+ # @return [String]
95
+ def get_id
96
+ return @m_id
97
+ end
98
+
99
+ public
100
+
101
+ # ID
102
+ #
103
+ # @return [String]
104
+ attr_reader :id
105
+
106
+ def id
107
+ get_id
108
+ end
109
+
110
+ protected
111
+
112
+ # @return [bool]
113
+ attr_accessor :n_prefix
114
+
115
+ # (This method is generated in Translator_default#buildImpl)
116
+ #
117
+ # @private
118
+ # @return [String]
119
+ def get_prefix
120
+ return @m_prefix
121
+ end
122
+
123
+ public
124
+
125
+ # ネットワークプレフィックス
126
+ #
127
+ # @return [String]
128
+ attr_reader :prefix
129
+
130
+ def prefix
131
+ get_prefix
132
+ end
133
+
134
+ protected
135
+
136
+ # @return [bool]
137
+ attr_accessor :n_prefix_len
138
+
139
+ # (This method is generated in Translator_default#buildImpl)
140
+ #
141
+ # @private
142
+ # @return [Fixnum]
143
+ def get_prefix_len
144
+ return @m_prefix_len
145
+ end
146
+
147
+ public
148
+
149
+ # ネットワークプレフィックス長
150
+ #
151
+ # @return [Fixnum]
152
+ attr_reader :prefix_len
153
+
154
+ def prefix_len
155
+ get_prefix_len
156
+ end
157
+
158
+ protected
159
+
160
+ # @return [bool]
161
+ attr_accessor :n_prefix_tail
162
+
163
+ # (This method is generated in Translator_default#buildImpl)
164
+ #
165
+ # @private
166
+ # @return [String]
167
+ def get_prefix_tail
168
+ return @m_prefix_tail
169
+ end
170
+
171
+ public
172
+
173
+ # このネットワーク範囲における最後のIPv6アドレス
174
+ #
175
+ # @return [String]
176
+ attr_reader :prefix_tail
177
+
178
+ def prefix_tail
179
+ get_prefix_tail
180
+ end
181
+
182
+ protected
183
+
184
+ # (This method is generated in Translator_default#buildImpl)
185
+ #
186
+ # @param [any] r
187
+ def api_deserialize_impl(r)
188
+ @is_new = (r).nil?
189
+ r = {} if @is_new
190
+ @is_incomplete = false
191
+ if Saklient::Util::exists_path(r, 'ID')
192
+ @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
193
+ else
194
+ @m_id = nil
195
+ @is_incomplete = true
196
+ end
197
+ @n_id = false
198
+ if Saklient::Util::exists_path(r, 'IPv6Prefix')
199
+ @m_prefix = (Saklient::Util::get_by_path(r, 'IPv6Prefix')).nil? ? nil : Saklient::Util::get_by_path(r, 'IPv6Prefix').to_s
200
+ else
201
+ @m_prefix = nil
202
+ @is_incomplete = true
203
+ end
204
+ @n_prefix = false
205
+ if Saklient::Util::exists_path(r, 'IPv6PrefixLen')
206
+ @m_prefix_len = (Saklient::Util::get_by_path(r, 'IPv6PrefixLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'IPv6PrefixLen').to_s).to_i(10)
207
+ else
208
+ @m_prefix_len = nil
209
+ @is_incomplete = true
210
+ end
211
+ @n_prefix_len = false
212
+ if Saklient::Util::exists_path(r, 'IPv6PrefixTail')
213
+ @m_prefix_tail = (Saklient::Util::get_by_path(r, 'IPv6PrefixTail')).nil? ? nil : Saklient::Util::get_by_path(r, 'IPv6PrefixTail').to_s
214
+ else
215
+ @m_prefix_tail = nil
216
+ @is_incomplete = true
217
+ end
218
+ @n_prefix_tail = false
219
+ end
220
+
221
+ # @private
222
+ # @param [bool] withClean
223
+ # @return [any]
224
+ def api_serialize_impl(withClean = false)
225
+ Saklient::Util::validate_type(withClean, 'bool')
226
+ ret = {}
227
+ Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
228
+ Saklient::Util::set_by_path(ret, 'IPv6Prefix', @m_prefix) if withClean || @n_prefix
229
+ Saklient::Util::set_by_path(ret, 'IPv6PrefixLen', @m_prefix_len) if withClean || @n_prefix_len
230
+ Saklient::Util::set_by_path(ret, 'IPv6PrefixTail', @m_prefix_tail) if withClean || @n_prefix_tail
231
+ return ret
232
+ end
233
+
234
+ end
235
+
236
+ end
237
+ end
238
+ end