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
@@ -12,11 +12,19 @@ module OCI
|
|
12
12
|
# @return [String]
|
13
13
|
attr_accessor :display_name
|
14
14
|
|
15
|
-
#
|
15
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
16
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
17
|
+
#
|
18
|
+
# Example: `{\"Department\": \"Finance\"}`
|
19
|
+
#
|
16
20
|
# @return [Hash<String, String>]
|
17
21
|
attr_accessor :freeform_tags
|
18
22
|
|
19
|
-
#
|
23
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
24
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
25
|
+
#
|
26
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
27
|
+
#
|
20
28
|
# @return [Hash<String, Hash<String, Object>>]
|
21
29
|
attr_accessor :defined_tags
|
22
30
|
|
@@ -0,0 +1,237 @@
|
|
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
|
+
# Updates the configuration details of a Custom Protection rule. The update is possible only if the rule hasn't been selected as active in any WAAS policy (remains in `Off` state).
|
8
|
+
# **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
|
9
|
+
class Waas::Models::UpdateCustomProtectionRuleDetails
|
10
|
+
# A user-friendly name for the Custom Protection rule.
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :display_name
|
13
|
+
|
14
|
+
# A description for the Custom Protection rule.
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :description
|
17
|
+
|
18
|
+
# The template text of the Custom Protection rule. The syntax is based on ModSecurity Rule Language. Additionaly it needs to include two variables / placeholders which will be replaced during publishing.
|
19
|
+
#
|
20
|
+
# - **{{mode}}** - rule action, defined by user in UI, like `OFF`, `DETECT` or `BLOCK`.
|
21
|
+
#
|
22
|
+
# - **{{id_1}}** - unique rule ID which identifies a `SecRule`, generated by the system. Multiple IDs can be used by increasing the number of the variable for every `SecRule` defined in the template.
|
23
|
+
#
|
24
|
+
# *Example usage:*
|
25
|
+
# ```
|
26
|
+
# SecRule REQUEST_COOKIES \"regex matching SQL injection - part 1/2\" \\
|
27
|
+
# \"phase:2, \\
|
28
|
+
# msg:'Detects chained SQL injection attempts 1/2.', \\
|
29
|
+
# id: {{id_1}}, \\
|
30
|
+
# ctl:ruleEngine={{mode}}, \\
|
31
|
+
# deny\"
|
32
|
+
# SecRule REQUEST_COOKIES \"regex matching SQL injection - part 2/2\" \\
|
33
|
+
# \"phase:2, \\
|
34
|
+
# msg:'Detects chained SQL injection attempts 2/2.', \\
|
35
|
+
# id: {{id_2}}, \\
|
36
|
+
# ctl:ruleEngine={{mode}}, \\
|
37
|
+
# deny\"
|
38
|
+
# ```
|
39
|
+
# The example contains two `SecRules` each having distinct regex expression to match
|
40
|
+
# `Cookie` header value during second input analysis phase.
|
41
|
+
# The disruptive `deny` action takes effect only when `{{mode}}` is set to `BLOCK`.
|
42
|
+
# The message is logged either when `{{mode}}` is set to `DETECT` or `BLOCK`.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation](https://www.modsecurity.org/CRS/Documentation/making.html).
|
46
|
+
# @return [String]
|
47
|
+
attr_accessor :template
|
48
|
+
|
49
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
50
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
51
|
+
#
|
52
|
+
# Example: `{\"Department\": \"Finance\"}`
|
53
|
+
#
|
54
|
+
# @return [Hash<String, String>]
|
55
|
+
attr_accessor :freeform_tags
|
56
|
+
|
57
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
58
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
59
|
+
#
|
60
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
61
|
+
#
|
62
|
+
# @return [Hash<String, Hash<String, Object>>]
|
63
|
+
attr_accessor :defined_tags
|
64
|
+
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
66
|
+
def self.attribute_map
|
67
|
+
{
|
68
|
+
# rubocop:disable Style/SymbolLiteral
|
69
|
+
'display_name': :'displayName',
|
70
|
+
'description': :'description',
|
71
|
+
'template': :'template',
|
72
|
+
'freeform_tags': :'freeformTags',
|
73
|
+
'defined_tags': :'definedTags'
|
74
|
+
# rubocop:enable Style/SymbolLiteral
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# Attribute type mapping.
|
79
|
+
def self.swagger_types
|
80
|
+
{
|
81
|
+
# rubocop:disable Style/SymbolLiteral
|
82
|
+
'display_name': :'String',
|
83
|
+
'description': :'String',
|
84
|
+
'template': :'String',
|
85
|
+
'freeform_tags': :'Hash<String, String>',
|
86
|
+
'defined_tags': :'Hash<String, Hash<String, Object>>'
|
87
|
+
# rubocop:enable Style/SymbolLiteral
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
92
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
93
|
+
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @option attributes [String] :display_name The value to assign to the {#display_name} property
|
98
|
+
# @option attributes [String] :description The value to assign to the {#description} property
|
99
|
+
# @option attributes [String] :template The value to assign to the {#template} property
|
100
|
+
# @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
|
101
|
+
# @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
|
102
|
+
def initialize(attributes = {})
|
103
|
+
return unless attributes.is_a?(Hash)
|
104
|
+
|
105
|
+
# convert string to symbol for hash key
|
106
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
107
|
+
|
108
|
+
self.display_name = attributes[:'displayName'] if attributes[:'displayName']
|
109
|
+
|
110
|
+
raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
|
111
|
+
|
112
|
+
self.display_name = attributes[:'display_name'] if attributes[:'display_name']
|
113
|
+
|
114
|
+
self.description = attributes[:'description'] if attributes[:'description']
|
115
|
+
|
116
|
+
self.template = attributes[:'template'] if attributes[:'template']
|
117
|
+
|
118
|
+
self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
|
119
|
+
|
120
|
+
raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
|
121
|
+
|
122
|
+
self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
|
123
|
+
|
124
|
+
self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
|
125
|
+
|
126
|
+
raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
|
127
|
+
|
128
|
+
self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
|
129
|
+
end
|
130
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
131
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
132
|
+
|
133
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
134
|
+
|
135
|
+
|
136
|
+
# Checks equality by comparing each attribute.
|
137
|
+
# @param [Object] other the other object to be compared
|
138
|
+
def ==(other)
|
139
|
+
return true if equal?(other)
|
140
|
+
|
141
|
+
self.class == other.class &&
|
142
|
+
display_name == other.display_name &&
|
143
|
+
description == other.description &&
|
144
|
+
template == other.template &&
|
145
|
+
freeform_tags == other.freeform_tags &&
|
146
|
+
defined_tags == other.defined_tags
|
147
|
+
end
|
148
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
149
|
+
|
150
|
+
# @see the `==` method
|
151
|
+
# @param [Object] other the other object to be compared
|
152
|
+
def eql?(other)
|
153
|
+
self == other
|
154
|
+
end
|
155
|
+
|
156
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
157
|
+
|
158
|
+
|
159
|
+
# Calculates hash code according to all attributes.
|
160
|
+
# @return [Fixnum] Hash code
|
161
|
+
def hash
|
162
|
+
[display_name, description, template, freeform_tags, defined_tags].hash
|
163
|
+
end
|
164
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
165
|
+
|
166
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
167
|
+
|
168
|
+
|
169
|
+
# Builds the object from hash
|
170
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
+
# @return [Object] Returns the model itself
|
172
|
+
def build_from_hash(attributes)
|
173
|
+
return nil unless attributes.is_a?(Hash)
|
174
|
+
|
175
|
+
self.class.swagger_types.each_pair do |key, type|
|
176
|
+
if type =~ /^Array<(.*)>/i
|
177
|
+
# check to ensure the input is an array given that the the attribute
|
178
|
+
# is documented as an array but the input is not
|
179
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
180
|
+
public_method("#{key}=").call(
|
181
|
+
attributes[self.class.attribute_map[key]]
|
182
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
183
|
+
)
|
184
|
+
end
|
185
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
186
|
+
public_method("#{key}=").call(
|
187
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
188
|
+
)
|
189
|
+
end
|
190
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the object in the form of hash
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_hash
|
206
|
+
hash = {}
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
208
|
+
value = public_method(attr).call
|
209
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
210
|
+
|
211
|
+
hash[param] = _to_hash(value)
|
212
|
+
end
|
213
|
+
hash
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
|
218
|
+
# Outputs non-array value in the form of hash
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
220
|
+
# @param [Object] value Any valid value
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
222
|
+
def _to_hash(value)
|
223
|
+
if value.is_a?(Array)
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
225
|
+
elsif value.is_a?(Hash)
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
228
|
+
end
|
229
|
+
elsif value.respond_to? :to_hash
|
230
|
+
value.to_hash
|
231
|
+
else
|
232
|
+
value
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
@@ -8,7 +8,7 @@ module OCI
|
|
8
8
|
#
|
9
9
|
# **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
|
10
10
|
class Waas::Models::UpdateWaasPolicyDetails
|
11
|
-
# A user-friendly name for the WAAS policy. The name
|
11
|
+
# A user-friendly name for the WAAS policy. The name can be changed and does not need to be unique.
|
12
12
|
# @return [String]
|
13
13
|
attr_accessor :display_name
|
14
14
|
|
@@ -20,17 +20,29 @@ module OCI
|
|
20
20
|
# @return [Hash<String, OCI::Waas::Models::Origin>]
|
21
21
|
attr_accessor :origins
|
22
22
|
|
23
|
+
# The map of origin groups and their keys used to associate origins to the wafConfig.
|
24
|
+
# @return [Hash<String, OCI::Waas::Models::OriginGroup>]
|
25
|
+
attr_accessor :origin_groups
|
26
|
+
|
23
27
|
# @return [OCI::Waas::Models::PolicyConfig]
|
24
28
|
attr_accessor :policy_config
|
25
29
|
|
26
30
|
# @return [OCI::Waas::Models::WafConfig]
|
27
31
|
attr_accessor :waf_config
|
28
32
|
|
29
|
-
#
|
33
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
34
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
35
|
+
#
|
36
|
+
# Example: `{\"Department\": \"Finance\"}`
|
37
|
+
#
|
30
38
|
# @return [Hash<String, String>]
|
31
39
|
attr_accessor :freeform_tags
|
32
40
|
|
33
|
-
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
41
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
42
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
43
|
+
#
|
44
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
45
|
+
#
|
34
46
|
# @return [Hash<String, Hash<String, Object>>]
|
35
47
|
attr_accessor :defined_tags
|
36
48
|
|
@@ -41,6 +53,7 @@ module OCI
|
|
41
53
|
'display_name': :'displayName',
|
42
54
|
'additional_domains': :'additionalDomains',
|
43
55
|
'origins': :'origins',
|
56
|
+
'origin_groups': :'originGroups',
|
44
57
|
'policy_config': :'policyConfig',
|
45
58
|
'waf_config': :'wafConfig',
|
46
59
|
'freeform_tags': :'freeformTags',
|
@@ -56,6 +69,7 @@ module OCI
|
|
56
69
|
'display_name': :'String',
|
57
70
|
'additional_domains': :'Array<String>',
|
58
71
|
'origins': :'Hash<String, OCI::Waas::Models::Origin>',
|
72
|
+
'origin_groups': :'Hash<String, OCI::Waas::Models::OriginGroup>',
|
59
73
|
'policy_config': :'OCI::Waas::Models::PolicyConfig',
|
60
74
|
'waf_config': :'OCI::Waas::Models::WafConfig',
|
61
75
|
'freeform_tags': :'Hash<String, String>',
|
@@ -73,6 +87,7 @@ module OCI
|
|
73
87
|
# @option attributes [String] :display_name The value to assign to the {#display_name} property
|
74
88
|
# @option attributes [Array<String>] :additional_domains The value to assign to the {#additional_domains} property
|
75
89
|
# @option attributes [Hash<String, OCI::Waas::Models::Origin>] :origins The value to assign to the {#origins} property
|
90
|
+
# @option attributes [Hash<String, OCI::Waas::Models::OriginGroup>] :origin_groups The value to assign to the {#origin_groups} property
|
76
91
|
# @option attributes [OCI::Waas::Models::PolicyConfig] :policy_config The value to assign to the {#policy_config} property
|
77
92
|
# @option attributes [OCI::Waas::Models::WafConfig] :waf_config The value to assign to the {#waf_config} property
|
78
93
|
# @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
|
@@ -97,6 +112,12 @@ module OCI
|
|
97
112
|
|
98
113
|
self.origins = attributes[:'origins'] if attributes[:'origins']
|
99
114
|
|
115
|
+
self.origin_groups = attributes[:'originGroups'] if attributes[:'originGroups']
|
116
|
+
|
117
|
+
raise 'You cannot provide both :originGroups and :origin_groups' if attributes.key?(:'originGroups') && attributes.key?(:'origin_groups')
|
118
|
+
|
119
|
+
self.origin_groups = attributes[:'origin_groups'] if attributes[:'origin_groups']
|
120
|
+
|
100
121
|
self.policy_config = attributes[:'policyConfig'] if attributes[:'policyConfig']
|
101
122
|
|
102
123
|
raise 'You cannot provide both :policyConfig and :policy_config' if attributes.key?(:'policyConfig') && attributes.key?(:'policy_config')
|
@@ -136,6 +157,7 @@ module OCI
|
|
136
157
|
display_name == other.display_name &&
|
137
158
|
additional_domains == other.additional_domains &&
|
138
159
|
origins == other.origins &&
|
160
|
+
origin_groups == other.origin_groups &&
|
139
161
|
policy_config == other.policy_config &&
|
140
162
|
waf_config == other.waf_config &&
|
141
163
|
freeform_tags == other.freeform_tags &&
|
@@ -155,7 +177,7 @@ module OCI
|
|
155
177
|
# Calculates hash code according to all attributes.
|
156
178
|
# @return [Fixnum] Hash code
|
157
179
|
def hash
|
158
|
-
[display_name, additional_domains, origins, policy_config, waf_config, freeform_tags, defined_tags].hash
|
180
|
+
[display_name, additional_domains, origins, origin_groups, policy_config, waf_config, freeform_tags, defined_tags].hash
|
159
181
|
end
|
160
182
|
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
161
183
|
|
@@ -55,17 +55,29 @@ module OCI
|
|
55
55
|
# @return [Hash<String, OCI::Waas::Models::Origin>]
|
56
56
|
attr_accessor :origins
|
57
57
|
|
58
|
+
# The map of origin groups and their keys used to associate origins to the wafConfig.
|
59
|
+
# @return [Hash<String, OCI::Waas::Models::OriginGroup>]
|
60
|
+
attr_accessor :origin_groups
|
61
|
+
|
58
62
|
# @return [OCI::Waas::Models::PolicyConfig]
|
59
63
|
attr_accessor :policy_config
|
60
64
|
|
61
65
|
# @return [OCI::Waas::Models::WafConfig]
|
62
66
|
attr_accessor :waf_config
|
63
67
|
|
64
|
-
#
|
68
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
69
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
70
|
+
#
|
71
|
+
# Example: `{\"Department\": \"Finance\"}`
|
72
|
+
#
|
65
73
|
# @return [Hash<String, String>]
|
66
74
|
attr_accessor :freeform_tags
|
67
75
|
|
68
|
-
#
|
76
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
77
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
78
|
+
#
|
79
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
80
|
+
#
|
69
81
|
# @return [Hash<String, Hash<String, Object>>]
|
70
82
|
attr_accessor :defined_tags
|
71
83
|
|
@@ -82,6 +94,7 @@ module OCI
|
|
82
94
|
'lifecycle_state': :'lifecycleState',
|
83
95
|
'time_created': :'timeCreated',
|
84
96
|
'origins': :'origins',
|
97
|
+
'origin_groups': :'originGroups',
|
85
98
|
'policy_config': :'policyConfig',
|
86
99
|
'waf_config': :'wafConfig',
|
87
100
|
'freeform_tags': :'freeformTags',
|
@@ -103,6 +116,7 @@ module OCI
|
|
103
116
|
'lifecycle_state': :'String',
|
104
117
|
'time_created': :'DateTime',
|
105
118
|
'origins': :'Hash<String, OCI::Waas::Models::Origin>',
|
119
|
+
'origin_groups': :'Hash<String, OCI::Waas::Models::OriginGroup>',
|
106
120
|
'policy_config': :'OCI::Waas::Models::PolicyConfig',
|
107
121
|
'waf_config': :'OCI::Waas::Models::WafConfig',
|
108
122
|
'freeform_tags': :'Hash<String, String>',
|
@@ -126,6 +140,7 @@ module OCI
|
|
126
140
|
# @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
|
127
141
|
# @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
|
128
142
|
# @option attributes [Hash<String, OCI::Waas::Models::Origin>] :origins The value to assign to the {#origins} property
|
143
|
+
# @option attributes [Hash<String, OCI::Waas::Models::OriginGroup>] :origin_groups The value to assign to the {#origin_groups} property
|
129
144
|
# @option attributes [OCI::Waas::Models::PolicyConfig] :policy_config The value to assign to the {#policy_config} property
|
130
145
|
# @option attributes [OCI::Waas::Models::WafConfig] :waf_config The value to assign to the {#waf_config} property
|
131
146
|
# @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
|
@@ -174,6 +189,12 @@ module OCI
|
|
174
189
|
|
175
190
|
self.origins = attributes[:'origins'] if attributes[:'origins']
|
176
191
|
|
192
|
+
self.origin_groups = attributes[:'originGroups'] if attributes[:'originGroups']
|
193
|
+
|
194
|
+
raise 'You cannot provide both :originGroups and :origin_groups' if attributes.key?(:'originGroups') && attributes.key?(:'origin_groups')
|
195
|
+
|
196
|
+
self.origin_groups = attributes[:'origin_groups'] if attributes[:'origin_groups']
|
197
|
+
|
177
198
|
self.policy_config = attributes[:'policyConfig'] if attributes[:'policyConfig']
|
178
199
|
|
179
200
|
raise 'You cannot provide both :policyConfig and :policy_config' if attributes.key?(:'policyConfig') && attributes.key?(:'policy_config')
|
@@ -232,6 +253,7 @@ module OCI
|
|
232
253
|
lifecycle_state == other.lifecycle_state &&
|
233
254
|
time_created == other.time_created &&
|
234
255
|
origins == other.origins &&
|
256
|
+
origin_groups == other.origin_groups &&
|
235
257
|
policy_config == other.policy_config &&
|
236
258
|
waf_config == other.waf_config &&
|
237
259
|
freeform_tags == other.freeform_tags &&
|
@@ -251,7 +273,7 @@ module OCI
|
|
251
273
|
# Calculates hash code according to all attributes.
|
252
274
|
# @return [Fixnum] Hash code
|
253
275
|
def hash
|
254
|
-
[id, compartment_id, display_name, domain, additional_domains, cname, lifecycle_state, time_created, origins, policy_config, waf_config, freeform_tags, defined_tags].hash
|
276
|
+
[id, compartment_id, display_name, domain, additional_domains, cname, lifecycle_state, time_created, origins, origin_groups, policy_config, waf_config, freeform_tags, defined_tags].hash
|
255
277
|
end
|
256
278
|
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
257
279
|
|
@@ -0,0 +1,207 @@
|
|
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
|
+
# Summary information about a Custom Protection rule.
|
9
|
+
class Waas::Models::WaasPolicyCustomProtectionRuleSummary
|
10
|
+
ACTION_ENUM = [
|
11
|
+
ACTION_DETECT = 'DETECT'.freeze,
|
12
|
+
ACTION_BLOCK = 'BLOCK'.freeze,
|
13
|
+
ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
# The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Custom Protection rule.
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# The user-friendly name of the Custom Protection rule.
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :display_name
|
23
|
+
|
24
|
+
# The action to take when the Custom Protection rule is triggered.
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :action
|
27
|
+
|
28
|
+
# The list of the ModSecurity rule IDs that apply to this protection rule. For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation](https://www.modsecurity.org/CRS/Documentation/index.html).
|
29
|
+
# @return [Array<String>]
|
30
|
+
attr_accessor :mod_security_rule_ids
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
# rubocop:disable Style/SymbolLiteral
|
36
|
+
'id': :'id',
|
37
|
+
'display_name': :'displayName',
|
38
|
+
'action': :'action',
|
39
|
+
'mod_security_rule_ids': :'modSecurityRuleIds'
|
40
|
+
# rubocop:enable Style/SymbolLiteral
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.swagger_types
|
46
|
+
{
|
47
|
+
# rubocop:disable Style/SymbolLiteral
|
48
|
+
'id': :'String',
|
49
|
+
'display_name': :'String',
|
50
|
+
'action': :'String',
|
51
|
+
'mod_security_rule_ids': :'Array<String>'
|
52
|
+
# rubocop:enable Style/SymbolLiteral
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
57
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
58
|
+
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
# @option attributes [String] :id The value to assign to the {#id} property
|
63
|
+
# @option attributes [String] :display_name The value to assign to the {#display_name} property
|
64
|
+
# @option attributes [String] :action The value to assign to the {#action} property
|
65
|
+
# @option attributes [Array<String>] :mod_security_rule_ids The value to assign to the {#mod_security_rule_ids} property
|
66
|
+
def initialize(attributes = {})
|
67
|
+
return unless attributes.is_a?(Hash)
|
68
|
+
|
69
|
+
# convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
71
|
+
|
72
|
+
self.id = attributes[:'id'] if attributes[:'id']
|
73
|
+
|
74
|
+
self.display_name = attributes[:'displayName'] if attributes[:'displayName']
|
75
|
+
|
76
|
+
raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
|
77
|
+
|
78
|
+
self.display_name = attributes[:'display_name'] if attributes[:'display_name']
|
79
|
+
|
80
|
+
self.action = attributes[:'action'] if attributes[:'action']
|
81
|
+
|
82
|
+
self.mod_security_rule_ids = attributes[:'modSecurityRuleIds'] if attributes[:'modSecurityRuleIds']
|
83
|
+
|
84
|
+
raise 'You cannot provide both :modSecurityRuleIds and :mod_security_rule_ids' if attributes.key?(:'modSecurityRuleIds') && attributes.key?(:'mod_security_rule_ids')
|
85
|
+
|
86
|
+
self.mod_security_rule_ids = attributes[:'mod_security_rule_ids'] if attributes[:'mod_security_rule_ids']
|
87
|
+
end
|
88
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
89
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
90
|
+
|
91
|
+
# Custom attribute writer method checking allowed values (enum).
|
92
|
+
# @param [Object] action Object to be assigned
|
93
|
+
def action=(action)
|
94
|
+
# rubocop:disable Style/ConditionalAssignment
|
95
|
+
if action && !ACTION_ENUM.include?(action)
|
96
|
+
OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
|
97
|
+
@action = ACTION_UNKNOWN_ENUM_VALUE
|
98
|
+
else
|
99
|
+
@action = action
|
100
|
+
end
|
101
|
+
# rubocop:enable Style/ConditionalAssignment
|
102
|
+
end
|
103
|
+
|
104
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
105
|
+
|
106
|
+
|
107
|
+
# Checks equality by comparing each attribute.
|
108
|
+
# @param [Object] other the other object to be compared
|
109
|
+
def ==(other)
|
110
|
+
return true if equal?(other)
|
111
|
+
|
112
|
+
self.class == other.class &&
|
113
|
+
id == other.id &&
|
114
|
+
display_name == other.display_name &&
|
115
|
+
action == other.action &&
|
116
|
+
mod_security_rule_ids == other.mod_security_rule_ids
|
117
|
+
end
|
118
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
119
|
+
|
120
|
+
# @see the `==` method
|
121
|
+
# @param [Object] other the other object to be compared
|
122
|
+
def eql?(other)
|
123
|
+
self == other
|
124
|
+
end
|
125
|
+
|
126
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
127
|
+
|
128
|
+
|
129
|
+
# Calculates hash code according to all attributes.
|
130
|
+
# @return [Fixnum] Hash code
|
131
|
+
def hash
|
132
|
+
[id, display_name, action, mod_security_rule_ids].hash
|
133
|
+
end
|
134
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
135
|
+
|
136
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
137
|
+
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def build_from_hash(attributes)
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
144
|
+
|
145
|
+
self.class.swagger_types.each_pair do |key, type|
|
146
|
+
if type =~ /^Array<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
public_method("#{key}=").call(
|
151
|
+
attributes[self.class.attribute_map[key]]
|
152
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
153
|
+
)
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
public_method("#{key}=").call(
|
157
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
158
|
+
)
|
159
|
+
end
|
160
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
|
163
|
+
self
|
164
|
+
end
|
165
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
166
|
+
|
167
|
+
# Returns the string representation of the object
|
168
|
+
# @return [String] String presentation of the object
|
169
|
+
def to_s
|
170
|
+
to_hash.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = public_method(attr).call
|
179
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
180
|
+
|
181
|
+
hash[param] = _to_hash(value)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
private
|
187
|
+
|
188
|
+
# Outputs non-array value in the form of hash
|
189
|
+
# For object, use to_hash. Otherwise, just return the value
|
190
|
+
# @param [Object] value Any valid value
|
191
|
+
# @return [Hash] Returns the value in the form of hash
|
192
|
+
def _to_hash(value)
|
193
|
+
if value.is_a?(Array)
|
194
|
+
value.compact.map { |v| _to_hash(v) }
|
195
|
+
elsif value.is_a?(Hash)
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
198
|
+
end
|
199
|
+
elsif value.respond_to? :to_hash
|
200
|
+
value.to_hash
|
201
|
+
else
|
202
|
+
value
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|