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.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/config.sh.sample +5 -0
- data/example.rb +83 -0
- data/example.sh +6 -0
- data/lib/saklient/cloud/api.rb +382 -0
- data/lib/saklient/cloud/client.rb +111 -0
- data/lib/saklient/cloud/enums/eappliance_class.rb +39 -0
- data/lib/saklient/cloud/enums/eavailability.rb +79 -0
- data/lib/saklient/cloud/enums/edisk_connection.rb +39 -0
- data/lib/saklient/cloud/enums/escope.rb +39 -0
- data/lib/saklient/cloud/enums/escript_class.rb +39 -0
- data/lib/saklient/cloud/enums/eserver_instance_status.rb +44 -0
- data/lib/saklient/cloud/enums/estorage_class.rb +34 -0
- data/lib/saklient/cloud/errors/access_api_key_disabled_exception.rb +23 -0
- data/lib/saklient/cloud/errors/access_sakura_exception.rb +23 -0
- data/lib/saklient/cloud/errors/access_staff_exception.rb +23 -0
- data/lib/saklient/cloud/errors/access_token_exception.rb +23 -0
- data/lib/saklient/cloud/errors/access_xhr_or_api_key_exception.rb +23 -0
- data/lib/saklient/cloud/errors/account_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/account_not_specified_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ambiguous_identifier_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ambiguous_zone_exception.rb +23 -0
- data/lib/saklient/cloud/errors/api_proxy_timeout_exception.rb +23 -0
- data/lib/saklient/cloud/errors/api_proxy_timeout_non_get_exception.rb +23 -0
- data/lib/saklient/cloud/errors/archive_is_incomplete_exception.rb +23 -0
- data/lib/saklient/cloud/errors/boot_failure_by_lock_exception.rb +23 -0
- data/lib/saklient/cloud/errors/boot_failure_in_group_exception.rb +23 -0
- data/lib/saklient/cloud/errors/busy_exception.rb +23 -0
- data/lib/saklient/cloud/errors/cant_resize_smaller_exception.rb +23 -0
- data/lib/saklient/cloud/errors/cdrom_device_locked_exception.rb +23 -0
- data/lib/saklient/cloud/errors/cdrom_disabled_exception.rb +23 -0
- data/lib/saklient/cloud/errors/cdrom_in_use_exception.rb +23 -0
- data/lib/saklient/cloud/errors/cdrom_is_incomplete_exception.rb +23 -0
- data/lib/saklient/cloud/errors/connect_to_same_switch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/contract_creation_exception.rb +23 -0
- data/lib/saklient/cloud/errors/copy_to_itself_exception.rb +23 -0
- data/lib/saklient/cloud/errors/delete_disk_b4_template_exception.rb +23 -0
- data/lib/saklient/cloud/errors/delete_ip_v6_nets_first_exception.rb +23 -0
- data/lib/saklient/cloud/errors/delete_res_b4_account_exception.rb +23 -0
- data/lib/saklient/cloud/errors/delete_router_b4_switch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/delete_static_route_first_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disabled_in_sandbox_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disconnect_b4_delete_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disconnect_b4_update_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_connection_limit_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_is_copying_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_is_not_available_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_license_mismatch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_or_ss_in_migration_exception.rb +23 -0
- data/lib/saklient/cloud/errors/disk_stock_run_out_exception.rb +23 -0
- data/lib/saklient/cloud/errors/dns_aaaa_record_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/dns_arecord_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/dns_ptr_update_failure_exception.rb +23 -0
- data/lib/saklient/cloud/errors/dont_create_in_sandbox_exception.rb +23 -0
- data/lib/saklient/cloud/errors/duplicate_account_code_exception.rb +23 -0
- data/lib/saklient/cloud/errors/duplicate_entry_exception.rb +23 -0
- data/lib/saklient/cloud/errors/duplicate_user_code_exception.rb +23 -0
- data/lib/saklient/cloud/errors/file_not_uploaded_exception.rb +23 -0
- data/lib/saklient/cloud/errors/filter_array_comparison_exception.rb +23 -0
- data/lib/saklient/cloud/errors/filter_bad_operator_exception.rb +23 -0
- data/lib/saklient/cloud/errors/filter_null_comparison_exception.rb +23 -0
- data/lib/saklient/cloud/errors/filter_unknown_operator_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ftp_cannot_close_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ftp_is_already_close_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ftp_is_already_open_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ftp_must_be_closed_exception.rb +23 -0
- data/lib/saklient/cloud/errors/host_operation_failure_exception.rb +23 -0
- data/lib/saklient/cloud/errors/illegal_das_usage_exception.rb +23 -0
- data/lib/saklient/cloud/errors/in_migration_exception.rb +23 -0
- data/lib/saklient/cloud/errors/invalid_format_exception.rb +23 -0
- data/lib/saklient/cloud/errors/invalid_param_comb_exception.rb +23 -0
- data/lib/saklient/cloud/errors/invalid_range_exception.rb +23 -0
- data/lib/saklient/cloud/errors/invalid_uri_argument_exception.rb +23 -0
- data/lib/saklient/cloud/errors/ip_v6_net_already_attached_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_count_in_account_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_count_in_member_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_count_in_network_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_count_in_router_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_count_in_zone_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_memory_in_account_exception.rb +23 -0
- data/lib/saklient/cloud/errors/limit_size_in_account_exception.rb +23 -0
- data/lib/saklient/cloud/errors/missing_iso_image_exception.rb +23 -0
- data/lib/saklient/cloud/errors/missing_param_exception.rb +23 -0
- data/lib/saklient/cloud/errors/must_be_of_same_zone_exception.rb +23 -0
- data/lib/saklient/cloud/errors/no_display_response_exception.rb +23 -0
- data/lib/saklient/cloud/errors/not_for_router_exception.rb +23 -0
- data/lib/saklient/cloud/errors/not_replicating_exception.rb +23 -0
- data/lib/saklient/cloud/errors/not_with_hybridconn_exception.rb +23 -0
- data/lib/saklient/cloud/errors/old_storage_plan_exception.rb +23 -0
- data/lib/saklient/cloud/errors/operation_failure_exception.rb +23 -0
- data/lib/saklient/cloud/errors/operation_timeout_exception.rb +23 -0
- data/lib/saklient/cloud/errors/original_hash_mismatch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/packet_filter_applying_exception.rb +23 -0
- data/lib/saklient/cloud/errors/packet_filter_version_mismatch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/param_ip_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/param_res_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/payment_credit_card_exception.rb +23 -0
- data/lib/saklient/cloud/errors/payment_payment_exception.rb +23 -0
- data/lib/saklient/cloud/errors/payment_registration_exception.rb +23 -0
- data/lib/saklient/cloud/errors/payment_tel_certification_exception.rb +23 -0
- data/lib/saklient/cloud/errors/payment_unpayable_exception.rb +23 -0
- data/lib/saklient/cloud/errors/penalty_operation_exception.rb +23 -0
- data/lib/saklient/cloud/errors/replica_already_exists_exception.rb +23 -0
- data/lib/saklient/cloud/errors/replica_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/res_already_connected_exception.rb +23 -0
- data/lib/saklient/cloud/errors/res_already_disconnected_exception.rb +23 -0
- data/lib/saklient/cloud/errors/res_already_exists_exception.rb +23 -0
- data/lib/saklient/cloud/errors/res_used_in_zone_exception.rb +23 -0
- data/lib/saklient/cloud/errors/resource_path_not_found_exception.rb +23 -0
- data/lib/saklient/cloud/errors/run_out_of_ip_address_exception.rb +23 -0
- data/lib/saklient/cloud/errors/same_license_required_exception.rb +23 -0
- data/lib/saklient/cloud/errors/server_could_not_stop_exception.rb +23 -0
- data/lib/saklient/cloud/errors/server_is_cleaning_exception.rb +23 -0
- data/lib/saklient/cloud/errors/server_operation_failure_exception.rb +23 -0
- data/lib/saklient/cloud/errors/server_power_must_be_down_exception.rb +23 -0
- data/lib/saklient/cloud/errors/server_power_must_be_up_exception.rb +23 -0
- data/lib/saklient/cloud/errors/service_temporarily_unavailable_exception.rb +23 -0
- data/lib/saklient/cloud/errors/size_mismatch_exception.rb +23 -0
- data/lib/saklient/cloud/errors/snapshot_in_migration_exception.rb +23 -0
- data/lib/saklient/cloud/errors/still_creating_exception.rb +23 -0
- data/lib/saklient/cloud/errors/storage_abnormal_exception.rb +23 -0
- data/lib/saklient/cloud/errors/storage_operation_failure_exception.rb +23 -0
- data/lib/saklient/cloud/errors/switch_hybrid_connected_exception.rb +23 -0
- data/lib/saklient/cloud/errors/template_ftp_is_open_exception.rb +23 -0
- data/lib/saklient/cloud/errors/template_is_incomplete_exception.rb +23 -0
- data/lib/saklient/cloud/errors/too_many_request_exception.rb +23 -0
- data/lib/saklient/cloud/errors/unknown_exception.rb +23 -0
- data/lib/saklient/cloud/errors/unknown_os_type_exception.rb +23 -0
- data/lib/saklient/cloud/errors/unsupported_res_class_exception.rb +23 -0
- data/lib/saklient/cloud/errors/user_not_specified_exception.rb +23 -0
- data/lib/saklient/cloud/errors/vnc_proxy_request_failure_exception.rb +23 -0
- data/lib/saklient/cloud/models/model.rb +348 -0
- data/lib/saklient/cloud/models/model_appliance.rb +161 -0
- data/lib/saklient/cloud/models/model_archive.rb +207 -0
- data/lib/saklient/cloud/models/model_disk.rb +200 -0
- data/lib/saklient/cloud/models/model_disk_plan.rb +156 -0
- data/lib/saklient/cloud/models/model_icon.rb +178 -0
- data/lib/saklient/cloud/models/model_iface.rb +115 -0
- data/lib/saklient/cloud/models/model_ipv6_net.rb +106 -0
- data/lib/saklient/cloud/models/model_iso_image.rb +207 -0
- data/lib/saklient/cloud/models/model_router.rb +148 -0
- data/lib/saklient/cloud/models/model_router_plan.rb +106 -0
- data/lib/saklient/cloud/models/model_script.rb +178 -0
- data/lib/saklient/cloud/models/model_server.rb +237 -0
- data/lib/saklient/cloud/models/model_server_plan.rb +119 -0
- data/lib/saklient/cloud/models/model_swytch.rb +138 -0
- data/lib/saklient/cloud/models/query_params.rb +44 -0
- data/lib/saklient/cloud/product.rb +95 -0
- data/lib/saklient/cloud/resources/appliance.rb +551 -0
- data/lib/saklient/cloud/resources/archive.rb +861 -0
- data/lib/saklient/cloud/resources/disk.rb +802 -0
- data/lib/saklient/cloud/resources/disk_config.rb +353 -0
- data/lib/saklient/cloud/resources/disk_plan.rb +194 -0
- data/lib/saklient/cloud/resources/ftp_info.rb +93 -0
- data/lib/saklient/cloud/resources/icon.rb +268 -0
- data/lib/saklient/cloud/resources/iface.rb +329 -0
- data/lib/saklient/cloud/resources/ipv4_net.rb +275 -0
- data/lib/saklient/cloud/resources/ipv6_net.rb +238 -0
- data/lib/saklient/cloud/resources/iso_image.rb +666 -0
- data/lib/saklient/cloud/resources/resource.rb +287 -0
- data/lib/saklient/cloud/resources/router.rb +508 -0
- data/lib/saklient/cloud/resources/router_plan.rb +230 -0
- data/lib/saklient/cloud/resources/script.rb +554 -0
- data/lib/saklient/cloud/resources/server.rb +730 -0
- data/lib/saklient/cloud/resources/server_instance.rb +217 -0
- data/lib/saklient/cloud/resources/server_plan.rb +285 -0
- data/lib/saklient/cloud/resources/swytch.rb +521 -0
- data/lib/saklient/errors/exception_factory.rb +532 -0
- data/lib/saklient/errors/http_bad_gateway_exception.rb +21 -0
- data/lib/saklient/errors/http_bad_request_exception.rb +21 -0
- data/lib/saklient/errors/http_conflict_exception.rb +21 -0
- data/lib/saklient/errors/http_exception.rb +27 -0
- data/lib/saklient/errors/http_expectation_failed_exception.rb +21 -0
- data/lib/saklient/errors/http_failed_dependency_exception.rb +21 -0
- data/lib/saklient/errors/http_forbidden_exception.rb +21 -0
- data/lib/saklient/errors/http_gateway_timeout_exception.rb +21 -0
- data/lib/saklient/errors/http_gone_exception.rb +21 -0
- data/lib/saklient/errors/http_http_version_not_supported_exception.rb +21 -0
- data/lib/saklient/errors/http_insufficient_storage_exception.rb +21 -0
- data/lib/saklient/errors/http_internal_server_error_exception.rb +21 -0
- data/lib/saklient/errors/http_length_required_exception.rb +21 -0
- data/lib/saklient/errors/http_locked_exception.rb +21 -0
- data/lib/saklient/errors/http_method_not_allowed_exception.rb +21 -0
- data/lib/saklient/errors/http_not_acceptable_exception.rb +21 -0
- data/lib/saklient/errors/http_not_extended_exception.rb +21 -0
- data/lib/saklient/errors/http_not_found_exception.rb +21 -0
- data/lib/saklient/errors/http_not_implemented_exception.rb +21 -0
- data/lib/saklient/errors/http_payment_required_exception.rb +21 -0
- data/lib/saklient/errors/http_precondition_failed_exception.rb +21 -0
- data/lib/saklient/errors/http_proxy_authentication_required_exception.rb +21 -0
- data/lib/saklient/errors/http_request_entity_too_large_exception.rb +21 -0
- data/lib/saklient/errors/http_request_timeout_exception.rb +21 -0
- data/lib/saklient/errors/http_request_uri_too_long_exception.rb +21 -0
- data/lib/saklient/errors/http_requested_range_not_satisfiable_exception.rb +21 -0
- data/lib/saklient/errors/http_service_unavailable_exception.rb +21 -0
- data/lib/saklient/errors/http_unauthorized_exception.rb +21 -0
- data/lib/saklient/errors/http_unprocessable_entity_exception.rb +21 -0
- data/lib/saklient/errors/http_unsupported_media_type_exception.rb +21 -0
- data/lib/saklient/errors/http_upgrade_required_exception.rb +21 -0
- data/lib/saklient/errors/http_variant_also_negotiates_exception.rb +21 -0
- data/lib/saklient/errors/saklient_exception.rb +22 -0
- data/lib/saklient/util.rb +121 -0
- data/lib/saklient/version.rb +5 -0
- data/saklient.gemspec +24 -0
- data/spec/archive_spec.rb +141 -0
- data/spec/enum_spec.rb +24 -0
- data/spec/exception_spec.rb +25 -0
- data/spec/iso_image_spec.rb +172 -0
- data/spec/router_spec.rb +124 -0
- data/spec/server_spec.rb +261 -0
- data/spec/util_spec.rb +72 -0
- data/test-sshkey.txt +27 -0
- metadata +281 -0
@@ -0,0 +1,268 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../errors/saklient_exception'
|
4
|
+
require_relative '../client'
|
5
|
+
require_relative 'resource'
|
6
|
+
require_relative '../enums/escope'
|
7
|
+
|
8
|
+
module Saklient
|
9
|
+
module Cloud
|
10
|
+
module Resources
|
11
|
+
|
12
|
+
# アイコンの実体1つに対応し, 属性の取得や操作を行うためのクラス.
|
13
|
+
class Icon < Saklient::Cloud::Resources::Resource
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# ID
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :m_id
|
21
|
+
|
22
|
+
# スコープ {Saklient::Cloud::Enums::EScope}
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :m_scope
|
26
|
+
|
27
|
+
# 名前
|
28
|
+
#
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :m_name
|
31
|
+
|
32
|
+
# URL
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :m_url
|
36
|
+
|
37
|
+
# @private
|
38
|
+
# @return [String]
|
39
|
+
def _api_path
|
40
|
+
return '/icon'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @private
|
44
|
+
# @return [String]
|
45
|
+
def _root_key
|
46
|
+
return 'Icon'
|
47
|
+
end
|
48
|
+
|
49
|
+
# @private
|
50
|
+
# @return [String]
|
51
|
+
def _root_key_m
|
52
|
+
return 'Icons'
|
53
|
+
end
|
54
|
+
|
55
|
+
public
|
56
|
+
|
57
|
+
# @private
|
58
|
+
# @return [String]
|
59
|
+
def _class_name
|
60
|
+
return 'Icon'
|
61
|
+
end
|
62
|
+
|
63
|
+
# @private
|
64
|
+
# @return [String]
|
65
|
+
def _id
|
66
|
+
return get_id
|
67
|
+
end
|
68
|
+
|
69
|
+
# このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
|
70
|
+
#
|
71
|
+
# @return [Icon] this
|
72
|
+
def save
|
73
|
+
return _save
|
74
|
+
end
|
75
|
+
|
76
|
+
# 最新のリソース情報を再取得します.
|
77
|
+
#
|
78
|
+
# @return [Icon] this
|
79
|
+
def reload
|
80
|
+
return _reload
|
81
|
+
end
|
82
|
+
|
83
|
+
# @private
|
84
|
+
# @param [Saklient::Cloud::Client] client
|
85
|
+
# @param [any] obj
|
86
|
+
# @param [bool] wrapped
|
87
|
+
def initialize(client, obj, wrapped = false)
|
88
|
+
super(client)
|
89
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
90
|
+
Saklient::Util::validate_type(wrapped, 'bool')
|
91
|
+
api_deserialize(obj, wrapped)
|
92
|
+
end
|
93
|
+
|
94
|
+
protected
|
95
|
+
|
96
|
+
# @return [bool]
|
97
|
+
attr_accessor :n_id
|
98
|
+
|
99
|
+
# (This method is generated in Translator_default#buildImpl)
|
100
|
+
#
|
101
|
+
# @private
|
102
|
+
# @return [String]
|
103
|
+
def get_id
|
104
|
+
return @m_id
|
105
|
+
end
|
106
|
+
|
107
|
+
public
|
108
|
+
|
109
|
+
# ID
|
110
|
+
#
|
111
|
+
# @return [String]
|
112
|
+
attr_reader :id
|
113
|
+
|
114
|
+
def id
|
115
|
+
get_id
|
116
|
+
end
|
117
|
+
|
118
|
+
protected
|
119
|
+
|
120
|
+
# @return [bool]
|
121
|
+
attr_accessor :n_scope
|
122
|
+
|
123
|
+
# (This method is generated in Translator_default#buildImpl)
|
124
|
+
#
|
125
|
+
# @private
|
126
|
+
# @return [String]
|
127
|
+
def get_scope
|
128
|
+
return @m_scope
|
129
|
+
end
|
130
|
+
|
131
|
+
public
|
132
|
+
|
133
|
+
# スコープ {Saklient::Cloud::Enums::EScope}
|
134
|
+
#
|
135
|
+
# @return [String]
|
136
|
+
attr_reader :scope
|
137
|
+
|
138
|
+
def scope
|
139
|
+
get_scope
|
140
|
+
end
|
141
|
+
|
142
|
+
protected
|
143
|
+
|
144
|
+
# @return [bool]
|
145
|
+
attr_accessor :n_name
|
146
|
+
|
147
|
+
# (This method is generated in Translator_default#buildImpl)
|
148
|
+
#
|
149
|
+
# @private
|
150
|
+
# @return [String]
|
151
|
+
def get_name
|
152
|
+
return @m_name
|
153
|
+
end
|
154
|
+
|
155
|
+
# (This method is generated in Translator_default#buildImpl)
|
156
|
+
#
|
157
|
+
# @private
|
158
|
+
# @param [String] v
|
159
|
+
# @return [String]
|
160
|
+
def set_name(v)
|
161
|
+
Saklient::Util::validate_type(v, 'String')
|
162
|
+
@m_name = v
|
163
|
+
@n_name = true
|
164
|
+
return @m_name
|
165
|
+
end
|
166
|
+
|
167
|
+
public
|
168
|
+
|
169
|
+
# 名前
|
170
|
+
#
|
171
|
+
# @return [String]
|
172
|
+
attr_accessor :name
|
173
|
+
|
174
|
+
def name
|
175
|
+
get_name
|
176
|
+
end
|
177
|
+
|
178
|
+
def name=(v)
|
179
|
+
set_name(v)
|
180
|
+
end
|
181
|
+
|
182
|
+
protected
|
183
|
+
|
184
|
+
# @return [bool]
|
185
|
+
attr_accessor :n_url
|
186
|
+
|
187
|
+
# (This method is generated in Translator_default#buildImpl)
|
188
|
+
#
|
189
|
+
# @private
|
190
|
+
# @return [String]
|
191
|
+
def get_url
|
192
|
+
return @m_url
|
193
|
+
end
|
194
|
+
|
195
|
+
public
|
196
|
+
|
197
|
+
# URL
|
198
|
+
#
|
199
|
+
# @return [String]
|
200
|
+
attr_reader :url
|
201
|
+
|
202
|
+
def url
|
203
|
+
get_url
|
204
|
+
end
|
205
|
+
|
206
|
+
protected
|
207
|
+
|
208
|
+
# (This method is generated in Translator_default#buildImpl)
|
209
|
+
#
|
210
|
+
# @param [any] r
|
211
|
+
def api_deserialize_impl(r)
|
212
|
+
@is_new = (r).nil?
|
213
|
+
r = {} if @is_new
|
214
|
+
@is_incomplete = false
|
215
|
+
if Saklient::Util::exists_path(r, 'ID')
|
216
|
+
@m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
|
217
|
+
else
|
218
|
+
@m_id = nil
|
219
|
+
@is_incomplete = true
|
220
|
+
end
|
221
|
+
@n_id = false
|
222
|
+
if Saklient::Util::exists_path(r, 'Scope')
|
223
|
+
@m_scope = (Saklient::Util::get_by_path(r, 'Scope')).nil? ? nil : Saklient::Util::get_by_path(r, 'Scope').to_s
|
224
|
+
else
|
225
|
+
@m_scope = nil
|
226
|
+
@is_incomplete = true
|
227
|
+
end
|
228
|
+
@n_scope = false
|
229
|
+
if Saklient::Util::exists_path(r, 'Name')
|
230
|
+
@m_name = (Saklient::Util::get_by_path(r, 'Name')).nil? ? nil : Saklient::Util::get_by_path(r, 'Name').to_s
|
231
|
+
else
|
232
|
+
@m_name = nil
|
233
|
+
@is_incomplete = true
|
234
|
+
end
|
235
|
+
@n_name = false
|
236
|
+
if Saklient::Util::exists_path(r, 'URL')
|
237
|
+
@m_url = (Saklient::Util::get_by_path(r, 'URL')).nil? ? nil : Saklient::Util::get_by_path(r, 'URL').to_s
|
238
|
+
else
|
239
|
+
@m_url = nil
|
240
|
+
@is_incomplete = true
|
241
|
+
end
|
242
|
+
@n_url = false
|
243
|
+
end
|
244
|
+
|
245
|
+
# @private
|
246
|
+
# @param [bool] withClean
|
247
|
+
# @return [any]
|
248
|
+
def api_serialize_impl(withClean = false)
|
249
|
+
Saklient::Util::validate_type(withClean, 'bool')
|
250
|
+
missing = []
|
251
|
+
ret = {}
|
252
|
+
Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
|
253
|
+
Saklient::Util::set_by_path(ret, 'Scope', @m_scope) if withClean || @n_scope
|
254
|
+
if withClean || @n_name
|
255
|
+
Saklient::Util::set_by_path(ret, 'Name', @m_name)
|
256
|
+
else
|
257
|
+
missing << 'name' if @is_new
|
258
|
+
end
|
259
|
+
Saklient::Util::set_by_path(ret, 'URL', @m_url) if withClean || @n_url
|
260
|
+
raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the Icon creation: ' + missing.join(', ')) if missing.length > 0
|
261
|
+
return ret
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
@@ -0,0 +1,329 @@
|
|
1
|
+
# -*- encoding: UTF-8 -*-
|
2
|
+
|
3
|
+
require_relative '../../errors/saklient_exception'
|
4
|
+
require_relative '../client'
|
5
|
+
require_relative 'resource'
|
6
|
+
|
7
|
+
module Saklient
|
8
|
+
module Cloud
|
9
|
+
module Resources
|
10
|
+
|
11
|
+
# インタフェースの実体1つに対応し, 属性の取得や操作を行うためのクラス.
|
12
|
+
class Iface < Saklient::Cloud::Resources::Resource
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
# ID
|
17
|
+
#
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :m_id
|
20
|
+
|
21
|
+
# MACアドレス
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :m_mac_address
|
25
|
+
|
26
|
+
# IPv4アドレス(共有セグメントによる自動割当)
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :m_ip_address
|
30
|
+
|
31
|
+
# ユーザ設定IPv4アドレス
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :m_user_ip_address
|
35
|
+
|
36
|
+
# このインタフェースが取り付けられているサーバのID
|
37
|
+
#
|
38
|
+
# @return [String]
|
39
|
+
attr_accessor :m_server_id
|
40
|
+
|
41
|
+
# @private
|
42
|
+
# @return [String]
|
43
|
+
def _api_path
|
44
|
+
return '/interface'
|
45
|
+
end
|
46
|
+
|
47
|
+
# @private
|
48
|
+
# @return [String]
|
49
|
+
def _root_key
|
50
|
+
return 'Interface'
|
51
|
+
end
|
52
|
+
|
53
|
+
# @private
|
54
|
+
# @return [String]
|
55
|
+
def _root_key_m
|
56
|
+
return 'Interfaces'
|
57
|
+
end
|
58
|
+
|
59
|
+
public
|
60
|
+
|
61
|
+
# @private
|
62
|
+
# @return [String]
|
63
|
+
def _class_name
|
64
|
+
return 'Iface'
|
65
|
+
end
|
66
|
+
|
67
|
+
# @private
|
68
|
+
# @return [String]
|
69
|
+
def _id
|
70
|
+
return get_id
|
71
|
+
end
|
72
|
+
|
73
|
+
# このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
|
74
|
+
#
|
75
|
+
# @return [Iface] this
|
76
|
+
def save
|
77
|
+
return _save
|
78
|
+
end
|
79
|
+
|
80
|
+
# 最新のリソース情報を再取得します.
|
81
|
+
#
|
82
|
+
# @return [Iface] this
|
83
|
+
def reload
|
84
|
+
return _reload
|
85
|
+
end
|
86
|
+
|
87
|
+
# @private
|
88
|
+
# @param [Saklient::Cloud::Client] client
|
89
|
+
# @param [any] obj
|
90
|
+
# @param [bool] wrapped
|
91
|
+
def initialize(client, obj, wrapped = false)
|
92
|
+
super(client)
|
93
|
+
Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
|
94
|
+
Saklient::Util::validate_type(wrapped, 'bool')
|
95
|
+
api_deserialize(obj, wrapped)
|
96
|
+
end
|
97
|
+
|
98
|
+
# 共有セグメントに接続します.
|
99
|
+
#
|
100
|
+
# @return [Iface] this
|
101
|
+
def connect_to_shared_segment
|
102
|
+
@_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch/shared')
|
103
|
+
return reload
|
104
|
+
end
|
105
|
+
|
106
|
+
protected
|
107
|
+
|
108
|
+
# @return [bool]
|
109
|
+
attr_accessor :n_id
|
110
|
+
|
111
|
+
# (This method is generated in Translator_default#buildImpl)
|
112
|
+
#
|
113
|
+
# @private
|
114
|
+
# @return [String]
|
115
|
+
def get_id
|
116
|
+
return @m_id
|
117
|
+
end
|
118
|
+
|
119
|
+
public
|
120
|
+
|
121
|
+
# ID
|
122
|
+
#
|
123
|
+
# @return [String]
|
124
|
+
attr_reader :id
|
125
|
+
|
126
|
+
def id
|
127
|
+
get_id
|
128
|
+
end
|
129
|
+
|
130
|
+
protected
|
131
|
+
|
132
|
+
# @return [bool]
|
133
|
+
attr_accessor :n_mac_address
|
134
|
+
|
135
|
+
# (This method is generated in Translator_default#buildImpl)
|
136
|
+
#
|
137
|
+
# @private
|
138
|
+
# @return [String]
|
139
|
+
def get_mac_address
|
140
|
+
return @m_mac_address
|
141
|
+
end
|
142
|
+
|
143
|
+
public
|
144
|
+
|
145
|
+
# MACアドレス
|
146
|
+
#
|
147
|
+
# @return [String]
|
148
|
+
attr_reader :mac_address
|
149
|
+
|
150
|
+
def mac_address
|
151
|
+
get_mac_address
|
152
|
+
end
|
153
|
+
|
154
|
+
protected
|
155
|
+
|
156
|
+
# @return [bool]
|
157
|
+
attr_accessor :n_ip_address
|
158
|
+
|
159
|
+
# (This method is generated in Translator_default#buildImpl)
|
160
|
+
#
|
161
|
+
# @private
|
162
|
+
# @return [String]
|
163
|
+
def get_ip_address
|
164
|
+
return @m_ip_address
|
165
|
+
end
|
166
|
+
|
167
|
+
public
|
168
|
+
|
169
|
+
# IPv4アドレス(共有セグメントによる自動割当)
|
170
|
+
#
|
171
|
+
# @return [String]
|
172
|
+
attr_reader :ip_address
|
173
|
+
|
174
|
+
def ip_address
|
175
|
+
get_ip_address
|
176
|
+
end
|
177
|
+
|
178
|
+
protected
|
179
|
+
|
180
|
+
# @return [bool]
|
181
|
+
attr_accessor :n_user_ip_address
|
182
|
+
|
183
|
+
# (This method is generated in Translator_default#buildImpl)
|
184
|
+
#
|
185
|
+
# @private
|
186
|
+
# @return [String]
|
187
|
+
def get_user_ip_address
|
188
|
+
return @m_user_ip_address
|
189
|
+
end
|
190
|
+
|
191
|
+
# (This method is generated in Translator_default#buildImpl)
|
192
|
+
#
|
193
|
+
# @private
|
194
|
+
# @param [String] v
|
195
|
+
# @return [String]
|
196
|
+
def set_user_ip_address(v)
|
197
|
+
Saklient::Util::validate_type(v, 'String')
|
198
|
+
@m_user_ip_address = v
|
199
|
+
@n_user_ip_address = true
|
200
|
+
return @m_user_ip_address
|
201
|
+
end
|
202
|
+
|
203
|
+
public
|
204
|
+
|
205
|
+
# ユーザ設定IPv4アドレス
|
206
|
+
#
|
207
|
+
# @return [String]
|
208
|
+
attr_accessor :user_ip_address
|
209
|
+
|
210
|
+
def user_ip_address
|
211
|
+
get_user_ip_address
|
212
|
+
end
|
213
|
+
|
214
|
+
def user_ip_address=(v)
|
215
|
+
set_user_ip_address(v)
|
216
|
+
end
|
217
|
+
|
218
|
+
protected
|
219
|
+
|
220
|
+
# @return [bool]
|
221
|
+
attr_accessor :n_server_id
|
222
|
+
|
223
|
+
# (This method is generated in Translator_default#buildImpl)
|
224
|
+
#
|
225
|
+
# @private
|
226
|
+
# @return [String]
|
227
|
+
def get_server_id
|
228
|
+
return @m_server_id
|
229
|
+
end
|
230
|
+
|
231
|
+
# (This method is generated in Translator_default#buildImpl)
|
232
|
+
#
|
233
|
+
# @private
|
234
|
+
# @param [String] v
|
235
|
+
# @return [String]
|
236
|
+
def set_server_id(v)
|
237
|
+
Saklient::Util::validate_type(v, 'String')
|
238
|
+
raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Iface#server_id') if !@is_new
|
239
|
+
@m_server_id = v
|
240
|
+
@n_server_id = true
|
241
|
+
return @m_server_id
|
242
|
+
end
|
243
|
+
|
244
|
+
public
|
245
|
+
|
246
|
+
# このインタフェースが取り付けられているサーバのID
|
247
|
+
#
|
248
|
+
# @return [String]
|
249
|
+
attr_accessor :server_id
|
250
|
+
|
251
|
+
def server_id
|
252
|
+
get_server_id
|
253
|
+
end
|
254
|
+
|
255
|
+
def server_id=(v)
|
256
|
+
set_server_id(v)
|
257
|
+
end
|
258
|
+
|
259
|
+
protected
|
260
|
+
|
261
|
+
# (This method is generated in Translator_default#buildImpl)
|
262
|
+
#
|
263
|
+
# @param [any] r
|
264
|
+
def api_deserialize_impl(r)
|
265
|
+
@is_new = (r).nil?
|
266
|
+
r = {} if @is_new
|
267
|
+
@is_incomplete = false
|
268
|
+
if Saklient::Util::exists_path(r, 'ID')
|
269
|
+
@m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s
|
270
|
+
else
|
271
|
+
@m_id = nil
|
272
|
+
@is_incomplete = true
|
273
|
+
end
|
274
|
+
@n_id = false
|
275
|
+
if Saklient::Util::exists_path(r, 'MACAddress')
|
276
|
+
@m_mac_address = (Saklient::Util::get_by_path(r, 'MACAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'MACAddress').to_s
|
277
|
+
else
|
278
|
+
@m_mac_address = nil
|
279
|
+
@is_incomplete = true
|
280
|
+
end
|
281
|
+
@n_mac_address = false
|
282
|
+
if Saklient::Util::exists_path(r, 'IPAddress')
|
283
|
+
@m_ip_address = (Saklient::Util::get_by_path(r, 'IPAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'IPAddress').to_s
|
284
|
+
else
|
285
|
+
@m_ip_address = nil
|
286
|
+
@is_incomplete = true
|
287
|
+
end
|
288
|
+
@n_ip_address = false
|
289
|
+
if Saklient::Util::exists_path(r, 'UserIPAddress')
|
290
|
+
@m_user_ip_address = (Saklient::Util::get_by_path(r, 'UserIPAddress')).nil? ? nil : Saklient::Util::get_by_path(r, 'UserIPAddress').to_s
|
291
|
+
else
|
292
|
+
@m_user_ip_address = nil
|
293
|
+
@is_incomplete = true
|
294
|
+
end
|
295
|
+
@n_user_ip_address = false
|
296
|
+
if Saklient::Util::exists_path(r, 'Server.ID')
|
297
|
+
@m_server_id = (Saklient::Util::get_by_path(r, 'Server.ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'Server.ID').to_s
|
298
|
+
else
|
299
|
+
@m_server_id = nil
|
300
|
+
@is_incomplete = true
|
301
|
+
end
|
302
|
+
@n_server_id = false
|
303
|
+
end
|
304
|
+
|
305
|
+
# @private
|
306
|
+
# @param [bool] withClean
|
307
|
+
# @return [any]
|
308
|
+
def api_serialize_impl(withClean = false)
|
309
|
+
Saklient::Util::validate_type(withClean, 'bool')
|
310
|
+
missing = []
|
311
|
+
ret = {}
|
312
|
+
Saklient::Util::set_by_path(ret, 'ID', @m_id) if withClean || @n_id
|
313
|
+
Saklient::Util::set_by_path(ret, 'MACAddress', @m_mac_address) if withClean || @n_mac_address
|
314
|
+
Saklient::Util::set_by_path(ret, 'IPAddress', @m_ip_address) if withClean || @n_ip_address
|
315
|
+
Saklient::Util::set_by_path(ret, 'UserIPAddress', @m_user_ip_address) if withClean || @n_user_ip_address
|
316
|
+
if withClean || @n_server_id
|
317
|
+
Saklient::Util::set_by_path(ret, 'Server.ID', @m_server_id)
|
318
|
+
else
|
319
|
+
missing << 'server_id' if @is_new
|
320
|
+
end
|
321
|
+
raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the Iface creation: ' + missing.join(', ')) if missing.length > 0
|
322
|
+
return ret
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|