oci 2.5.11 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/oci.rb +1 -0
- data/lib/oci/auth/federation_client.rb +2 -1
- data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +6 -1
- data/lib/oci/auth/url_based_certificate_retriever.rb +6 -2
- data/lib/oci/auth/util.rb +18 -0
- data/lib/oci/core/compute_client.rb +730 -48
- data/lib/oci/core/compute_client_composite_operations.rb +119 -0
- data/lib/oci/core/compute_management_client.rb +11 -4
- data/lib/oci/core/core.rb +13 -0
- data/lib/oci/core/models/add_security_rule_details.rb +4 -2
- data/lib/oci/core/models/attach_vnic_details.rb +1 -0
- data/lib/oci/core/models/capture_console_history_details.rb +1 -0
- data/lib/oci/core/models/change_dedicated_vm_host_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_dhcp_options_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_internet_gateway_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_local_peering_gateway_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_network_security_group_compartment_details.rb +155 -0
- data/lib/oci/core/models/change_public_ip_compartment_details.rb +155 -0
- data/lib/oci/core/models/create_dedicated_vm_host_details.rb +262 -0
- data/lib/oci/core/models/create_drg_attachment_details.rb +4 -2
- data/lib/oci/core/models/create_image_details.rb +1 -1
- data/lib/oci/core/models/create_instance_configuration_base.rb +16 -6
- data/lib/oci/core/models/create_instance_configuration_details.rb +1 -1
- data/lib/oci/core/models/create_instance_configuration_from_instance_details.rb +3 -2
- data/lib/oci/core/models/create_instance_pool_details.rb +3 -1
- data/lib/oci/core/models/create_local_peering_gateway_details.rb +1 -1
- data/lib/oci/core/models/create_service_gateway_details.rb +1 -1
- data/lib/oci/core/models/create_volume_group_backup_details.rb +3 -1
- data/lib/oci/core/models/create_volume_group_details.rb +1 -1
- data/lib/oci/core/models/cross_connect_mapping.rb +4 -0
- data/lib/oci/core/models/dedicated_vm_host.rb +359 -0
- data/lib/oci/core/models/dedicated_vm_host_instance_shape_summary.rb +170 -0
- data/lib/oci/core/models/dedicated_vm_host_instance_summary.rb +215 -0
- data/lib/oci/core/models/dedicated_vm_host_shape_summary.rb +171 -0
- data/lib/oci/core/models/dedicated_vm_host_summary.rb +325 -0
- data/lib/oci/core/models/drg_attachment.rb +6 -3
- data/lib/oci/core/models/egress_security_rule.rb +1 -0
- data/lib/oci/core/models/image.rb +2 -0
- data/lib/oci/core/models/ingress_security_rule.rb +2 -1
- data/lib/oci/core/models/instance.rb +16 -1
- data/lib/oci/core/models/instance_configuration.rb +10 -7
- data/lib/oci/core/models/ipv6.rb +2 -0
- data/lib/oci/core/models/launch_instance_details.rb +16 -1
- data/lib/oci/core/models/launch_options.rb +3 -2
- data/lib/oci/core/models/local_peering_gateway.rb +4 -3
- data/lib/oci/core/models/route_rule.rb +2 -1
- data/lib/oci/core/models/security_rule.rb +3 -1
- data/lib/oci/core/models/service_gateway.rb +4 -3
- data/lib/oci/core/models/subnet.rb +2 -1
- data/lib/oci/core/models/update_console_history_details.rb +1 -0
- data/lib/oci/core/models/update_dedicated_vm_host_details.rb +194 -0
- data/lib/oci/core/models/update_drg_attachment_details.rb +6 -3
- data/lib/oci/core/models/update_instance_pool_details.rb +3 -1
- data/lib/oci/core/models/update_local_peering_gateway_details.rb +4 -3
- data/lib/oci/core/models/update_network_security_group_details.rb +2 -0
- data/lib/oci/core/models/update_security_rule_details.rb +4 -2
- data/lib/oci/core/models/update_service_gateway_details.rb +4 -3
- data/lib/oci/core/models/update_vnic_details.rb +2 -0
- data/lib/oci/core/models/update_volume_backup_details.rb +1 -1
- data/lib/oci/core/models/update_volume_group_backup_details.rb +2 -1
- data/lib/oci/core/models/update_volume_group_details.rb +2 -1
- data/lib/oci/core/models/vcn.rb +2 -1
- data/lib/oci/core/models/volume_backup_schedule.rb +1 -1
- data/lib/oci/core/virtual_network_client.rb +396 -59
- data/lib/oci/dts/dts.rb +57 -0
- data/lib/oci/dts/models/attach_devices_details.rb +153 -0
- data/lib/oci/dts/models/change_transfer_job_compartment_details.rb +154 -0
- data/lib/oci/dts/models/create_transfer_appliance_details.rb +152 -0
- data/lib/oci/dts/models/create_transfer_appliance_entitlement_details.rb +178 -0
- data/lib/oci/dts/models/create_transfer_device_details.rb +165 -0
- data/lib/oci/dts/models/create_transfer_job_details.rb +238 -0
- data/lib/oci/dts/models/create_transfer_package_details.rb +178 -0
- data/lib/oci/dts/models/detach_devices_details.rb +153 -0
- data/lib/oci/dts/models/multiple_transfer_appliances.rb +153 -0
- data/lib/oci/dts/models/multiple_transfer_devices.rb +153 -0
- data/lib/oci/dts/models/multiple_transfer_packages.rb +153 -0
- data/lib/oci/dts/models/new_transfer_device.rb +246 -0
- data/lib/oci/dts/models/shipping_address.rb +263 -0
- data/lib/oci/dts/models/shipping_vendors.rb +149 -0
- data/lib/oci/dts/models/transfer_appliance.rb +367 -0
- data/lib/oci/dts/models/transfer_appliance_certificate.rb +148 -0
- data/lib/oci/dts/models/transfer_appliance_encryption_passphrase.rb +152 -0
- data/lib/oci/dts/models/transfer_appliance_entitlement.rb +240 -0
- data/lib/oci/dts/models/transfer_appliance_public_key.rb +152 -0
- data/lib/oci/dts/models/transfer_appliance_summary.rb +223 -0
- data/lib/oci/dts/models/transfer_device.rb +268 -0
- data/lib/oci/dts/models/transfer_device_summary.rb +254 -0
- data/lib/oci/dts/models/transfer_job.rb +356 -0
- data/lib/oci/dts/models/transfer_job_summary.rb +296 -0
- data/lib/oci/dts/models/transfer_package.rb +281 -0
- data/lib/oci/dts/models/transfer_package_summary.rb +201 -0
- data/lib/oci/dts/models/update_transfer_appliance_details.rb +180 -0
- data/lib/oci/dts/models/update_transfer_device_details.rb +166 -0
- data/lib/oci/dts/models/update_transfer_job_details.rb +237 -0
- data/lib/oci/dts/models/update_transfer_package_details.rb +204 -0
- data/lib/oci/dts/shipping_vendors_client.rb +165 -0
- data/lib/oci/dts/shipping_vendors_client_composite_operations.rb +24 -0
- data/lib/oci/dts/transfer_appliance_client.rb +569 -0
- data/lib/oci/dts/transfer_appliance_client_composite_operations.rb +104 -0
- data/lib/oci/dts/transfer_appliance_entitlement_client.rb +223 -0
- data/lib/oci/dts/transfer_appliance_entitlement_client_composite_operations.rb +24 -0
- data/lib/oci/dts/transfer_device_client.rb +402 -0
- data/lib/oci/dts/transfer_device_client_composite_operations.rb +65 -0
- data/lib/oci/dts/transfer_job_client.rb +458 -0
- data/lib/oci/dts/transfer_job_client_composite_operations.rb +143 -0
- data/lib/oci/dts/transfer_package_client.rb +515 -0
- data/lib/oci/dts/transfer_package_client_composite_operations.rb +104 -0
- data/lib/oci/dts/util.rb +2 -0
- data/lib/oci/file_storage/models/create_file_system_details.rb +19 -4
- data/lib/oci/file_storage/models/file_system.rb +19 -4
- data/lib/oci/file_storage/models/file_system_summary.rb +19 -4
- data/lib/oci/file_storage/models/update_file_system_details.rb +22 -4
- data/lib/oci/limits/limits.rb +5 -0
- data/lib/oci/limits/limits_client.rb +444 -0
- data/lib/oci/limits/limits_client_composite_operations.rb +24 -0
- data/lib/oci/limits/models/create_quota_details.rb +1 -1
- data/lib/oci/limits/models/limit_definition_summary.rb +241 -0
- data/lib/oci/limits/models/limit_value_summary.rb +210 -0
- data/lib/oci/limits/models/quota.rb +1 -1
- data/lib/oci/limits/models/resource_availability.rb +163 -0
- data/lib/oci/limits/models/service_summary.rb +159 -0
- data/lib/oci/limits/models/update_quota_details.rb +1 -1
- data/lib/oci/limits/quotas_client.rb +12 -11
- data/lib/oci/monitoring/models/alarm.rb +20 -1
- data/lib/oci/monitoring/models/create_alarm_details.rb +20 -1
- data/lib/oci/monitoring/models/list_metrics_details.rb +23 -3
- data/lib/oci/monitoring/models/metric.rb +20 -1
- data/lib/oci/monitoring/models/metric_data.rb +20 -1
- data/lib/oci/monitoring/models/metric_data_details.rb +20 -1
- data/lib/oci/monitoring/models/summarize_metrics_data_details.rb +20 -1
- data/lib/oci/monitoring/models/update_alarm_details.rb +20 -1
- data/lib/oci/regions.rb +14 -8
- data/lib/oci/streaming/models/archiver.rb +291 -0
- data/lib/oci/streaming/models/archiver_error.rb +159 -0
- data/lib/oci/streaming/models/archiver_lifecycle_state.rb +14 -0
- data/lib/oci/streaming/models/archiver_start_position.rb +10 -0
- data/lib/oci/streaming/models/create_archiver_details.rb +223 -0
- data/lib/oci/streaming/models/update_archiver_details.rb +222 -0
- data/lib/oci/streaming/stream_admin_client.rb +304 -0
- data/lib/oci/streaming/stream_admin_client_composite_operations.rb +162 -0
- data/lib/oci/streaming/streaming.rb +6 -0
- data/lib/oci/version.rb +1 -1
- data/lib/oci/waas/models/access_rule.rb +121 -4
- data/lib/oci/waas/models/access_rule_criteria.rb +12 -0
- data/lib/oci/waas/models/address_list.rb +289 -0
- data/lib/oci/waas/models/address_list_summary.rb +279 -0
- data/lib/oci/waas/models/caching_rule.rb +243 -0
- data/lib/oci/waas/models/caching_rule_criteria.rb +194 -0
- data/lib/oci/waas/models/caching_rule_summary.rb +246 -0
- data/lib/oci/waas/models/certificate.rb +22 -9
- data/lib/oci/waas/models/certificate_extensions.rb +3 -0
- data/lib/oci/waas/models/certificate_issuer_name.rb +225 -0
- data/lib/oci/waas/models/certificate_public_key_info.rb +4 -1
- data/lib/oci/waas/models/certificate_subject_name.rb +8 -1
- data/lib/oci/waas/models/certificate_summary.rb +10 -2
- data/lib/oci/waas/models/change_address_list_compartment_details.rb +154 -0
- data/lib/oci/waas/models/change_custom_protection_rule_compartment_details.rb +154 -0
- data/lib/oci/waas/models/create_address_list_details.rb +213 -0
- data/lib/oci/waas/models/create_certificate_details.rb +22 -3
- data/lib/oci/waas/models/create_custom_protection_rule_details.rb +251 -0
- data/lib/oci/waas/models/create_waas_policy_details.rb +26 -4
- data/lib/oci/waas/models/custom_protection_rule.rb +326 -0
- data/lib/oci/waas/models/custom_protection_rule_setting.rb +180 -0
- data/lib/oci/waas/models/custom_protection_rule_summary.rb +279 -0
- data/lib/oci/waas/models/origin_group.rb +149 -0
- data/lib/oci/waas/models/origin_group_origins.rb +159 -0
- data/lib/oci/waas/models/policy_config.rb +201 -4
- data/lib/oci/waas/models/protection_rule_exclusion.rb +2 -2
- data/lib/oci/waas/models/purge_cache.rb +149 -0
- data/lib/oci/waas/models/update_address_list_details.rb +199 -0
- data/lib/oci/waas/models/update_certificate_details.rb +10 -2
- data/lib/oci/waas/models/update_custom_protection_rule_details.rb +237 -0
- data/lib/oci/waas/models/update_waas_policy_details.rb +26 -4
- data/lib/oci/waas/models/waas_policy.rb +25 -3
- data/lib/oci/waas/models/waas_policy_custom_protection_rule_summary.rb +207 -0
- data/lib/oci/waas/models/waas_policy_summary.rb +10 -2
- data/lib/oci/waas/models/waf_config.rb +43 -1
- data/lib/oci/waas/models/waf_config_details.rb +43 -1
- data/lib/oci/waas/models/waf_log.rb +3 -3
- data/lib/oci/waas/models/work_request.rb +4 -1
- data/lib/oci/waas/models/work_request_operation_types.rb +4 -1
- data/lib/oci/waas/models/work_request_summary.rb +4 -1
- data/lib/oci/waas/waas.rb +19 -0
- data/lib/oci/waas/waas_client.rb +1147 -61
- data/lib/oci/waas/waas_client_composite_operations.rb +386 -0
- metadata +90 -2
@@ -0,0 +1,152 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
6
|
+
module OCI
|
7
|
+
# TransferAppliancePublicKey model.
|
8
|
+
class Dts::Models::TransferAppliancePublicKey
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :public_key
|
11
|
+
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
# rubocop:disable Style/SymbolLiteral
|
16
|
+
'public_key': :'publicKey'
|
17
|
+
# rubocop:enable Style/SymbolLiteral
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attribute type mapping.
|
22
|
+
def self.swagger_types
|
23
|
+
{
|
24
|
+
# rubocop:disable Style/SymbolLiteral
|
25
|
+
'public_key': :'String'
|
26
|
+
# rubocop:enable Style/SymbolLiteral
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
31
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
32
|
+
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
# @option attributes [String] :public_key The value to assign to the {#public_key} property
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
42
|
+
|
43
|
+
self.public_key = attributes[:'publicKey'] if attributes[:'publicKey']
|
44
|
+
|
45
|
+
raise 'You cannot provide both :publicKey and :public_key' if attributes.key?(:'publicKey') && attributes.key?(:'public_key')
|
46
|
+
|
47
|
+
self.public_key = attributes[:'public_key'] if attributes[:'public_key']
|
48
|
+
end
|
49
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
50
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
51
|
+
|
52
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
53
|
+
|
54
|
+
|
55
|
+
# Checks equality by comparing each attribute.
|
56
|
+
# @param [Object] other the other object to be compared
|
57
|
+
def ==(other)
|
58
|
+
return true if equal?(other)
|
59
|
+
|
60
|
+
self.class == other.class &&
|
61
|
+
public_key == other.public_key
|
62
|
+
end
|
63
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
64
|
+
|
65
|
+
# @see the `==` method
|
66
|
+
# @param [Object] other the other object to be compared
|
67
|
+
def eql?(other)
|
68
|
+
self == other
|
69
|
+
end
|
70
|
+
|
71
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
72
|
+
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Fixnum] Hash code
|
76
|
+
def hash
|
77
|
+
[public_key].hash
|
78
|
+
end
|
79
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
80
|
+
|
81
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
82
|
+
|
83
|
+
|
84
|
+
# Builds the object from hash
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
# @return [Object] Returns the model itself
|
87
|
+
def build_from_hash(attributes)
|
88
|
+
return nil unless attributes.is_a?(Hash)
|
89
|
+
|
90
|
+
self.class.swagger_types.each_pair do |key, type|
|
91
|
+
if type =~ /^Array<(.*)>/i
|
92
|
+
# check to ensure the input is an array given that the the attribute
|
93
|
+
# is documented as an array but the input is not
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
public_method("#{key}=").call(
|
96
|
+
attributes[self.class.attribute_map[key]]
|
97
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
98
|
+
)
|
99
|
+
end
|
100
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
|
+
public_method("#{key}=").call(
|
102
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
103
|
+
)
|
104
|
+
end
|
105
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
106
|
+
end
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
111
|
+
|
112
|
+
# Returns the string representation of the object
|
113
|
+
# @return [String] String presentation of the object
|
114
|
+
def to_s
|
115
|
+
to_hash.to_s
|
116
|
+
end
|
117
|
+
|
118
|
+
# Returns the object in the form of hash
|
119
|
+
# @return [Hash] Returns the object in the form of hash
|
120
|
+
def to_hash
|
121
|
+
hash = {}
|
122
|
+
self.class.attribute_map.each_pair do |attr, param|
|
123
|
+
value = public_method(attr).call
|
124
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
125
|
+
|
126
|
+
hash[param] = _to_hash(value)
|
127
|
+
end
|
128
|
+
hash
|
129
|
+
end
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
# Outputs non-array value in the form of hash
|
134
|
+
# For object, use to_hash. Otherwise, just return the value
|
135
|
+
# @param [Object] value Any valid value
|
136
|
+
# @return [Hash] Returns the value in the form of hash
|
137
|
+
def _to_hash(value)
|
138
|
+
if value.is_a?(Array)
|
139
|
+
value.compact.map { |v| _to_hash(v) }
|
140
|
+
elsif value.is_a?(Hash)
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
143
|
+
end
|
144
|
+
elsif value.respond_to? :to_hash
|
145
|
+
value.to_hash
|
146
|
+
else
|
147
|
+
value
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'logger'
|
5
|
+
|
6
|
+
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
7
|
+
module OCI
|
8
|
+
# TransferApplianceSummary model.
|
9
|
+
class Dts::Models::TransferApplianceSummary
|
10
|
+
LIFECYCLE_STATE_ENUM = [
|
11
|
+
LIFECYCLE_STATE_REQUESTED = 'REQUESTED'.freeze,
|
12
|
+
LIFECYCLE_STATE_ORACLE_PREPARING = 'ORACLE_PREPARING'.freeze,
|
13
|
+
LIFECYCLE_STATE_SHIPPING = 'SHIPPING'.freeze,
|
14
|
+
LIFECYCLE_STATE_DELIVERED = 'DELIVERED'.freeze,
|
15
|
+
LIFECYCLE_STATE_PREPARING = 'PREPARING'.freeze,
|
16
|
+
LIFECYCLE_STATE_RETURN_SHIPPED = 'RETURN_SHIPPED'.freeze,
|
17
|
+
LIFECYCLE_STATE_RETURN_SHIPPED_CANCELLED = 'RETURN_SHIPPED_CANCELLED'.freeze,
|
18
|
+
LIFECYCLE_STATE_ORACLE_RECEIVED = 'ORACLE_RECEIVED'.freeze,
|
19
|
+
LIFECYCLE_STATE_ORACLE_RECEIVED_CANCELLED = 'ORACLE_RECEIVED_CANCELLED'.freeze,
|
20
|
+
LIFECYCLE_STATE_PROCESSING = 'PROCESSING'.freeze,
|
21
|
+
LIFECYCLE_STATE_COMPLETE = 'COMPLETE'.freeze,
|
22
|
+
LIFECYCLE_STATE_CUSTOMER_NEVER_RECEIVED = 'CUSTOMER_NEVER_RECEIVED'.freeze,
|
23
|
+
LIFECYCLE_STATE_ORACLE_NEVER_RECEIVED = 'ORACLE_NEVER_RECEIVED'.freeze,
|
24
|
+
LIFECYCLE_STATE_CUSTOMER_LOST = 'CUSTOMER_LOST'.freeze,
|
25
|
+
LIFECYCLE_STATE_CANCELLED = 'CANCELLED'.freeze,
|
26
|
+
LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
|
27
|
+
LIFECYCLE_STATE_REJECTED = 'REJECTED'.freeze,
|
28
|
+
LIFECYCLE_STATE_ERROR = 'ERROR'.freeze,
|
29
|
+
LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
|
30
|
+
].freeze
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :label
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
attr_reader :lifecycle_state
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
attr_accessor :serial_number
|
40
|
+
|
41
|
+
# @return [DateTime]
|
42
|
+
attr_accessor :creation_time
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
# rubocop:disable Style/SymbolLiteral
|
48
|
+
'label': :'label',
|
49
|
+
'lifecycle_state': :'lifecycleState',
|
50
|
+
'serial_number': :'serialNumber',
|
51
|
+
'creation_time': :'creationTime'
|
52
|
+
# rubocop:enable Style/SymbolLiteral
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
# rubocop:disable Style/SymbolLiteral
|
60
|
+
'label': :'String',
|
61
|
+
'lifecycle_state': :'String',
|
62
|
+
'serial_number': :'String',
|
63
|
+
'creation_time': :'DateTime'
|
64
|
+
# rubocop:enable Style/SymbolLiteral
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
69
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
70
|
+
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
# @option attributes [String] :label The value to assign to the {#label} property
|
75
|
+
# @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
|
76
|
+
# @option attributes [String] :serial_number The value to assign to the {#serial_number} property
|
77
|
+
# @option attributes [DateTime] :creation_time The value to assign to the {#creation_time} property
|
78
|
+
def initialize(attributes = {})
|
79
|
+
return unless attributes.is_a?(Hash)
|
80
|
+
|
81
|
+
# convert string to symbol for hash key
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
83
|
+
|
84
|
+
self.label = attributes[:'label'] if attributes[:'label']
|
85
|
+
|
86
|
+
self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
|
87
|
+
|
88
|
+
raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
|
89
|
+
|
90
|
+
self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
|
91
|
+
|
92
|
+
self.serial_number = attributes[:'serialNumber'] if attributes[:'serialNumber']
|
93
|
+
|
94
|
+
raise 'You cannot provide both :serialNumber and :serial_number' if attributes.key?(:'serialNumber') && attributes.key?(:'serial_number')
|
95
|
+
|
96
|
+
self.serial_number = attributes[:'serial_number'] if attributes[:'serial_number']
|
97
|
+
|
98
|
+
self.creation_time = attributes[:'creationTime'] if attributes[:'creationTime']
|
99
|
+
|
100
|
+
raise 'You cannot provide both :creationTime and :creation_time' if attributes.key?(:'creationTime') && attributes.key?(:'creation_time')
|
101
|
+
|
102
|
+
self.creation_time = attributes[:'creation_time'] if attributes[:'creation_time']
|
103
|
+
end
|
104
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
105
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
106
|
+
|
107
|
+
# Custom attribute writer method checking allowed values (enum).
|
108
|
+
# @param [Object] lifecycle_state Object to be assigned
|
109
|
+
def lifecycle_state=(lifecycle_state)
|
110
|
+
# rubocop:disable Style/ConditionalAssignment
|
111
|
+
if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
|
112
|
+
OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
|
113
|
+
@lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
|
114
|
+
else
|
115
|
+
@lifecycle_state = lifecycle_state
|
116
|
+
end
|
117
|
+
# rubocop:enable Style/ConditionalAssignment
|
118
|
+
end
|
119
|
+
|
120
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
121
|
+
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] other the other object to be compared
|
125
|
+
def ==(other)
|
126
|
+
return true if equal?(other)
|
127
|
+
|
128
|
+
self.class == other.class &&
|
129
|
+
label == other.label &&
|
130
|
+
lifecycle_state == other.lifecycle_state &&
|
131
|
+
serial_number == other.serial_number &&
|
132
|
+
creation_time == other.creation_time
|
133
|
+
end
|
134
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
135
|
+
|
136
|
+
# @see the `==` method
|
137
|
+
# @param [Object] other the other object to be compared
|
138
|
+
def eql?(other)
|
139
|
+
self == other
|
140
|
+
end
|
141
|
+
|
142
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
143
|
+
|
144
|
+
|
145
|
+
# Calculates hash code according to all attributes.
|
146
|
+
# @return [Fixnum] Hash code
|
147
|
+
def hash
|
148
|
+
[label, lifecycle_state, serial_number, creation_time].hash
|
149
|
+
end
|
150
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
151
|
+
|
152
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
153
|
+
|
154
|
+
|
155
|
+
# Builds the object from hash
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
+
# @return [Object] Returns the model itself
|
158
|
+
def build_from_hash(attributes)
|
159
|
+
return nil unless attributes.is_a?(Hash)
|
160
|
+
|
161
|
+
self.class.swagger_types.each_pair do |key, type|
|
162
|
+
if type =~ /^Array<(.*)>/i
|
163
|
+
# check to ensure the input is an array given that the the attribute
|
164
|
+
# is documented as an array but the input is not
|
165
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
+
public_method("#{key}=").call(
|
167
|
+
attributes[self.class.attribute_map[key]]
|
168
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
169
|
+
)
|
170
|
+
end
|
171
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
172
|
+
public_method("#{key}=").call(
|
173
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
174
|
+
)
|
175
|
+
end
|
176
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
177
|
+
end
|
178
|
+
|
179
|
+
self
|
180
|
+
end
|
181
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = public_method(attr).call
|
195
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
196
|
+
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
private
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
@@ -0,0 +1,268 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'logger'
|
5
|
+
|
6
|
+
# rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
7
|
+
module OCI
|
8
|
+
# TransferDevice model.
|
9
|
+
class Dts::Models::TransferDevice
|
10
|
+
LIFECYCLE_STATE_ENUM = [
|
11
|
+
LIFECYCLE_STATE_PREPARING = 'PREPARING'.freeze,
|
12
|
+
LIFECYCLE_STATE_READY = 'READY'.freeze,
|
13
|
+
LIFECYCLE_STATE_PACKAGED = 'PACKAGED'.freeze,
|
14
|
+
LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
|
15
|
+
LIFECYCLE_STATE_PROCESSING = 'PROCESSING'.freeze,
|
16
|
+
LIFECYCLE_STATE_COMPLETE = 'COMPLETE'.freeze,
|
17
|
+
LIFECYCLE_STATE_MISSING = 'MISSING'.freeze,
|
18
|
+
LIFECYCLE_STATE_ERROR = 'ERROR'.freeze,
|
19
|
+
LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
|
20
|
+
LIFECYCLE_STATE_CANCELLED = 'CANCELLED'.freeze,
|
21
|
+
LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
|
22
|
+
].freeze
|
23
|
+
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :serial_number
|
26
|
+
|
27
|
+
# @return [String]
|
28
|
+
attr_accessor :iscsi_iqn
|
29
|
+
|
30
|
+
# This attribute is required.
|
31
|
+
# @return [String]
|
32
|
+
attr_accessor :label
|
33
|
+
|
34
|
+
# @return [String]
|
35
|
+
attr_reader :lifecycle_state
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :transfer_job_id
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
attr_accessor :attached_transfer_package_label
|
42
|
+
|
43
|
+
# @return [DateTime]
|
44
|
+
attr_accessor :creation_time
|
45
|
+
|
46
|
+
# @return [String]
|
47
|
+
attr_accessor :upload_status_log_uri
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
# rubocop:disable Style/SymbolLiteral
|
53
|
+
'serial_number': :'serialNumber',
|
54
|
+
'iscsi_iqn': :'iscsiIQN',
|
55
|
+
'label': :'label',
|
56
|
+
'lifecycle_state': :'lifecycleState',
|
57
|
+
'transfer_job_id': :'transferJobId',
|
58
|
+
'attached_transfer_package_label': :'attachedTransferPackageLabel',
|
59
|
+
'creation_time': :'creationTime',
|
60
|
+
'upload_status_log_uri': :'uploadStatusLogUri'
|
61
|
+
# rubocop:enable Style/SymbolLiteral
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute type mapping.
|
66
|
+
def self.swagger_types
|
67
|
+
{
|
68
|
+
# rubocop:disable Style/SymbolLiteral
|
69
|
+
'serial_number': :'String',
|
70
|
+
'iscsi_iqn': :'String',
|
71
|
+
'label': :'String',
|
72
|
+
'lifecycle_state': :'String',
|
73
|
+
'transfer_job_id': :'String',
|
74
|
+
'attached_transfer_package_label': :'String',
|
75
|
+
'creation_time': :'DateTime',
|
76
|
+
'upload_status_log_uri': :'String'
|
77
|
+
# rubocop:enable Style/SymbolLiteral
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
82
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
83
|
+
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
# @option attributes [String] :serial_number The value to assign to the {#serial_number} property
|
88
|
+
# @option attributes [String] :iscsi_iqn The value to assign to the {#iscsi_iqn} property
|
89
|
+
# @option attributes [String] :label The value to assign to the {#label} property
|
90
|
+
# @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
|
91
|
+
# @option attributes [String] :transfer_job_id The value to assign to the {#transfer_job_id} property
|
92
|
+
# @option attributes [String] :attached_transfer_package_label The value to assign to the {#attached_transfer_package_label} property
|
93
|
+
# @option attributes [DateTime] :creation_time The value to assign to the {#creation_time} property
|
94
|
+
# @option attributes [String] :upload_status_log_uri The value to assign to the {#upload_status_log_uri} property
|
95
|
+
def initialize(attributes = {})
|
96
|
+
return unless attributes.is_a?(Hash)
|
97
|
+
|
98
|
+
# convert string to symbol for hash key
|
99
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
100
|
+
|
101
|
+
self.serial_number = attributes[:'serialNumber'] if attributes[:'serialNumber']
|
102
|
+
|
103
|
+
raise 'You cannot provide both :serialNumber and :serial_number' if attributes.key?(:'serialNumber') && attributes.key?(:'serial_number')
|
104
|
+
|
105
|
+
self.serial_number = attributes[:'serial_number'] if attributes[:'serial_number']
|
106
|
+
|
107
|
+
self.iscsi_iqn = attributes[:'iscsiIQN'] if attributes[:'iscsiIQN']
|
108
|
+
|
109
|
+
raise 'You cannot provide both :iscsiIQN and :iscsi_iqn' if attributes.key?(:'iscsiIQN') && attributes.key?(:'iscsi_iqn')
|
110
|
+
|
111
|
+
self.iscsi_iqn = attributes[:'iscsi_iqn'] if attributes[:'iscsi_iqn']
|
112
|
+
|
113
|
+
self.label = attributes[:'label'] if attributes[:'label']
|
114
|
+
|
115
|
+
self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
|
116
|
+
|
117
|
+
raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
|
118
|
+
|
119
|
+
self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
|
120
|
+
|
121
|
+
self.transfer_job_id = attributes[:'transferJobId'] if attributes[:'transferJobId']
|
122
|
+
|
123
|
+
raise 'You cannot provide both :transferJobId and :transfer_job_id' if attributes.key?(:'transferJobId') && attributes.key?(:'transfer_job_id')
|
124
|
+
|
125
|
+
self.transfer_job_id = attributes[:'transfer_job_id'] if attributes[:'transfer_job_id']
|
126
|
+
|
127
|
+
self.attached_transfer_package_label = attributes[:'attachedTransferPackageLabel'] if attributes[:'attachedTransferPackageLabel']
|
128
|
+
|
129
|
+
raise 'You cannot provide both :attachedTransferPackageLabel and :attached_transfer_package_label' if attributes.key?(:'attachedTransferPackageLabel') && attributes.key?(:'attached_transfer_package_label')
|
130
|
+
|
131
|
+
self.attached_transfer_package_label = attributes[:'attached_transfer_package_label'] if attributes[:'attached_transfer_package_label']
|
132
|
+
|
133
|
+
self.creation_time = attributes[:'creationTime'] if attributes[:'creationTime']
|
134
|
+
|
135
|
+
raise 'You cannot provide both :creationTime and :creation_time' if attributes.key?(:'creationTime') && attributes.key?(:'creation_time')
|
136
|
+
|
137
|
+
self.creation_time = attributes[:'creation_time'] if attributes[:'creation_time']
|
138
|
+
|
139
|
+
self.upload_status_log_uri = attributes[:'uploadStatusLogUri'] if attributes[:'uploadStatusLogUri']
|
140
|
+
|
141
|
+
raise 'You cannot provide both :uploadStatusLogUri and :upload_status_log_uri' if attributes.key?(:'uploadStatusLogUri') && attributes.key?(:'upload_status_log_uri')
|
142
|
+
|
143
|
+
self.upload_status_log_uri = attributes[:'upload_status_log_uri'] if attributes[:'upload_status_log_uri']
|
144
|
+
end
|
145
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
146
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
147
|
+
|
148
|
+
# Custom attribute writer method checking allowed values (enum).
|
149
|
+
# @param [Object] lifecycle_state Object to be assigned
|
150
|
+
def lifecycle_state=(lifecycle_state)
|
151
|
+
# rubocop:disable Style/ConditionalAssignment
|
152
|
+
if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
|
153
|
+
OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
|
154
|
+
@lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
|
155
|
+
else
|
156
|
+
@lifecycle_state = lifecycle_state
|
157
|
+
end
|
158
|
+
# rubocop:enable Style/ConditionalAssignment
|
159
|
+
end
|
160
|
+
|
161
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
162
|
+
|
163
|
+
|
164
|
+
# Checks equality by comparing each attribute.
|
165
|
+
# @param [Object] other the other object to be compared
|
166
|
+
def ==(other)
|
167
|
+
return true if equal?(other)
|
168
|
+
|
169
|
+
self.class == other.class &&
|
170
|
+
serial_number == other.serial_number &&
|
171
|
+
iscsi_iqn == other.iscsi_iqn &&
|
172
|
+
label == other.label &&
|
173
|
+
lifecycle_state == other.lifecycle_state &&
|
174
|
+
transfer_job_id == other.transfer_job_id &&
|
175
|
+
attached_transfer_package_label == other.attached_transfer_package_label &&
|
176
|
+
creation_time == other.creation_time &&
|
177
|
+
upload_status_log_uri == other.upload_status_log_uri
|
178
|
+
end
|
179
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
180
|
+
|
181
|
+
# @see the `==` method
|
182
|
+
# @param [Object] other the other object to be compared
|
183
|
+
def eql?(other)
|
184
|
+
self == other
|
185
|
+
end
|
186
|
+
|
187
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
188
|
+
|
189
|
+
|
190
|
+
# Calculates hash code according to all attributes.
|
191
|
+
# @return [Fixnum] Hash code
|
192
|
+
def hash
|
193
|
+
[serial_number, iscsi_iqn, label, lifecycle_state, transfer_job_id, attached_transfer_package_label, creation_time, upload_status_log_uri].hash
|
194
|
+
end
|
195
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
196
|
+
|
197
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
198
|
+
|
199
|
+
|
200
|
+
# Builds the object from hash
|
201
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
202
|
+
# @return [Object] Returns the model itself
|
203
|
+
def build_from_hash(attributes)
|
204
|
+
return nil unless attributes.is_a?(Hash)
|
205
|
+
|
206
|
+
self.class.swagger_types.each_pair do |key, type|
|
207
|
+
if type =~ /^Array<(.*)>/i
|
208
|
+
# check to ensure the input is an array given that the the attribute
|
209
|
+
# is documented as an array but the input is not
|
210
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
211
|
+
public_method("#{key}=").call(
|
212
|
+
attributes[self.class.attribute_map[key]]
|
213
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
214
|
+
)
|
215
|
+
end
|
216
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
217
|
+
public_method("#{key}=").call(
|
218
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
219
|
+
)
|
220
|
+
end
|
221
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
222
|
+
end
|
223
|
+
|
224
|
+
self
|
225
|
+
end
|
226
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
227
|
+
|
228
|
+
# Returns the string representation of the object
|
229
|
+
# @return [String] String presentation of the object
|
230
|
+
def to_s
|
231
|
+
to_hash.to_s
|
232
|
+
end
|
233
|
+
|
234
|
+
# Returns the object in the form of hash
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_hash
|
237
|
+
hash = {}
|
238
|
+
self.class.attribute_map.each_pair do |attr, param|
|
239
|
+
value = public_method(attr).call
|
240
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
241
|
+
|
242
|
+
hash[param] = _to_hash(value)
|
243
|
+
end
|
244
|
+
hash
|
245
|
+
end
|
246
|
+
|
247
|
+
private
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|