oci 2.5.11 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,7 +12,7 @@ module OCI
|
|
|
12
12
|
# @return [String]
|
|
13
13
|
attr_accessor :compartment_id
|
|
14
14
|
|
|
15
|
-
# A user-friendly name for the WAAS policy. The name
|
|
15
|
+
# A user-friendly name for the WAAS policy. The name can be changed and does not need to be unique.
|
|
16
16
|
# @return [String]
|
|
17
17
|
attr_accessor :display_name
|
|
18
18
|
|
|
@@ -28,17 +28,29 @@ module OCI
|
|
|
28
28
|
# @return [Hash<String, OCI::Waas::Models::Origin>]
|
|
29
29
|
attr_accessor :origins
|
|
30
30
|
|
|
31
|
+
# The map of origin groups and their keys used to associate origins to the wafConfig.
|
|
32
|
+
# @return [Hash<String, OCI::Waas::Models::OriginGroup>]
|
|
33
|
+
attr_accessor :origin_groups
|
|
34
|
+
|
|
31
35
|
# @return [OCI::Waas::Models::PolicyConfig]
|
|
32
36
|
attr_accessor :policy_config
|
|
33
37
|
|
|
34
38
|
# @return [OCI::Waas::Models::WafConfigDetails]
|
|
35
39
|
attr_accessor :waf_config
|
|
36
40
|
|
|
37
|
-
#
|
|
41
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
|
42
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
|
43
|
+
#
|
|
44
|
+
# Example: `{\"Department\": \"Finance\"}`
|
|
45
|
+
#
|
|
38
46
|
# @return [Hash<String, String>]
|
|
39
47
|
attr_accessor :freeform_tags
|
|
40
48
|
|
|
41
|
-
#
|
|
49
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
|
50
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
|
51
|
+
#
|
|
52
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
|
53
|
+
#
|
|
42
54
|
# @return [Hash<String, Hash<String, Object>>]
|
|
43
55
|
attr_accessor :defined_tags
|
|
44
56
|
|
|
@@ -51,6 +63,7 @@ module OCI
|
|
|
51
63
|
'domain': :'domain',
|
|
52
64
|
'additional_domains': :'additionalDomains',
|
|
53
65
|
'origins': :'origins',
|
|
66
|
+
'origin_groups': :'originGroups',
|
|
54
67
|
'policy_config': :'policyConfig',
|
|
55
68
|
'waf_config': :'wafConfig',
|
|
56
69
|
'freeform_tags': :'freeformTags',
|
|
@@ -68,6 +81,7 @@ module OCI
|
|
|
68
81
|
'domain': :'String',
|
|
69
82
|
'additional_domains': :'Array<String>',
|
|
70
83
|
'origins': :'Hash<String, OCI::Waas::Models::Origin>',
|
|
84
|
+
'origin_groups': :'Hash<String, OCI::Waas::Models::OriginGroup>',
|
|
71
85
|
'policy_config': :'OCI::Waas::Models::PolicyConfig',
|
|
72
86
|
'waf_config': :'OCI::Waas::Models::WafConfigDetails',
|
|
73
87
|
'freeform_tags': :'Hash<String, String>',
|
|
@@ -87,6 +101,7 @@ module OCI
|
|
|
87
101
|
# @option attributes [String] :domain The value to assign to the {#domain} property
|
|
88
102
|
# @option attributes [Array<String>] :additional_domains The value to assign to the {#additional_domains} property
|
|
89
103
|
# @option attributes [Hash<String, OCI::Waas::Models::Origin>] :origins The value to assign to the {#origins} property
|
|
104
|
+
# @option attributes [Hash<String, OCI::Waas::Models::OriginGroup>] :origin_groups The value to assign to the {#origin_groups} property
|
|
90
105
|
# @option attributes [OCI::Waas::Models::PolicyConfig] :policy_config The value to assign to the {#policy_config} property
|
|
91
106
|
# @option attributes [OCI::Waas::Models::WafConfigDetails] :waf_config The value to assign to the {#waf_config} property
|
|
92
107
|
# @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
|
|
@@ -119,6 +134,12 @@ module OCI
|
|
|
119
134
|
|
|
120
135
|
self.origins = attributes[:'origins'] if attributes[:'origins']
|
|
121
136
|
|
|
137
|
+
self.origin_groups = attributes[:'originGroups'] if attributes[:'originGroups']
|
|
138
|
+
|
|
139
|
+
raise 'You cannot provide both :originGroups and :origin_groups' if attributes.key?(:'originGroups') && attributes.key?(:'origin_groups')
|
|
140
|
+
|
|
141
|
+
self.origin_groups = attributes[:'origin_groups'] if attributes[:'origin_groups']
|
|
142
|
+
|
|
122
143
|
self.policy_config = attributes[:'policyConfig'] if attributes[:'policyConfig']
|
|
123
144
|
|
|
124
145
|
raise 'You cannot provide both :policyConfig and :policy_config' if attributes.key?(:'policyConfig') && attributes.key?(:'policy_config')
|
|
@@ -160,6 +181,7 @@ module OCI
|
|
|
160
181
|
domain == other.domain &&
|
|
161
182
|
additional_domains == other.additional_domains &&
|
|
162
183
|
origins == other.origins &&
|
|
184
|
+
origin_groups == other.origin_groups &&
|
|
163
185
|
policy_config == other.policy_config &&
|
|
164
186
|
waf_config == other.waf_config &&
|
|
165
187
|
freeform_tags == other.freeform_tags &&
|
|
@@ -179,7 +201,7 @@ module OCI
|
|
|
179
201
|
# Calculates hash code according to all attributes.
|
|
180
202
|
# @return [Fixnum] Hash code
|
|
181
203
|
def hash
|
|
182
|
-
[compartment_id, display_name, domain, additional_domains, origins, policy_config, waf_config, freeform_tags, defined_tags].hash
|
|
204
|
+
[compartment_id, display_name, domain, additional_domains, origins, origin_groups, policy_config, waf_config, freeform_tags, defined_tags].hash
|
|
183
205
|
end
|
|
184
206
|
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
|
185
207
|
|
|
@@ -0,0 +1,326 @@
|
|
|
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
|
+
# The details of a Custom Protection rule.
|
|
9
|
+
class Waas::Models::CustomProtectionRule
|
|
10
|
+
LIFECYCLE_STATE_ENUM = [
|
|
11
|
+
LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
|
|
12
|
+
LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
|
|
13
|
+
LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
|
|
14
|
+
LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
|
|
15
|
+
LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
|
|
16
|
+
LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
|
|
17
|
+
LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
# The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Custom Protecion rule.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :id
|
|
23
|
+
|
|
24
|
+
# The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Custom Protecion rule's compartment.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :compartment_id
|
|
27
|
+
|
|
28
|
+
# The user-friendly name of the Custom Protecion rule.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :display_name
|
|
31
|
+
|
|
32
|
+
# The description of the Custom Protection rule.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :description
|
|
35
|
+
|
|
36
|
+
# 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).
|
|
37
|
+
# @return [Array<String>]
|
|
38
|
+
attr_accessor :mod_security_rule_ids
|
|
39
|
+
|
|
40
|
+
# 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.
|
|
41
|
+
#
|
|
42
|
+
# - **{{mode}}** - rule action, defined by user in UI, like `OFF`, `DETECT` or `BLOCK`.
|
|
43
|
+
#
|
|
44
|
+
# - **{{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.
|
|
45
|
+
#
|
|
46
|
+
# *Example usage:*
|
|
47
|
+
# ```
|
|
48
|
+
# SecRule REQUEST_COOKIES \"regex matching SQL injection - part 1/2\" \\
|
|
49
|
+
# \"phase:2, \\
|
|
50
|
+
# msg:'Detects chained SQL injection attempts 1/2.', \\
|
|
51
|
+
# id: {{id_1}}, \\
|
|
52
|
+
# ctl:ruleEngine={{mode}}, \\
|
|
53
|
+
# deny\"
|
|
54
|
+
# SecRule REQUEST_COOKIES \"regex matching SQL injection - part 2/2\" \\
|
|
55
|
+
# \"phase:2, \\
|
|
56
|
+
# msg:'Detects chained SQL injection attempts 2/2.', \\
|
|
57
|
+
# id: {{id_2}}, \\
|
|
58
|
+
# ctl:ruleEngine={{mode}}, \\
|
|
59
|
+
# deny\"
|
|
60
|
+
# ```
|
|
61
|
+
# The example contains two `SecRules` each having distinct regex expression to match
|
|
62
|
+
# `Cookie` header value during second input analysis phase.
|
|
63
|
+
# The disruptive `deny` action takes effect only when `{{mode}}` is set to `BLOCK`.
|
|
64
|
+
# The message is logged either when `{{mode}}` is set to `DETECT` or `BLOCK`.
|
|
65
|
+
#
|
|
66
|
+
#
|
|
67
|
+
# For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation](https://www.modsecurity.org/CRS/Documentation/making.html).
|
|
68
|
+
# @return [String]
|
|
69
|
+
attr_accessor :template
|
|
70
|
+
|
|
71
|
+
# The current lifecycle state of the Custom Protection rule.
|
|
72
|
+
# @return [String]
|
|
73
|
+
attr_reader :lifecycle_state
|
|
74
|
+
|
|
75
|
+
# The date and time the protection rule was created, expressed in RFC 3339 timestamp format.
|
|
76
|
+
# @return [DateTime]
|
|
77
|
+
attr_accessor :time_created
|
|
78
|
+
|
|
79
|
+
# Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
|
|
80
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
|
81
|
+
#
|
|
82
|
+
# Example: `{\"Department\": \"Finance\"}`
|
|
83
|
+
#
|
|
84
|
+
# @return [Hash<String, String>]
|
|
85
|
+
attr_accessor :freeform_tags
|
|
86
|
+
|
|
87
|
+
# Defined tags for this resource. Each key is predefined and scoped to a namespace.
|
|
88
|
+
# For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
|
|
89
|
+
#
|
|
90
|
+
# Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
|
|
91
|
+
#
|
|
92
|
+
# @return [Hash<String, Hash<String, Object>>]
|
|
93
|
+
attr_accessor :defined_tags
|
|
94
|
+
|
|
95
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
96
|
+
def self.attribute_map
|
|
97
|
+
{
|
|
98
|
+
# rubocop:disable Style/SymbolLiteral
|
|
99
|
+
'id': :'id',
|
|
100
|
+
'compartment_id': :'compartmentId',
|
|
101
|
+
'display_name': :'displayName',
|
|
102
|
+
'description': :'description',
|
|
103
|
+
'mod_security_rule_ids': :'modSecurityRuleIds',
|
|
104
|
+
'template': :'template',
|
|
105
|
+
'lifecycle_state': :'lifecycleState',
|
|
106
|
+
'time_created': :'timeCreated',
|
|
107
|
+
'freeform_tags': :'freeformTags',
|
|
108
|
+
'defined_tags': :'definedTags'
|
|
109
|
+
# rubocop:enable Style/SymbolLiteral
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Attribute type mapping.
|
|
114
|
+
def self.swagger_types
|
|
115
|
+
{
|
|
116
|
+
# rubocop:disable Style/SymbolLiteral
|
|
117
|
+
'id': :'String',
|
|
118
|
+
'compartment_id': :'String',
|
|
119
|
+
'display_name': :'String',
|
|
120
|
+
'description': :'String',
|
|
121
|
+
'mod_security_rule_ids': :'Array<String>',
|
|
122
|
+
'template': :'String',
|
|
123
|
+
'lifecycle_state': :'String',
|
|
124
|
+
'time_created': :'DateTime',
|
|
125
|
+
'freeform_tags': :'Hash<String, String>',
|
|
126
|
+
'defined_tags': :'Hash<String, Hash<String, Object>>'
|
|
127
|
+
# rubocop:enable Style/SymbolLiteral
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
132
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# Initializes the object
|
|
136
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
137
|
+
# @option attributes [String] :id The value to assign to the {#id} property
|
|
138
|
+
# @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
|
|
139
|
+
# @option attributes [String] :display_name The value to assign to the {#display_name} property
|
|
140
|
+
# @option attributes [String] :description The value to assign to the {#description} property
|
|
141
|
+
# @option attributes [Array<String>] :mod_security_rule_ids The value to assign to the {#mod_security_rule_ids} property
|
|
142
|
+
# @option attributes [String] :template The value to assign to the {#template} property
|
|
143
|
+
# @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
|
|
144
|
+
# @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
|
|
145
|
+
# @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
|
|
146
|
+
# @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
|
|
147
|
+
def initialize(attributes = {})
|
|
148
|
+
return unless attributes.is_a?(Hash)
|
|
149
|
+
|
|
150
|
+
# convert string to symbol for hash key
|
|
151
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
152
|
+
|
|
153
|
+
self.id = attributes[:'id'] if attributes[:'id']
|
|
154
|
+
|
|
155
|
+
self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
|
|
156
|
+
|
|
157
|
+
raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
|
|
158
|
+
|
|
159
|
+
self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
|
|
160
|
+
|
|
161
|
+
self.display_name = attributes[:'displayName'] if attributes[:'displayName']
|
|
162
|
+
|
|
163
|
+
raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
|
|
164
|
+
|
|
165
|
+
self.display_name = attributes[:'display_name'] if attributes[:'display_name']
|
|
166
|
+
|
|
167
|
+
self.description = attributes[:'description'] if attributes[:'description']
|
|
168
|
+
|
|
169
|
+
self.mod_security_rule_ids = attributes[:'modSecurityRuleIds'] if attributes[:'modSecurityRuleIds']
|
|
170
|
+
|
|
171
|
+
raise 'You cannot provide both :modSecurityRuleIds and :mod_security_rule_ids' if attributes.key?(:'modSecurityRuleIds') && attributes.key?(:'mod_security_rule_ids')
|
|
172
|
+
|
|
173
|
+
self.mod_security_rule_ids = attributes[:'mod_security_rule_ids'] if attributes[:'mod_security_rule_ids']
|
|
174
|
+
|
|
175
|
+
self.template = attributes[:'template'] if attributes[:'template']
|
|
176
|
+
|
|
177
|
+
self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
|
|
178
|
+
|
|
179
|
+
raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
|
|
180
|
+
|
|
181
|
+
self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
|
|
182
|
+
|
|
183
|
+
self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
|
|
184
|
+
|
|
185
|
+
raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
|
|
186
|
+
|
|
187
|
+
self.time_created = attributes[:'time_created'] if attributes[:'time_created']
|
|
188
|
+
|
|
189
|
+
self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
|
|
190
|
+
|
|
191
|
+
raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
|
|
192
|
+
|
|
193
|
+
self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
|
|
194
|
+
|
|
195
|
+
self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
|
|
196
|
+
|
|
197
|
+
raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
|
|
198
|
+
|
|
199
|
+
self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
|
|
200
|
+
end
|
|
201
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
202
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
205
|
+
# @param [Object] lifecycle_state Object to be assigned
|
|
206
|
+
def lifecycle_state=(lifecycle_state)
|
|
207
|
+
# rubocop:disable Style/ConditionalAssignment
|
|
208
|
+
if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
|
|
209
|
+
OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
|
|
210
|
+
@lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
|
|
211
|
+
else
|
|
212
|
+
@lifecycle_state = lifecycle_state
|
|
213
|
+
end
|
|
214
|
+
# rubocop:enable Style/ConditionalAssignment
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
# Checks equality by comparing each attribute.
|
|
221
|
+
# @param [Object] other the other object to be compared
|
|
222
|
+
def ==(other)
|
|
223
|
+
return true if equal?(other)
|
|
224
|
+
|
|
225
|
+
self.class == other.class &&
|
|
226
|
+
id == other.id &&
|
|
227
|
+
compartment_id == other.compartment_id &&
|
|
228
|
+
display_name == other.display_name &&
|
|
229
|
+
description == other.description &&
|
|
230
|
+
mod_security_rule_ids == other.mod_security_rule_ids &&
|
|
231
|
+
template == other.template &&
|
|
232
|
+
lifecycle_state == other.lifecycle_state &&
|
|
233
|
+
time_created == other.time_created &&
|
|
234
|
+
freeform_tags == other.freeform_tags &&
|
|
235
|
+
defined_tags == other.defined_tags
|
|
236
|
+
end
|
|
237
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
|
238
|
+
|
|
239
|
+
# @see the `==` method
|
|
240
|
+
# @param [Object] other the other object to be compared
|
|
241
|
+
def eql?(other)
|
|
242
|
+
self == other
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
# Calculates hash code according to all attributes.
|
|
249
|
+
# @return [Fixnum] Hash code
|
|
250
|
+
def hash
|
|
251
|
+
[id, compartment_id, display_name, description, mod_security_rule_ids, template, lifecycle_state, time_created, freeform_tags, defined_tags].hash
|
|
252
|
+
end
|
|
253
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
|
254
|
+
|
|
255
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# Builds the object from hash
|
|
259
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
260
|
+
# @return [Object] Returns the model itself
|
|
261
|
+
def build_from_hash(attributes)
|
|
262
|
+
return nil unless attributes.is_a?(Hash)
|
|
263
|
+
|
|
264
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
265
|
+
if type =~ /^Array<(.*)>/i
|
|
266
|
+
# check to ensure the input is an array given that the the attribute
|
|
267
|
+
# is documented as an array but the input is not
|
|
268
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
269
|
+
public_method("#{key}=").call(
|
|
270
|
+
attributes[self.class.attribute_map[key]]
|
|
271
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
|
272
|
+
)
|
|
273
|
+
end
|
|
274
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
275
|
+
public_method("#{key}=").call(
|
|
276
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
|
277
|
+
)
|
|
278
|
+
end
|
|
279
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
self
|
|
283
|
+
end
|
|
284
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
|
285
|
+
|
|
286
|
+
# Returns the string representation of the object
|
|
287
|
+
# @return [String] String presentation of the object
|
|
288
|
+
def to_s
|
|
289
|
+
to_hash.to_s
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Returns the object in the form of hash
|
|
293
|
+
# @return [Hash] Returns the object in the form of hash
|
|
294
|
+
def to_hash
|
|
295
|
+
hash = {}
|
|
296
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
297
|
+
value = public_method(attr).call
|
|
298
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
|
299
|
+
|
|
300
|
+
hash[param] = _to_hash(value)
|
|
301
|
+
end
|
|
302
|
+
hash
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
private
|
|
306
|
+
|
|
307
|
+
# Outputs non-array value in the form of hash
|
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
309
|
+
# @param [Object] value Any valid value
|
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
|
311
|
+
def _to_hash(value)
|
|
312
|
+
if value.is_a?(Array)
|
|
313
|
+
value.compact.map { |v| _to_hash(v) }
|
|
314
|
+
elsif value.is_a?(Hash)
|
|
315
|
+
{}.tap do |hash|
|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
317
|
+
end
|
|
318
|
+
elsif value.respond_to? :to_hash
|
|
319
|
+
value.to_hash
|
|
320
|
+
else
|
|
321
|
+
value
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
# The OCID and action of a Custom Protection rule.
|
|
9
|
+
class Waas::Models::CustomProtectionRuleSetting
|
|
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 Protecion rule.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
# The action to take when the Custom Protection rule is triggered.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_reader :action
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
# rubocop:disable Style/SymbolLiteral
|
|
28
|
+
'id': :'id',
|
|
29
|
+
'action': :'action'
|
|
30
|
+
# rubocop:enable Style/SymbolLiteral
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Attribute type mapping.
|
|
35
|
+
def self.swagger_types
|
|
36
|
+
{
|
|
37
|
+
# rubocop:disable Style/SymbolLiteral
|
|
38
|
+
'id': :'String',
|
|
39
|
+
'action': :'String'
|
|
40
|
+
# rubocop:enable Style/SymbolLiteral
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
45
|
+
# rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Initializes the object
|
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
50
|
+
# @option attributes [String] :id The value to assign to the {#id} property
|
|
51
|
+
# @option attributes [String] :action The value to assign to the {#action} property
|
|
52
|
+
def initialize(attributes = {})
|
|
53
|
+
return unless attributes.is_a?(Hash)
|
|
54
|
+
|
|
55
|
+
# convert string to symbol for hash key
|
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
57
|
+
|
|
58
|
+
self.id = attributes[:'id'] if attributes[:'id']
|
|
59
|
+
|
|
60
|
+
self.action = attributes[:'action'] if attributes[:'action']
|
|
61
|
+
self.action = "DETECT" if action.nil? && !attributes.key?(:'action') # rubocop:disable Style/StringLiterals
|
|
62
|
+
end
|
|
63
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
64
|
+
# rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
|
65
|
+
|
|
66
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
67
|
+
# @param [Object] action Object to be assigned
|
|
68
|
+
def action=(action)
|
|
69
|
+
# rubocop:disable Style/ConditionalAssignment
|
|
70
|
+
if action && !ACTION_ENUM.include?(action)
|
|
71
|
+
OCI.logger.debug("Unknown value for 'action' [" + action + "]. Mapping to 'ACTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
|
|
72
|
+
@action = ACTION_UNKNOWN_ENUM_VALUE
|
|
73
|
+
else
|
|
74
|
+
@action = action
|
|
75
|
+
end
|
|
76
|
+
# rubocop:enable Style/ConditionalAssignment
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# Checks equality by comparing each attribute.
|
|
83
|
+
# @param [Object] other the other object to be compared
|
|
84
|
+
def ==(other)
|
|
85
|
+
return true if equal?(other)
|
|
86
|
+
|
|
87
|
+
self.class == other.class &&
|
|
88
|
+
id == other.id &&
|
|
89
|
+
action == other.action
|
|
90
|
+
end
|
|
91
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
|
92
|
+
|
|
93
|
+
# @see the `==` method
|
|
94
|
+
# @param [Object] other the other object to be compared
|
|
95
|
+
def eql?(other)
|
|
96
|
+
self == other
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# Calculates hash code according to all attributes.
|
|
103
|
+
# @return [Fixnum] Hash code
|
|
104
|
+
def hash
|
|
105
|
+
[id, action].hash
|
|
106
|
+
end
|
|
107
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
|
108
|
+
|
|
109
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# Builds the object from hash
|
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
114
|
+
# @return [Object] Returns the model itself
|
|
115
|
+
def build_from_hash(attributes)
|
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
|
117
|
+
|
|
118
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
119
|
+
if type =~ /^Array<(.*)>/i
|
|
120
|
+
# check to ensure the input is an array given that the the attribute
|
|
121
|
+
# is documented as an array but the input is not
|
|
122
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
123
|
+
public_method("#{key}=").call(
|
|
124
|
+
attributes[self.class.attribute_map[key]]
|
|
125
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
129
|
+
public_method("#{key}=").call(
|
|
130
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
self
|
|
137
|
+
end
|
|
138
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
|
139
|
+
|
|
140
|
+
# Returns the string representation of the object
|
|
141
|
+
# @return [String] String presentation of the object
|
|
142
|
+
def to_s
|
|
143
|
+
to_hash.to_s
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Returns the object in the form of hash
|
|
147
|
+
# @return [Hash] Returns the object in the form of hash
|
|
148
|
+
def to_hash
|
|
149
|
+
hash = {}
|
|
150
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
151
|
+
value = public_method(attr).call
|
|
152
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
|
153
|
+
|
|
154
|
+
hash[param] = _to_hash(value)
|
|
155
|
+
end
|
|
156
|
+
hash
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
private
|
|
160
|
+
|
|
161
|
+
# Outputs non-array value in the form of hash
|
|
162
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
163
|
+
# @param [Object] value Any valid value
|
|
164
|
+
# @return [Hash] Returns the value in the form of hash
|
|
165
|
+
def _to_hash(value)
|
|
166
|
+
if value.is_a?(Array)
|
|
167
|
+
value.compact.map { |v| _to_hash(v) }
|
|
168
|
+
elsif value.is_a?(Hash)
|
|
169
|
+
{}.tap do |hash|
|
|
170
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
171
|
+
end
|
|
172
|
+
elsif value.respond_to? :to_hash
|
|
173
|
+
value.to_hash
|
|
174
|
+
else
|
|
175
|
+
value
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
# rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
|